Agentic Workflow

作者 parcadeid07ff4b06b62無授權條款3.9K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫8 個月前更新

Agentic Workflow Pattern

AI 產生的概覽

定義用於實作任務的五階段多代理流程,研究、規劃、驗證、實作與審查代理之間以檔案交接。

功能
此技能說明了一套用於實作工作的標準多代理工作流程模式。它規定了五個階段——研究、規劃、驗證、實作與審查——每個階段都以背景子代理執行,並將輸出寫入 .claude/cache/agents/ / 下的檔案,供下一階段讀取作為脈絡。內容也涵蓋進度監控、卡住偵測,以及交接產物的目錄結構。
適用情境
當你要為程式實作任務編排多代理流程,並希望有明確的階段順序與以檔案為基礎的交接時使用。它適合主對話僅負責協調、代理在背景執行的情境。
執行需求
僅為說明內容,技能未附帶指令碼。它假定執行環境具備 Task 工具與背景子代理,以及指定的子代理類型(oracle、plan-agent、validate-agent、agentica-agent、review-agent)、/nia-docs 技能、NIA Oracle、RP-CLI,以及可寫入的 .claude/cache/agents/ 目錄。

Agentic Workflow Pattern

Standard multi-agent pipeline for implementation tasks.

Architecture Principles

  • Use run_in_background: true for all agents to keep main context minimal
  • Use Task tool (never TaskOutput) to avoid receiving full agent transcripts
  • Agents write outputs to .claude/cache/agents/<stage>/ for injection into subsequent agents
  • Main conversation is pure orchestration — no heavy lifting, only coordination

Workflow Stages

1. Research Agent

Task(subagent_type="oracle", run_in_background=true, prompt="""Query NIA Oracle (via /nia-docs skill) to verify approach and gather best practices.
Output to: .claude/cache/agents/oracle/<task>-research.md""")
  • Enforce NIA as the research layer
  • Output: Research findings

2. Planning Agent

Task(subagent_type="plan-agent", run_in_background=true, prompt="""Read: .claude/cache/agents/oracle/<task>-research.mdUse RP-CLI to analyze the target codebase section.Generate implementation plan informed by research.
Output to: .claude/cache/agents/plan-agent/<task>-plan.md""")
  • Receives: Research agent output as context
  • Output: Implementation plan

3. Validation Agent

Task(subagent_type="validate-agent", run_in_background=true, prompt="""Read: .claude/cache/agents/plan-agent/<task>-plan.mdRead: .claude/cache/agents/oracle/<task>-research.mdReview plan against research findings and best practices.
Output to: .claude/cache/agents/validate-agent/<task>-validated.md""")
  • Reviews plan against research
  • Output: Validated plan with amendments

4. Implementation Agent

Task(subagent_type="agentica-agent", run_in_background=true, prompt="""Read: .claude/cache/agents/validate-agent/<task>-validated.mdRead: .claude/cache/agents/oracle/<task>-research.md
TDD approach: Write failing tests FIRST, then implement.Run tests to verify.
Output summary to: .claude/cache/agents/implement-agent/<task>-implementation.md""")
  • Receives: Validated plan + research context
  • TDD: Failing tests first
  • Output: Implementation + tests

5. Review Agent

Task(subagent_type="review-agent", run_in_background=true, prompt="""Read: .claude/cache/agents/implement-agent/<task>-implementation.mdRead: .claude/cache/agents/validate-agent/<task>-validated.mdRead: .claude/cache/agents/oracle/<task>-research.md
Cross-reference implementation against plan and research.Run tests to confirm passing.
Output to: .claude/cache/agents/review-agent/<task>-review.md""")
  • Cross-references all artifacts
  • Confirms tests pass
  • Output: Review summary

Agent Progress Monitoring

bash
# Watch for system reminders:# "Agent a42a16e progress: 6 new tools used, 88914 new tokens"
# Poll for output files:find .claude/cache/agents -name "*.md" -mmin -5
# Check task file size growth:wc -c /tmp/claude/.../tasks/<id>.output

Stuck detection:

  1. Progress reminders stop arriving
  2. Task output file size stops growing
  3. Expected output file not created after reasonable time

Directory Structure

.claude/cache/agents/├── oracle/│   └── <task>-research.md├── plan-agent/│   └── <task>-plan.md├── validate-agent/│   └── <task>-validated.md├── implement-agent/│   └── <task>-implementation.md└── review-agent/    └── <task>-review.md

Key Rules

  1. Never use TaskOutput - floods context with 70k+ token transcripts
  2. Always run_in_background=true - isolates agent context
  3. File-based handoff - each agent reads previous agent's output file
  4. Poll, don't block - check file system for outputs, don't wait
  5. TDD in implementation - failing tests first, then make them pass

Source

  • Session 2026-01-01: SDK Phase 3 implementation using this pattern

來源與署名

來源:parcadei/continuous-claude-v3位於.claude/skills/agentic-workflow提交d07ff4b

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架