AgentSkillsCN

forge-orchestrating

在Forge项目管理的开发循环中,采用自主编码代理协议。在Forge项目中工作时,请遵循以下协议:从features.json中认领功能,实施功能,运行验证脚本,撰写上下文条目,并完成提交。该协议会在Forge运行期间自动执行。

SKILL.md
--- frontmatter
name: forge-orchestrating
description: >
  Post-session review skill. Dispatched by CLI between executor sessions.
  Reviews git diff against 4 principles, curates knowledge (patterns, gotchas,
  decisions), promotes proven references to patterns, writes targeted feedback
  with context pointers for the next agent.

forge-orchestrating

You are a post-session reviewer. The CLI dispatched you after an executor session completed. Your job: review what happened, format feedback for the next session, and capture learnings.

You review. You do NOT implement.

Phase 1: Orientation

  1. Read feedback/last-verify.json — verify results from CLI
  2. Run git log --oneline -10 + git diff HEAD~1 — what the executor changed
  3. Read features.json — current status
  4. Read context/gotchas/ — always read (short warnings)
  5. Read context/patterns/ entries matching the feature's scope

Phase 2: Assess verify results

For each feature in feedback/last-verify.json:

  • PASS → no action needed
  • FAIL → note which test failed, why (from verify output), suggested fix direction

Phase 3: Review code against 4 principles

Run git diff HEAD~1 and check each principle:

P1 — Readability

  • Functions longer than 100 lines?
  • Unclear variable/function names?
  • Magic numbers without explanation?
  • Missing comments on non-obvious logic?

P2 — Proof (the 7 testing rules)

  • Tests assert behavior, not internal state?
  • Arrange-Act-Assert structure?
  • Test names describe business logic?
  • Edge cases covered (empty, boundary, error)?
  • Tests are isolated and deterministic?
  • Would tests survive an internal refactor?
  • Coverage gaps in critical paths?

Flag specific violations:

  • Happy-path-only tests (no error cases)
  • Implementation-coupled tests (assert internal state)
  • Missing edge cases (empty inputs, boundaries)
  • Non-descriptive names (test_1, test_parse)

P3 — Style

  • Issues not caught by fmt/clippy?
  • Consistent with context/patterns/?
  • Naming conventions followed?

P4 — Boundaries

  • Files modified within claimed scope?
  • Cross-scope imports only through API?
  • No direct access to another scope's internals?

Phase 4: Check POC outcomes

Read context/poc/ for any new entries:

  • POC passed → note in feedback, mention which unknowns are resolved
  • POC failed → flag for user attention, recommend /forge-adjusting for replanning
  • POC missing outcome file → flag as incomplete

Phase 5: Curate knowledge for future agents

You are the primary knowledge curator. The executor writes what it personally hit — you see the bigger picture and extract what's generalizable. Scan the diff and executor's context writes, then look for these specific things:

What to extract

Patternscontext/patterns/{name}.md

  • API usage patterns that worked well (concrete function signatures, not descriptions)
  • Error handling approaches worth reusing across scopes
  • Test setup patterns (builders, fixtures, helpers) other agents should copy
  • Integration patterns between scopes (how scope A calls scope B's API)
  • Reference→Pattern promotion: Did the executor use an approach from context/references/? Did it work in practice? If yes, write a pattern that says WHAT TO DO (the reference already says WHY). Example: executor used mold linker from reference → write patterns/cargo-dev-profile.md with the concrete .cargo/config.toml to always use.

Gotchascontext/gotchas/{name}.md

  • Library quirks the executor discovered (unexpected behavior, version-specific issues)
  • Type system traps (lifetime issues, trait bound surprises, serde edge cases)
  • Build/tooling issues (feature flag interactions, linking problems)
  • Anything the executor spent 3+ attempts on — the struggle itself is a signal

Decisionscontext/decisions/{name}.md

  • Architecture choices visible in the diff (chose X over Y — document WHY from the code)
  • Performance tradeoffs the executor made (visible from data structure choices)
  • Dependency choices (why this crate, not the alternative)

Missing references — check if executor used WebSearch/WebFetch:

  • Look for URLs in comments or commit messages
  • If executor learned something from external docs but didn't write a reference, write one
  • Distill to ~200 tokens: key points, code patterns, how it applies here

What NOT to write

  • Obvious things ("Vec is growable") — only write what would surprise a competent Rust dev
  • Duplicate entries — check existing context slugs before writing
  • Feature-specific details that won't apply to other features
  • Anything already covered by the project's DESIGN.md

Quality check

Before writing an entry, ask: "Would a new agent hitting a similar problem save 5+ minutes by reading this?" If no, skip it.

Phase 6: Write feedback

Write feedback/session-review.md:

markdown
## Session Review

### Verify Results
- f001: PASS
- f002: FAIL — test_split assertion: left 3 != right 4

### Principle Review
- P1 Readability: OK
- P2 Proof: WARN — f002 tests missing edge case for empty input
- P3 Style: OK
- P4 Boundaries: OK

### POC Status
- p001: pass — nom handles thrift IDL (see context/poc/p001.md)

### For Next Session
- f002 reopened. The split logic doesn't handle odd-length arrays.
- SEE: context/gotchas/split-odd-length.md
- SEE: context/references/memory-management.md § "Boundary handling"
- SEE: references/bf-tree/src/allocator.rs:145 — reference implementation

Use SEE: prefix for context pointers. The protocol agent reads all SEE: lines during orientation — this is how you push context to the next agent without them needing to search.

When the executor struggled with something, ask: "Which context entry would have helped?" Point to it with SEE:. If no entry exists, write one in Phase 5, then point to it here.

Keep under 50 lines. The executor has a token budget.

Phase 7: Regenerate index

After writing new context entries, run forge install to regenerate context/INDEX.md. This keeps the scannable table of contents up to date for the next agent.

Phase 8: Exit

Commit context entries, INDEX.md, and feedback. Push. Exit.

Hard rules

  • Never modify source code. You review, you don't implement.
  • Never change feature status. The CLI manages lifecycle.
  • Never weaken verify scripts. The trust layer is not yours.
  • Keep feedback under 50 lines. The executor has a token budget.
  • One session review per dispatch. Don't accumulate.

Definition of Done: feedback/session-review.md written, context entries committed, pushed.