一键导入
implement
Execute a single beads issue with full lifecycle. Triggers: "implement", "work on task", "fix bug", "start feature", "pick up next issue".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Execute a single beads issue with full lifecycle. Triggers: "implement", "work on task", "fix bug", "start feature", "pick up next issue".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
This skill should be used when the user asks to "track issues", "create beads issue", "show blockers", "what's ready to work on", "beads routing", "prefix routing", "cross-rig beads", "BEADS_DIR", "two-level beads", "town vs rig beads", "slingable beads", or needs guidance on git-based issue tracking with the bd CLI.
Investigate suspected bugs with git archaeology and root cause analysis. Triggers: "bug", "broken", "doesn't work", "failing", "investigate bug".
Analyze code complexity and find refactor targets using radon/gocyclo. Triggers: "complexity", "analyze complexity", "find complex code", "refactor targets", "cyclomatic complexity", "code metrics".
Fully autonomous epic execution. Runs until ALL children are CLOSED. Level 1 uses /swarm (Task tool). Level 2 uses /spawn + Agent Mail for cross-session orchestration with Chiron help routing. NO human prompts, NO stopping.
This skill should be used when the user asks to "generate documentation", "validate docs", "check doc coverage", "find missing docs", "create code-map", "sync documentation", "update docs", or needs guidance on documentation generation and validation for any repository type. Triggers: doc, documentation, code-map, doc coverage, validate docs.
Extract decisions and learnings from Claude session transcripts. Triggers: "extract learnings", "process pending", SessionStart hook.
| name | implement |
| description | Execute a single beads issue with full lifecycle. Triggers: "implement", "work on task", "fix bug", "start feature", "pick up next issue". |
Quick Ref: Execute single issue end-to-end. Output: code changes + commit + closed issue.
YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.
Execute a single issue from start to finish.
Requires: bd CLI (beads) for issue tracking. Falls back to plain descriptions if unavailable.
Given /implement <issue-id-or-description>:
Before starting implementation, check if resuming:
bd show <issue-id> --json 2>/dev/null | jq -r '.status'
If status = in_progress AND assigned to you:
bd show <id> --json | jq -r '.notes'If status = in_progress AND assigned to another agent:
bd update <id> --assignee self --force to override"Store checkpoints after each major step:
bd update <issue-id> --append-notes "CHECKPOINT: Step N completed at $(date -Iseconds)" 2>/dev/null
Before implementation, verify prior workflow gates passed:
# Check if ao CLI is available
if command -v ao &>/dev/null; then
# Check if research and plan phases completed
RATCHET_STATUS=$(ao ratchet status --json 2>/dev/null || echo '{}')
RESEARCH_DONE=$(echo "$RATCHET_STATUS" | jq -r '.research.completed // false')
PLAN_DONE=$(echo "$RATCHET_STATUS" | jq -r '.plan.completed // false')
if [ "$RESEARCH_DONE" = "true" ] && [ "$PLAN_DONE" = "true" ]; then
echo "Ratchet: Prior gates passed (research + plan complete)"
elif [ "$RESEARCH_DONE" = "false" ] || [ "$PLAN_DONE" = "false" ]; then
echo "WARNING: Prior gates not complete. Run /research and /plan first."
echo " Research: $RESEARCH_DONE"
echo " Plan: $PLAN_DONE"
echo ""
echo "Override with: ao ratchet skip <gate> --reason 'manual override'"
fi
# Get current spec path for reference
SPEC_PATH=$(ao ratchet spec 2>/dev/null || echo "")
if [ -n "$SPEC_PATH" ]; then
echo "Ratchet: Current spec at $SPEC_PATH"
fi
else
echo "Ratchet: ao CLI not available - skipping gate check"
fi
Fallback: If ao is not available, proceed without ratchet checks. The skill continues normally.
If beads issue ID provided (e.g., gt-123):
bd show <issue-id> 2>/dev/null
If plain description provided: Use that as the task description.
If no argument: Check for ready work:
bd ready 2>/dev/null | head -3
bd update <issue-id> --status in_progress 2>/dev/null
USE THE TASK TOOL to explore relevant code:
Tool: Task
Parameters:
subagent_type: "Explore"
description: "Gather context for: <issue title>"
prompt: |
Find code relevant to: <issue description>
1. Search for related files (Glob)
2. Search for relevant keywords (Grep)
3. Read key files to understand current implementation
4. Identify where changes need to be made
Return:
- Files to modify (paths)
- Current implementation summary
- Suggested approach
- Any risks or concerns
Based on the context gathered:
Success Criteria (all must pass):
Check for test files and run them:
# Find tests
ls *test* tests/ test/ __tests__/ 2>/dev/null | head -5
# Run tests (adapt to project type)
# Python: pytest
# Go: go test ./...
# Node: npm test
# Rust: cargo test
If tests exist: All tests must pass. Any failure = verification failed.
If no tests exist: Manual verification required:
If verification fails: Do NOT proceed to Step 5a. Fix the issue first.
THE IRON LAW: NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
Before reporting success, you MUST:
Forbidden phrases without fresh verification evidence:
| Excuse | Reality |
|---|---|
| "Too simple to verify" | Simple code breaks. Verification takes 10 seconds. |
| "I just ran it" | Run it AGAIN. Fresh output only. |
| "Tests passed earlier" | Run them NOW. State changes. |
| "It's obvious it works" | Nothing is obvious. Evidence or silence. |
| "The edit looks correct" | Looking != working. Run the code. |
Store checkpoint:
bd update <issue-id> --append-notes "CHECKPOINT: Step 5a verification passed at $(date -Iseconds)" 2>/dev/null
If the change is complete and verified:
git add <modified-files>
git commit -m "<descriptive message>
Implements: <issue-id>"
bd update <issue-id> --status closed 2>/dev/null
After successful issue closure, record in ratchet:
# Check if ao CLI is available
if command -v ao &>/dev/null; then
# Get the commit hash as output artifact
COMMIT_HASH=$(git rev-parse HEAD 2>/dev/null || echo "")
CHANGED_FILES=$(git diff --name-only HEAD~1 2>/dev/null | tr '\n' ',' | sed 's/,$//')
if [ -n "$COMMIT_HASH" ]; then
# Record successful implementation
ao ratchet record implement \
--output "$COMMIT_HASH" \
--files "$CHANGED_FILES" \
--issue "<issue-id>" \
2>&1 | tee -a .agents/ratchet.log
if [ $? -eq 0 ]; then
echo "Ratchet: Implementation recorded (commit: ${COMMIT_HASH:0:8})"
else
echo "Ratchet: Failed to record - chain.jsonl may need repair"
fi
else
echo "Ratchet: No commit found - skipping record"
fi
else
echo "Ratchet: ao CLI not available - implementation NOT recorded"
echo " Run manually: ao ratchet record implement --output <commit>"
fi
On failure/blocker: Record the blocker in ratchet:
if command -v ao &>/dev/null; then
ao ratchet record implement \
--status blocked \
--reason "<blocker description>" \
2>/dev/null
fi
Fallback: If ao is not available, the issue is still closed via bd but won't be tracked in the ratchet chain. The skill continues normally.
Tell the user:
Output completion marker:
<promise>DONE</promise>
If blocked or incomplete:
<promise>BLOCKED</promise>
Reason: <why blocked>
<promise>PARTIAL</promise>
Remaining: <what's left>
If bd CLI not available:
When: Agent Mail MCP tools are available (Level 2 Olympus or multi-agent coordination)
Level 2 mode enhances /implement with real-time coordination via MCP Agent Mail. This enables:
Detect the operational level at skill start:
# Check for Agent Mail availability
AGENT_MAIL_AVAILABLE=false
# Method 1: Check if running inside /demigod context
if [ -n "$OLYMPUS_DEMIGOD_ID" ]; then
AGENT_MAIL_AVAILABLE=true
fi
# Method 2: Check for explicit flag
# /implement <issue-id> --agent-mail --thread-id <id>
Level Semantics:
| Level | Condition | Behavior |
|---|---|---|
level_1 | No Agent Mail | Current behavior (all steps above) |
level_2 | Agent Mail available | Enhanced coordination (steps below) |
| Parameter | Description | Default |
|---|---|---|
--agent-mail | Enable Agent Mail coordination | false |
--thread-id | Thread ID for message grouping (usually bead-id) | <issue-id> |
--demigod-id | Agent identity for message sender | demigod-<issue-id> |
--orchestrator | Who to send status messages to | mayor@olympus |
When --agent-mail is enabled OR $OLYMPUS_DEMIGOD_ID is set:
# If not already registered (Demigod handles this), register self
# This is typically done by /demigod, but implement can work standalone
if [ -z "$OLYMPUS_DEMIGOD_ID" ]; then
# Standalone Level 2 mode - need to register
DEMIGOD_ID="${DEMIGOD_ID:-demigod-$(date +%s)}"
else
DEMIGOD_ID="$OLYMPUS_DEMIGOD_ID"
fi
MCP Tool Call (if standalone):
Tool: mcp__mcp-agent-mail__register_agent
Parameters:
project_key: "olympus"
program: "implement-skill"
model: "claude-opus-4-5-20250101"
task_description: "Implementing <issue-id>"
After claiming the issue (Step 2 in base flow), notify the orchestrator:
MCP Tool Call:
Tool: mcp__mcp-agent-mail__send_message
Parameters:
project_key: "olympus"
sender_name: "<demigod-id>"
to: "<orchestrator>"
subject: "BEAD_ACCEPTED"
body_md: |
Accepted bead: <issue-id>
Title: <issue-title>
Starting implementation at: <timestamp>
thread_id: "<issue-id>"
ack_required: false
Before Steps 3, 4, 5 in base flow, check for incoming messages:
MCP Tool Call:
Tool: mcp__mcp-agent-mail__fetch_inbox
Parameters:
project_key: "olympus"
agent_name: "<demigod-id>"
Handle incoming messages:
| Message Type | Action |
|---|---|
GUIDANCE | Incorporate guidance into approach |
NUDGE | Respond with progress update |
TERMINATE | Exit gracefully (checkpoint work) |
After each major step, send progress update:
Timing:
MCP Tool Call:
Tool: mcp__mcp-agent-mail__send_message
Parameters:
project_key: "olympus"
sender_name: "<demigod-id>"
to: "<orchestrator>"
subject: "PROGRESS"
body_md: |
Bead: <issue-id>
Step: <current-step>
Status: <what's happening>
Context usage: <approximate %>
Files touched: <list>
thread_id: "<issue-id>"
ack_required: false
Replace user prompts with Agent Mail help requests:
Instead of:
"I'm stuck on X. Should I proceed with Y or Z?"
Do this:
Tool: mcp__mcp-agent-mail__send_message
Parameters:
project_key: "olympus"
sender_name: "<demigod-id>"
to: "chiron@olympus" # Help goes to Chiron (coach)
subject: "HELP_REQUEST"
body_md: |
Bead: <issue-id>
Issue Type: STUCK | SPEC_UNCLEAR | BLOCKED | TECHNICAL
## Problem
<describe the issue>
## What I Tried
<approaches attempted>
## Files Touched
- path/to/file.py
- path/to/other.py
## Question
<specific question needing answer>
thread_id: "<issue-id>"
ack_required: true
Then wait for HELP_RESPONSE:
# Poll inbox for response (max 2 minutes per help-response timeout)
for i in {1..24}; do
# Check inbox
# If HELP_RESPONSE found, continue with guidance
# If timeout exceeded, proceed with best judgment or fail gracefully
sleep 5
done
After Step 7 (closing the issue), send completion message:
On Success:
Tool: mcp__mcp-agent-mail__send_message
Parameters:
project_key: "olympus"
sender_name: "<demigod-id>"
to: "<orchestrator>"
subject: "OFFERING_READY"
body_md: |
Bead: <issue-id>
Status: DONE
## Changes
- Commit: <commit-sha>
- Files: <changed-files>
## Self-Validation
- Tests: PASS/FAIL
- Lint: PASS/FAIL
- Build: PASS/FAIL
## Summary
<brief description of what was implemented>
thread_id: "<issue-id>"
ack_required: true
On Failure:
Tool: mcp__mcp-agent-mail__send_message
Parameters:
project_key: "olympus"
sender_name: "<demigod-id>"
to: "<orchestrator>"
subject: "FAILED"
body_md: |
Bead: <issue-id>
Status: FAILED
## Failure
Type: TESTS_FAIL | BUILD_FAIL | SPEC_IMPOSSIBLE | ERROR
Reason: <description>
Internal Attempts: <count>
## Partial Progress
- Commit: <partial-commit-sha if any>
- Files: <files-modified>
## Recommendation
<what needs to happen to unblock>
thread_id: "<issue-id>"
ack_required: false
When running in Level 2 with parallel workers, claim files before editing:
Before Step 4 (implementation):
Tool: mcp__mcp-agent-mail__file_reservation_paths
Parameters:
project_key: "olympus"
agent_name: "<demigod-id>"
paths:
- "path/to/file1.py"
- "path/to/file2.py"
exclusive: false # Advisory, not blocking
After Step 7 (completion):
Tool: mcp__mcp-agent-mail__release_file_reservations
Parameters:
project_key: "olympus"
agent_name: "<demigod-id>"
If context usage is high (>80%), send checkpoint before exiting:
Tool: mcp__mcp-agent-mail__send_message
Parameters:
project_key: "olympus"
sender_name: "<demigod-id>"
to: "<orchestrator>"
subject: "CHECKPOINT"
body_md: |
Bead: <issue-id>
Reason: CONTEXT_HIGH
## Progress
- Commit: <partial-commit-sha>
- Description: <what's done, what remains>
- Context usage: <pct>%
## Next Steps for Successor
<guidance for replacement demigod>
thread_id: "<issue-id>"
ack_required: false
| Behavior | Level 1 | Level 2 |
|---|---|---|
| Progress reporting | None | PROGRESS messages |
| When stuck | Ask user / proceed | HELP_REQUEST to Chiron |
| Completion | bd update only | OFFERING_READY + bd update |
| Failure | Report to user | FAILED message + report |
| File conflicts | Race conditions | Advisory reservations |
| Guidance | None | Check inbox for GUIDANCE |
When /implement is called from /demigod skill:
$OLYMPUS_DEMIGOD_ID, etc.)When /implement is called standalone with --agent-mail: