| name | aa-ma-plan-workflow |
| description | Use when planning complex multi-step tasks, creating AA-MA artifacts, or transitioning from ad-hoc to structured development - transforms rough ideas into executable plans through 5-phase workflow with integrated skills and validation gates |
AA-MA Plan Workflow Skill
Transform initial feature requests into fully-structured AA-MA (Advanced Agentic Memory Architecture) artifacts through a comprehensive 5-phase workflow with integrated skills, validation gates, and complexity-based routing.
This skill MUST be used when:
- User asks to plan complex features or architectural changes
- Task requires 3+ major milestones with dependencies
- Work will span multiple sessions (multi-day/week development)
- Estimated complexity ≥ 60%
- Need audit trail, rollback capability, or provenance tracking
- User explicitly requests AA-MA planning or uses `/aa-ma-plan` command
DO NOT rationalize away using this skill. Complex tasks without proper planning lead to context drift, scope creep, and incomplete implementations.
Optional dependency: Several phases invoke superpowers skills (brainstorming, writing-plans, TDD). If superpowers is not installed, the workflow falls back to native Claude Code tools.
Quick Reference
| Resource | Location |
|---|
| Phase 0 Details | references/PHASE_0_OPERATIONAL_READINESS.md |
| Phase 1 Details | references/PHASE_1_CONTEXT.md |
| Phase 2 Details | references/PHASE_2_BRAINSTORM.md |
| Phase 3 Details | references/PHASE_3_RESEARCH.md |
| Phase 4 Details | references/PHASE_4_PLAN_GENERATION.md |
| Phase 5 Details | references/PHASE_5_ARTIFACT_CREATION.md |
| Skill Integration | references/SKILL_INTEGRATION.md |
| Validation Gates | references/VALIDATION_GATES.md |
| Complexity Routing | references/COMPLEXITY_ROUTING.md |
| Sync Protocol | references/SYNC_PROTOCOL.md |
| Plan Template | templates/plan-template.md |
| Validation Checklist | templates/validation-checklist.md |
When to Use This Skill
Use When
- "Refactor [major component]", "Implement [multi-step feature]"
- "This will take a while", "Let's break this down"
- Task complexity ≥ 60% or 3+ milestones needed
- Need audit trail, rollback capability, provenance tracking
Skip When
- Simple, single-file changes (< 3 steps)
- Quick bug fixes or typo corrections
- Complexity < 30% (trivial tasks)
Workflow Overview
Phase 0: Operational Readiness → Ops-mode activation + Gate 0
↓
Phase 1: Context Gathering → Multi-method input + clarifications
↓
Phase 2: Structured Thinking → Brainstorming + Gate 1 validation
↓
Phase 3: Research & Docs → Context7 MCP + parallel agents + Gate 2
↓
Phase 4: Plan Generation → AA-MA standard (12 elements) + Gate 3
↓
Phase 4.5: Adversarial Verify → 6-angle verification + Gate 3.5
↓
[ENFORCEMENT GATE] → MUST create artifacts — auto-recovery if skipped
↓
Phase 5: AA-MA Artifact Creation → Scribe+Validator agents + Gate 4
↓
Ready for Execution → /execute-aa-ma-milestone
Skill Integration Matrix
| Phase | Skill | Trigger |
|---|
| Phase 0 | operational-constraints | Always (establish discipline) |
| Phase 2 | superpowers:brainstorming | Always (primary) |
| Phase 2 | architecture-patterns | Architectural decisions needed |
| Phase 2 | spec-driven-development | API design, contract-first signals (advisory) |
| Phase 3 | dispatching-parallel-agents | 3+ independent research domains |
| Phase 3 | system-mapping | 3+ files OR unfamiliar code |
| Phase 3 | impact-analysis | Always (mandatory) |
| Phase 4 | complexity-router | Always (determines routing) |
| Phase 4 | Deep architectural review | Complexity ≥ 80% (human review, ultrathinking, or architecture skill) |
| Phase 4 | Plan quality scoring | Always (inline checklist or evaluation skill) |
| Phase 4.5 | plan-verification | Always (adversarial verification) |
| Phase 3 | agent-teams | Complex research needing competing hypotheses |
| Phase 5 | agent-teams | Always (scribe+validator artifact creation) |
| Phase 5 | defense-in-depth | Always (consistency validation) |
| Error | debugging-strategies | Validation fails twice |
See references/SKILL_INTEGRATION.md for detailed integration points.
Validation Gates
| Gate | After Phase | Key Criteria |
|---|
| Gate 0 | Phase 0 | Ops-mode decision made, complexity estimated, parallel scan |
| Gate 1 | Phase 2 | 3+ alternatives, assumptions validated, edge cases |
| Gate 2 | Phase 3 | Research coverage, sources documented, impact assessed |
| Gate 3 | Phase 4 | Criteria testable, specific, achievable; quality ≥ 70% |
| Gate 3.5 | Phase 4.5 | 0 CRITICALs (automated), report generated (interactive/skip) |
| Gate 4 | Phase 5 | Cross-file consistency, no contradictions |
See references/VALIDATION_GATES.md for detailed specifications.
Complexity Routing
| Complexity | Action |
|---|
| 0-59% | Standard workflow |
| 60-79% | Enhanced validation, flag in plan |
| 80-100% | Deep architectural review required (human review, ultrathinking, or architecture skill) |
See references/COMPLEXITY_ROUTING.md for estimation algorithm.
Phase 0: Operational Readiness
Objective: Establish disciplined execution mode before planning begins.
Skills: operational-constraints (always)
Steps:
- Check if ops-mode already active
- Run quick complexity heuristic (signal-based estimation)
- Scan for parallel research opportunities
- Load Pre-Task Checklist items
- Pass Gate 0 before proceeding
Gate 0 Criteria:
- Ops-mode activation decision made
- Quick complexity estimate captured
- Parallel opportunity scan complete
- Pre-Task Checklist reviewed
Output:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PHASE 0 COMPLETE: Operational Ready
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Mode: [Standard | Ops-Mode | Full Ops-Mode]
Quick Complexity: [X%]
Parallel Research: [Yes/No]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
See references/PHASE_0_OPERATIONAL_READINESS.md for details.
Phase 1: Context Gathering
Objective: Understand request, gather context, determine task name and scope.
Steps:
- Detect input method (selected text / inline / interactive)
- Gather project context (pwd, git hash, existing tasks)
- Ask clarifying questions (task name, objective, complexity)
- Display context summary
Output:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PHASE 1 COMPLETE: Context Gathered
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Task: [name]
Objective: [summary]
Complexity: [estimate]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
See references/PHASE_1_CONTEXT.md for details.
Phase 2: Structured Thinking
Objective: Refine requirements, explore alternatives, validate assumptions.
Skills: superpowers:brainstorming (primary), architecture-patterns (if architectural)
Steps:
- Invoke brainstorm skill (or fallback prompt)
- Explore 3+ alternatives with pros/cons
- Validate assumptions, identify edge cases
- Apply KISS/DRY/SOLID/SOC principles; if task involves services/deployment, apply 12-Factor; always check env-var-drift for .env files
- Pass Gate 1 before proceeding
Gate 1 Criteria:
- ≥ 3 alternatives explored
- All assumptions have validation method
- ≥ 3 edge cases identified
- Simplest solution identified
See references/PHASE_2_BRAINSTORM.md for details.
Phase 3: Research & Documentation
Objective: Gather technical docs, explore codebase, assess impact.
Skills: dispatching-parallel-agents (3+ domains), agent-teams (competing hypotheses), impact-analysis (always)
Steps:
- Identify research needs from Phase 2
- Use Context7 MCP for library docs (fallback: WebSearch)
- Dispatch parallel agents for complex research
- For complex research with 3+ competing approaches: use
agent-teams with competing hypotheses protocol
- Run impact analysis (identify upstream callers)
- Consolidate findings
- Pass Gate 2 before proceeding
Gate 2 Criteria:
- All research needs addressed
- Sources documented
- Conflicts resolved
- Impact assessment complete
See references/PHASE_3_RESEARCH.md for details.
Phase 4: Plan Generation
Objective: Generate comprehensive plan with all 12 AA-MA elements.
Skills: complexity-router, deep architectural review (if ≥80%)
Steps:
- Check complexity (trigger deep architectural review if ≥80%)
- Invoke write-plan skill (or fallback prompt)
- Ensure all 11 AA-MA elements present
- Score plan quality (must be ≥70%)
- Pass Gate 3 before proceeding
The 12 AA-MA Elements:
- Executive summary (≤3 lines)
- Ordered stepwise implementation plan
- Milestones with measurable goals
- Acceptance criteria per step (testable)
- Required artifacts per step
- Tests per milestone
- Rollback strategies
- Dependencies & assumptions
- Effort estimates & complexity (0-100%)
- Risks & mitigations (top 3 per milestone, include cascade risks)
- Next action (concrete first step)
- Engineering Standards Declaration (themes from
claude-code/rules/engineering-standards.md that materially apply, with one-sentence rationale per theme — captured in Phase 2 Step 2.4)
Gate 3 Criteria:
- Criteria testable and specific
- No vague terms
- Quality score ≥ 70%
See references/PHASE_4_PLAN_GENERATION.md for details.
Phase 4.5: Adversarial Verification
Objective: Verify plan claims against external reality before artifact creation.
Skills: plan-verification (always)
Steps:
- Prompt user: automated / interactive / skip
- If not skipped, invoke
plan-verification skill
- Wave 1: 4 parallel agents (ground-truth, assumptions, impact, criteria falsifiability)
- Wave 2: 2 sequential agents (fresh-agent simulation, specialist domain audit)
- Consolidate findings, classify severity
- Pass Gate 3.5 before proceeding
Gate 3.5 Criteria:
| Mode | Criteria |
|---|
| Automated | 0 unresolved CRITICALs + verification report generated |
| Interactive | Verification report generated + findings presented |
| Skip | Auto-pass (user explicitly chose to skip) |
Revision Loop (automated mode only):
- If CRITICALs found: revise plan, re-run affected angles only
- Max 2 revision loops, then escalate to user
Output:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PHASE 4.5 COMPLETE: Verification
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Mode: [Automated | Interactive | Skipped]
CRITICAL: [N] | WARNING: [N]
Result: [PASS | FAIL | SKIPPED]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
See plan-verification skill for full protocol. Design doc: docs/plans/2026-03-08-aa-ma-plan-verification-design.md
Enforcement Gate: Phase 4 → Phase 5
After Gate 3 passes, you MUST proceed to Phase 5 artifact creation. This is NOT optional.
If Phase 5 is skipped (e.g., due to context pressure or eager execution), execute commands will auto-recover by triggering Phase 5 with the scribe+validator agents. But prevention is better than recovery.
Rule: After a plan passes Gate 3, the ONLY valid next action is Phase 5 artifact creation. No execution, no "quick start", no shortcuts.
Auto-Recovery: If execution commands (/execute-aa-ma-*) detect missing artifacts, they will:
- Notify user: "AA-MA artifacts incomplete. Auto-creating..."
- Spawn
aa-ma-scribe agent to write artifacts from the plan
- Spawn
aa-ma-validator agent to verify artifacts
- Resume execution only after validation passes
See references/PHASE_5_ARTIFACT_CREATION.md for the scribe+validator spawn protocol.
Phase 5: AA-MA Artifact Creation
Objective: Create all AA-MA files (5 standard + verification if Phase 4.5 ran) with validated content.
Skills: agent-teams (scribe+validator), defense-in-depth (cross-file validation)
Steps:
- Create
.claude/dev/active/[task-name]/ directory
- Spawn
aa-ma-scribe agent to write all 5 files from approved plan
- Spawn
aa-ma-validator agent to verify artifacts (post-creation context)
- If validator reports FAIL → scribe rewrites failed files → re-validate
- Run
defense-in-depth cross-file consistency check
- Pass Gate 4 before completing
Fallback: If agent spawning fails, write artifacts directly (see references/PHASE_5_ARTIFACT_CREATION.md for manual procedure).
Gate 4 Criteria:
- Facts consistent across files
- Tasks align with plan
- No contradictions
- All references valid
Final Output:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ AA-MA PLAN WORKFLOW COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Task Directory: .claude/dev/active/[task-name]/
Files: plan.md, reference.md, context-log.md, tasks.md, provenance.log
📊 Summary: [N] milestones, [N] steps, [N] high-complexity (≥80%)
🎯 Next Action: [from plan]
RECOMMENDED: /execute-aa-ma-milestone
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
See references/PHASE_5_ARTIFACT_CREATION.md for details.
Error Handling
| Error | Auto-Recover? | Fallback |
|---|
| Superpowers unavailable | ✅ Yes | Native prompts |
| Context7 MCP failed | ✅ Yes (1 retry) | WebSearch + codebase |
| Task directory exists | ❌ No | Prompt user |
| Plan validation fails | ⚠️ Partial | Regenerate, then manual |
| Gate fails twice | ⚠️ Partial | debugging-strategies |
Execution Handoff
After aa-ma-plan completes, use aa-ma-execution skill:
| Mode | Command | Use When |
|---|
| Milestone | /execute-aa-ma-milestone | RECOMMENDED - balanced structure |
| Step | /execute-aa-ma-step | Fine-grained control |
| Full | /execute-aa-ma-full | After validating 1-2 milestones |
Optional goal-synthesis (Claude Code /goal): If the user intends to run
/execute-aa-ma-full in AFK mode, the execution command's §2.5 will invoke
Skill(goal-condition-synthesis) to produce a /goal condition from this
plan's Acceptance Criteria. The synthesis is decoupled from plan
generation — plan output remains the 5 standard files regardless. If goal
synthesis is performed during the plan run (rare; usually deferred to execute
time), emit the optional PHASE_4.7 marker per
docs/spec/plan-marker-grammar.md.
IMPORTANT - Commit Signature:
All commits while AA-MA plan is active MUST include:
[AA-MA Plan] [task-name] .claude/dev/active/[task-name]
Master Checklist
Phase 0
Phase 1
Phase 2
Phase 3
Phase 4
Phase 4.5
Phase 5
Best Practices
- Don't skip Phase 1 - Invest 1-2 minutes to prevent hours of rework
- Use superpowers skills when available for higher quality
- Extract facts aggressively to reference.md
- Flag high-complexity steps (≥80%) for deep reasoning
- Start with milestone mode to validate plan quality
- Document decisions in context-log (why, not what)
End of aa-ma-plan-workflow/SKILL.md
For detailed procedures, see reference files in references/ directory.