Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

dual-loop双环路

Agent Skill

dual-loop 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

544

周安装

22

GitHub Stars

2

下载量

171
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dual-loop(双环路)
来源仓库:https://github.com/richfrem/agent-plugins-skills
仓库路径:skills/dual-loop
安装命令:
npx skills add https://github.com/richfrem/agent-plugins-skills --skill dual-loop
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/richfrem/agent-plugins-skills --skill dual-loop

简介

dual-loop 定义内外环代理委托架构,实现任务分解与结果验证的双重保障机制。

  • 适用于 Codex、Claude、Cursor、Gemini CLI 中复杂工作流的分层协调管理。
  • 外层代理负责规划与校验,内层代理专注编码执行,形成闭环质量控制体系。
  • 无需额外依赖包,仅需 Python 3.8+ 标准库即可部署运行核心逻辑。
  • dual-loop 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Dependencies

This skill requires Python 3.8+ and standard library only. No external packages needed.

To install this skill's dependencies:

pip-compile ./requirements.in
pip install -r ./requirements.txt

See ../../requirements.txt for the dependency lockfile (currently empty — standard library only).


Dual-Loop (Inner/Outer Agent Delegation)

This skill defines the orchestration pattern for the Dual-Loop Agent Architecture. The Outer Loop (the directing agent) uses this protocol to organize work, delegate execution to an Inner Loop (the coding/tactical agent), and rigorously verify the results before merging.

This architecture is entirely framework-agnostic and can be utilized by any AI agent pairing (e.g., Antigravity directing Claude Code, or an OpenHands agent directing a specialized CLI sub-agent).

CRITICAL: Anti-Simulation Rules

YOU MUST ACTUALLY PERFORM THE VALIDATIONS LISTED BELOW. Describing what you "would do" or marking a step complete without actually doing the verification is a PROTOCOL VIOLATION.

Architecture Overview

flowchart LR
    subgraph Outer["Outer Loop (Strategy & Protocol)"]
        Scout[Scout & Plan] --> Spec[Define Tasks]
        Spec --> Packet[Generate Strategy Packet]
        Verify[Verify Result] -->|Pass| Commit[Seal & Commit]
        Verify -->|Fail| Correct[Generate Correction Packet]
    end

    subgraph Inner["Inner Loop (Execution)"]
        Receive[Read Packet] --> Execute[Write Code & Run Tests]
        Execute -->|No Git| Done[Signal Done]
    end

    Packet -->|Handoff| Receive
    Done -->|Completion| Verify
    Correct -->|Delta Fix| Receive

Reference: Architecture Diagram


The Workflow Loop

Step 1: The Plan (Outer Loop)

  1. Orientation: The Outer Loop agent reads the project requirements or goals.
  2. Decomposition: Break the goal down into distinct Work Packages (WPs) or sub-tasks.
  3. Verification: Confirm that the tasks are atomic, testable, and do not overlap.

Step 2: Prepare Execution Environment

  1. Isolation: Ensure a safe workspace exists for the Inner Loop. Workspace creation (e.g., worktrees, branching, ephemeral containers) is strictly a delegated responsibility of the Orchestrator or external tooling. The Dual-Loop just receives the environment.
  2. Update State: Mark the current Work Package as "In Progress" in whatever task-tracking system the project uses.

Step 3: Generate Strategy Packet (Outer Loop)

  1. Write a tightly scoped markdown document (the "Strategy Packet") specifically for the Inner Loop.
  2. Requirements for the Packet:

- The exact goal. - A Pre-Execution Workflow Commitment Diagram (an ASCII box) mapping out the steps the Inner Loop must take. - Only the specific file paths the sub-agent needs to care about. - Strict "NO GIT" constraints (the Inner Loop must not commit). - If generating scripts/pipelines, instruct the Inner Loop to use the "Modular Building Blocks" architecture (split convenience CLI wrappers from core Python APIs). - Clear Acceptance Criteria.

  1. Save the packet (e.g., handoffs/task_packet_001.md).

Step 4: Hand-off (The Bridge)

The Outer Loop invokes the Inner Loop. Depending on the environment, this is either done by spawning a sub-process (e.g., claude "Read handoffs/task_packet_001.md"), calling an API, or asking the Human User to switch terminals.

