dual-loop — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited dual-loop (Agent Skill) and scored it 87/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 3 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 3 flagged
The text {match} tells the agent to skip the normal "ask the user first" gate. Used adversarially it removes the human-in-the-loop check before destructive or sensitive actions, turning a normally-gated agent into a fire-and-forget executor.
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
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.txtSee ../../requirements.txt for the dependency lockfile (currently empty — standard library only).
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).
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.
flowchart LR
subgraph Outer["Outer Loop (Strategy & Protocol)"]
Scout[Scout & Plan] --> Spec[Define Tasks]
Spec --> Query[Query User]
Query --> 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] --> Plan[Commit to Plan]
Plan --> Execute[Write Code & Run Tests]
Execute -->|No Git| Done[Signal Done]
end
Packet -->|Handoff| Receive
Done -->|Completion| Verify
Correct -->|Delta Fix| ReceiveReference: Architecture Diagram
Before generating the Strategy Packet or executing commands, you must interactively ask the user:
agy (Antigravity CLI), claude (Claude CLI), copilot (GitHub Copilot CLI), codex (OpenAI-compatible CLI), or llama (local Gemma host).Gemini 3.5 Flash (Low)).Once confirmed, record this configuration and use the selected CLI and model in the sub-agent delegation command.
handoffs/task_packet_001.md).(Best Practice: Run a functional CLI heartbeat using a simple health prompt to verify end-to-end connectivity before the first hand-off).
The Outer Loop invokes the Inner Loop. To ensure stability, avoid shell process hangs in background/headless environments (which freeze when attempting to read standard input without redirection), and target the chosen LLM backend, the Outer Loop must run run_agent.py using relative pathing and passing the user's selected CLI and model. Always append < /dev/null to the command to prevent SIGTTIN halts:
# Explicitly delegate inner-loop execution with redirected stdin and chosen model
python scripts/run_agent.py \
handoffs/task_packet_001.md \
<target_file_to_modify> \
handoffs/result_packet.md \
"Execute the strategy packet instructions exactly." \
--cli <selected_cli> \
--model "<selected_model>" < /dev/nullIf run_agent.py is unavailable, this is done by spawning a sub-process (e.g., agy -p "Read handoffs/task_packet_001.md" < /dev/null), calling an API, or asking the Human User to switch terminals.
The Inner Loop agent:
Constraint: The Inner Loop MUST NOT run version control commands.
Once the Inner Loop signals completion, the Outer Loop must verify the results under the Trust But Verify and TDD principles:
git diff or system state checks) to see exactly what files the Inner Loop altered. Ensure no unexpected files were modified, no stubs were left, and no security regressions were introduced.#### On Verification PASS:
#### On Verification FAIL:
./friction-log.md) for the Orchestrator to review at handoff.Before handoff, both the Outer Loop and Inner Loop MUST each complete the Post-Run Self-Assessment Survey (references/memory/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 a local file (e.g., ./retrospective-[YYYYMMDD]-[HHMM]-[AGENT].md) or stdout.
If any single friction cause appears 3+ times this cycle, flag for Triple-Loop Retrospective Full Loop before the next cycle begins.
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). Memory promotion is the responsibility of the calling system.
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:
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.
If an isolated workspace cannot be provided:
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.