memory-orchestrator
Memory Orchestrator: Task Decomposition & Coordination
Purpose
Orchestrate complex tasks by decomposing them into manageable subtasks, assigning appropriate roles (architect, implementer, tester, etc.), and coordinating execution with context from long-term memory.
When to Use This Skill
✅ USE when:
- Task involves multiple files or components
- Requires planning before implementation
- Needs coordination between different roles (design, code, tests, docs)
- Project has historical context to consider
- Post-commit verification needed
❌ DO NOT USE when:
- Simple question about code
- Single-file edit
- Documentation lookup
- Trivial task without planning needed
Core Workflow
1. Initialization
Check project state and load context:
1. Verify active project via project_list() or initialize with project_init()
2. Load relevant context: memory_get_context(project_id, task_description)
3. Check context usage: context_check()
- If > 70%: trigger context_compact(project_id)
Context check importance: Prevent mid-task context overflow by checking early and compacting if needed.
2. Task Planning
Decompose the task into subtasks with role assignments:
1. Call task_plan(project_id, description, use_context=true)
2. Review returned subtasks and role assignments
3. Validate plan makes sense for the task
4. Adjust if needed based on project specifics
Role assignment guidelines:
| Situation | Assign Role |
|---|---|
| New feature design | architect |
| Writing code | implementer |
| Creating tests | tester |
| Code review | reviewer |
| Bug fixing | debugger |
| Documentation | documenter |
3. Sequential Execution
Execute subtasks one at a time, loading appropriate skills:
For each subtask:
1. Get next subtask: task_execute(task_id, subtask_id)
2. Load role skill: .github/skills/{role}/SKILL.md
3. Execute with role-specific guidance
4. Record result: task_complete(task_id, subtask_id, result)
5. Store decisions: memory_store() for key information
Execution principles:
- Complete one subtask fully before starting next
- Load only the skill needed for current subtask
- Record all decisions and changes in memory
- Don't skip subtasks even if they seem simple
4. Post-Commit Verification
After implementation and git commit:
1. Sync git info: git_sync(project_id)
2. Run verification: task_verify(task_id, commit_hash)
3. If failed: load debugger skill and address issues
4. If passed: load documenter skill for final docs
5. Store verification results in memory
Verification phases:
- Intent Check - Does implementation meet original request?
- Docs Check - Is documentation current?
- Tests Check - Do all tests pass?
- Environment Check - Is application running correctly?
Context Management
Monitor context usage throughout task execution:
Before each major step:
usage = context_check()
if usage["should_compact"]:
context_compact(project_id)
When to compact:
- Usage > 70%
- Before starting new major subtask
- Before loading large reference files
What gets saved during compaction:
- Task decisions and rationale
- Code structure choices
- Pending work items
- Key implementation details
Memory Storage Strategy
Store information strategically during task execution:
Store immediately:
- Architectural decisions (why pattern X chosen)
- Technical trade-offs (why option A over B)
- Breaking changes or migrations
- Complex implementation details
- Security decisions
Store after completion:
- Task summary with all subtasks
- Final verification results
- Lessons learned
- Next steps or future work
Use appropriate types:
decision- Architectural or technical choicesimplementation- Code changes summarycontext- Background informationtask_result- Completed task outcomes
Role Skill Integration
When executing subtasks, reference the appropriate skill:
Architect skill (.github/skills/architect/SKILL.md):
- Trigger for: Design, pattern selection, structure planning
- Provides: Decision frameworks, architectural patterns
- Output: Implementation plan with rationale
Implementer skill (.github/skills/implementer/SKILL.md):
- Trigger for: Writing code, creating functions/components
- Provides: Coding principles (SOLID, DRY, YAGNI)
- Output: Working code following project standards
Tester skill (.github/skills/tester/SKILL.md):
- Trigger for: Test creation, validation, verification
- Provides: Test patterns, verification cycles
- Output: Passing tests with good coverage
Reviewer skill (.github/skills/reviewer/SKILL.md):
- Trigger for: Code review, quality checks
- Provides: Review checklists, quality standards
- Output: Approval or change requests
Debugger skill (.github/skills/debugger/SKILL.md):
- Trigger for: Errors, unexpected behavior, failures
- Provides: Debugging methodology, diagnostic tools
- Output: Root cause analysis and fixes
Documenter skill (.github/skills/documenter/SKILL.md):
- Trigger for: Documentation, comments, READMEs
- Provides: Documentation patterns, style guides
- Output: Clear, complete documentation
Example Task Flow
User Request: "Add user authentication with JWT tokens"
Initialization
project_list() → Current project: "web-app-xyz"
memory_get_context("web-app-xyz", "authentication JWT")
→ Returns: existing auth patterns, security decisions
context_check() → 45% used ✓
Planning
task_plan("web-app-xyz", "Add JWT authentication")
→ Subtasks:
1. [architect] Design auth flow and JWT structure
2. [architect] Choose JWT library and storage approach
3. [implementer] Create auth middleware
4. [implementer] Implement JWT generation/validation
5. [implementer] Add protected route examples
6. [tester] Create auth tests (unit + integration)
7. [reviewer] Review security and implementation
8. [documenter] Document auth setup and usage
Execution
Subtask 1: task_execute(task_id, "1")
→ Load architect skill
→ Design auth flow (login → JWT → protected routes)
→ Decision: JWT in httpOnly cookie vs header
→ Store decision in memory
→ task_complete(task_id, "1", result)
Subtask 2: task_execute(task_id, "2")
→ Load architect skill
→ Research libraries (jsonwebtoken vs jose)
→ Choose jsonwebtoken (better docs, maintained)
→ Store decision with rationale
→ task_complete(task_id, "2", result)
[Continue for subtasks 3-8...]
Verification
git_sync("web-app-xyz")
task_verify(task_id, "abc123")
→ Intent: ✓ JWT auth implemented as requested
→ Docs: ✓ Library up to date
→ Tests: ✓ 12/12 passing, 95% coverage
→ Environment: ✓ App running, auth working
Result: PASSED
Troubleshooting
Context overflow during execution:
- Compact context immediately:
context_compact(project_id) - Resume with most recent subtask
- Context summary preserved in memory
Subtask fails verification:
- Don't proceed to next subtask
- Load debugger skill
- Fix issues before continuing
- Re-verify before moving on
Lost track of progress:
- Check active task:
task_execute(task_id) - Review completed subtasks in memory
- Continue from last incomplete subtask
Project context missing:
- Initialize if needed:
project_init(name, path, git_repo) - Load context manually:
memory_search(project_id, query) - Build context from git history:
git_get_changes(project_id)
Advanced Usage
Multi-Project Orchestration
Switch between projects during task execution:
project_switch("project-a")
# Execute subtasks for project A
project_switch("project-b")
# Execute related subtasks for project B
Parallel Planning
Plan multiple related tasks:
task1 = task_plan("proj", "Backend API")
task2 = task_plan("proj", "Frontend integration")
# Execute task1 subtasks, then task2
Recovery from Interruption
Resume after session restart:
context_summary(project_id)
→ Returns: Recent tasks, decisions, pending work
# Continue from last checkpoint
Additional Resources
Reference Files
For detailed workflows:
references/workflows.md- Complete workflow patterns for common scenariosreferences/mcp-tools.md- Full MCP tool reference with examples
Example Files
Working examples:
examples/task-decomposition.md- Real task decomposition examplesexamples/verification-report.md- Sample verification report format
Key Principles
- Always load context first - Understanding history prevents repeated work
- One role at a time - Load only the skill needed for current subtask
- Store decisions immediately - Don't wait until end of task
- Verify before moving on - Each subtask should be validated
- Monitor context usage - Compact proactively, not reactively
- Use appropriate roles - Don't use implementer for design work
- Complete verification cycle - Don't skip environment validation
Summary
This skill coordinates complex, multi-step tasks by:
- Loading relevant project context
- Decomposing tasks into role-specific subtasks
- Executing subtasks sequentially with appropriate skills
- Storing decisions and progress in memory
- Verifying implementation meets requirements
- Managing context to prevent overflow
Focus on systematic execution, appropriate role assignment, and continuous memory updates for effective task orchestration.