# Send Forge 🔨 Repair-Inspect Loop to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "forge-loop",
    "name": "Forge 🔨 Repair-Inspect Loop",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/melody1015/forge-loop",
    "canonicalUrl": "https://clawhub.ai/melody1015/forge-loop",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/forge-loop",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=forge-loop",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "assets/templates/inspector.md",
      "assets/templates/repair-engineer.md",
      "references/protocol.md",
      "reflections/README.md",
      "scripts/forge.py"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "forge-loop",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-03T10:30:44.413Z",
      "expiresAt": "2026-05-10T10:30:44.413Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=forge-loop",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=forge-loop",
        "contentDisposition": "attachment; filename=\"forge-loop-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "forge-loop"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/forge-loop"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/forge-loop",
    "downloadUrl": "https://openagent3.xyz/downloads/forge-loop",
    "agentUrl": "https://openagent3.xyz/skills/forge-loop/agent",
    "manifestUrl": "https://openagent3.xyz/skills/forge-loop/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/forge-loop/agent.md"
  }
}
```
## Documentation

### Forge 🔨 — 维修-监理自动循环

Automated repair-inspect loop with state persistence, dependency analysis, and safety guardrails.

### When to Use

Multiple repair tasks from review board / audit / user instructions
Need independent verification (not just "looks fixed")
Want protected file safety + auto-commit on PASS

### Quick Start

cd /path/to/project

# 1. Initialize
python3 ~/clawd/skills/forge/scripts/forge.py init

# 2. Add tasks
python3 forge.py add "修复空值处理" --criteria "空输入不崩溃" --priority P0
python3 forge.py add "清理废弃代码" --criteria "无import报错" --depends task-001

# 3. See execution plan
python3 forge.py plan

# 4. Run (outputs spawn instructions)
python3 forge.py run

# 5. Execute spawns, then run again to check results
python3 forge.py run   # checks results, auto-loops on FAIL

# 6. When all done
python3 forge.py summary

### CLI Reference

CommandDescriptioninit --workdir DIRInitialize forge sessionadd "desc" --criteria "..." --depends task-001 --priority P0Add repair taskplanShow dependency graph + parallel execution wavesrunAdvance state machine (spawn or check results)statusShow current progresscheckPre-commit safety check (protected files, deletions)summaryGenerate completion reportresetClear state

### State Machine (per task)

pending → repairing → inspecting → done
                ↑          │
                └── fail ──┘   (auto-loop, max 5 rounds)

inspecting → needs_human  (pause, escalate)
inspecting → escalated    (>5 rounds)
repairing  → needs_human  (all BLOCKED)

### Dependency-Aware Parallel Execution

Tasks without dependencies run in parallel. forge.py plan shows execution waves:

Wave 1: task-001, task-002, task-003  (并行)
Wave 2: task-004 ← task-001          (等task-001完成)

### Safety Guardrails (3 layers)

Protected files — protected-files.txt in project root. Listed files cannot be modified by repair agents. Touching them → BLOCKED → NEEDS_HUMAN.
Pre-commit diff check — forge.py check detects: file deletions, protected file modifications, abnormally large changes.
Prompt constraints — Repair engineer prompt explicitly forbids deletions, protected files, cron changes.

### Experience Accumulation

Each repair produces a repair_pattern with error classification and reusable solution templates. These are stored in forge-reflections.jsonl and the most recent 5 patterns are injected into future repair tasks as context.

### Integration with AI Agents

When the agent receives repair tasks (from code review, audit, or user):

# 1. Init forge in project dir
exec("cd /path/to/project && python3 ~/clawd/skills/forge/scripts/forge.py init")

# 2. Add tasks
exec("python3 forge.py add 'Fix null handling in processor' --criteria 'No crash on empty input' --priority P0")

# 3. Run to get spawn instructions
exec("python3 forge.py run")
# → Script outputs spawn instructions

# 4. Execute spawns
sessions_spawn(task=read(task_file), label=label, model=model)

# 5. After spawn completes, run again
exec("python3 forge.py run")
# → Checks repair result → prepares inspector spawn
# → Or auto-loops on FAIL → prepares next repair spawn

# 6. On all PASS → git commit + notify

### File Layout

forge/
├── SKILL.md                           # This file
├── scripts/
│   └── forge.py                       # Core orchestrator
├── references/
│   └── protocol.md                    # Full protocol documentation
└── assets/
    └── templates/
        ├── repair-engineer.md         # Repair agent role reference
        └── inspector.md              # Inspector role reference

### Project-side files (created by forge)

project/
├── forge-state.json                   # State persistence (crash recovery)
├── forge-reflections.jsonl            # Project-specific experience (stays with project)
├── forge-output/                      # Task files and results
│   ├── task-001-repair-r1.task.md     # Repair spawn task
│   ├── task-001-repair-r1.json        # Repair result
│   ├── task-001-inspect-r1.task.md    # Inspect spawn task
│   └── task-001-inspect-r1.json       # Inspect result
└── protected-files.txt                # (optional) Protected file list

### Experience: Two-Layer Architecture

forge/reflections/patterns.jsonl       # Universal patterns (cross-project, stays with skill)
project/forge-reflections.jsonl        # Project-specific patterns (stays with project)

Universal layer (forge/reflections/patterns.jsonl): Abstract lessons stripped of file paths and project context. Auto-extracted from project patterns after each repair. Deduped by pattern_name. Injected into ALL future repairs across any project.
Project layer ({project}/forge-reflections.jsonl): Full detail with file names, paths, project-specific context. Only injected when working on that project.
Auto-extraction: After each repair, extract_universal_pattern() checks if the pattern is generalizable (not too many project-specific paths). If so, it's added to the universal layer with dedup.

### Doc-Sync Check (文档同步检查)

Forge收尾时自动检查：修改的代码文件是否有关联文档需要同步更新。

### 工作原理

优先运行 scripts/tools/doc-sync-checker.py --json（如果存在）
回退到 references/doc-sync-manifest.yaml：交叉对比forge修改的文件与manifest中的authority→consumer映射

### 项目配置

在项目中创建 references/doc-sync-manifest.yaml：

facts:
  api_config:
    authority: src/config.py
    consumers:
      - docs/api-reference.md
      - docs/deployment-guide.md
    last_synced: 2026-03-01

Forge完成报告会显示：

📄 文档同步检查 — 2 个文档可能需要更新:
  ⚠️ docs/api-reference.md 可能需要同步更新（api_config 的权威源 src/config.py 已修改）

### Configuration

Via init flags or forge-state.json config section:

KeyDefaultDescriptionmodelanthropic/claude-opus-4-6LLM model for agentsmax_rounds5Max repair-inspect cycles before escalationrepair_timeout600Repair agent timeout (seconds)inspect_timeout300Inspector timeout (seconds)auto_committrueAuto git-commit on PASS
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: melody1015
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-03T10:30:44.413Z
- Expires at: 2026-05-10T10:30:44.413Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/forge-loop)
- [Send to Agent page](https://openagent3.xyz/skills/forge-loop/agent)
- [JSON manifest](https://openagent3.xyz/skills/forge-loop/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/forge-loop/agent.md)
- [Download page](https://openagent3.xyz/downloads/forge-loop)