execute-aa-ma-step
Executes one sub-step of an active AA-MA plan, the next PENDING one or a named N.M: checks its dependencies and acceptance criteria, does the work, then records its Result Log. Use when asked for the next AA-MA step, a specific step, or one-step-at-a-time progress on an AA-MA task.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-12
- Stars
- ★ 6
- Forks
- 1
01 前言 Front Matter
- name
- execute-aa-ma-step
- description
- Executes one sub-step of an active AA-MA plan, the next PENDING one or a named N.M: checks its dependencies and acceptance criteria, does the work, then records its Result Log. Use when asked for the next AA-MA step, a specific step, or one-step-at-a-time progress on an AA-MA task.
03 SKILL.md 正文
AA-MA Step Execution
You are executing a single task from an AA-MA (Advanced Agentic Memory Architecture) tracked plan.
Scope: One HTP task node (maximum granular control) Validation: Lightweight guardrails (Result Log enforcement, acceptance criteria check, milestone boundary detection) Git: No auto-commit (changes accumulate)
1. Locate Active Task & Pre-Execution Validation
Check .claude/dev/active/ for the most recent task directory:
ls -lt .claude/dev/active/ | head -5
Expected structure: .claude/dev/active/[task-name]/
Tier 1: Existence Check (Fast)
Verify all 5 required AA-MA files exist and are non-empty:
TASK_DIR=".claude/dev/active/[task-name]"
TASK_NAME="[task-name]"
MISSING=0
for file in "${TASK_NAME}-plan.md" "${TASK_NAME}-reference.md" "${TASK_NAME}-context-log.md" "${TASK_NAME}-tasks.md" "${TASK_NAME}-provenance.log"; do
if [[ ! -s "${TASK_DIR}/${file}" ]]; then
echo "❌ MISSING or EMPTY: ${file}"
MISSING=$((MISSING + 1))
fi
done
echo "Tier 1 result: ${MISSING} files missing"
If Tier 1 fails (any files missing or empty):
⚠️ AA-MA ARTIFACTS INCOMPLETE — AUTO-RECOVERY TRIGGERED
Missing/empty files detected: [list]
Auto-recovery: Triggering Phase 5 artifact creation with scribe+validator agents...
- Notify user that auto-recovery is starting
- Spawn
aa-ma-scribeagent to create missing files from available plan context - Spawn
aa-ma-validatoragent to verify created files (5-dimension check) - If validator reports PASS/WARN → continue execution
- If validator reports FAIL → retry once (re-scribe → re-validate)
- If still FAIL after retry → HALT and alert user: "Auto-recovery failed. Run
/aa-ma-planto recreate artifacts." - If agent spawning unavailable → fallback: create files directly inline, then continue
Note: Step execution uses Tier 1 only (existence check). Full content validation (Tier 2) runs at milestone boundaries via /execute-aa-ma-milestone.
2. Priority Context Injection
REQUIRED - Auto-inject with XML delimiters:
Load and inject these two files immediately:
<REFERENCE>
{Read contents of [task-name]-reference.md}
# Immutable facts and constants. Treat as non-negotiable.
# Examples: API endpoints, file paths, configuration values, core function signatures
</REFERENCE>
<TASKS>
{Read contents of [task-name]-tasks.md}
# HTP (Hierarchical Task Planning) roadmap. Defines your required next action.
# Current execution scope: SINGLE STEP
# Status values: PENDING | ACTIVE | COMPLETE | BLOCKED
</TASKS>
CONDITIONAL - Load if tokens allow:
3. [task-name]-context-log.md (summarized architectural decisions)
4. [task-name]-plan.md (original strategy and rationale)
3. Validate Loaded Context
Required checks:
- ✅ REFERENCE contains key constants (APIs, paths, configs)
- ✅ TASKS has clear HTP structure with Status fields
- ✅ At least one task has
Status: PENDINGorStatus: ACTIVE
If validation fails:
ERROR: [Specific issue]
- Missing AA-MA files → "AA-MA files not found. Run /aa-ma-plan first."
- Malformed HTP → "tasks.md lacks proper HTP format. Review AA-MA Planning Standard."
- No pending tasks → "All tasks complete. Check tasks.md status."
4. Parse HTP & Create TodoWrite Todos
Parse tasks.md for HTP structure:
## headers= Milestones (e.g., "## Step 1: Setup Infrastructure")### headers= Sub-tasks (e.g., "### Sub-step: Install dependencies")- Extract
Status:field (PENDING | ACTIVE | COMPLETE | BLOCKED) - Extract
Complexity:percentage
Identify next PENDING task:
- Find first task node with
Status: PENDING - This is your target task for this execution
Create TodoWrite todos for:
- The target task (## level)
- All its sub-tasks (### level)
Todo format:
{
"content": "[Task title from HTP]",
"status": "pending|in_progress|completed",
"activeForm": "[Present continuous form]"
}
Status mapping:
- HTP
PENDING→ TodoWritepending - HTP
ACTIVE→ TodoWritein_progress - HTP
COMPLETE→ TodoWritecompleted - HTP
BLOCKED→ TodoWritepending(prefix content with "BLOCKED: ")
Complexity flagging:
- If
Complexity: ≥ 80%→ Prefix content with "[High Complexity] " - High complexity signals need for deep reasoning / Chain-of-Thought
4.5 Quality Standards (Actionable Triggers)
These principles apply DURING execution. Each has a trigger and skip condition.
- KISS: If implementation exceeds 200 lines for a single function, decompose. Skip for generated code.
- DRY: Before writing a new utility, grep the codebase for existing implementations.
- SOLID: If a class has >5 public methods, evaluate single-responsibility. If a module mixes data access + business logic + presentation, separate.
- SOC: If a file grows beyond one clear responsibility, split.
- TDD: If this step produces code, invoke
superpowers:test-driven-development. Skip for docs/config. - 12-Factor: If task involves services/deployment, reference 12-Factor. For tasks with
.envfiles, verify env-var-drift (seerules/env-var-drift.md). - Context7 MCP: Use for library docs. Retry once on failure, fall back to WebSearch + official docs.
- WebSearch: Fallback when Context7 fails. Use proactively for unfamiliar APIs or recent library changes.
5. Execute Target Task
Set task status to ACTIVE:
- Update tasks.md: Change target task
Status: PENDING→Status: ACTIVE - Update TodoWrite: Mark corresponding todo as
in_progress
Mode Dispatch (HITL / AFK):
- Parse
Mode:field from the target task in tasks.md - If not present, inherit from parent milestone; default to
HITL - HITL: Display task summary and acceptance criteria, use
AskUserQuestion[Proceed / Skip / Abort]. Only continue if Proceed. - AFK: Proceed directly to execution without pause
Execute the task:
- Follow task instructions and acceptance criteria
- Use agents, skills, Context7 MCP as appropriate for efficiency
- For high complexity tasks (≥80%), use deep reasoning / Chain-of-Thought
- Execute all sub-tasks (### nodes) within the target task
Impact awareness (lightweight, no blocking):
- Before editing existing code, run
Skill(impact-analysis)on it (callers, contracts, tests) - Be aware of contract changes (function signatures, return types)
- Full impact analysis verification runs at milestone boundary (not step level)
- If editing shared/core modules, note potential impacts in Result Log
For each sub-task:
- Mark TodoWrite sub-task as
in_progress - Execute sub-task
- Verify result meets expectations (guidance-based, trust your assessment)
- IMMEDIATELY update
Result Log:field in tasks.md with specific evidence — do not batch to end of task - If sub-task has acceptance criteria, verify them now (quick pass/fail)
- Mark TodoWrite sub-task as
completed
6. Complete Task
When all sub-tasks done:
6.1 Result Log Enforcement (REQUIRED)
Before marking any sub-step or task COMPLETE, you MUST write its Result Log entry in tasks.md.
This is not optional. Per L-080/L-081/L-082, Result Log drift is the #1 cause of sub-step state loss.
For each sub-step and the parent task:
- Write
Status: COMPLETEand a conciseResult Log:with specific evidence (file paths created, test counts, pass/fail verdicts, IDs generated) - Vague Result Logs are rejected. Bad: "Done." Good: "Created
src/auth/middleware.pywith JWT validation; 3/3 unit tests pass." - Do not proceed to the next step until the current step's Result Log is written and saved to tasks.md.
6.2 Step Acceptance Criteria Check (if defined)
If the step has Acceptance Criteria: defined in tasks.md, verify each criterion before marking COMPLETE:
- Read the acceptance criteria for this step
- For each criterion, confirm it is met (run the test, check the file exists, verify the output)
- If any criterion FAILS: set
Status: BLOCKEDwith the failing criterion in the Result Log, do not mark COMPLETE - If no explicit acceptance criteria exist: proceed with guidance-based assessment (trust your judgment)
This is lightweight — no formal verification matrix, just a quick pass/fail check per criterion.
6.2.5 Engineering Standards Advisory Checklist
Reference: claude-code/rules/engineering-standards.md Theme 5 (Execution Checklist).
Before flipping Status: COMPLETE, the agent self-reports against this 7-item
checklist. HARD items are advisory at step level — final enforcement happens
at the milestone HARD gate in /execute-aa-ma-milestone (Section 6 boundary
validation). Step-level reporting surfaces issues early without blocking atomic
flow.
| # | Item | Tier | Step-level action |
|---|---|---|---|
| 1 | Implementation tested with running code/API | HARD | Note evidence in Result Log; verified at milestone gate |
| 2 | Tests written and passing | HARD | Note pass count in Result Log; verified at milestone gate |
| 3 | Non-breaking constraint verified | HARD | Note any contract changes in Result Log; verified at milestone gate |
| 4 | AA-MA artifacts in sync; git clean for AA-MA | HARD | Note any drift in Result Log; verified at milestone gate |
| 5 | No assumptions left unvalidated | SOFT | Declare in context-log.md if any assumption remains untested |
| 6 | Relevant skills/subagents consulted | SOFT | Declare in context-log.md which skills/subagents were used |
| 7 | Changes reviewed against past mistakes | SOFT | Declare in context-log.md which lessons (Phase 1 scan) applied |
Conditional sub-items (when present in tasks.md, surface evidence in Result Log):
Critical-Path: <value>→ mentionCRITICAL_PATH_REVIEWevidence (verified at milestone gate)Prototype-Required: YES→ mentionPROTOTYPE — <milestone heading> — <verdict> — verdict-changes-plan: YES|NOevidence (YES → a plan-verification Angle-3 check on the decision delta); a sub-step's YES rolls up to the milestone gate (§6.7 reads it viaaa-ma-gate), so the entry must name the milestone heading
When Critical-Path: or Prototype-Required: is absent from the task, skip
the corresponding check (no failure).
This step-level checklist is advisory. Atomic step flow proceeds even if HARD items are partial — the milestone HARD gate is the structural enforcer.
6.3 Last-Step-of-Milestone Detection
After completing this step, check: are there any remaining PENDING steps in the current milestone?
# Quick check — count PENDING steps in the current milestone section
grep -c "Status: PENDING" [relevant milestone section of tasks.md]
- If PENDING steps remain: Report completion normally (Section 7)
- If this was the LAST step of the milestone: Display prominently:
=== MILESTONE BOUNDARY REACHED ===
All steps in [Milestone Name] are COMPLETE.
Run /execute-aa-ma-milestone for full validation, impact analysis, and auto-commit.
Do NOT proceed to the next milestone without running milestone validation.
6.4 Update State
-
Update tasks.md:
- Change target task
Status: ACTIVE→Status: COMPLETE - Confirm task-level
Result Log:is filled (Section 6.1 should have done this already)
- Change target task
-
Update TodoWrite:
- Mark task todo as
completed
- Mark task todo as
-
Sync changes:
- Save tasks.md with updated Status and Result Log
- Ensure TodoWrite reflects all status changes
-
NO AUTO-COMMIT:
- Changes accumulate in working directory
- Allows related tasks to be committed together
- User will commit manually or use execute-aa-ma-milestone for auto-commit
- IMPORTANT: When commits are made (manually or via milestone), include the AA-MA signature:
[AA-MA Plan] [task-name] .claude/dev/active/[task-name]
-
FINALIZATION NOTE:
- The Finalization Protocol (integrity check, doc auto-update, user approval) does NOT run at step level
- Finalization runs at milestone completion only (via
/execute-aa-ma-milestoneor/execute-aa-ma-full) - Steps accumulate until milestone boundary is reached
7. Next Actions
Report completion to user:
✅ Task completed: [task title]
Summary: [brief outcome summary]
Result Log updated in tasks.md.
Next steps:
- Run /execute-aa-ma-step again to continue with next task
- OR run /execute-aa-ma-milestone to execute remaining tasks in this milestone
- OR commit changes manually when ready: git add . && git commit -m "..."
If blocked:
? Task blocked: [task title]
Issue: [specific blocker]
Actions taken:
- Set Status: BLOCKED in tasks.md
- Created new sub-task: "### Sub-step N.M: Resolve [blocker]"
Suggested resolution:
[remediation steps]
Please resolve blocker, then re-run /execute-aa-ma-step.
Token & Context Optimization
- Monitor token usage: Check current session context usage
- If approaching limits: Consider context compaction:
- Summarize completed work
- Preserve essential state and open issues
- Discard redundant tool outputs
- Reset session with compacted context
Error Handling
Missing dependencies:
ERROR: Task has unmet dependencies
- Task: [task-id]
- Dependencies: [list]
- Status of dependencies: [check Status: fields]
Resolution: Complete dependency tasks first, then retry.
Malformed acceptance criteria:
WARNING: Acceptance criteria unclear or missing
- Task: [task-id]
- Issue: [description]
Proceeding with best-effort execution. Consider updating tasks.md with clearer criteria.
End of execute-aa-ma-step.md
04 同仓库更多 Skills
deploy-helper
You can use this to help with deploy stuff, deploying, deployments, releases, shipping, pushing to prod, going live, rollouts.
writing-for-agents
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
verify-plan
Slash entry for plan verification: runs plan-verification on an existing AA-MA plan, writes [task]-verification.md, and with --iterate loops until the plan converges. Use when the user types /verify-plan or wants the verification report saved.
verify-impl
Post-impl adversarial review symmetric to /verify-plan. Dispatches up to 5 parallel audit agents (code-reviewer, security-auditor, tdd-sequence-auditor, context7-evidence-auditor, future-proofing-auditor) based on the milestone's plan-declared Audit-Profile. CRITICAL findings surface via AskUserQuestion accept/dispute/defer panel before §7.3 user authorization. Introduced in v0.8.0 per ADR-0005. Invoked by Phase 6.8 of /execute-aa-ma-milestone.
understand-codebase
Onboard to a new, inherited, or shared codebase. Read it, understand it, map it, and learn its conventions, versioning, tests, tech stack, rules (AGENTS.md / CLAUDE.md / .cursorrules / etc.), build/run/CI, integrations, security posture, and repo health — then produce an honest pros/cons verdict, a "contribute safely" playbook, and an "add a feature" playbook, written to ONBOARDING.md at the repo root plus a .claude/onboarding/ set of deep-dives — and optionally author an AGENTS.md if one is missing, or review and propose improvements to an existing one. Tiered (Quick / Standard / Deep). Reuses codemem (index + diagrams), gsd-map-codebase, system-mapping, code-intelligence, impact-analysis rather than re-implementing them; Deep tier runs a TeamCreate agent-team. Keywords: new codebase, shared codebase, inherited code, onboard, understand this repo, how do I contribute, how do I add a feature, ramp up, get oriented, ONBOARDING.md, AGENTS.md, codebase walkthrough, joining a project.
token-compression
Output token compression for AA-MA workflows. Reduces response tokens by 40-75% while preserving full technical accuracy. Three intensity levels mapped to execution modes: lite (HITL), full (general), ultra (AFK). Auto-activates during AA-MA execution based on task Mode field. Manual activation via /compress lite|full|ultra.