@lvlup-sw/exarchos 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/.claude-plugin/marketplace.json +22 -0
  2. package/.claude-plugin/plugin.json +17 -0
  3. package/.mcp.json +17 -0
  4. package/AGENTS.md +59 -0
  5. package/CLAUDE.md.template +62 -0
  6. package/LICENSE +202 -0
  7. package/README.md +258 -0
  8. package/commands/autocompact.md +37 -0
  9. package/commands/checkpoint.md +85 -0
  10. package/commands/cleanup.md +99 -0
  11. package/commands/debug.md +145 -0
  12. package/commands/delegate.md +56 -0
  13. package/commands/ideate.md +82 -0
  14. package/commands/plan.md +150 -0
  15. package/commands/refactor.md +139 -0
  16. package/commands/reload.md +37 -0
  17. package/commands/resume.md +130 -0
  18. package/commands/review.md +51 -0
  19. package/commands/sync-schemas.md +74 -0
  20. package/commands/synthesize.md +122 -0
  21. package/commands/tdd.md +58 -0
  22. package/dist/exarchos-cli.js +8828 -0
  23. package/dist/exarchos-mcp.js +50 -0
  24. package/hooks/hooks.json +53 -0
  25. package/package.json +59 -0
  26. package/rules/coding-standards.md +46 -0
  27. package/rules/mcp-tool-guidance.md +26 -0
  28. package/rules/pr-descriptions.md +12 -0
  29. package/rules/rm-safety.md +9 -0
  30. package/rules/skill-path-resolution.md +10 -0
  31. package/rules/tdd.md +41 -0
  32. package/rules/telemetry-awareness.md +9 -0
  33. package/scripts/assess-refactor-scope.sh +239 -0
  34. package/scripts/check-benchmark-regression.sh +229 -0
  35. package/scripts/check-coderabbit.sh +288 -0
  36. package/scripts/check-coverage-thresholds.sh +194 -0
  37. package/scripts/check-polish-scope.sh +245 -0
  38. package/scripts/check-property-tests.sh +167 -0
  39. package/scripts/check-tdd-compliance.sh +265 -0
  40. package/scripts/coderabbit-review-gate.sh +518 -0
  41. package/scripts/debug-review-gate.sh +201 -0
  42. package/scripts/extract-fix-tasks.sh +179 -0
  43. package/scripts/extract-task.sh +67 -0
  44. package/scripts/generate-traceability.sh +209 -0
  45. package/scripts/investigation-timer.sh +171 -0
  46. package/scripts/needs-schema-sync.sh +174 -0
  47. package/scripts/new-project.sh +103 -0
  48. package/scripts/post-delegation-check.sh +317 -0
  49. package/scripts/pre-synthesis-check.sh +440 -0
  50. package/scripts/reconcile-state.sh +346 -0
  51. package/scripts/reconstruct-stack.sh +432 -0
  52. package/scripts/review-diff.sh +63 -0
  53. package/scripts/review-verdict.sh +169 -0
  54. package/scripts/security-scan.sh +248 -0
  55. package/scripts/select-debug-track.sh +186 -0
  56. package/scripts/setup-worktree.sh +323 -0
  57. package/scripts/spec-coverage-check.sh +230 -0
  58. package/scripts/static-analysis-gate.sh +236 -0
  59. package/scripts/sync-labels.sh +122 -0
  60. package/scripts/validate-companion.sh +161 -0
  61. package/scripts/validate-dotnet-standards.sh +267 -0
  62. package/scripts/validate-installation.sh +101 -0
  63. package/scripts/validate-plugin.sh +223 -0
  64. package/scripts/validate-refactor.sh +234 -0
  65. package/scripts/validate-rm.sh +93 -0
  66. package/scripts/verify-delegation-saga.sh +240 -0
  67. package/scripts/verify-doc-links.sh +211 -0
  68. package/scripts/verify-ideate-artifacts.sh +296 -0
  69. package/scripts/verify-plan-coverage.sh +228 -0
  70. package/scripts/verify-review-triage.sh +219 -0
  71. package/scripts/verify-worktree-baseline.sh +159 -0
  72. package/scripts/verify-worktree.sh +84 -0
  73. package/settings.json +47 -0
  74. package/skills/brainstorming/SKILL.md +127 -0
  75. package/skills/brainstorming/references/design-template.md +65 -0
  76. package/skills/cleanup/SKILL.md +147 -0
  77. package/skills/cleanup/references/merge-verification.md +40 -0
  78. package/skills/debug/SKILL.md +204 -0
  79. package/skills/debug/references/hotfix-track.md +134 -0
  80. package/skills/debug/references/investigation-checklist.md +217 -0
  81. package/skills/debug/references/rca-template.md +150 -0
  82. package/skills/debug/references/state-schema.md +294 -0
  83. package/skills/debug/references/thorough-track.md +194 -0
  84. package/skills/debug/references/triage-questions.md +155 -0
  85. package/skills/debug/references/troubleshooting.md +47 -0
  86. package/skills/delegation/SKILL.md +150 -0
  87. package/skills/delegation/references/adaptive-orchestration.md +31 -0
  88. package/skills/delegation/references/agent-teams-saga.md +248 -0
  89. package/skills/delegation/references/fix-mode.md +74 -0
  90. package/skills/delegation/references/fixer-prompt.md +162 -0
  91. package/skills/delegation/references/implementer-prompt.md +322 -0
  92. package/skills/delegation/references/parallel-strategy.md +124 -0
  93. package/skills/delegation/references/pbt-patterns.md +172 -0
  94. package/skills/delegation/references/pr-fixes-mode.md +154 -0
  95. package/skills/delegation/references/state-management.md +51 -0
  96. package/skills/delegation/references/testing-patterns.md +129 -0
  97. package/skills/delegation/references/troubleshooting.md +33 -0
  98. package/skills/delegation/references/workflow-steps.md +127 -0
  99. package/skills/delegation/references/worktree-enforcement.md +64 -0
  100. package/skills/dotnet-standards/SKILL.md +269 -0
  101. package/skills/dotnet-standards/references/csharp-standards.md +120 -0
  102. package/skills/dotnet-standards/templates/.editorconfig +366 -0
  103. package/skills/dotnet-standards/templates/Directory.Build.props +56 -0
  104. package/skills/dotnet-standards/templates/Directory.Packages.props +69 -0
  105. package/skills/dotnet-standards/templates/global.json +6 -0
  106. package/skills/dotnet-standards/templates/nuget.config +9 -0
  107. package/skills/dotnet-standards/templates/stylecop.json +37 -0
  108. package/skills/git-worktrees/SKILL.md +255 -0
  109. package/skills/implementation-planning/SKILL.md +233 -0
  110. package/skills/implementation-planning/references/plan-document-template.md +42 -0
  111. package/skills/implementation-planning/references/spec-tracing-guide.md +51 -0
  112. package/skills/implementation-planning/references/task-template.md +43 -0
  113. package/skills/implementation-planning/references/testing-strategy-guide.md +88 -0
  114. package/skills/quality-review/SKILL.md +278 -0
  115. package/skills/quality-review/references/code-quality-checklist.md +159 -0
  116. package/skills/quality-review/references/review-report-template.md +65 -0
  117. package/skills/quality-review/references/security-checklist.md +79 -0
  118. package/skills/quality-review/references/typescript-standards.md +24 -0
  119. package/skills/refactor/COMMAND.md +67 -0
  120. package/skills/refactor/SKILL.md +198 -0
  121. package/skills/refactor/phases/auto-chain.md +262 -0
  122. package/skills/refactor/phases/brief.md +176 -0
  123. package/skills/refactor/phases/explore.md +132 -0
  124. package/skills/refactor/phases/overhaul-delegate.md +136 -0
  125. package/skills/refactor/phases/overhaul-plan.md +312 -0
  126. package/skills/refactor/phases/overhaul-review.md +304 -0
  127. package/skills/refactor/phases/polish-implement.md +349 -0
  128. package/skills/refactor/phases/polish-validate.md +218 -0
  129. package/skills/refactor/phases/update-docs.md +234 -0
  130. package/skills/refactor/references/brief-template.md +81 -0
  131. package/skills/refactor/references/doc-update-checklist.md +110 -0
  132. package/skills/refactor/references/explore-checklist.md +73 -0
  133. package/skills/refactor/references/overhaul-track.md +215 -0
  134. package/skills/refactor/references/polish-track.md +170 -0
  135. package/skills/shared/prompts/context-reading.md +58 -0
  136. package/skills/shared/prompts/report-format.md +54 -0
  137. package/skills/shared/prompts/tdd-requirements.md +39 -0
  138. package/skills/shepherd/SKILL.md +264 -0
  139. package/skills/shepherd/references/assess-checklist.md +124 -0
  140. package/skills/shepherd/references/fix-strategies.md +191 -0
  141. package/skills/spec-review/SKILL.md +229 -0
  142. package/skills/spec-review/references/review-checklist.md +60 -0
  143. package/skills/sync-schemas/SKILL.md +114 -0
  144. package/skills/sync-schemas/references/configuration.md +73 -0
  145. package/skills/synthesis/SKILL.md +129 -0
  146. package/skills/synthesis/references/pr-descriptions.md +87 -0
  147. package/skills/synthesis/references/synthesis-steps.md +109 -0
  148. package/skills/synthesis/references/troubleshooting.md +115 -0
  149. package/skills/validate-all-skills.sh +57 -0
  150. package/skills/validate-frontmatter.sh +237 -0
  151. package/skills/workflow-state/SKILL.md +210 -0
  152. package/skills/workflow-state/references/mcp-tool-reference.md +111 -0
  153. package/skills/workflow-state/references/phase-transitions.md +141 -0
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: workflow-state
3
+ description: "Checkpoint and resume workflow state for context persistence across sessions. Use when the user says 'save progress', 'checkpoint', 'I need to stop', or runs /checkpoint or /resume. Saves current workflow phase, task progress, and artifacts for later resumption. Do NOT use for workflow initialization (handled by ideate/debug/refactor commands)."
4
+ metadata:
5
+ author: exarchos
6
+ version: 1.0.0
7
+ mcp-server: exarchos
8
+ category: utility
9
+ phase-affinity:
10
+ - ideate
11
+ - plan
12
+ - delegate
13
+ - review
14
+ - synthesize
15
+ ---
16
+
17
+ # Workflow State Management Skill
18
+
19
+ ## Overview
20
+
21
+ Manage persistent workflow state that survives context auto-summarization.
22
+
23
+ State files store: task details, worktree locations, PR URLs, and review status.
24
+
25
+ ## Triggers
26
+
27
+ Activate this skill when:
28
+ - Starting a new workflow (`/exarchos:ideate`)
29
+ - Transitioning between workflow phases
30
+ - Restoring context after summarization (`/exarchos:resume`)
31
+ - Saving progress for later continuation (`/exarchos:checkpoint`)
32
+
33
+ ## Phase Transitions
34
+
35
+ Valid transitions, guards, and prerequisites for all workflow types are documented in `references/phase-transitions.md`. **CRITICAL:** When a transition has a guard, send the prerequisite `updates` and `phase` in a single `set` call — updates apply before guards evaluate.
36
+
37
+ ## State File Location
38
+
39
+ ```
40
+ ~/.claude/workflow-state/<feature-id>.state.json
41
+ ```
42
+
43
+ State files are gitignored - they persist locally but are not committed.
44
+
45
+ ## State Operations
46
+
47
+ For full MCP tool signatures, error handling, and anti-patterns, see `references/mcp-tool-reference.md`.
48
+
49
+ ### Initialize State
50
+
51
+ At the start of `/exarchos:ideate`, use `mcp__exarchos__exarchos_workflow` with `action: "init"` with:
52
+ - `featureId`: the workflow identifier (e.g., `"user-authentication"`)
53
+ - `workflowType`: one of `"feature"`, `"debug"`, `"refactor"`
54
+
55
+ This creates a new state file with phase "ideate".
56
+
57
+ ### Read State
58
+
59
+ Use `mcp__exarchos__exarchos_workflow` with `action: "get"` and `featureId`:
60
+
61
+ - **Full state**: Call with just `featureId`
62
+ - **Specific field**: Add `query` for dot-path lookup (e.g., `query: "phase"`, `query: "tasks"`)
63
+ - **Multiple fields**: Add `fields` array for projection (e.g., `fields: ["phase", "featureId", "tasks"]`)
64
+
65
+ Field projection via `fields` returns only the requested top-level keys, reducing token cost.
66
+
67
+ ### Update State
68
+
69
+ Use `mcp__exarchos__exarchos_workflow` with `action: "set"` with `featureId` and either `updates`, `phase`, or both:
70
+
71
+ - **Update phase**: `phase: "delegate"`
72
+ - **Set artifact path**: `updates: { "artifacts.design": "docs/designs/2026-01-05-feature.md" }`
73
+ - **Mark task complete**: `updates: { "tasks[id=001].status": "complete", "tasks[id=001].completedAt": "<timestamp>" }`
74
+ - **Add worktree**: `updates: { "worktrees.wt-001": { "branch": "feature/001-types", "taskId": "001", "status": "active" } }`
75
+ - **Phase + updates together**: `phase: "delegate"`, `updates: { "artifacts.plan": "docs/plans/plan.md" }`
76
+
77
+ Worktree status values: `'active' | 'merged' | 'removed'`
78
+
79
+ ### Get Summary
80
+
81
+ For context restoration after summarization, use `mcp__exarchos__exarchos_workflow` with `action: "get"` and `featureId`. This outputs a minimal summary suitable for rebuilding orchestrator context.
82
+
83
+ ### Reconcile State
84
+
85
+ To verify state matches git reality, the SessionStart hook automatically reconciles on resume. For manual verification, run the reconciliation script:
86
+
87
+ ```bash
88
+ scripts/reconcile-state.sh --state-file <state-file> --repo-root <repo-root>
89
+ ```
90
+
91
+ **On exit 0:** State is consistent.
92
+ **On exit 1:** Discrepancies found — review output and resolve.
93
+
94
+ ## Integration Points
95
+
96
+ ### When to Update State
97
+
98
+ | Event | State Update |
99
+ |-------|--------------|
100
+ | `/exarchos:ideate` starts | Create state file |
101
+ | Design saved | Set `artifacts.design`, phase = "plan" |
102
+ | Plan saved | Set `artifacts.plan`, populate tasks, phase = "plan-review" |
103
+ | Plan-review gaps found | Set `planReview.gaps`, auto-loop to plan |
104
+ | Plan-review approved | Set `planReview.approved = true`, phase = "delegate" |
105
+ | Task dispatched | Set task `status = "in_progress"`, `startedAt` |
106
+ | Task complete | Set task `status = "complete"`, `completedAt` |
107
+ | Worktree created | Add to `worktrees` object |
108
+ | Review complete | Update `reviews` object |
109
+ | PR created | Set `artifacts.pr`, `synthesis.prUrl` |
110
+ | PR feedback | Append to `synthesis.prFeedback` |
111
+
112
+ ### Automatic State Updates
113
+
114
+ Skills should update state at key moments:
115
+
116
+ **brainstorming/SKILL.md:**
117
+ ```markdown
118
+ After saving design:
119
+ 1. Update state: `.artifacts.design = "<path>"`
120
+ 2. Update state: `.phase = "plan"`
121
+ ```
122
+
123
+ **implementation-planning/SKILL.md:**
124
+ ```markdown
125
+ After saving plan:
126
+ 1. Update state: `.artifacts.plan = "<path>"`
127
+ 2. Populate `.tasks` from plan
128
+ 3. Update state: `.phase = "delegate"`
129
+ ```
130
+
131
+ **delegation/SKILL.md:**
132
+ ```markdown
133
+ On task dispatch:
134
+ - Update task status to "in_progress"
135
+ - Add worktree to state if created
136
+
137
+ On task complete:
138
+ - Update task status to "complete"
139
+ - Check if all tasks done, suggest checkpoint
140
+ ```
141
+
142
+ ## State Schema
143
+
144
+ See `docs/schemas/workflow-state.schema.json` for full schema.
145
+
146
+ Key sections:
147
+ - `version`: Schema version (currently "1.1")
148
+ - `featureId`: Unique workflow identifier
149
+ - `workflowType`: Required. One of "feature", "debug", or "refactor"
150
+ - `phase`: Current workflow phase
151
+ - `artifacts`: Paths to design, plan, PR
152
+ - `tasks`: Task list with status
153
+ - `worktrees`: Active git worktrees
154
+ - `planReview`: Plan-review delta analysis results (`gaps`, `approved`)
155
+ - `reviews`: Review results
156
+ - `synthesis`: Merge/PR state
157
+
158
+ ## Best Practices
159
+
160
+ 1. **Update often** - State should reflect reality at all times
161
+ 2. **Use MCP tools** - Prefer workflow-state MCP tools over manual JSON editing
162
+ 3. **Reconcile on resume** - Always verify state matches git state
163
+ 4. **Checkpoint at boundaries** - Save state before likely context exhaustion
164
+ 5. **Read state, don't remember** - After summarization, read from state file
165
+
166
+ ## Troubleshooting
167
+
168
+ ### MCP Tool Call Failed
169
+ If an Exarchos MCP tool returns an error:
170
+ 1. Check the error message — it usually contains specific guidance
171
+ 2. Verify the workflow state exists: call `mcp__exarchos__exarchos_workflow` with `action: "get"` and the featureId
172
+ 3. If "version mismatch": another process updated state — retry the operation
173
+ 4. If state is corrupted: call `mcp__exarchos__exarchos_workflow` with `action: "cancel"` and `dryRun: true`
174
+
175
+ ### State Desync
176
+ If workflow state doesn't match git reality:
177
+ 1. The SessionStart hook runs reconciliation automatically on resume
178
+ 2. If manual check needed: compare state file with `git log` and branch state
179
+ 3. Update state via `mcp__exarchos__exarchos_workflow` with `action: "set"` to match git truth
180
+
181
+ ### Checkpoint File Missing
182
+ If the PreCompact hook can't find state to checkpoint:
183
+ 1. Verify a workflow is active: call `mcp__exarchos__exarchos_workflow` with `action: "get"` and the featureId
184
+ 2. If no active workflow: the hook will silently skip (expected behavior)
185
+ 3. If workflow exists but checkpoint fails: check disk space and permissions
186
+
187
+ ### Resume Finds Stale State
188
+ If state references branches or worktrees that no longer exist:
189
+ 1. The SessionStart hook handles reconciliation automatically
190
+ 2. It updates state to reflect current git reality
191
+ 3. Missing branches are flagged in the session-start output
192
+
193
+ ### Multiple Active Workflows
194
+ If multiple workflow state files exist:
195
+ 1. The system uses the most recently updated active (non-completed) workflow
196
+ 2. Use `mcp__exarchos__exarchos_workflow` with `action: "cancel"` and `dryRun: true` on stale workflows to preview cleanup
197
+ 3. Cancel stale workflows before starting new ones
198
+
199
+ ## Example Workflow
200
+
201
+ 1. **Start new workflow**: Use `mcp__exarchos__exarchos_workflow` with `action: "init"` with `featureId: "user-authentication"`, `workflowType: "feature"`
202
+
203
+ 2. **After design phase**: Use `mcp__exarchos__exarchos_workflow` with `action: "set"` with:
204
+ - `featureId: "user-authentication"`
205
+ - `phase: "plan"`
206
+ - `updates: { "artifacts.design": "docs/designs/2026-01-05-user-auth.md" }`
207
+
208
+ 3. **Check state**: Use `mcp__exarchos__exarchos_workflow` with `action: "get"` with `featureId: "user-authentication"`
209
+
210
+ 4. **Resume after context loss**: Use `mcp__exarchos__exarchos_workflow` with `action: "get"` with `featureId: "user-authentication"` to get context restoration output
@@ -0,0 +1,111 @@
1
+ # MCP Tool Reference
2
+
3
+ Detailed tool usage, methods, and anti-patterns for all installed MCP servers.
4
+
5
+ ## Exarchos (`mcp__exarchos__*`)
6
+
7
+ Unified MCP server for workflow orchestration, event sourcing, CQRS views, and task coordination. **Always use for workflow tracking.** Exposes 5 composite tools with action discriminators. Note: inter-agent messaging uses Claude Code's native Agent Teams, not Exarchos.
8
+
9
+ ### Composite Tools
10
+
11
+ | Tool | Actions | When to Use |
12
+ |------|---------|-------------|
13
+ | `mcp__exarchos__exarchos_workflow` | `init`, `get`, `set`, `cancel`, `cleanup` | Workflow CRUD: starting workflows, reading/updating state, cancelling abandoned workflows, resolving merged workflows |
14
+ | `mcp__exarchos__exarchos_event` | `append`, `query` | Event sourcing: recording workflow events, reading event history |
15
+ | `mcp__exarchos__exarchos_orchestrate` | `task_claim`, `task_complete`, `task_fail` | Task coordination and lifecycle |
16
+ | `mcp__exarchos__exarchos_view` | `pipeline`, `tasks`, `workflow_status`, `stack_status`, `stack_place` | CQRS materialized views for read-optimized queries |
17
+ | `mcp__exarchos__exarchos_sync` | `now` | Force sync of materialized views |
18
+
19
+ ### Workflow Tool Actions
20
+
21
+ | Action | When to Use |
22
+ |--------|-------------|
23
+ | `init` | Starting any `/exarchos:ideate`, `/exarchos:debug`, or `/exarchos:refactor` workflow |
24
+ | `get` | Restoring context, checking phase, reading task details. Use `query` for dot-path lookup (e.g., `query: "phase"`), or `fields` array for projection (e.g., `fields: ["phase", "tasks"]`) to reduce token cost |
25
+ | `set` | Updating phase (`phase: "delegate"`), recording artifacts, marking tasks complete. Use `updates` for field changes and `phase` for transitions |
26
+ | `cancel` | Cleaning up abandoned workflows. Supports `dryRun: true` to preview cleanup actions |
27
+ | `cleanup` | Resolve a merged workflow to completed. Verifies merge, backfills synthesis metadata, force-resolves reviews, transitions to completed. Requires `mergeVerified: true` — pass after verifying PRs are merged via GitHub API |
28
+
29
+ **Hooks (automatic, no tool call needed):**
30
+ - **SessionStart hook** — Discovers active workflows, restores context, determines next action, and verifies state on resume (replaces former `workflow_list`, `workflow_summary`, `workflow_next_action`, `workflow_reconcile` tools)
31
+ - **PreCompact hook** — Saves checkpoints before context exhaustion (replaces former `workflow_checkpoint` tool)
32
+ - Valid phase transitions are documented in `references/phase-transitions.md` (replaces former `workflow_transitions` tool). `INVALID_TRANSITION` errors include valid targets with guard descriptions.
33
+
34
+ ### Event Tool Actions
35
+
36
+ | Action | When to Use |
37
+ |--------|-------------|
38
+ | `append` | Recording workflow events (task.assigned, gate.executed, etc.). Use `expectedSequence` for optimistic concurrency |
39
+ | `query` | Reading event history. Use `filter` for type/time filtering, `limit`/`offset` for pagination |
40
+
41
+ ### Orchestrate Tool Actions
42
+
43
+ | Action | When to Use |
44
+ |--------|-------------|
45
+ | `task_claim` | Claim a task for execution. Returns `ALREADY_CLAIMED` if previously claimed — handle gracefully |
46
+ | `task_complete` | Mark a task complete with optional `result` (artifacts, duration) |
47
+ | `task_fail` | Mark a task failed with `error` message and optional `diagnostics` |
48
+
49
+ ### View Tool Actions
50
+
51
+ | Action | When to Use |
52
+ |--------|-------------|
53
+ | `pipeline` | Aggregated view of all workflows with stack positions. Use `limit`/`offset` for pagination |
54
+ | `tasks` | Task detail view with filtering and projection. Use `workflowId` to scope, `filter` for property matching, `fields` for projection (e.g., `fields: ["taskId", "status", "title"]`), `limit`/`offset` for pagination |
55
+ | `workflow_status` | Workflow phase, task counts, and metadata. Use `workflowId` to scope |
56
+ | `stack_status` | Get current stack positions from events. Use `streamId` to scope |
57
+ | `stack_place` | Record a stack position with `position`, `taskId`, `branch`, optional `prUrl` |
58
+
59
+ ## GitHub (`mcp__plugin_github_github__*`)
60
+ > Available with exarchos-dev-tools companion. Fallback: use `gh` CLI.
61
+
62
+ ## Serena (`mcp__plugin_serena_serena__*`)
63
+ > Available with exarchos-dev-tools companion. Fallback: use Grep/Read/Glob.
64
+
65
+ ## Context7 (`mcp__plugin_context7_context7__*`)
66
+ > Available with exarchos-dev-tools companion. Fallback: use WebSearch.
67
+
68
+ ## Graphite (`mcp__graphite__*`)
69
+
70
+ Stacked PR management and merge queue. **Use for all PR stacking and submission.**
71
+
72
+ | Tool | When to Use |
73
+ |------|-------------|
74
+ | `run_gt_cmd` | Execute any `gt` command: `create`, `submit`, `modify`, `restack`, `sync`, `checkout` |
75
+ | `learn_gt` | Learn Graphite stacking workflow and available commands |
76
+
77
+ ### Key commands via `run_gt_cmd`
78
+
79
+ | Instead of | Use |
80
+ |------------|-----|
81
+ | `git commit` + `git push` | `gt create -m "message"` then `gt submit --no-interactive --publish --merge-when-ready` |
82
+ | `gh pr create` | `gt submit --no-interactive --publish --merge-when-ready` (creates stacked PRs automatically) |
83
+ | Manual rebasing | `gt restack` (rebases all PRs in the stack) |
84
+ | `git checkout <branch>` | `gt checkout` (interactive branch selection) |
85
+
86
+ **Proactive use:** When the workflow involves stacked PRs or progressive merging (e.g., `/exarchos:delegate` with multiple tasks), use `mcp__graphite__run_gt_cmd` for stack management rather than raw git commands or `gh pr create`.
87
+
88
+ ## Microsoft Learn (`mcp__microsoft-learn__*`)
89
+ > Available with exarchos-dev-tools companion. Fallback: use WebSearch.
90
+
91
+ ## Workflow Transition Errors
92
+
93
+ ### INVALID_TRANSITION
94
+ No path exists from current phase to target. Check `validTargets` in the error — it lists reachable phases with guard descriptions. You may need to step through intermediate phases.
95
+
96
+ ### GUARD_FAILED
97
+ The transition exists but the guard condition is unmet. Send prerequisite `updates` and `phase` in a **single** `set` call — updates apply before guards evaluate. See `references/phase-transitions.md` for guard prerequisites.
98
+
99
+ ### CIRCUIT_OPEN
100
+ A compound state's fix cycle limit was reached. Escalate to user or cancel the workflow.
101
+
102
+ ## Anti-Patterns
103
+
104
+ | Don't | Do Instead |
105
+ |-------|------------|
106
+ | Use `gh pr create` or `create_pull_request` | Use Graphite `gt submit --no-interactive --publish --merge-when-ready` for ALL PR creation |
107
+ | Manually edit workflow state JSON | Use `mcp__exarchos__exarchos_workflow` with `action: "set"` |
108
+ | Use `git commit` or `git push` | Use `gt create` + `gt submit --no-interactive --publish --merge-when-ready` |
109
+ | Skip state reconciliation on resume | The SessionStart hook handles reconciliation automatically |
110
+
111
+ > See companion reference for additional tool anti-patterns (Serena, GitHub MCP, Context7).
@@ -0,0 +1,141 @@
1
+ # Phase Transitions Reference
2
+
3
+ All valid HSM phase transitions for each workflow type. Every transition listed here is the **only** way to move between phases — the HSM rejects unlisted transitions with `INVALID_TRANSITION`.
4
+
5
+ ## Combined Updates + Phase Pattern
6
+
7
+ **CRITICAL:** When a transition has a guard that requires prerequisite state, send `updates` and `phase` in a single `set` call. Updates are applied BEFORE guards evaluate:
8
+
9
+ ```
10
+ action: "set"
11
+ featureId: "my-feature"
12
+ phase: "delegate"
13
+ updates: { "planReview.approved": true }
14
+ ```
15
+
16
+ This satisfies the `planReviewComplete` guard in one call. Two separate calls (set data, then transition) also work but waste a tool call.
17
+
18
+ ## Universal Transitions
19
+
20
+ Available from **any non-final** phase in all workflow types:
21
+
22
+ | To | Guard | How to Trigger |
23
+ |----|-------|----------------|
24
+ | `cancelled` | None | `exarchos_workflow cancel` (not `set`) — runs saga compensation |
25
+ | `completed` | `merge-verified` | `exarchos_workflow cleanup` with `mergeVerified: true` — for post-merge resolution |
26
+
27
+ ## Feature Workflow
28
+
29
+ ```
30
+ ideate → plan → plan-review → delegate ⇄ review → synthesize → completed
31
+
32
+ plan (gaps found)
33
+ ```
34
+
35
+ | From | To | Guard | Prerequisite |
36
+ |------|----|-------|-------------|
37
+ | `ideate` | `plan` | `design-artifact-exists` | Set `artifacts.design` |
38
+ | `plan` | `plan-review` | `plan-artifact-exists` | Set `artifacts.plan` |
39
+ | `plan-review` | `delegate` | `plan-review-complete` | Set `planReview.approved = true` |
40
+ | `plan-review` | `plan` | `plan-review-gaps-found` | Set `planReview.gapsFound = true` |
41
+ | `delegate` | `review` | `all-tasks-complete` | All `tasks[].status = "complete"` |
42
+ | `review` | `synthesize` | `all-reviews-passed` | All `reviews.{name}.status` in `["pass", "passed", "approved"]` |
43
+ | `review` | `delegate` | `any-review-failed` | Any `reviews.{name}.status` in `["fail", "failed", "needs_fixes"]` (fix cycle) |
44
+ | `synthesize` | `completed` | `pr-url-exists` | Set `synthesis.prUrl` or `artifacts.pr` |
45
+ | `blocked` | `delegate` | `human-unblocked` | Set `unblocked = true` |
46
+
47
+ **Compound state:** `implementation` contains `delegate` and `review`. Max 3 fix cycles before circuit breaker opens.
48
+
49
+ ## Debug Workflow
50
+
51
+ ```
52
+ triage → investigate → [hotfix-track | thorough-track] → synthesize → completed
53
+ ```
54
+
55
+ | From | To | Guard | Prerequisite |
56
+ |------|----|-------|-------------|
57
+ | `triage` | `investigate` | `triage-complete` | Set `triage.symptom` |
58
+ | `investigate` | `rca` | `thorough-track-selected` | Set `track = "thorough"` |
59
+ | `investigate` | `hotfix-implement` | `hotfix-track-selected` | Set `track = "hotfix"` |
60
+
61
+ ### Thorough Track
62
+
63
+ | From | To | Guard | Prerequisite |
64
+ |------|----|-------|-------------|
65
+ | `rca` | `design` | `rca-document-complete` | Set `artifacts.rca` |
66
+ | `design` | `debug-implement` | `fix-design-complete` | Set `artifacts.fixDesign` |
67
+ | `debug-implement` | `debug-validate` | `implementation-complete` | Always passes |
68
+ | `debug-validate` | `debug-review` | `validation-passed` | Set `validation.testsPass = true` |
69
+ | `debug-review` | `synthesize` | `review-passed` | All `reviews.{name}.status` passing |
70
+
71
+ **Compound state:** `thorough-track` contains `rca` through `debug-review`. Max 2 fix cycles.
72
+
73
+ ### Hotfix Track
74
+
75
+ | From | To | Guard | Prerequisite |
76
+ |------|----|-------|-------------|
77
+ | `hotfix-implement` | `hotfix-validate` | `implementation-complete` | Always passes |
78
+ | `hotfix-validate` | `completed` | `validation-passed` | Set `validation.testsPass = true` |
79
+
80
+ ### Shared
81
+
82
+ | From | To | Guard | Prerequisite |
83
+ |------|----|-------|-------------|
84
+ | `synthesize` | `completed` | `pr-url-exists` | Set `synthesis.prUrl` or `artifacts.pr` |
85
+
86
+ ## Refactor Workflow
87
+
88
+ ```
89
+ explore → brief → [polish-track | overhaul-track] → completed
90
+ ```
91
+
92
+ | From | To | Guard | Prerequisite |
93
+ |------|----|-------|-------------|
94
+ | `explore` | `brief` | `scope-assessment-complete` | Set `explore.scopeAssessment` |
95
+ | `brief` | `polish-implement` | `polish-track-selected` | Set `track = "polish"` |
96
+ | `brief` | `overhaul-plan` | `overhaul-track-selected` | Set `track = "overhaul"` |
97
+
98
+ ### Polish Track
99
+
100
+ | From | To | Guard | Prerequisite |
101
+ |------|----|-------|-------------|
102
+ | `polish-implement` | `polish-validate` | `implementation-complete` | Always passes |
103
+ | `polish-validate` | `polish-update-docs` | `goals-verified` | Set `validation.testsPass = true` |
104
+ | `polish-update-docs` | `completed` | `docs-updated` | Set `validation.docsUpdated = true` |
105
+
106
+ ### Overhaul Track
107
+
108
+ | From | To | Guard | Prerequisite |
109
+ |------|----|-------|-------------|
110
+ | `overhaul-plan` | `overhaul-delegate` | `plan-artifact-exists` | Set `artifacts.plan` |
111
+ | `overhaul-delegate` | `overhaul-review` | `all-tasks-complete` | All `tasks[].status = "complete"` |
112
+ | `overhaul-review` | `overhaul-update-docs` | `all-reviews-passed` | All `reviews.{name}.status` passing |
113
+ | `overhaul-review` | `overhaul-delegate` | `any-review-failed` | Any `reviews.{name}.status` failing (fix cycle) |
114
+ | `overhaul-update-docs` | `synthesize` | `docs-updated` | Set `validation.docsUpdated = true` |
115
+ | `synthesize` | `completed` | `pr-url-exists` | Set `synthesis.prUrl` or `artifacts.pr` |
116
+
117
+ **Compound state:** `overhaul-track` contains `overhaul-plan` through `overhaul-review`. Max 3 fix cycles.
118
+
119
+ ## Troubleshooting
120
+
121
+ ### INVALID_TRANSITION Error
122
+
123
+ The HSM rejected the transition because no path exists from the current phase to the target.
124
+
125
+ 1. Check `validTargets` in the error response — it lists all reachable phases with their guards
126
+ 2. You may need to step through intermediate phases (no phase skipping)
127
+
128
+ ### GUARD_FAILED Error
129
+
130
+ The transition exists but the guard condition is not met.
131
+
132
+ 1. Check `guardDescription` in the error response for what's required
133
+ 2. Set the prerequisite state via `updates` in the same `set` call as the `phase`
134
+ 3. Refer to the "Prerequisite" column in the tables above
135
+
136
+ ### CIRCUIT_OPEN Error
137
+
138
+ A compound state's fix cycle limit has been reached (e.g., review → delegate looped too many times).
139
+
140
+ 1. The workflow is stuck — escalate to the user
141
+ 2. Consider cancelling and restarting with a different approach