agent-army
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Army
Agent军团
Architecture
架构
Commander
|
|-- Layer 1: Team (3 to 50+, each = own 1M context)
| |
| |-- Agent A (1M) -- Sub-agent A1 (own context), A2 (own context), ...
| |-- Agent B (1M) -- Sub-agent B1 (own context), B2 (own context), ...
| |-- Agent C (1M) -- Sub-agent C1 (own context), C2 (own context), ...
| |-- ... (no cap)Commander
|
|-- Layer 1: Team (3 to 50+, each = own 1M context)
| |
| |-- Agent A (1M) -- Sub-agent A1 (own context), A2 (own context), ...
| |-- Agent B (1M) -- Sub-agent B1 (own context), B2 (own context), ...
| |-- Agent C (1M) -- Sub-agent C1 (own context), C2 (own context), ...
| |-- ... (no cap)Layer 1 Prompt Template
第一层提示词模板
This is what spawned agents actually see. It is the most important section in this skill.
You are [AGENT_NAME], specialist on [DOMAIN].
Objective: [One sentence]
Approved patterns: [Exact values -- hex codes, class names, etc.]
Forbidden patterns: [What to remove/avoid]
Your files: [Absolute paths with line counts]
Rules: [Constraints]. Skip files already using approved patterns. Flag issues outside your files in "Flags for Commander" -- do NOT fix them.
CRITICAL: You MUST use the Agent tool to spawn the sub-agents listed below. Do NOT do the work yourself. Do NOT skip spawning. Deploy ALL sub-agents in a single message with multiple Agent tool calls.
Sub-agents:
- "[NAME]": [files with line counts]
- "[NAME]": [files with line counts]
Pass each sub-agent: objective, their files, approved/forbidden patterns, rules, report format. After all complete, aggregate reports and verify no forbidden patterns remain.这是被生成的Agent实际会看到的内容,是本技能中最重要的部分。
You are [AGENT_NAME], specialist on [DOMAIN].
Objective: [One sentence]
Approved patterns: [Exact values -- hex codes, class names, etc.]
Forbidden patterns: [What to remove/avoid]
Your files: [Absolute paths with line counts]
Rules: [Constraints]. Skip files already using approved patterns. Flag issues outside your files in "Flags for Commander" -- do NOT fix them.
CRITICAL: You MUST use the Agent tool to spawn the sub-agents listed below. Do NOT do the work yourself. Do NOT skip spawning. Deploy ALL sub-agents in a single message with multiple Agent tool calls.
Sub-agents:
- "[NAME]": [files with line counts]
- "[NAME]": [files with line counts]
Pass each sub-agent: objective, their files, approved/forbidden patterns, rules, report format. After all complete, aggregate reports and verify no forbidden patterns remain.Layer 2 Prompt Template
第二层提示词模板
You are [SUB_AGENT_NAME], working under [TEAM_MEMBER_NAME].
Objective: [One sentence]
Files you own: [Absolute paths with line counts -- only touch these]
Approved/Forbidden patterns: [Exact values to use and remove]
Rules: [Constraints]. Skip files already correct. Flag issues outside your files -- do NOT fix them.
Report when done: Files Modified (file: N replacements), Files Skipped (already correct), Flags for Commander, Issues Encountered, Status (COMPLETE/PARTIAL/FAILED).You are [SUB_AGENT_NAME], working under [TEAM_MEMBER_NAME].
Objective: [One sentence]
Files you own: [Absolute paths with line counts -- only touch these]
Approved/Forbidden patterns: [Exact values to use and remove]
Rules: [Constraints]. Skip files already correct. Flag issues outside your files -- do NOT fix them.
Report when done: Files Modified (file: N replacements), Files Skipped (already correct), Flags for Commander, Issues Encountered, Status (COMPLETE/PARTIAL/FAILED).MANDATORY RULES
强制规则
- EVERY Layer 1 agent MUST spawn 2+ sub-agents. No exceptions. If deploying without sub-agents, STOP and restructure.
- NEVER silently reduce army size. Match the user's chosen tier.
- Report as agents complete:
[Agent N/M complete] name: X files modified, Y flags - Show the army plan before deploying (Full Mode). Quick Mode: compose plan internally, skip confirmation.
- Sub-agent deployment instructions go INSIDE the Layer 1 brief. If missing, sub-agents will not exist.
- Build check after every wave. If it fails, trigger a fix wave.
- "Keep going" / "don't stop" = continuous mode. Launch new agents as each completes. Do not wait. Do not ask.
- 每个第一层Agent必须生成2个以上的Sub-agent,无例外。如果部署时没有Sub-agent,请立即停止并重新调整结构。
- 绝对不能悄悄缩减军团规模,必须匹配用户选择的档位。
- 当Agent完成任务时按以下格式上报:
[Agent N/M complete] name: X files modified, Y flags - 部署前展示军团计划(完整模式);快速模式:内部生成计划,无需确认。
- Sub-agent部署指令必须写在第一层Agent的任务说明内部,如果缺失,Sub-agent将无法生成。
- 每轮执行后都要进行构建检查,如果失败,触发修复轮次。
- "Keep going" / "don't stop" = 持续模式,每个Agent完成后立即启动新的Agent,无需等待,无需询问。
Army Size
军团规模
Confirm tier before starting. Present this table:
| Tier | Agents | Total with Sub-agents | Est. Tokens |
|------|--------|----------------------|-------------|
| Conservative | 3 | ~9 | ~200-500K |
| Standard | 5-10 | ~15-30 | ~500K-1.5M |
| Aggressive | 10-20 | ~30-60 | ~1.5-4M |
| Maximum | 20-50+ | ~60-100+ | ~4M+ |
| Custom | You pick | You pick | Varies |
Token estimates vary by task complexity. Pick a tier or enter a custom number:Default to Standard if user says "just do it." Tier question applies to BOTH Quick and Full modes.
After recon (Step 3), recommend a specific number based on what you found. Example: "Found 35 files across 6 domains. I recommend Aggressive tier: 8 Layer 1 agents with 2-3 sub-agents each (~22 total, ~2M tokens). Want to adjust?"
开始前确认档位,向用户展示下表:
| Tier | Agents | Total with Sub-agents | Est. Tokens |
|------|--------|----------------------|-------------|
| Conservative | 3 | ~9 | ~200-500K |
| Standard | 5-10 | ~15-30 | ~500K-1.5M |
| Aggressive | 10-20 | ~30-60 | ~1.5-4M |
| Maximum | 20-50+ | ~60-100+ | ~4M+ |
| Custom | You pick | You pick | Varies |
Token estimates vary by task complexity. Pick a tier or enter a custom number:如果用户说"just do it"则默认使用标准档。档位确认规则同时适用于快速模式和完整模式。
摸排(第3步)完成后,根据摸排结果推荐具体的数量。示例:"Found 35 files across 6 domains. I recommend Aggressive tier: 8 Layer 1 agents with 2-3 sub-agents each (~22 total, ~2M tokens). Want to adjust?"
Deployment Gate
部署准入检查
Output this checklist in your response before deploying. Do NOT skip it. Do NOT just check it mentally.
DEPLOYMENT GATE:
[ ] Every L1 brief contains "You MUST spawn N sub-agents"
[ ] Every sub-agent named with specific files assigned
[ ] Every file owned by exactly one sub-agent
[ ] L1 briefs include full sub-agent deployment instructions
[ ] Tier matches user's selectionAll must PASS. If any FAIL: fix the plan first.
部署前在响应中输出以下检查清单,不得跳过,不得仅在内部核对。
DEPLOYMENT GATE:
[ ] Every L1 brief contains "You MUST spawn N sub-agents"
[ ] Every sub-agent named with specific files assigned
[ ] Every file owned by exactly one sub-agent
[ ] L1 briefs include full sub-agent deployment instructions
[ ] Tier matches user's selection所有项必须通过,如有任何一项不通过,请先调整计划。
Protocol
执行流程
Mode: If scope is clear and specific (file paths, exact changes), skip to Step 3. Otherwise start at Step 1.
模式: 如果范围清晰明确(文件路径、具体修改内容),直接跳到第3步,否则从第1步开始。
Step 1: Intake (Full Mode)
第1步:信息收集(完整模式)
Confirm with user:
- Goal (one sentence)
- Scope (files, directories, or "everything")
- Constraints (don't touch X, match Y style)
- Tier (show table above)
If user already provided context, confirm in one line: "Goal: [X]. Scope: [Y]. Tier: [Z]. Starting."
向用户确认:
- 目标(一句话描述)
- 范围(文件、目录或"全部内容")
- 约束(不能修改X、匹配Y风格等)
- 档位(展示上述表格)
如果用户已经提供了上下文,用一句话确认:"Goal: [X]. Scope: [Y]. Tier: [Z]. Starting."
Step 2: Git Checkpoint
第2步:Git检查点
- Run . Warn if uncommitted changes.
git status - Create checkpoint: , switch back.
git checkout -b agent-army/checkpoint-{timestamp} - No git repo? Warn user and get confirmation.
- 运行,如果有未提交的变更则发出警告。
git status - 创建检查点:,然后切回原分支。
git checkout -b agent-army/checkpoint-{timestamp} - 没有Git仓库?向用户发出警告并获取确认。
Step 3: Recon
第3步:摸排
- Scan -- Grep, Glob, Read to find all affected files
- Count units of work
- each file. Flag 500+ line files as heavy (assign solo)
wc -l - Classify into domains (by directory, imports, file type, naming pattern)
- Identify shared dependencies (foundation files -- handle first)
- Identify build command (check package.json, Makefile, etc.)
Output scope report:
Files: N | Heavy: [list] | Domains: [list] | Shared deps: [list] | Build cmd: [cmd]- 扫描——通过Grep、Glob、读取操作找出所有受影响的文件
- 统计工作单元数量
- 对每个文件执行统计行数,标记500行以上的文件为大文件(单独分配)
wc -l - 按目录、导入、文件类型、命名模式分类到不同领域
- 识别共享依赖(基础文件——优先处理)
- 识别构建命令(检查package.json、Makefile等)
输出范围报告:
Files: N | Heavy: [list] | Domains: [list] | Shared deps: [list] | Build cmd: [cmd]Step 4: Compose
第4步:编排组建
- Foundation Agent for shared deps (runs first, before parallel wave)
- Layer 1: 1 agent per domain. Split large domains across multiple agents.
- Layer 2: 2+ sub-agents per L1 agent based on file weight
- Name every agent. Assign every file to exactly one sub-agent.
Output army plan. Full Mode: pause for "Proceed?" Quick Mode: show one-line summary, deploy.
- 优先为共享依赖配置基础Agent(先执行,早于并行批次)
- 第一层:每个领域配置1个Agent,大型领域拆分给多个Agent处理
- 第二层:根据文件重量为每个第一层Agent配置2个以上的Sub-agent
- 为每个Agent命名,每个文件恰好分配给一个Sub-agent
输出军团计划。完整模式:暂停等待用户回复"Proceed?";快速模式:展示一行总结后直接部署。
Step 5: Deploy
第5步:部署
- Foundation Agent first (if needed). Wait for completion.
- Launch ALL Layer 1 agents in parallel (, single message).
run_in_background: true - L1 agents spawn L2 sub-agents in parallel (per their brief).
- Report each completion:
[Agent N/M complete] name: results
- 优先启动基础Agent(如有需要),等待其完成。
- 并行启动所有第一层Agent(,单条消息触发)。
run_in_background: true - 第一层Agent根据其任务说明并行生成第二层Sub-agent。
- 每个Agent完成后上报结果:
[Agent N/M complete] name: results
Step 6: Verify
第6步:校验
- Re-scan for remaining violations (same searches as Step 3)
- Run build command
- Resolve cross-team flags
- Output army report:
Agents: N total | Files modified: N | Skipped: N | Build: PASS/FAIL | Flags: [list] | Rollback: git checkout agent-army/checkpoint-{timestamp}- 重新扫描是否有剩余违规项(和第3步使用相同的搜索规则)
- 执行构建命令
- 解决跨团队标记的问题
- 输出军团报告:
Agents: N total | Files modified: N | Skipped: N | Build: PASS/FAIL | Flags: [list] | Rollback: git checkout agent-army/checkpoint-{timestamp}Waves
执行波次
After Wave 1: build + re-scan. If clean, done. If issues remain, deploy Wave 2 (fix wave). If still issues, Wave 3 (propagate to tests/docs). Max 3 waves. Pause for user approval before each.
第1波完成后:执行构建+重新扫描,如果没有问题则结束;如果仍有问题,部署第2波(修复波);如果还有问题,部署第3波(同步到测试/文档),最多3波。每波部署前都需要暂停获取用户批准。
Shared Scratchpad (optional)
共享暂存区(可选)
For complex multi-wave tasks, write after Wave 1: files modified, flags, issues, decisions. Wave 2 agents read it directly for full context. Skip for single-wave tasks.
.army-state.md针对复杂的多波次任务,第1波完成后写入:修改的文件、标记的问题、遇到的问题、决策内容。第2波的Agent直接读取该文件获取完整上下文,单波次任务可跳过。
.army-state.mdReport Format
报告格式
Every agent returns:
undefined每个Agent返回内容如下:
undefinedReport: [Name]
Report: [Name]
Files Modified: [file: N replacements]
Files Skipped: [file: reason]
Flags for Commander: [issue or "None"]
Issues: [issue or "None"]
Status: COMPLETE / PARTIAL / FAILED
undefinedFiles Modified: [file: N replacements]
Files Skipped: [file: reason]
Flags for Commander: [issue or "None"]
Issues: [issue or "None"]
Status: COMPLETE / PARTIAL / FAILED
undefinedError Handling
错误处理
- Sub-agent fails: L1 agent retries or spawns replacement
- L1 agent fails: Commander spawns replacement with same brief
- Build failure: compare against checkpoint, diagnose, fix wave
- Sub-agent执行失败:第一层Agent重试或生成新的替代Sub-agent
- 第一层Agent执行失败:指挥官生成相同任务说明的替代Agent
- 构建失败:和检查点版本对比,诊断问题,触发修复波