Step 5: Execute (Inner Loop)

The Inner Loop agent:

  1. Reads the packet.
  2. Writes the code.
  3. Runs the tests.
  4. Signals "Done" when the Acceptance Criteria are met (or if it gets fundamentally stuck).
*Constraint: The Inner Loop MUST NOT run version control commands.*

Step 6: Verify (Outer Loop)

Once the Inner Loop signals completion, the Outer Loop must verify the results:

  1. Delta Check: Inspect the changes (e.g., via diff tools or system state checks) to see what the Inner Loop actually altered.
  2. Test Check: Run the test suite mechanically to ensure nothing broke.
  3. Lint Check: Validate the syntax.

On Verification PASS:

  1. The Outer Loop accepts the changes.
  2. The task tracker is updated to "Done".

On Verification FAIL:

  1. The Outer Loop generates a Correction Packet using the strict Severity-Stratified Output Schema:

- 🔴 CRITICAL: The code fails to compile, tests fail, or the requested feature is entirely missing. - 🟡 MODERATE: The feature works, but violates project architecture, ADRs, or performance standards. - 🟢 MINOR: The feature works and follows architecture, but has minor naming or stylistic issues.

  1. The Outer Loop loops back to Step 4, handing the Correction Packet to the Inner Loop.

Step 7: Self-Assessment Survey (MANDATORY — Outer Loop and Inner Loop)

Before handoff, both the Outer Loop and Inner Loop MUST each complete the Post-Run Self-Assessment Survey (references/post_run_survey.md). Answer every section in full.

Count-Based Signals: How many times did you not know what to do next? Miss a step? Use wrong CLI syntax? Get redirected by a human? Total friction events?

Qualitative Friction: Where were you most uncertain? Which step felt ambiguous? What was the biggest source of friction? What one change would have helped most?

Improvement Recommendation: What one change should be tested before the next run? What is the target (Skill/Prompt/Script/Rule)?

Save to: ${CLAUDE_PROJECT_DIR}/context/memory/retrospectives/survey_[YYYYMMDD]_[HHMM]_[AGENT].md

Emit survey completion:

python3 context/kernel.py emit_event --agent <ROLE> \
  --type learning --action survey_completed \
  --summary "retrospectives/survey_[DATE]_[TIME]_[AGENT].md"

If any single friction cause appears 3+ times this cycle, flag for os-learning-loop Full Loop before the next cycle begins.

Step 8: Completion & Handoff

Once all Work Packages are verified and surveys saved, the Dual-Loop pattern is complete. The Outer Loop terminates and returns control to the global lifecycle manager (Orchestrator) for memory persistence via session-memory-manager and ecosystem sealing.


Task Lane Management

Throughout the process, the Outer Loop must maintain discipline over task states. If you are operating this loop, you must ensure you or the task tracker accurately reflects:

  1. Backlog -> Doing (When Strategy Packet is generated)
  2. Doing -> Review (When Inner Loop signals completion)
  3. Review -> Done (When Outer Loop verifies and commits)
  4. Review -> Doing (If verification fails and a Correction Packet is sent)

Workspace Isolation

Dual-Loop (Agent-Loops) does not manage workspaces. It receives an isolated directory or execution context from the Orchestrator and runs the loop inside it. Workspace creation (e.g., git worktrees, branches) is a delegated responsibility of the Orchestrator or the global system environment.

Fallback: In-Place Execution

If an isolated workspace cannot be provided:

  1. The Inner Loop codes directly in the main directory.
  2. The Outer Loop must log this lack of isolation in a friction log for the handoff to the Orchestrator.
  3. All other constraints (no system manipulation from Inner Loop out of scope, verification gate, correction packets) still apply.

Fundamental Constraints

  • No Protocol Crossing: The Inner Loop manages tacticals (code compilation, tests). The Outer Loop manages strategy (git, architecture decisions, human interactions).
  • Isolation: Strategy Packets must be minimal. Do not send the Inner Loop thousands of lines of conversation history. Give it exactly what it needs to execute the specific Work Package.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.34%
按下载量换算55

Claude

31.9%
按下载量换算55

Cursor

19.42%
按下载量换算33

Gemini CLI

9.11%
按下载量换算16

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills