@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
package/settings.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Read",
5
+ "Write",
6
+ "Edit",
7
+ "Glob",
8
+ "Grep",
9
+ "NotebookEdit",
10
+ "Task",
11
+ "LSP",
12
+ "WebSearch",
13
+ "WebFetch",
14
+ "mcp__*",
15
+ "Bash(gt:*)",
16
+ "Bash(gh:*)",
17
+ "Bash(git:*)",
18
+ "Bash(npm:*)",
19
+ "Bash(npx:*)",
20
+ "Bash(yarn:*)",
21
+ "Bash(pnpm:*)",
22
+ "Bash(bun:*)",
23
+ "Bash(node:*)",
24
+ "Bash(docker:*)",
25
+ "Bash(docker-compose:*)",
26
+ "Bash(make:*)",
27
+ "Bash(ls:*)",
28
+ "Bash(cat:*)",
29
+ "Bash(find:*)",
30
+ "Bash(grep:*)",
31
+ "Bash(mkdir:*)",
32
+ "Bash(rm:*)",
33
+ "Bash(cp:*)",
34
+ "Bash(mv:*)",
35
+ "Bash(chmod:*)",
36
+ "Bash(ln:*)",
37
+ "Bash(echo:*)",
38
+ "Bash(pwd:*)",
39
+ "Bash(which:*)",
40
+ "Bash(env:*)",
41
+ "Bash(test:*)",
42
+ "Bash(diff:*)",
43
+ "Bash(jq:*)"
44
+ ]
45
+ },
46
+ "model": "claude-opus-4-6"
47
+ }
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: brainstorming
3
+ description: "Collaborative design exploration for new features and architecture decisions. Use when the user says \"let's brainstorm\", \"let's ideate\", \"explore options\", or runs /ideate. Presents 2-3 distinct approaches with trade-offs, then documents the chosen approach as a design document. Do NOT use for implementation planning or code review. Use when no design document exists yet for the target feature. Do NOT use if a design document already exists — use /plan instead."
4
+ metadata:
5
+ author: exarchos
6
+ version: 1.0.0
7
+ mcp-server: exarchos
8
+ category: workflow
9
+ phase-affinity: ideate
10
+ ---
11
+
12
+ # Brainstorming Skill
13
+
14
+ ## Overview
15
+
16
+ Collaborative design exploration for new features, architecture decisions, and complex problem-solving.
17
+
18
+ ## Triggers
19
+
20
+ Activate this skill when:
21
+ - User says "let's brainstorm", "let's ideate", or "let's explore"
22
+ - User runs `/ideate` command
23
+ - User wants to discuss design options before implementation
24
+ - A problem has multiple valid solutions needing evaluation
25
+
26
+ ## Three-Phase Process
27
+
28
+ ### Phase 1: Understanding
29
+
30
+ **Goal:** Deeply understand the problem before proposing solutions.
31
+
32
+ **Rules:**
33
+ - Ask ONE question at a time
34
+ - Wait for response before asking next question
35
+ - Focus on: goals, constraints, existing patterns, user preferences
36
+ - Maximum 5 questions before moving to exploration
37
+
38
+ **Question Types:**
39
+ 1. "What problem are we solving?" (core need)
40
+ 2. "What constraints exist?" (time, tech, compatibility)
41
+ 3. "What patterns already exist in the codebase?" (consistency)
42
+ 4. "Who/what will consume this?" (users, APIs, other systems)
43
+ 5. "What does success look like?" (acceptance criteria)
44
+
45
+ ### Phase 2: Exploration
46
+
47
+ **Goal:** Present 2-3 distinct approaches with trade-offs.
48
+
49
+ Use the approach format from `references/design-template.md`. Present genuinely different approaches with honest trade-offs. Recommend one option with rationale.
50
+
51
+ ### Phase 3: Design Presentation
52
+
53
+ **Goal:** Document the chosen approach in detail.
54
+
55
+ Document the chosen approach using the structure in `references/design-template.md`. Sections of 200-300 words max. Use diagrams for complex flows.
56
+
57
+ **Save Location:** `docs/designs/YYYY-MM-DD-<feature>.md`
58
+
59
+ ## Anti-Patterns
60
+
61
+ | Don't | Do Instead |
62
+ |-------|------------|
63
+ | Jump to solution immediately | Ask clarifying questions first |
64
+ | Present only one option | Always show 2-3 alternatives |
65
+ | Hide drawbacks of preferred option | Be transparent about trade-offs |
66
+ | Write walls of text | Use 200-300 word sections max |
67
+ | Ignore existing patterns | Reference codebase conventions |
68
+ | Skip documentation | Save design to docs/designs/ |
69
+
70
+ ## State Management
71
+
72
+ This skill manages workflow state for context persistence.
73
+
74
+ ### On Start (before Phase 1)
75
+
76
+ Initialize workflow state using `mcp__exarchos__exarchos_workflow` with `action: "init"` and the featureId.
77
+
78
+ This creates a state file tracked by the MCP server.
79
+
80
+ ### On Design Save (after Phase 3)
81
+
82
+ ```
83
+ action: "set", featureId: "<id>", updates: { "artifacts": { "design": "<path>" } }, phase: "plan"
84
+ ```
85
+
86
+ ## Completion Verification
87
+
88
+ Run the ideation artifact verification:
89
+
90
+ ```bash
91
+ scripts/verify-ideate-artifacts.sh --state-file <state-file> --docs-dir docs/designs
92
+ ```
93
+
94
+ **On exit 0:** All completion criteria met — proceed to /exarchos:plan.
95
+ **On exit 1:** Missing artifacts — review output and complete before continuing.
96
+
97
+ ## Transition
98
+
99
+ After brainstorming completes, **auto-continue to planning** (no user confirmation):
100
+
101
+ ### Pre-Chain Validation (MANDATORY)
102
+
103
+ Before invoking `/exarchos:plan`:
104
+ 1. Verify `artifacts.design` exists in workflow state
105
+ 2. Verify the design file exists on disk: `test -f "$DESIGN_PATH"`
106
+ 3. If either fails: "Design artifact not found, cannot auto-chain to /exarchos:plan"
107
+
108
+ ### Chain Steps
109
+
110
+ 1. Update state: `action: "set", featureId: "<id>", updates: { "artifacts": { "design": "<path>" } }, phase: "plan"`
111
+
112
+ 2. Output: "Design saved. Auto-continuing to implementation planning..."
113
+
114
+ 3. Invoke immediately:
115
+ ```typescript
116
+ Skill({ skill: "exarchos:plan", args: "<design-path>" })
117
+ ```
118
+
119
+ This is NOT a human checkpoint. The human checkpoint occurs at plan-review (plan approval) and synthesize (merge confirmation).
120
+
121
+ **Workflow continues:** `/exarchos:ideate` -> `/exarchos:plan` -> plan-review -> [HUMAN CHECKPOINT] -> `/exarchos:delegate` -> `/exarchos:review` -> `/exarchos:synthesize` -> [HUMAN CHECKPOINT]
122
+
123
+ ## Exarchos Integration
124
+
125
+ When Exarchos MCP tools are available:
126
+
127
+ 1. **At workflow start:** Auto-emitted by `exarchos_workflow` `action: "init"` — do NOT manually append `workflow.started`
@@ -0,0 +1,65 @@
1
+ # Design Document Template
2
+
3
+ Save to: `docs/designs/YYYY-MM-DD-<feature>.md`
4
+
5
+ ## Approach Format (Phase 2)
6
+
7
+ Present 2-3 approaches using this format:
8
+
9
+ ```markdown
10
+ ### Option [N]: [Name]
11
+
12
+ **Approach:** [2-3 sentence description]
13
+
14
+ **Pros:**
15
+ - [Benefit 1]
16
+ - [Benefit 2]
17
+
18
+ **Cons:**
19
+ - [Drawback 1]
20
+ - [Drawback 2]
21
+
22
+ **Best when:** [Scenario where this option excels]
23
+ ```
24
+
25
+ Rules:
26
+ - Present genuinely different approaches (not variations of same idea)
27
+ - Be honest about trade-offs
28
+ - Include at least one "simple but limited" option
29
+ - Include at least one "flexible but complex" option
30
+ - Recommend one option but explain why
31
+
32
+ ## Design Document Structure (Phase 3)
33
+
34
+ Write sections of 200-300 words maximum. Use diagrams (ASCII or Mermaid) for complex flows. Reference existing codebase patterns.
35
+
36
+ ```markdown
37
+ # Design: [Feature Name]
38
+
39
+ ## Problem Statement
40
+ [What we're solving and why]
41
+
42
+ ## Chosen Approach
43
+ [Selected option with rationale]
44
+
45
+ ## Technical Design
46
+ [Implementation details, data structures, APIs]
47
+
48
+ ## Integration Points
49
+ [How this connects to existing code]
50
+
51
+ ## Testing Strategy
52
+ [How we'll verify it works]
53
+
54
+ ## Open Questions
55
+ [Decisions deferred or needing input]
56
+ ```
57
+
58
+ ## Exploration Quality Gate
59
+
60
+ Stop Phase 2 when ALL are true:
61
+ - [ ] 2-3 approaches documented
62
+ - [ ] Each answers design questions from Phase 1
63
+ - [ ] Approaches differ in at least 2 of: {data structure, API design, complexity}
64
+ - [ ] Trade-offs are honest and specific
65
+ - [ ] One approach recommended with rationale
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: cleanup
3
+ description: "Post-merge workflow resolution. Verifies PR merge status, backfills synthesis metadata, force-resolves review statuses, transitions to completed, and cleans up worktrees/branches. Use when the user says 'cleanup', 'resolve workflow', 'mark as done', or runs /cleanup. Do NOT use before PRs are merged."
4
+ metadata:
5
+ author: exarchos
6
+ version: 1.0.0
7
+ mcp-server: exarchos
8
+ category: workflow
9
+ phase-affinity: cleanup
10
+ ---
11
+
12
+ # Cleanup Skill
13
+
14
+ ## Overview
15
+
16
+ Resolve merged workflows to `completed` state in a single operation. Replaces the manual multi-step process of navigating HSM guards after PR stacks merge.
17
+
18
+ ## Triggers
19
+
20
+ Activate this skill when:
21
+ - User runs `/cleanup` command
22
+ - User says "cleanup", "resolve workflow", "mark as done"
23
+ - PR stack has merged and workflow needs resolution
24
+ - User wants to close out a completed feature
25
+
26
+ ## Prerequisites
27
+
28
+ - Active workflow in any non-terminal phase
29
+ - All PRs merged on GitHub
30
+
31
+ ## Process
32
+
33
+ ### 1. Identify Target Workflow
34
+
35
+ Read workflow state to get current phase and metadata:
36
+ ```typescript
37
+ mcp__exarchos__exarchos_workflow({ action: "get", featureId: "<id>" })
38
+ ```
39
+
40
+ If featureId not provided, use pipeline view to list active workflows:
41
+ ```typescript
42
+ mcp__exarchos__exarchos_view({ action: "pipeline" })
43
+ ```
44
+
45
+ ### 2. Verify Merge Status
46
+
47
+ For each PR associated with the workflow, verify it is merged.
48
+
49
+ **Primary method** — gh CLI:
50
+ ```bash
51
+ gh pr view <number> --json state,mergedAt,headRefName
52
+ ```
53
+
54
+ > Or use GitHub MCP `pull_request_read` if available.
55
+
56
+ Collect from merged PRs:
57
+ - `prUrl`: The PR URL (or array of URLs for stacked PRs)
58
+ - `mergedBranches`: The head branch names that were merged
59
+
60
+ **Safety check:** If ANY PR is not merged, abort with clear error message.
61
+
62
+ For detailed verification guidance, see `references/merge-verification.md`.
63
+
64
+ ### 3. Invoke Cleanup Action
65
+
66
+ Call the MCP cleanup action with collected data:
67
+ ```typescript
68
+ mcp__exarchos__exarchos_workflow({
69
+ action: "cleanup",
70
+ featureId: "<id>",
71
+ mergeVerified: true,
72
+ prUrl: "<url-or-array>",
73
+ mergedBranches: ["branch1", "branch2"]
74
+ })
75
+ ```
76
+
77
+ This single call:
78
+ - Backfills `synthesis.prUrl` and `synthesis.mergedBranches`
79
+ - Force-resolves all blocking review statuses to `approved`
80
+ - Transitions to `completed` via universal cleanup path
81
+ - Emits `workflow.cleanup` event to event store
82
+
83
+ ### 4. Worktree Cleanup
84
+
85
+ Remove all worktrees associated with the workflow:
86
+ ```bash
87
+ # Read worktrees from state (already captured in step 1)
88
+ git worktree remove .worktrees/<name>
89
+ git worktree prune
90
+ ```
91
+
92
+ Handle gracefully if worktrees are already removed.
93
+
94
+ ### 5. Branch Sync
95
+
96
+ Remove merged local branches:
97
+ ```bash
98
+ gt sync --force
99
+ ```
100
+
101
+ ### 6. Report Completion
102
+
103
+ Output summary:
104
+ ```markdown
105
+ ## Cleanup Complete
106
+
107
+ **Feature:** <featureId>
108
+ **Transition:** <previousPhase> → completed
109
+ **PRs merged:** <count>
110
+ **Worktrees removed:** <count>
111
+ **Branches synced:** ✓
112
+ ```
113
+
114
+ ## Dry Run
115
+
116
+ Use `dryRun: true` to preview what cleanup would do without modifying state:
117
+ ```typescript
118
+ mcp__exarchos__exarchos_workflow({
119
+ action: "cleanup",
120
+ featureId: "<id>",
121
+ mergeVerified: true,
122
+ dryRun: true
123
+ })
124
+ ```
125
+
126
+ ## Error Handling
127
+
128
+ | Error | Cause | Resolution |
129
+ |-------|-------|------------|
130
+ | STATE_NOT_FOUND | Invalid featureId | Check pipeline view for active workflows |
131
+ | ALREADY_COMPLETED | Workflow already done | No action needed |
132
+ | INVALID_TRANSITION | Workflow is cancelled | Cannot cleanup cancelled workflows |
133
+ | GUARD_FAILED | mergeVerified is false | Verify PRs are merged before cleanup |
134
+
135
+ ## Anti-Patterns
136
+
137
+ | Don't | Do Instead |
138
+ |-------|------------|
139
+ | Use cleanup as escape hatch during implementation | Only use after PRs are merged |
140
+ | Skip merge verification | Always verify via GitHub API |
141
+ | Manually navigate HSM guards post-merge | Use /exarchos:cleanup |
142
+ | Leave worktrees after cleanup | Include worktree removal in process |
143
+
144
+ ## Exarchos Integration
145
+
146
+ The cleanup action auto-emits events — do NOT manually emit:
147
+ - `workflow.cleanup` — emitted by the MCP cleanup action for the phase change to completed
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: merge-verification
3
+ ---
4
+
5
+ # Merge Verification Guide
6
+
7
+ ## Why Verify?
8
+
9
+ The cleanup action trusts the `mergeVerified` flag — it does not query GitHub itself. The orchestrator (skill) is responsible for verification. This separation keeps the MCP server free of GitHub API dependencies.
10
+
11
+ ## Verification Methods
12
+
13
+ ### gh CLI (Primary)
14
+
15
+ ```bash
16
+ gh pr view 123 --json state,mergedAt,headRefName
17
+ # Check: .state == "MERGED" and .mergedAt is not null
18
+ ```
19
+
20
+ > Or use GitHub MCP `pull_request_read` if available for structured data.
21
+
22
+ ### For Stacked PRs
23
+
24
+ When verifying a Graphite stack, check ALL PRs in the stack:
25
+
26
+ ```bash
27
+ # List PRs for the branch stack
28
+ gh pr list --head "feature/*" --json number,state,headRefName
29
+ ```
30
+
31
+ Collect from each merged PR:
32
+ - `number` — for logging
33
+ - `headRefName` — for `mergedBranches` array
34
+ - PR URL — for `prUrl` (use array if multiple)
35
+
36
+ ## Edge Cases
37
+
38
+ - **Partially merged stack:** If some PRs are merged and others are not, abort cleanup. All PRs must be merged.
39
+ - **Squash-merged PRs:** The branch name may differ from what's in the worktree. Use the PR's `headRefName` field.
40
+ - **Already-deleted branches:** GitHub may have auto-deleted branches after merge. This is fine — `gt sync` will handle it.
@@ -0,0 +1,204 @@
1
+ ---
2
+ name: debug
3
+ description: "Bug investigation and fix workflow with hotfix and thorough tracks. Use when the user says 'debug', 'fix bug', 'investigate issue', 'something is broken', 'debug this issue', or runs /debug. Hotfix track for quick fixes, thorough track for complex bugs requiring root cause analysis. Do NOT use for feature development or planned refactoring. Do NOT escalate to /ideate unless the fix requires architectural redesign — implementation complexity alone is not sufficient reason to escalate."
4
+ metadata:
5
+ author: exarchos
6
+ version: 1.0.0
7
+ mcp-server: exarchos
8
+ category: workflow
9
+ phase-affinity:
10
+ - triage
11
+ - investigate
12
+ - rca
13
+ - design
14
+ - implement
15
+ - validate
16
+ - review
17
+ - synthesize
18
+ ---
19
+
20
+ # Debug Workflow Skill
21
+
22
+ ## Overview
23
+
24
+ Investigation-first workflow for debugging and regression fixes. Provides two tracks based on urgency: hotfix (fast, minimal ceremony) and thorough (rigorous, full RCA documentation).
25
+
26
+ ## Triggers
27
+
28
+ Activate this skill when:
29
+ - User runs `/debug` command
30
+ - User reports a bug or regression
31
+ - User needs to investigate an error
32
+ - User says "fix this bug" or similar
33
+
34
+ **Disambiguation:** If the user says "fix" or "clean up" — use `/debug` when something is *broken* (error, crash, wrong behavior). Use `/refactor` when the code *works* but needs structural improvement.
35
+
36
+ ## Workflow Overview
37
+
38
+ ```
39
+ /exarchos:debug
40
+
41
+ ┌────┴────┐
42
+ │ Triage │
43
+ └────┬────┘
44
+
45
+ ┌─────────────────┼─────────────────┐
46
+ │ │ │
47
+ --hotfix (default) --escalate
48
+ │ │ │
49
+ ▼ ▼ ▼
50
+ ┌────────────────┐ ┌─────────────┐ ┌──────────┐
51
+ │ Hotfix Track │ │ Thorough │ │ /exarchos:ideate │
52
+ │ │ │ Track │ │ handoff │
53
+ └────────────────┘ └─────────────┘ └──────────┘
54
+ ```
55
+
56
+ ## Command Interface
57
+
58
+ ### Start Debug Workflow
59
+
60
+ ```bash
61
+ # Default: thorough track
62
+ /debug "Description of the bug"
63
+
64
+ # Fast path: hotfix track
65
+ /debug --hotfix "Production is down - users can't login"
66
+
67
+ # Escalate to feature workflow
68
+ /debug --escalate "This needs architectural changes"
69
+ ```
70
+
71
+ ### Mid-Workflow Commands
72
+
73
+ These are user-facing commands (the orchestrator resolves them to namespaced form internally):
74
+
75
+ ```bash
76
+ # Switch from hotfix to thorough (during investigation)
77
+ /debug --switch-thorough
78
+
79
+ # Escalate to /ideate (manual handoff)
80
+ /debug --escalate "Reason for escalation"
81
+
82
+ # Resume after context compaction
83
+ /resume
84
+ ```
85
+
86
+ ## Track Comparison
87
+
88
+ | Aspect | Hotfix | Thorough |
89
+ |--------|--------|----------|
90
+ | Urgency | P0 (production down) | P1/P2 (normal priority) |
91
+ | Investigation | 15 min time-boxed | No time limit |
92
+ | RCA Document | No (minimal in state) | Yes (full docs/rca/) |
93
+ | Worktree | No (in-place fix) | Yes (isolated) |
94
+ | Review | Smoke test only | Spec review |
95
+ | Human Checkpoints | 1 (merge) | 1 (merge) |
96
+
97
+ ## Hotfix Track
98
+
99
+ Fix production issues ASAP. Speed over ceremony.
100
+
101
+ **Phases:** Triage (see `references/triage-questions.md`) -> Investigate (15 min max) -> Implement (no worktree) -> Validate -> Merge
102
+
103
+ ### Investigation Timer
104
+
105
+ 1. On hotfix track selection: record `investigation.startedAt` in state
106
+ 2. After each major finding: check elapsed time
107
+ 3. At 15 min mark: emit `investigation.timeout` event, pause for user confirmation
108
+ - Switch to thorough track? (yes/no)
109
+
110
+ For detailed phase instructions, see `references/hotfix-track.md`.
111
+
112
+ ## Thorough Track
113
+
114
+ Fix bugs with proper rigor. Full RCA documentation.
115
+
116
+ **Phases:** Triage -> Investigate -> RCA -> Design -> Implement (worktree + TDD) -> Review -> Synthesize -> Merge
117
+
118
+ For detailed phase instructions, see `references/thorough-track.md`. For systematic investigation methodology, see `references/investigation-checklist.md`.
119
+
120
+ ### Track Switching
121
+
122
+ - **Hotfix -> Thorough:** When investigation timer expires (15 min). All findings preserved.
123
+ - **Thorough -> Escalate:** When fix requires architectural changes. Hand off to `/exarchos:ideate`.
124
+
125
+ For detailed switching logic, see `references/thorough-track.md`.
126
+
127
+ ## Auto-Chain Behavior
128
+
129
+ Both tracks have ONE human checkpoint: merge confirmation.
130
+
131
+ **Hotfix auto-chain:**
132
+ ```
133
+ triage → investigate → implement → validate → [HUMAN: merge]
134
+ (auto) (auto) (auto)
135
+ ```
136
+
137
+ **Thorough auto-chain:**
138
+ ```
139
+ triage → investigate → rca → design → implement → review → synthesize → [HUMAN: merge]
140
+ (auto) (auto) (auto) (auto) (auto) (auto)
141
+ ```
142
+
143
+ ## State Management
144
+
145
+ Initialize debug workflow:
146
+ ```
147
+ action: "init", featureId: "debug-<issue-slug>", workflowType: "debug"
148
+ ```
149
+
150
+ See `@skills/debug/references/state-schema.md` for full schema.
151
+
152
+ ## Integration Points
153
+
154
+ ### With /resume
155
+
156
+ Debug workflows resume like feature workflows:
157
+ ```bash
158
+ /resume ~/.claude/workflow-state/debug-<issue-slug>.state.json
159
+ ```
160
+
161
+ ### With Existing Skills
162
+
163
+ - Uses spec-review skill for thorough track review phase
164
+ - Uses synthesis skill for PR creation
165
+ - Uses git-worktrees skill for thorough track implementation
166
+
167
+ ### With MCP Workflow State Tools
168
+
169
+ Extended to support:
170
+ - `workflowType: "debug"` field
171
+ - Debug-specific phases handled by the SessionStart hook (which determines next action on resume)
172
+ - Debug context provided by the SessionStart hook on session start
173
+
174
+ ## Completion Criteria
175
+
176
+ ### Hotfix Complete
177
+
178
+ - [ ] Root cause identified (even if briefly)
179
+ - [ ] Minimal fix applied
180
+ - [ ] Affected tests pass
181
+ - [ ] Follow-up RCA task created
182
+ - [ ] Changes merged
183
+
184
+ ### Thorough Complete
185
+
186
+ - [ ] Full RCA documented in docs/rca/ (use `references/rca-template.md`)
187
+ - [ ] Fix matches RCA findings
188
+ - [ ] TDD implementation with tests
189
+ - [ ] Spec review passed
190
+ - [ ] PR merged
191
+
192
+ ## Anti-Patterns
193
+
194
+ | Don't | Do Instead |
195
+ |-------|------------|
196
+ | Start coding before understanding bug | Investigate first, always |
197
+ | Skip RCA on thorough track | Document for future learning |
198
+ | Exceed 15 min on hotfix investigation | Switch to thorough track |
199
+ | Add features during bug fix | Scope creep - only fix the bug |
200
+ | Skip tests because "it's just a fix" | Fixes need tests to prevent regression |
201
+
202
+ ## Troubleshooting
203
+
204
+ See `references/troubleshooting.md` for MCP tool failures, state desync, investigation timeouts, and track switching issues.