@luanpdd/kit-mcp 1.21.0 → 1.22.0

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 (253) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +648 -648
  3. package/kit/COMANDOS.md +138 -138
  4. package/kit/README.md +76 -52
  5. package/kit/agents/advisor-researcher.md +106 -106
  6. package/kit/agents/assumptions-analyzer.md +107 -107
  7. package/kit/agents/auditor-consistencia-isolamento.md +380 -0
  8. package/kit/agents/codebase-mapper.md +768 -768
  9. package/kit/agents/crm-pipeline-implementer.md +17 -0
  10. package/kit/agents/debugger.md +772 -772
  11. package/kit/agents/detector-tenant-quente.md +337 -0
  12. package/kit/agents/example-reviewer.md +21 -21
  13. package/kit/agents/executor.md +523 -523
  14. package/kit/agents/integration-checker.md +200 -200
  15. package/kit/agents/multi-tenant-isolation-auditor.md +10 -0
  16. package/kit/agents/nyquist-auditor.md +178 -178
  17. package/kit/agents/phase-researcher.md +696 -696
  18. package/kit/agents/plan-checker.md +272 -272
  19. package/kit/agents/planner.md +891 -891
  20. package/kit/agents/project-researcher.md +652 -652
  21. package/kit/agents/research-synthesizer.md +245 -245
  22. package/kit/agents/roadmapper.md +677 -677
  23. package/kit/agents/supabase-architect.md +10 -0
  24. package/kit/agents/supabase-migration-writer.md +12 -0
  25. package/kit/agents/ui-auditor.md +437 -437
  26. package/kit/agents/ui-checker.md +302 -302
  27. package/kit/agents/ui-researcher.md +355 -355
  28. package/kit/agents/user-profiler.md +175 -175
  29. package/kit/agents/validador-evolucao-schema.md +335 -0
  30. package/kit/agents/verifier.md +728 -728
  31. package/kit/commands/adicionar-backlog.md +75 -75
  32. package/kit/commands/adicionar-fase.md +42 -42
  33. package/kit/commands/adicionar-tarefa.md +45 -45
  34. package/kit/commands/adicionar-testes.md +41 -41
  35. package/kit/commands/ajuda.md +21 -21
  36. package/kit/commands/atualizar.md +37 -37
  37. package/kit/commands/auditar-marco.md +179 -179
  38. package/kit/commands/auditar-uat.md +23 -23
  39. package/kit/commands/autonomo.md +40 -40
  40. package/kit/commands/branch-pr.md +24 -24
  41. package/kit/commands/concluir-marco.md +247 -247
  42. package/kit/commands/configuracoes.md +36 -36
  43. package/kit/commands/dados-distribuidos.md +188 -0
  44. package/kit/commands/definir-perfil.md +10 -10
  45. package/kit/commands/depurar.md +190 -190
  46. package/kit/commands/discutir-fase.md +131 -131
  47. package/kit/commands/entrar-discord.md +17 -17
  48. package/kit/commands/estatisticas.md +18 -18
  49. package/kit/commands/example-greeting.md +33 -33
  50. package/kit/commands/executar-fase.md +58 -58
  51. package/kit/commands/expresso.md +56 -56
  52. package/kit/commands/fase-ui.md +34 -34
  53. package/kit/commands/fazer.md +57 -57
  54. package/kit/commands/fio.md +125 -125
  55. package/kit/commands/fluxos-trabalho.md +64 -64
  56. package/kit/commands/forense.md +176 -176
  57. package/kit/commands/gerenciador.md +38 -38
  58. package/kit/commands/inserir-fase.md +31 -31
  59. package/kit/commands/limpeza.md +17 -17
  60. package/kit/commands/listar-hipoteses-fase.md +45 -45
  61. package/kit/commands/listar-workspaces.md +18 -18
  62. package/kit/commands/mapear-codebase.md +70 -70
  63. package/kit/commands/nota.md +33 -33
  64. package/kit/commands/novo-marco.md +43 -43
  65. package/kit/commands/novo-projeto.md +41 -41
  66. package/kit/commands/novo-workspace.md +43 -43
  67. package/kit/commands/pausar-trabalho.md +37 -37
  68. package/kit/commands/perfil-usuario.md +45 -45
  69. package/kit/commands/pesquisar-fase.md +195 -195
  70. package/kit/commands/planejar-fase.md +67 -67
  71. package/kit/commands/planejar-lacunas.md +33 -33
  72. package/kit/commands/plantar-ideia.md +25 -25
  73. package/kit/commands/progresso.md +24 -24
  74. package/kit/commands/proximo.md +30 -30
  75. package/kit/commands/publicar.md +490 -490
  76. package/kit/commands/rapido.md +35 -35
  77. package/kit/commands/reaplicar-patches.md +124 -124
  78. package/kit/commands/relatorio-sessao.md +19 -19
  79. package/kit/commands/remover-fase.md +31 -31
  80. package/kit/commands/remover-workspace.md +26 -26
  81. package/kit/commands/resumo-marco.md +50 -50
  82. package/kit/commands/retomar-trabalho.md +40 -40
  83. package/kit/commands/revisar-backlog.md +60 -60
  84. package/kit/commands/revisar-ui.md +32 -32
  85. package/kit/commands/revisar.md +37 -37
  86. package/kit/commands/saude.md +21 -21
  87. package/kit/commands/setup-notion.md +93 -93
  88. package/kit/commands/sync-main.md +68 -68
  89. package/kit/commands/validar-fase.md +35 -35
  90. package/kit/commands/verificar-tarefas.md +44 -44
  91. package/kit/commands/verificar-trabalho.md +64 -64
  92. package/kit/file-manifest.json +27 -15
  93. package/kit/framework/bin/lib/commands.cjs +959 -959
  94. package/kit/framework/bin/lib/config.cjs +442 -442
  95. package/kit/framework/bin/lib/core.cjs +1230 -1230
  96. package/kit/framework/bin/lib/frontmatter.cjs +336 -336
  97. package/kit/framework/bin/lib/init.cjs +1442 -1442
  98. package/kit/framework/bin/lib/milestone.cjs +252 -252
  99. package/kit/framework/bin/lib/model-profiles.cjs +68 -68
  100. package/kit/framework/bin/lib/phase.cjs +888 -888
  101. package/kit/framework/bin/lib/profile-output.cjs +952 -952
  102. package/kit/framework/bin/lib/profile-pipeline.cjs +539 -539
  103. package/kit/framework/bin/lib/roadmap.cjs +329 -329
  104. package/kit/framework/bin/lib/security.cjs +382 -382
  105. package/kit/framework/bin/lib/state.cjs +1031 -1031
  106. package/kit/framework/bin/lib/template.cjs +222 -222
  107. package/kit/framework/bin/lib/uat.cjs +282 -282
  108. package/kit/framework/bin/lib/verify.cjs +888 -888
  109. package/kit/framework/bin/lib/workstream.cjs +491 -491
  110. package/kit/framework/bin/tools.cjs +918 -918
  111. package/kit/framework/commands/workstreams.md +63 -63
  112. package/kit/framework/references/checkpoints.md +778 -778
  113. package/kit/framework/references/continuation-format.md +249 -249
  114. package/kit/framework/references/decimal-phase-calculation.md +64 -64
  115. package/kit/framework/references/git-integration.md +295 -295
  116. package/kit/framework/references/git-planning-commit.md +38 -38
  117. package/kit/framework/references/model-profile-resolution.md +36 -36
  118. package/kit/framework/references/model-profiles.md +139 -139
  119. package/kit/framework/references/phase-argument-parsing.md +61 -61
  120. package/kit/framework/references/planning-config.md +202 -202
  121. package/kit/framework/references/questioning.md +162 -162
  122. package/kit/framework/references/tdd.md +263 -263
  123. package/kit/framework/references/ui-brand.md +160 -160
  124. package/kit/framework/references/user-profiling.md +657 -657
  125. package/kit/framework/references/verification-patterns.md +612 -612
  126. package/kit/framework/references/workstream-flag.md +58 -58
  127. package/kit/framework/templates/DEBUG.md +164 -164
  128. package/kit/framework/templates/UAT.md +265 -265
  129. package/kit/framework/templates/UI-SPEC.md +100 -100
  130. package/kit/framework/templates/VALIDATION.md +76 -76
  131. package/kit/framework/templates/claude-md.md +122 -122
  132. package/kit/framework/templates/codebase/architecture.md +185 -185
  133. package/kit/framework/templates/codebase/concerns.md +205 -205
  134. package/kit/framework/templates/codebase/conventions.md +204 -204
  135. package/kit/framework/templates/codebase/integrations.md +192 -192
  136. package/kit/framework/templates/codebase/stack.md +158 -158
  137. package/kit/framework/templates/codebase/structure.md +199 -199
  138. package/kit/framework/templates/codebase/testing.md +301 -301
  139. package/kit/framework/templates/config.json +44 -44
  140. package/kit/framework/templates/context.md +352 -352
  141. package/kit/framework/templates/continue-here.md +78 -78
  142. package/kit/framework/templates/copilot-instructions.md +7 -7
  143. package/kit/framework/templates/debug-subagent-prompt.md +91 -91
  144. package/kit/framework/templates/dev-preferences.md +20 -20
  145. package/kit/framework/templates/discovery.md +146 -146
  146. package/kit/framework/templates/discussion-log.md +63 -63
  147. package/kit/framework/templates/milestone-archive.md +123 -123
  148. package/kit/framework/templates/milestone.md +115 -115
  149. package/kit/framework/templates/phase-prompt.md +610 -610
  150. package/kit/framework/templates/planner-subagent-prompt.md +117 -117
  151. package/kit/framework/templates/project.md +186 -186
  152. package/kit/framework/templates/requirements.md +231 -231
  153. package/kit/framework/templates/research-project/ARCHITECTURE.md +204 -204
  154. package/kit/framework/templates/research-project/FEATURES.md +147 -147
  155. package/kit/framework/templates/research-project/PITFALLS.md +200 -200
  156. package/kit/framework/templates/research-project/STACK.md +120 -120
  157. package/kit/framework/templates/research-project/SUMMARY.md +170 -170
  158. package/kit/framework/templates/research.md +419 -419
  159. package/kit/framework/templates/retrospective.md +54 -54
  160. package/kit/framework/templates/roadmap.md +202 -202
  161. package/kit/framework/templates/state.md +176 -176
  162. package/kit/framework/templates/summary-complex.md +59 -59
  163. package/kit/framework/templates/summary-minimal.md +41 -41
  164. package/kit/framework/templates/summary-standard.md +48 -48
  165. package/kit/framework/templates/summary.md +209 -209
  166. package/kit/framework/templates/user-profile.md +146 -146
  167. package/kit/framework/templates/user-setup.md +256 -256
  168. package/kit/framework/templates/verification-report.md +258 -258
  169. package/kit/framework/workflows/add-phase.md +112 -112
  170. package/kit/framework/workflows/add-tests.md +351 -351
  171. package/kit/framework/workflows/add-todo.md +158 -158
  172. package/kit/framework/workflows/audit-milestone.md +340 -340
  173. package/kit/framework/workflows/audit-uat.md +109 -109
  174. package/kit/framework/workflows/autonomous.md +891 -891
  175. package/kit/framework/workflows/check-todos.md +177 -177
  176. package/kit/framework/workflows/cleanup.md +152 -152
  177. package/kit/framework/workflows/complete-milestone.md +696 -696
  178. package/kit/framework/workflows/diagnose-issues.md +231 -231
  179. package/kit/framework/workflows/discovery-phase.md +289 -289
  180. package/kit/framework/workflows/discuss-phase-assumptions.md +653 -653
  181. package/kit/framework/workflows/discuss-phase.md +784 -784
  182. package/kit/framework/workflows/do.md +104 -104
  183. package/kit/framework/workflows/execute-phase.md +838 -838
  184. package/kit/framework/workflows/execute-plan.md +510 -510
  185. package/kit/framework/workflows/fast.md +102 -102
  186. package/kit/framework/workflows/forensics.md +265 -265
  187. package/kit/framework/workflows/health.md +181 -181
  188. package/kit/framework/workflows/help.md +619 -619
  189. package/kit/framework/workflows/insert-phase.md +130 -130
  190. package/kit/framework/workflows/list-phase-assumptions.md +178 -178
  191. package/kit/framework/workflows/list-workspaces.md +56 -56
  192. package/kit/framework/workflows/manager.md +362 -362
  193. package/kit/framework/workflows/map-codebase.md +377 -377
  194. package/kit/framework/workflows/milestone-summary.md +223 -223
  195. package/kit/framework/workflows/new-milestone.md +486 -486
  196. package/kit/framework/workflows/new-project.md +1159 -1159
  197. package/kit/framework/workflows/new-workspace.md +237 -237
  198. package/kit/framework/workflows/next.md +97 -97
  199. package/kit/framework/workflows/node-repair.md +92 -92
  200. package/kit/framework/workflows/note.md +156 -156
  201. package/kit/framework/workflows/pause-work.md +176 -176
  202. package/kit/framework/workflows/plan-milestone-gaps.md +273 -273
  203. package/kit/framework/workflows/plan-phase.md +765 -765
  204. package/kit/framework/workflows/plant-seed.md +169 -169
  205. package/kit/framework/workflows/pr-branch.md +129 -129
  206. package/kit/framework/workflows/profile-user.md +450 -450
  207. package/kit/framework/workflows/progress.md +507 -507
  208. package/kit/framework/workflows/quick.md +757 -757
  209. package/kit/framework/workflows/remove-phase.md +155 -155
  210. package/kit/framework/workflows/remove-workspace.md +90 -90
  211. package/kit/framework/workflows/research-phase.md +82 -82
  212. package/kit/framework/workflows/resume-project.md +326 -326
  213. package/kit/framework/workflows/review.md +228 -228
  214. package/kit/framework/workflows/session-report.md +146 -146
  215. package/kit/framework/workflows/settings.md +283 -283
  216. package/kit/framework/workflows/ship.md +228 -228
  217. package/kit/framework/workflows/stats.md +60 -60
  218. package/kit/framework/workflows/transition.md +671 -671
  219. package/kit/framework/workflows/ui-phase.md +302 -302
  220. package/kit/framework/workflows/ui-review.md +165 -165
  221. package/kit/framework/workflows/update.md +323 -323
  222. package/kit/framework/workflows/validate-phase.md +174 -174
  223. package/kit/framework/workflows/verify-phase.md +252 -252
  224. package/kit/framework/workflows/verify-work.md +637 -637
  225. package/kit/hooks/check-update.js +118 -118
  226. package/kit/hooks/context-monitor.js +163 -163
  227. package/kit/hooks/prompt-guard.js +103 -103
  228. package/kit/hooks/statusline.js +125 -125
  229. package/kit/hooks/workflow-guard.js +101 -101
  230. package/kit/settings.json +45 -45
  231. package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -0
  232. package/kit/skills/armadilhas-sistemas-distribuidos/SKILL.md +447 -0
  233. package/kit/skills/audit-log-multi-tenant/SKILL.md +6 -0
  234. package/kit/skills/cascading-failures/SKILL.md +4 -0
  235. package/kit/skills/consistencia-leitura-replica/SKILL.md +385 -0
  236. package/kit/skills/crm-lead-pipeline-patterns/SKILL.md +17 -0
  237. package/kit/skills/escolha-modelo-consistencia/SKILL.md +495 -0
  238. package/kit/skills/evolucao-schema-compativel/SKILL.md +448 -0
  239. package/kit/skills/example-skill/SKILL.md +42 -42
  240. package/kit/skills/multi-tenant-performance-scaling/SKILL.md +4 -0
  241. package/kit/skills/multi-tenant-rls-hierarchy/SKILL.md +4 -0
  242. package/kit/skills/postgres-isolamento-concorrencia/SKILL.md +552 -0
  243. package/kit/skills/streams-eventos-cdc/SKILL.md +712 -0
  244. package/kit/skills/supabase-cron-queues/SKILL.md +9 -0
  245. package/kit/skills/supabase-migrations/SKILL.md +10 -0
  246. package/kit/skills/super-admin-platform-pattern/SKILL.md +4 -0
  247. package/kit/skills/tenant-quente-mitigacao/SKILL.md +605 -0
  248. package/package.json +63 -63
  249. package/src/core/kit.js +216 -216
  250. package/src/core/reflect.js +247 -247
  251. package/src/core/reverse-sync.js +372 -372
  252. package/src/core/sync.js +418 -418
  253. package/src/core/watch.js +121 -121
package/README.md CHANGED
@@ -1,648 +1,648 @@
1
- # kit-mcp
2
-
3
- [![npm version](https://img.shields.io/npm/v/@luanpdd/kit-mcp.svg)](https://www.npmjs.com/package/@luanpdd/kit-mcp)
4
- [![npm downloads](https://img.shields.io/npm/dm/@luanpdd/kit-mcp.svg)](https://www.npmjs.com/package/@luanpdd/kit-mcp)
5
- [![CI](https://github.com/luanpdd/kit-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/luanpdd/kit-mcp/actions/workflows/ci.yml)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
-
8
- An opinionated **brownfield planning workflow** (in PT-BR) — agents, slash-commands, framework — shipped as an **MCP server**, with one-shot **sync** that projects the kit into every supported IDE's native layout — Claude Code, Cursor, Codex, Gemini CLI, Windsurf, Antigravity, Copilot, Trae.
9
-
10
- > **One canonical source. N IDEs. Edit once, everywhere updated.**
11
- >
12
- > Install and inherit the bundled workflow, or point `--kit-root` at your own folder to replace it entirely.
13
-
14
- ---
15
-
16
- ## Why this exists
17
-
18
- `.claude/agents/`, `.claude/commands/`, `.claude/skills/` are powerful but locked to Claude Code. The same definitions also need to live as `AGENTS.md` for Codex, `GEMINI.md` for Gemini, `.cursor/rules/` for Cursor, etc. Maintaining all of those by hand drifts immediately.
19
-
20
- **kit-mcp** keeps your canonical source in one place and projects it into every supported IDE through a single registry. It also exposes the kit through an MCP server so any agent that speaks MCP can browse, search, sync, run gates, and record replays.
21
-
22
- Inspired by [vinilana/dotcontext](https://github.com/vinilana/dotcontext) — see the design notes at the bottom for what's adapted, what's not, and why.
23
-
24
- ---
25
-
26
- <!-- AUTOGEN-COUNTS-START -->
27
- **Bundled workflow:** 57 agents · 88 commands · 60 skills · 23 gates
28
- <!-- AUTOGEN-COUNTS-END -->
29
-
30
- ## What ships in the box
31
-
32
- ```
33
- kit-mcp/
34
- ├── kit/ ← bundled brownfield workflow (PT-BR)
35
- │ ├── agents/ 47 agents (planner, executor, verifier, debugger,
36
- │ │ ui-auditor, codebase-mapper, …)
37
- │ ├── commands/ 87 slash-commands (/novo-marco, /planejar-fase,
38
- │ │ /executar-fase, /publicar, …)
39
- │ ├── framework/ workflows + templates + bin libs the agents use
40
- │ ├── hooks/ workflow guards, prompt guards, statusline
41
- │ ├── skills/example-skill/ single example skill (replace with your own)
42
- │ └── README.md file-format guide
43
-
44
- ├── gates/ ← reusable workflow gates (regression, confidence, dep-check, …)
45
-
46
- ├── src/
47
- │ ├── core/ pure runtime — registry, kit, sync, reverse-sync, gates,
48
- │ │ gate-runner, watch, failures, replays, reflect
49
- │ ├── mcp-server/ MCP server entry + install command
50
- │ └── cli/ CLI mirror of the MCP tools
51
-
52
- ├── bin/
53
- │ ├── mcp.js shim → starts the MCP stdio server
54
- │ └── cli.js shim → runs the CLI
55
-
56
- ├── LICENSE MIT
57
- ├── CHANGELOG.md
58
- ├── package.json
59
- └── README.md ← you are here
60
- ```
61
-
62
- **Lines of source code:** ~1300. **Runtime dependencies:** 5 (`@modelcontextprotocol/sdk`, `commander`, `chokidar`, `picocolors`, `@inquirer/prompts`). **Build step:** none — plain ESM Node.js 20+.
63
-
64
- ### About the bundled workflow
65
-
66
- The bundled `kit/` is an opinionated **brownfield planning workflow** in Portuguese — milestones, phases, requirements, planning, execution with atomic commits and checkpoints, retrospective auditing. Installing `@luanpdd/kit-mcp` and syncing into your IDE gives you all 87+ slash-commands, 47+ agents, plus the framework templates that they delegate into.
67
-
68
- If that's not what you want, point `--kit-root` at your own folder and ignore everything under `kit/` — the infrastructure (registry, sync, gates, forensics, MCP server) works the same regardless of what kit you load.
69
-
70
- ### Observability suite (v1.9)
71
-
72
- A complete observability layer derived from *Observability Engineering* (Charity Majors, Liz Fong-Jones, George Miranda — O'Reilly, 2022) ships in the kit. It integrates deeply with the Supabase suite (v1.8) — every Supabase agent now consults observability skills, and the new `incident-investigator` agent uses `mcp__supabase__get_logs` / `execute_sql` / `get_advisors` to apply the **Core Analysis Loop** on real incidents.
73
-
74
- **11 skills** in `kit/skills/`:
75
- - `_shared-observability/glossary.md` — canonical bilingual vocabulary (PT-BR↔EN)
76
- - `structured-events`, `distributed-tracing`, `opentelemetry-standard`, `core-analysis-loop` — foundationals
77
- - `observability-driven-development` — the 4 pre-PR questions ("Does it do what I expected? Compare to previous version? Are users using? Anomalies emerge?")
78
- - `event-based-slos`, `burn-rate-alerting` — SLO definition + predictive burn alerts
79
- - `telemetry-sampling`, `telemetry-pipelines`, `observability-maturity-model` — scale + culture
80
-
81
- **5 agents** in `kit/agents/`:
82
- - `observability-instrumenter` — generates OTel + canonical attribute patches
83
- - `incident-investigator` — Core Analysis Loop with persistent state in `.planning/investigations/`
84
- - `slo-engineer` — generates `SLO.md` + SQL migrations to materialize SLI events
85
- - `burn-rate-forecaster` — calculates burn rate, ETA exhaustion, alert config
86
- - `omm-auditor` — scores 5 OMM capabilities (resilience, code quality, complexity, release cadence, user behavior)
87
-
88
- **6 commands**:
89
- - `/observabilidade <subcommand>` — single orchestrator (analog to `/supabase`) — dispatches to the 5 agents above with PT/EN synonyms
90
- - `/instrumentar-fase` — generates `INSTRUMENTATION.md` per plan after `/planejar-fase`
91
- - `/investigar-producao` — guided Core Analysis Loop with persistent state
92
- - `/definir-slo` — creates SLO definition + SQL materialized view
93
- - `/burn-rate-status` — table `[SLO | budget burned | ETA | action]`, also runnable in `/loop`
94
- - `/auditar-observabilidade` — generates OMM-REPORT.md scored
95
-
96
- **Quick start example:**
97
- ```bash
98
- # Define an SLO for a critical journey
99
- /observabilidade slo "checkout"
100
-
101
- # Investigate a production incident with Core Analysis Loop
102
- /observabilidade investigar "checkout SLO burn rate = 8 às 14:32"
103
-
104
- # Score project against Observability Maturity Model
105
- /observabilidade omm
106
- ```
107
-
108
- ### SRE Engagement suite (v1.10)
109
-
110
- A production engineering layer derived from *Site Reliability Engineering: How Google Runs Production Systems* (Beyer, Jones, Petoff, Murphy — Google/O'Reilly, 2016) ships in the kit. It composes with the Supabase suite (v1.8) and the Observability suite (v1.9) into a coherent production engineering stack — Supabase agents now suggest PRR before launch, every Edge Function template includes the **4 golden signals**, and `incident-investigator` outputs feed directly into blameless postmortems via `/postmortem --from-investigation <id>`.
111
-
112
- **6 skills** in `kit/skills/`:
113
- - `_shared-sre/glossary.md` — canonical bilingual vocabulary (PT-BR↔EN) — SLI/SLO/SLA, error budget, burn rate, toil, postmortem, blameless, PRR, golden signals, risk continuum, MTTR/MTBF
114
- - `sre-risk-management` — risk continuum (cap 3), 99.99% wisdom ("as reliable as needs to be, no more"), error budget as explicit risk × innovation balance
115
- - `four-golden-signals` — Latency + Traffic + Errors + Saturation (cap 6), histograms with exponential bucketing, success vs error latency separated, percentiles vs mean (long tail)
116
- - `eliminating-toil` — canonical toil definition (manual + repetitive + automatable + tactical + no enduring value + scales linearly), ≤ 50% rule (cap 5), automation patterns
117
- - `blameless-postmortems` — canonical 9-section template (cap 15), "no postmortem left unreviewed", blame culture as anti-pattern, Wheel of Misfortune
118
- - `production-readiness-review` — PRR checklist (cap 32) — 6 axes (System architecture, Instrumentation, Emergency response, Capacity planning, Change management, Performance), 3 engagement models
119
-
120
- **4 agents** in `kit/agents/`:
121
- - `golden-signals-instrumenter` — specialization of `observability-instrumenter` (v1.9); generates OTel patches with the 4 golden signals (Latency=histogram, Traffic=counter, Errors=counter by `error.type`, Saturation=gauge)
122
- - `toil-auditor` — analyzes git log + shell scripts + manual commands in README/runbooks; produces `TOIL-AUDIT.md` with P0/P1/P2 priority + estimated effort
123
- - `postmortem-writer` — natural continuation of `incident-investigator` (v1.9); reads `.planning/investigations/<id>.md` and produces blameless postmortem (Summary, Impact, Root Causes, Trigger, Resolution, Detection, Action Items, Lessons Learned, Timeline UTC)
124
- - `prr-conductor` — conducts Production Readiness Review for service/feature; reads schema (Supabase MCP), Edge Functions, `.planning/slos/`, audit logs; produces `PRR-REPORT.md` scored across the 6 axes
125
-
126
- **6 commands**:
127
- - `/sre <subcommand>` — single orchestrator (analog to `/supabase` v1.8 and `/observabilidade` v1.9) — dispatches to the 4 agents with PT/EN synonyms
128
- - `/golden-signals` — invokes `golden-signals-instrumenter` for service/Edge Function/phase; generates `GOLDEN-SIGNALS.md` with OTel-ready instrumentation
129
- - `/auditar-toil` — invokes `toil-auditor`; generates `.planning/TOIL-AUDIT.md`
130
- - `/postmortem` — invokes `postmortem-writer`; supports `--from-investigation <id>` (continue from v1.9 investigation) or `--incident "<description>"` (standalone)
131
- - `/prr` — invokes `prr-conductor`; supports `--service <name>` or `--feature <description>`; generates `PRR-REPORT.md`
132
- - `/risk-budget` — displays current error budget vs risk continuum, citing SLOs from v1.9 (`.planning/slos/`); applies `sre-risk-management` skill
133
-
134
- **3 audit gates** in `gates/`:
135
- - `golden-signals-coverage` (blocking, pre-verify) — verifies code in `supabase/functions/**`, `src/**`, `lib/**` covers the 4 golden signals (skips gracefully on content-only phases)
136
- - `postmortem-template-required` (blocking, pre-conclude) — blocks `/concluir-marco` if any `.planning/investigations/<id>.md` lacks a corresponding `.planning/postmortems/<id>.md` (`Status: INCONCLUSIVE` is the only exception)
137
- - `prr-checklist-coverage` (blocking, pre-verify) — verifies every `PRR-REPORT.md` in `.planning/prr/**/*.md` covers the 6 canonical axes; "skipping an axe = invalid approval"
138
-
139
- **Lifecycle integration:**
140
- - `/forense` — after Core Analysis Loop closes with VALIDATED root cause, suggests chain `/postmortem --from-investigation <id>` (Phase 40 / INT-FW-V2-01)
141
- - `/concluir-marco` — opt-in gate `workflow.complete_milestone_prr_gate=true` requires `PRR-REPORT.md` with status `passed` for production-bound features before archive (Phase 40 / INT-FW-V2-02)
142
- - `/auditar-marco` — auto-invokes `/auditar-toil` when `workflow.audit_milestone_toil=true` (default); result feeds OMM Capacidade 3 scoring via `omm-auditor` (Phase 40 / INT-FW-V2-03)
143
-
144
- **Quick start example — end-to-end SRE workflow:**
145
- ```bash
146
- # Before launching a new feature in production — PRR
147
- /sre prr --feature "checkout v2"
148
-
149
- # While instrumenting service — apply 4 golden signals
150
- /sre golden-signals supabase/functions/orders/index.ts
151
-
152
- # Audit team toil quarterly
153
- /sre toil
154
-
155
- # When SLO burn alert fires — investigate (v1.9 deep loop), then postmortem (v1.10)
156
- /investigar-producao "checkout SLO burn rate = 8 às 14:32"
157
- /sre postmortem --from-investigation checkout-2026-05-07
158
- # Or for framework-level failures:
159
- /forense "framework workflow X falhou em produção"
160
- /sre postmortem --incident "framework workflow X failed (see .planning/forensics/report-*)"
161
-
162
- # Risk dashboard against SLO budgets
163
- /sre risk-budget
164
- ```
165
-
166
- ---
167
-
168
- ## Prerequisites
169
-
170
- - **Node.js ≥ 20** (uses native ESM, no transpiler)
171
- - An IDE / agent that speaks MCP if you want to use it that way (Claude Code, Cursor, Codex, Gemini CLI, …)
172
- - Optional: a project where you'll sync the kit (any folder)
173
-
174
- ---
175
-
176
- ## Quick start
177
-
178
- ### 1. Use the bundled workflow as-is (recommended)
179
-
180
- ```bash
181
- # Browse what's bundled
182
- npx -y @luanpdd/kit-mcp kit list-agents # 47 agents
183
- npx -y @luanpdd/kit-mcp kit list-commands # 87 commands
184
- npx -y @luanpdd/kit-mcp sync targets # supported IDEs
185
-
186
- # Install into your project for Claude Code
187
- npx -y @luanpdd/kit-mcp sync install claude-code --project-root .
188
- ```
189
-
190
- After that, open the project in Claude Code and the slash-commands (`/novo-marco`, `/planejar-fase`, `/executar-fase`, `/publicar`, …) and agents are immediately available.
191
-
192
- ### 2. Replace the bundled workflow with your own kit
193
-
194
- Point kit-mcp at your own `kit/` folder via `--kit-root` or the `KIT_MCP_KIT_ROOT` env var:
195
-
196
- ```bash
197
- # Option A: per-command flag
198
- npx -y @luanpdd/kit-mcp --kit-root ~/my-kit kit list-agents
199
- npx -y @luanpdd/kit-mcp --kit-root ~/my-kit sync install claude-code --project-root .
200
-
201
- # Option B: env var (sticky for the session)
202
- export KIT_MCP_KIT_ROOT=~/my-kit
203
- npx -y @luanpdd/kit-mcp sync install claude-code --project-root .
204
- ```
205
-
206
- Your `~/my-kit/` follows the same layout as the bundled kit:
207
-
208
- ```
209
- my-kit/
210
- ├── agents/<name>.md YAML frontmatter + Markdown body
211
- ├── commands/<name>.md YAML frontmatter + Markdown body
212
- └── skills/<name>/SKILL.md YAML frontmatter + Markdown body
213
- references/ optional reference docs
214
- ```
215
-
216
- See [`kit/README.md`](kit/README.md) for the file format.
217
-
218
- ### 3. Register kit-mcp into an IDE (so agents inside the IDE can call the MCP tools)
219
-
220
- ```bash
221
- # Portable — works on any machine, no clone needed
222
- npx -y @luanpdd/kit-mcp install write claude-code --scope user --via npx
223
- ```
224
-
225
- For other IDEs, swap `claude-code` for `cursor`, `codex`, `gemini-cli`, `windsurf`, `antigravity`, `copilot`, or `trae`. Run `kit sync targets` for the live capability matrix.
226
-
227
- ---
228
-
229
- ## CLI reference
230
-
231
- The CLI mirrors the MCP tools 1:1. **By default the CLI prints colored, human-readable tables and summary panels.** Add `--json` to restore raw JSON-to-stdout (machine-readable, the default in v1.0). The global `--kit-root` flag overrides the kit source for any subcommand.
232
-
233
- ```bash
234
- kit list-agents # human: colored table, name + description
235
- kit list-agents --json # machine: JSON array
236
-
237
- kit sync install claude-code # human: progress bar + summary panel
238
- kit sync install claude-code --json # machine: full result object
239
- ```
240
-
241
- In non-TTY mode (pipes, CI), animations degrade to linear status lines automatically. `NO_COLOR=1` disables colors entirely; `FORCE_COLOR=1` forces them on even in pipes.
242
-
243
- ### `kit kit ...` — browse the kit
244
-
245
- ```bash
246
- kit kit list-agents # 47 agents (bundled workflow)
247
- kit kit list-commands # 87 commands (bundled workflow)
248
- kit kit list-skills # 49 skills (bundled workflow)
249
- kit kit get agent planner
250
- kit kit search "milestone" # fuzzy match across all kinds
251
- ```
252
-
253
- ### `kit sync ...` — project into an IDE
254
-
255
- ```bash
256
- kit sync targets # list supported IDEs + capabilities
257
- kit sync status claude-code # see which capability paths exist in cwd
258
- kit sync install claude-code # write the kit into the cwd as Claude Code expects
259
- kit sync install cursor --mode copy # copy mode (no link to canonical)
260
- kit sync install codex --dry-run # preview without writing
261
- kit sync remove claude-code # remove only files generated by kit-mcp (uses STUB_MARKER)
262
- kit sync watch claude-code cursor # watch kit/ → resync to listed IDEs on every change
263
- kit sync watch --all # watch + auto-detect every IDE already present in cwd
264
- ```
265
-
266
- **Modes:**
267
- - `reference` (default) — writes a stub that links back to `kit/`. Edit canonical → all IDEs see the change.
268
- - `copy` — duplicates content. Use when shipping a frozen snapshot of the kit.
269
-
270
- **Per-IDE projection** — what each target receives:
271
-
272
- | IDE | rules → | agents → | commands → | skills → | framework → | hooks → |
273
- |---|---|---|---|---|---|---|
274
- | Claude Code | `CLAUDE.md` | `.claude/agents/*.md` | `.claude/commands/*.md` | `.claude/skills/*/` | `.claude/framework/**` | `.claude/hooks/**` |
275
- | Cursor | `.cursor/rules/*.mdc` | `.cursor/agents/*.md` | — | — | — | — |
276
- | Codex | `AGENTS.md` | — | — | `.codex/skills/*/` | — | — |
277
- | Gemini CLI | `GEMINI.md` | — | — | `.gemini/skills/*/` | — | — |
278
- | Copilot | `.github/copilot-instructions.md` | `.github/agents/*.agent` | — | `.github/skills/*/` | — | — |
279
- | Windsurf | `.windsurf/rules/*.md` | `.windsurf/agents/*.md` | — | `.windsurf/skills/*/` | — | — |
280
- | Antigravity | `.agents/rules/*.md` | `.agents/agents/*.md` | — | `.agents/workflows/*/` | — | — |
281
- | Trae | `.trae/rules/*.md` | `.trae/agents/*.md` | — | — | — | — |
282
-
283
- A capability marked `—` is not supported by that IDE. Adding a new IDE = one entry in [`src/core/registry.js`](src/core/registry.js).
284
-
285
- **About `framework` and `hooks`:** these are *mirror-tree* capabilities — the entire `kit/framework/` and `kit/hooks/` subtrees are copied verbatim into `.claude/framework/` and `.claude/hooks/`. They're needed by the bundled workflow because slash-commands like `/novo-marco` reference framework files via paths like `@./.claude/framework/workflows/new-milestone.md`. A `.kit-mcp-managed` marker is written at the root of each managed tree so `kit sync remove` can clean up safely without touching directories you authored yourself.
286
-
287
- ### `kit install ...` — register kit-mcp into an IDE's MCP config
288
-
289
- ```bash
290
- kit install targets # list IDEs that support MCP config
291
- kit install dry-run claude-code --scope user --via npx # preview the JSON/TOML
292
- kit install write claude-code --scope user --via npx # portable: uses `npx @luanpdd/kit-mcp`
293
- kit install write claude-code --scope project --via local # local clone: uses ./bin/mcp.js absolute path
294
- kit install write claude-code --scope user --via global # assumes `npm install -g @luanpdd/kit-mcp`
295
- kit install write # no target: opens an interactive selector (TTY)
296
- kit install write claude-code --yes # CI: skip the confirm prompt
297
- ```
298
-
299
- Since v1.1, `install write` always **previews** the JSON/TOML it's about to write and asks you to confirm. Pass `--yes` (CI mode) or `--json` to bypass the prompt. Without a target argument in TTY mode, you get an arrow-key selector listing all 8 IDEs.
300
-
301
- `--via` decides how the IDE will invoke the server:
302
-
303
- | Mode | Command in IDE config | When to use |
304
- |---|---|---|
305
- | `npx` (recommended) | `npx -y @luanpdd/kit-mcp` | Portable — works on any machine |
306
- | `local` | `node /abs/path/to/clone/bin/mcp.js` | You're hacking on kit-mcp itself |
307
- | `global` | `kit-mcp` | After `npm install -g @luanpdd/kit-mcp` — fastest startup |
308
-
309
- ### `kit reverse-sync ...` — bring IDE edits back to the canonical kit
310
-
311
- If you edited an agent/command/skill/framework/hook **directly inside the IDE's folder** (`.claude/agents/foo.md`, `.claude/framework/workflows/bar.md`, `.claude/hooks/baz.js`, …) instead of in your kit, this brings those edits back so the canonical absorbs them.
312
-
313
- ```bash
314
- kit reverse-sync detect claude-code --project-root .
315
- kit reverse-sync apply claude-code --project-root . --strategy merge --dry-run
316
- kit reverse-sync apply claude-code --project-root . --strategy merge
317
- kit reverse-sync apply claude-code --project-root . --strategy overwrite --only agent/foo
318
- kit reverse-sync apply claude-code --project-root . --strategy overwrite --only framework/workflows/new-milestone.md
319
- ```
320
-
321
- **Strategies:** `skip` (list-only), `merge` (canonical frontmatter + edited body — for agents/commands/skills), `overwrite`, `rename` (preserve both as `-from-{ide}.md`).
322
-
323
- **Mirror-tree caps (`framework`, `hooks`):** files have no frontmatter, so `merge` degenerates to `overwrite` (with a note). The `.kit-mcp-managed` marker is automatically excluded from candidates. Filter individual files with `--only framework/<rel>` or `--only hooks/<file>`.
324
-
325
- ### `kit gates ...` — reusable workflow gates
326
-
327
- ```bash
328
- kit gates list # all gates with stage + blocking flag
329
- kit gates get regression # full markdown of one gate
330
- kit gates for-stage pre-verify # gates that run before the verify step
331
- kit gates run secrets-scan --project-root . # interactive: shows the script, asks y/N, runs
332
- kit gates run secrets-scan --project-root . --yes # non-interactive (CI)
333
- kit gates run confidence --no-interactive # manual gates → verdict=manual when not interactive
334
- ```
335
-
336
- **Verdicts:** `passed` (exit 0), `block` (exit≠0 + blocking), `warn` (exit≠0 + non-blocking), `manual` (no shell), `skipped` (declined).
337
-
338
- Author runnable gates with a `bash` code-fence under `## Check`:
339
-
340
- ````markdown
341
- ---
342
- id: my-gate
343
- stage: pre-verify
344
- blocking: true
345
- description: ...
346
- ---
347
- ## Check
348
- ```bash
349
- test -f package.json && npm test
350
- ```
351
- ````
352
-
353
- ### `kit forensics ...` — failure dataset, replays & LLM-driven prompt evolution
354
-
355
- ```bash
356
- # Aggregate failures across debug/, verifications, forensics
357
- kit forensics collect --project-root .
358
- kit forensics summarize --project-root .
359
- kit forensics write-learnings --project-root .
360
-
361
- # LLM pass: read learnings + current agent, propose minimal prompt edits
362
- kit forensics reflect --agent <name> --project-root . --dry-run
363
- kit forensics reflect --agent <name> --project-root .
364
- kit forensics reflect --agent <name> --project-root . --apply
365
-
366
- # Replays
367
- kit forensics list-replays --project-root .
368
- kit forensics load-replay <id> --project-root .
369
- ```
370
-
371
- `reflect` requires `ANTHROPIC_API_KEY` (override model with `KIT_REFLECT_MODEL`, max tokens with `KIT_REFLECT_MAX_TOKENS`). Without the key, `--dry-run` saves the assembled prompt for manual paste.
372
-
373
- The proposal is always saved to `.planning/learnings/{agent}.proposal.md` first; the canonical is only modified after explicit confirmation (or `--apply`). MCP `forensics.reflect` never auto-applies.
374
-
375
- ### `kit ui ...` — live process viewer (sidecar) — _new in 1.2_
376
-
377
- A tiny localhost web app that streams what kit-mcp is doing while your IDE drives it. Strictly opt-in: ignore it and v1.1 behavior is unchanged.
378
-
379
- ```bash
380
- # In one terminal — keeps running until Ctrl+C
381
- kit ui start
382
-
383
- # In another terminal (or via Claude Code / Cursor) — runs as before, but events
384
- # are now also broadcast to the sidecar window
385
- kit sync install claude-code
386
-
387
- # Tools too: pass autoSpawn:true on the MCP side, or just `kit ui start` first
388
- kit ui status
389
- kit ui stop
390
- ```
391
-
392
- What you get:
393
-
394
- - A single browser tab at `http://127.0.0.1:7100` (or the next free port up to 7199)
395
- - Live event stream over Server-Sent Events — `tool_invocation`, `progress`, `error`, `milestone`, `run.start`, `run.end`
396
- - Filters by event type and substring; pause/resume; auto-scroll; dark mode tracks the OS
397
- - The sidecar shuts itself down after 30 minutes of idle; `--idle-ms 0` disables that
398
-
399
- **Auto-spawn from MCP tools.** Pass `autoSpawn: true` in the inputSchema of `sync` (action=install), `reverse-sync` (action=apply), or `gates` (action=run). The MCP server will spawn `bin/ui.js` detached, wait for it to come online, open your default browser, and stream that tool's progress. Trivial tools (`kit list-*`, `forensics`, `install`) deliberately don't accept `autoSpawn` — the overhead isn't worth it.
400
-
401
- **Opt-out always available.** From the CLI: pass `--no-ui` or set `KIT_MCP_NO_UI=1`. The sidecar is never started behind your back; it's only used when a lockfile is already present (someone ran `kit ui start` or `autoSpawn: true`).
402
-
403
- **Security model.** Sidecar binds to `127.0.0.1` literally — never `0.0.0.0`, never `localhost` (which resolves to `::1` on Windows). Every route validates the `Host` header to mitigate DNS rebinding. CSP is strict (`default-src 'self'; …; frame-ancestors 'none'`). Paths in payloads are scrubbed (`$HOME → ~`, `<projectRoot> → <project>`) so screenshots don't leak directory structure. No persistence, no TLS, no auth — single-user dev workstation only. Full threat model in [`docs/sidecar-security.md`](docs/sidecar-security.md).
404
-
405
- **First-run quirks.** Windows Defender / macOS firewall may prompt the first time `kit ui start` binds. Approving "Private networks" is enough — the server doesn't accept anything from outside loopback regardless. On WSL, `kit ui start` opens the URL in the Windows host browser via `wslview`. In CI / SSH / `TERM=dumb`, browser launch is suppressed and the URL is printed to stderr instead.
406
-
407
- ---
408
-
409
- ## MCP usage
410
-
411
- Once registered (`kit install write <ide> --via npx`), the IDE's agent gets 6 MCP tools, all using **action-based dispatch** — one tool, many actions, low context cost.
412
-
413
- | Tool | Actions |
414
- |---|---|
415
- | `kit` | `list-agents`, `list-commands`, `list-skills`, `get`, `search` |
416
- | `sync` | `targets`, `status`, `install`, `remove` |
417
- | `reverse-sync` | `detect`, `apply` |
418
- | `gates` | `list`, `get`, `for-stage` |
419
- | `forensics` | `collect`, `summarize`, `write-learnings`, `reflect`, `list-replays`, `record-replay`, `load-replay`, `annotate-replay` |
420
- | `install` | `targets`, `install`, `dry-run` |
421
-
422
- ### Example calls (from inside an MCP client)
423
-
424
- ```jsonc
425
- { "tool": "kit", "arguments": { "action": "list-agents" } }
426
- { "tool": "sync", "arguments": { "action": "install", "target": "claude-code", "projectRoot": "/abs" } }
427
- { "tool": "gates", "arguments": { "action": "for-stage", "stage": "pre-verify" } }
428
- { "tool": "forensics", "arguments": { "action": "write-learnings", "projectRoot": "/abs" } }
429
- { "tool": "reverse-sync", "arguments": { "action": "detect", "target": "claude-code", "projectRoot": "/abs" } }
430
- ```
431
-
432
- ---
433
-
434
- ## Harness usage (programmatic)
435
-
436
- The `core/` modules are pure functions, no transport coupling:
437
-
438
- ```javascript
439
- import { listKit, searchKit } from '@luanpdd/kit-mcp/src/core/kit.js';
440
- import { syncTo, statusOf } from '@luanpdd/kit-mcp/src/core/sync.js';
441
- import { listGates, gatesForStage } from '@luanpdd/kit-mcp/src/core/gates.js';
442
- import { runGate } from '@luanpdd/kit-mcp/src/core/gate-runner.js';
443
- import { detectReverse, applyReverse } from '@luanpdd/kit-mcp/src/core/reverse-sync.js';
444
- import { watchKit } from '@luanpdd/kit-mcp/src/core/watch.js';
445
- import { collectFailures, writeLearnings } from '@luanpdd/kit-mcp/src/core/failures.js';
446
- import { reflect } from '@luanpdd/kit-mcp/src/core/reflect.js';
447
-
448
- // Browse the kit
449
- const kit = await listKit('/path/to/kit');
450
- console.log(kit.agents.length, 'agents');
451
-
452
- // Sync to multiple IDEs in parallel
453
- await Promise.all([
454
- syncTo('claude-code', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
455
- syncTo('cursor', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
456
- syncTo('codex', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
457
- ]);
458
-
459
- // Watch and resync
460
- const w = await watchKit(['claude-code'], { projectRoot: '/proj/foo' });
461
- // ... later: await w.stop();
462
- ```
463
-
464
- This is what dotcontext calls "the harness" — a runtime layer used both by CLI and MCP.
465
-
466
- ---
467
-
468
- ## Adding things
469
-
470
- ### Add a new agent / command / skill
471
-
472
- Drop a file (or folder, for skills) into your `kit/`:
473
-
474
- ```bash
475
- # kit/agents/refactor-suggester.md
476
- cat > kit/agents/refactor-suggester.md <<'EOF'
477
- ---
478
- name: refactor-suggester
479
- description: Scans a directory and suggests safe refactors with diff previews.
480
- tools: Read, Glob, Grep
481
- ---
482
- You are a refactoring assistant ...
483
- EOF
484
-
485
- # Re-sync (or use `kit sync watch` for automatic)
486
- kit sync install claude-code --project-root /your/project
487
- ```
488
-
489
- ### Add a new gate
490
-
491
- ```bash
492
- cat > gates/bundle-size.md <<'EOF'
493
- ---
494
- id: bundle-size
495
- stage: post-verify
496
- blocking: false
497
- description: Warn if the production bundle grew more than 10% versus the previous phase.
498
- ---
499
- ## Check
500
- ```bash
501
- # your script here; cwd will be --project-root
502
- EOF
503
- ```
504
-
505
- The gate appears in `kit gates list` immediately and is runnable with `kit gates run bundle-size`.
506
-
507
- ### Add a new IDE target
508
-
509
- Open [`src/core/registry.js`](src/core/registry.js) and add an entry to `TARGETS`:
510
-
511
- ```javascript
512
- 'my-new-ide': {
513
- label: 'My New IDE',
514
- rules: { path: 'MY_RULES.md', mode: 'single' },
515
- agents: { path: '.myide/agents/', mode: 'multi', extension: '.md' },
516
- commands: null,
517
- skills: { path: '.myide/skills/', mode: 'multi-dir' },
518
- mcpConfig:{ path: '.myide/mcp.json', strategy: 'merge-mcpServers-json',
519
- userPath: '~/.myide/mcp.json', userKey: 'mcpServers' },
520
- },
521
- ```
522
-
523
- That's the entire change. `kit sync install my-new-ide` and `kit install write my-new-ide` work immediately.
524
-
525
- ---
526
-
527
- ## How the sync stays in sync
528
-
529
- When you run `sync install <ide> --mode reference`, kit-mcp writes stubs like:
530
-
531
- ```markdown
532
- ---
533
- name: example-reviewer
534
- description: ...
535
- ---
536
-
537
- <!-- kit-mcp:reference -->
538
- # example-reviewer
539
-
540
- > Canonical source: [`../../kit/agents/example-reviewer.md`](../../kit/agents/example-reviewer.md)
541
- > Edit the source file in the kit, not this stub.
542
- ```
543
-
544
- The IDE reads the **frontmatter** (preserved verbatim) for the metadata it needs, and the body points back at the canonical file. Edit `kit/agents/example-reviewer.md` once; running `sync install` again refreshes timestamps but the link is unchanged.
545
-
546
- The `STUB_MARKER` (`<!-- kit-mcp:reference -->`) lets `sync remove` clean up only files we wrote, never touching anything you authored manually. It also lets `reverse-sync detect` recognize stubs vs user-edited content.
547
-
548
- ---
549
-
550
- ## Releasing (maintainers)
551
-
552
- The repo auto-publishes to npm via GitHub Actions whenever a version tag (`v*`) is pushed.
553
-
554
- ### One-time setup
555
-
556
- 1. **Create the GitHub repo** (if not already):
557
- ```bash
558
- gh repo create luanpdd/kit-mcp --public --source . --push
559
- ```
560
-
561
- 2. **Generate an npm token** at https://www.npmjs.com/settings/luanpdd/tokens
562
- - Type: **Granular Access Token**
563
- - Permissions: **Read and write** for `@luanpdd/*` scope
564
- - **Allow this token to bypass 2FA**: ✅ enabled (required for CI)
565
-
566
- 3. **Add the token as a GitHub secret**:
567
- ```bash
568
- gh secret set NPM_TOKEN
569
- # paste the npm_xxxxx token when prompted
570
- ```
571
-
572
- ### Release flow
573
-
574
- ```bash
575
- npm version patch # or minor / major — bumps + commits + tags
576
- git push --follow-tags
577
- # GitHub Action runs CLI smoke tests, then `npm publish --provenance`
578
- ```
579
-
580
- The publish workflow refuses to ship if `package.json` version doesn't match the tag.
581
-
582
- The CI workflow runs CLI smoke tests on **Ubuntu / macOS / Windows × Node 20 / 22** on every PR and push to `main`.
583
-
584
- ---
585
-
586
- ## Design notes — what we adapted from dotcontext, what we didn't
587
-
588
- **Adapted (load-bearing simplifications):**
589
-
590
- 1. **Single registry table** — `src/core/registry.js`. Adding an IDE = one entry, not a new adapter file. Capability differences handled by `null`, not `if/else`.
591
- 2. **Markdown references over copies** — edit the canonical, all targets see it.
592
- 3. **Action-based MCP dispatching** — 6 tools instead of 30+. Small surface, easy to remember.
593
- 4. **CLI ↔ harness ↔ MCP** — `core/` is pure, CLI and MCP are thin transports.
594
-
595
- **Adapted but reshaped:**
596
-
597
- 5. **Failure dataset** — `forensics collect/summarize/write-learnings` aggregates `debug/resolved/`, failed `*-VERIFICATION.md`, `forensics/*` into per-agent learning docs.
598
- 6. **Reflect (LLM pass)** — `forensics reflect` feeds learnings + current agent into an LLM and proposes minimal prompt edits.
599
- 7. **Replays** — `forensics record-replay / load-replay` for tight prompt iteration.
600
- 8. **Gates as named files** — extracted into `gates/*.md` with explicit verdict format. Runnable with `gates run`.
601
-
602
- **Not adapted (over-engineered for a personal kit):**
603
-
604
- - PREVC state machine, role assignments, sensors/contracts/policies/datasets — too much for personal use.
605
- - Built-in agents/skills hardcoded — yours come from your `kit/`.
606
-
607
- ---
608
-
609
- ## Roadmap (open ideas)
610
-
611
- - HTTP transport for IDEs that don't speak stdio MCP.
612
- - `forensics reflect` with diff visual instead of full content.
613
- - `kit gates run --all` aggregating verdicts of every gate at a stage.
614
- - Dependabot config to keep `chokidar` and `@modelcontextprotocol/sdk` current.
615
- - `kit sync watch` exposed via MCP (long-running tool challenge).
616
-
617
- PRs welcome.
618
-
619
- ---
620
-
621
- ## Tests
622
-
623
- Built on `node:test` (zero dependencies). Two suites:
624
-
625
- ```bash
626
- npm test # unit — kit parser, sync (all modes), reverse-sync, gates, registry
627
- npm run test:integration # integration — spawns bin/cli.js end-to-end on a temp project
628
- npm run test:all # both
629
- ```
630
-
631
- Plus the original quick smokes:
632
-
633
- ```bash
634
- node bin/cli.js kit list-agents | head -5 # 47 bundled agents
635
- node bin/cli.js sync targets # 8 IDEs
636
- node bin/cli.js gates list # 20 gates
637
- node bin/cli.js install dry-run claude-code --via npx
638
- ```
639
-
640
- CI runs unit + integration + smoke + MCP boot on Ubuntu / macOS / Windows × Node 20 / 22 on every push and PR.
641
-
642
- ---
643
-
644
- ## License
645
-
646
- MIT — see [LICENSE](LICENSE).
647
-
648
- Copyright © 2026 luanpdd.
1
+ # kit-mcp
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@luanpdd/kit-mcp.svg)](https://www.npmjs.com/package/@luanpdd/kit-mcp)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@luanpdd/kit-mcp.svg)](https://www.npmjs.com/package/@luanpdd/kit-mcp)
5
+ [![CI](https://github.com/luanpdd/kit-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/luanpdd/kit-mcp/actions/workflows/ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ An opinionated **brownfield planning workflow** (in PT-BR) — agents, slash-commands, framework — shipped as an **MCP server**, with one-shot **sync** that projects the kit into every supported IDE's native layout — Claude Code, Cursor, Codex, Gemini CLI, Windsurf, Antigravity, Copilot, Trae.
9
+
10
+ > **One canonical source. N IDEs. Edit once, everywhere updated.**
11
+ >
12
+ > Install and inherit the bundled workflow, or point `--kit-root` at your own folder to replace it entirely.
13
+
14
+ ---
15
+
16
+ ## Why this exists
17
+
18
+ `.claude/agents/`, `.claude/commands/`, `.claude/skills/` are powerful but locked to Claude Code. The same definitions also need to live as `AGENTS.md` for Codex, `GEMINI.md` for Gemini, `.cursor/rules/` for Cursor, etc. Maintaining all of those by hand drifts immediately.
19
+
20
+ **kit-mcp** keeps your canonical source in one place and projects it into every supported IDE through a single registry. It also exposes the kit through an MCP server so any agent that speaks MCP can browse, search, sync, run gates, and record replays.
21
+
22
+ Inspired by [vinilana/dotcontext](https://github.com/vinilana/dotcontext) — see the design notes at the bottom for what's adapted, what's not, and why.
23
+
24
+ ---
25
+
26
+ <!-- AUTOGEN-COUNTS-START -->
27
+ **Bundled workflow:** 60 agents · 89 commands · 67 skills · 23 gates
28
+ <!-- AUTOGEN-COUNTS-END -->
29
+
30
+ ## What ships in the box
31
+
32
+ ```
33
+ kit-mcp/
34
+ ├── kit/ ← bundled brownfield workflow (PT-BR)
35
+ │ ├── agents/ 47 agents (planner, executor, verifier, debugger,
36
+ │ │ ui-auditor, codebase-mapper, …)
37
+ │ ├── commands/ 87 slash-commands (/novo-marco, /planejar-fase,
38
+ │ │ /executar-fase, /publicar, …)
39
+ │ ├── framework/ workflows + templates + bin libs the agents use
40
+ │ ├── hooks/ workflow guards, prompt guards, statusline
41
+ │ ├── skills/example-skill/ single example skill (replace with your own)
42
+ │ └── README.md file-format guide
43
+
44
+ ├── gates/ ← reusable workflow gates (regression, confidence, dep-check, …)
45
+
46
+ ├── src/
47
+ │ ├── core/ pure runtime — registry, kit, sync, reverse-sync, gates,
48
+ │ │ gate-runner, watch, failures, replays, reflect
49
+ │ ├── mcp-server/ MCP server entry + install command
50
+ │ └── cli/ CLI mirror of the MCP tools
51
+
52
+ ├── bin/
53
+ │ ├── mcp.js shim → starts the MCP stdio server
54
+ │ └── cli.js shim → runs the CLI
55
+
56
+ ├── LICENSE MIT
57
+ ├── CHANGELOG.md
58
+ ├── package.json
59
+ └── README.md ← you are here
60
+ ```
61
+
62
+ **Lines of source code:** ~1300. **Runtime dependencies:** 5 (`@modelcontextprotocol/sdk`, `commander`, `chokidar`, `picocolors`, `@inquirer/prompts`). **Build step:** none — plain ESM Node.js 20+.
63
+
64
+ ### About the bundled workflow
65
+
66
+ The bundled `kit/` is an opinionated **brownfield planning workflow** in Portuguese — milestones, phases, requirements, planning, execution with atomic commits and checkpoints, retrospective auditing. Installing `@luanpdd/kit-mcp` and syncing into your IDE gives you all 87+ slash-commands, 47+ agents, plus the framework templates that they delegate into.
67
+
68
+ If that's not what you want, point `--kit-root` at your own folder and ignore everything under `kit/` — the infrastructure (registry, sync, gates, forensics, MCP server) works the same regardless of what kit you load.
69
+
70
+ ### Observability suite (v1.9)
71
+
72
+ A complete observability layer derived from *Observability Engineering* (Charity Majors, Liz Fong-Jones, George Miranda — O'Reilly, 2022) ships in the kit. It integrates deeply with the Supabase suite (v1.8) — every Supabase agent now consults observability skills, and the new `incident-investigator` agent uses `mcp__supabase__get_logs` / `execute_sql` / `get_advisors` to apply the **Core Analysis Loop** on real incidents.
73
+
74
+ **11 skills** in `kit/skills/`:
75
+ - `_shared-observability/glossary.md` — canonical bilingual vocabulary (PT-BR↔EN)
76
+ - `structured-events`, `distributed-tracing`, `opentelemetry-standard`, `core-analysis-loop` — foundationals
77
+ - `observability-driven-development` — the 4 pre-PR questions ("Does it do what I expected? Compare to previous version? Are users using? Anomalies emerge?")
78
+ - `event-based-slos`, `burn-rate-alerting` — SLO definition + predictive burn alerts
79
+ - `telemetry-sampling`, `telemetry-pipelines`, `observability-maturity-model` — scale + culture
80
+
81
+ **5 agents** in `kit/agents/`:
82
+ - `observability-instrumenter` — generates OTel + canonical attribute patches
83
+ - `incident-investigator` — Core Analysis Loop with persistent state in `.planning/investigations/`
84
+ - `slo-engineer` — generates `SLO.md` + SQL migrations to materialize SLI events
85
+ - `burn-rate-forecaster` — calculates burn rate, ETA exhaustion, alert config
86
+ - `omm-auditor` — scores 5 OMM capabilities (resilience, code quality, complexity, release cadence, user behavior)
87
+
88
+ **6 commands**:
89
+ - `/observabilidade <subcommand>` — single orchestrator (analog to `/supabase`) — dispatches to the 5 agents above with PT/EN synonyms
90
+ - `/instrumentar-fase` — generates `INSTRUMENTATION.md` per plan after `/planejar-fase`
91
+ - `/investigar-producao` — guided Core Analysis Loop with persistent state
92
+ - `/definir-slo` — creates SLO definition + SQL materialized view
93
+ - `/burn-rate-status` — table `[SLO | budget burned | ETA | action]`, also runnable in `/loop`
94
+ - `/auditar-observabilidade` — generates OMM-REPORT.md scored
95
+
96
+ **Quick start example:**
97
+ ```bash
98
+ # Define an SLO for a critical journey
99
+ /observabilidade slo "checkout"
100
+
101
+ # Investigate a production incident with Core Analysis Loop
102
+ /observabilidade investigar "checkout SLO burn rate = 8 às 14:32"
103
+
104
+ # Score project against Observability Maturity Model
105
+ /observabilidade omm
106
+ ```
107
+
108
+ ### SRE Engagement suite (v1.10)
109
+
110
+ A production engineering layer derived from *Site Reliability Engineering: How Google Runs Production Systems* (Beyer, Jones, Petoff, Murphy — Google/O'Reilly, 2016) ships in the kit. It composes with the Supabase suite (v1.8) and the Observability suite (v1.9) into a coherent production engineering stack — Supabase agents now suggest PRR before launch, every Edge Function template includes the **4 golden signals**, and `incident-investigator` outputs feed directly into blameless postmortems via `/postmortem --from-investigation <id>`.
111
+
112
+ **6 skills** in `kit/skills/`:
113
+ - `_shared-sre/glossary.md` — canonical bilingual vocabulary (PT-BR↔EN) — SLI/SLO/SLA, error budget, burn rate, toil, postmortem, blameless, PRR, golden signals, risk continuum, MTTR/MTBF
114
+ - `sre-risk-management` — risk continuum (cap 3), 99.99% wisdom ("as reliable as needs to be, no more"), error budget as explicit risk × innovation balance
115
+ - `four-golden-signals` — Latency + Traffic + Errors + Saturation (cap 6), histograms with exponential bucketing, success vs error latency separated, percentiles vs mean (long tail)
116
+ - `eliminating-toil` — canonical toil definition (manual + repetitive + automatable + tactical + no enduring value + scales linearly), ≤ 50% rule (cap 5), automation patterns
117
+ - `blameless-postmortems` — canonical 9-section template (cap 15), "no postmortem left unreviewed", blame culture as anti-pattern, Wheel of Misfortune
118
+ - `production-readiness-review` — PRR checklist (cap 32) — 6 axes (System architecture, Instrumentation, Emergency response, Capacity planning, Change management, Performance), 3 engagement models
119
+
120
+ **4 agents** in `kit/agents/`:
121
+ - `golden-signals-instrumenter` — specialization of `observability-instrumenter` (v1.9); generates OTel patches with the 4 golden signals (Latency=histogram, Traffic=counter, Errors=counter by `error.type`, Saturation=gauge)
122
+ - `toil-auditor` — analyzes git log + shell scripts + manual commands in README/runbooks; produces `TOIL-AUDIT.md` with P0/P1/P2 priority + estimated effort
123
+ - `postmortem-writer` — natural continuation of `incident-investigator` (v1.9); reads `.planning/investigations/<id>.md` and produces blameless postmortem (Summary, Impact, Root Causes, Trigger, Resolution, Detection, Action Items, Lessons Learned, Timeline UTC)
124
+ - `prr-conductor` — conducts Production Readiness Review for service/feature; reads schema (Supabase MCP), Edge Functions, `.planning/slos/`, audit logs; produces `PRR-REPORT.md` scored across the 6 axes
125
+
126
+ **6 commands**:
127
+ - `/sre <subcommand>` — single orchestrator (analog to `/supabase` v1.8 and `/observabilidade` v1.9) — dispatches to the 4 agents with PT/EN synonyms
128
+ - `/golden-signals` — invokes `golden-signals-instrumenter` for service/Edge Function/phase; generates `GOLDEN-SIGNALS.md` with OTel-ready instrumentation
129
+ - `/auditar-toil` — invokes `toil-auditor`; generates `.planning/TOIL-AUDIT.md`
130
+ - `/postmortem` — invokes `postmortem-writer`; supports `--from-investigation <id>` (continue from v1.9 investigation) or `--incident "<description>"` (standalone)
131
+ - `/prr` — invokes `prr-conductor`; supports `--service <name>` or `--feature <description>`; generates `PRR-REPORT.md`
132
+ - `/risk-budget` — displays current error budget vs risk continuum, citing SLOs from v1.9 (`.planning/slos/`); applies `sre-risk-management` skill
133
+
134
+ **3 audit gates** in `gates/`:
135
+ - `golden-signals-coverage` (blocking, pre-verify) — verifies code in `supabase/functions/**`, `src/**`, `lib/**` covers the 4 golden signals (skips gracefully on content-only phases)
136
+ - `postmortem-template-required` (blocking, pre-conclude) — blocks `/concluir-marco` if any `.planning/investigations/<id>.md` lacks a corresponding `.planning/postmortems/<id>.md` (`Status: INCONCLUSIVE` is the only exception)
137
+ - `prr-checklist-coverage` (blocking, pre-verify) — verifies every `PRR-REPORT.md` in `.planning/prr/**/*.md` covers the 6 canonical axes; "skipping an axe = invalid approval"
138
+
139
+ **Lifecycle integration:**
140
+ - `/forense` — after Core Analysis Loop closes with VALIDATED root cause, suggests chain `/postmortem --from-investigation <id>` (Phase 40 / INT-FW-V2-01)
141
+ - `/concluir-marco` — opt-in gate `workflow.complete_milestone_prr_gate=true` requires `PRR-REPORT.md` with status `passed` for production-bound features before archive (Phase 40 / INT-FW-V2-02)
142
+ - `/auditar-marco` — auto-invokes `/auditar-toil` when `workflow.audit_milestone_toil=true` (default); result feeds OMM Capacidade 3 scoring via `omm-auditor` (Phase 40 / INT-FW-V2-03)
143
+
144
+ **Quick start example — end-to-end SRE workflow:**
145
+ ```bash
146
+ # Before launching a new feature in production — PRR
147
+ /sre prr --feature "checkout v2"
148
+
149
+ # While instrumenting service — apply 4 golden signals
150
+ /sre golden-signals supabase/functions/orders/index.ts
151
+
152
+ # Audit team toil quarterly
153
+ /sre toil
154
+
155
+ # When SLO burn alert fires — investigate (v1.9 deep loop), then postmortem (v1.10)
156
+ /investigar-producao "checkout SLO burn rate = 8 às 14:32"
157
+ /sre postmortem --from-investigation checkout-2026-05-07
158
+ # Or for framework-level failures:
159
+ /forense "framework workflow X falhou em produção"
160
+ /sre postmortem --incident "framework workflow X failed (see .planning/forensics/report-*)"
161
+
162
+ # Risk dashboard against SLO budgets
163
+ /sre risk-budget
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Prerequisites
169
+
170
+ - **Node.js ≥ 20** (uses native ESM, no transpiler)
171
+ - An IDE / agent that speaks MCP if you want to use it that way (Claude Code, Cursor, Codex, Gemini CLI, …)
172
+ - Optional: a project where you'll sync the kit (any folder)
173
+
174
+ ---
175
+
176
+ ## Quick start
177
+
178
+ ### 1. Use the bundled workflow as-is (recommended)
179
+
180
+ ```bash
181
+ # Browse what's bundled
182
+ npx -y @luanpdd/kit-mcp kit list-agents # 47 agents
183
+ npx -y @luanpdd/kit-mcp kit list-commands # 87 commands
184
+ npx -y @luanpdd/kit-mcp sync targets # supported IDEs
185
+
186
+ # Install into your project for Claude Code
187
+ npx -y @luanpdd/kit-mcp sync install claude-code --project-root .
188
+ ```
189
+
190
+ After that, open the project in Claude Code and the slash-commands (`/novo-marco`, `/planejar-fase`, `/executar-fase`, `/publicar`, …) and agents are immediately available.
191
+
192
+ ### 2. Replace the bundled workflow with your own kit
193
+
194
+ Point kit-mcp at your own `kit/` folder via `--kit-root` or the `KIT_MCP_KIT_ROOT` env var:
195
+
196
+ ```bash
197
+ # Option A: per-command flag
198
+ npx -y @luanpdd/kit-mcp --kit-root ~/my-kit kit list-agents
199
+ npx -y @luanpdd/kit-mcp --kit-root ~/my-kit sync install claude-code --project-root .
200
+
201
+ # Option B: env var (sticky for the session)
202
+ export KIT_MCP_KIT_ROOT=~/my-kit
203
+ npx -y @luanpdd/kit-mcp sync install claude-code --project-root .
204
+ ```
205
+
206
+ Your `~/my-kit/` follows the same layout as the bundled kit:
207
+
208
+ ```
209
+ my-kit/
210
+ ├── agents/<name>.md YAML frontmatter + Markdown body
211
+ ├── commands/<name>.md YAML frontmatter + Markdown body
212
+ └── skills/<name>/SKILL.md YAML frontmatter + Markdown body
213
+ references/ optional reference docs
214
+ ```
215
+
216
+ See [`kit/README.md`](kit/README.md) for the file format.
217
+
218
+ ### 3. Register kit-mcp into an IDE (so agents inside the IDE can call the MCP tools)
219
+
220
+ ```bash
221
+ # Portable — works on any machine, no clone needed
222
+ npx -y @luanpdd/kit-mcp install write claude-code --scope user --via npx
223
+ ```
224
+
225
+ For other IDEs, swap `claude-code` for `cursor`, `codex`, `gemini-cli`, `windsurf`, `antigravity`, `copilot`, or `trae`. Run `kit sync targets` for the live capability matrix.
226
+
227
+ ---
228
+
229
+ ## CLI reference
230
+
231
+ The CLI mirrors the MCP tools 1:1. **By default the CLI prints colored, human-readable tables and summary panels.** Add `--json` to restore raw JSON-to-stdout (machine-readable, the default in v1.0). The global `--kit-root` flag overrides the kit source for any subcommand.
232
+
233
+ ```bash
234
+ kit list-agents # human: colored table, name + description
235
+ kit list-agents --json # machine: JSON array
236
+
237
+ kit sync install claude-code # human: progress bar + summary panel
238
+ kit sync install claude-code --json # machine: full result object
239
+ ```
240
+
241
+ In non-TTY mode (pipes, CI), animations degrade to linear status lines automatically. `NO_COLOR=1` disables colors entirely; `FORCE_COLOR=1` forces them on even in pipes.
242
+
243
+ ### `kit kit ...` — browse the kit
244
+
245
+ ```bash
246
+ kit kit list-agents # 47 agents (bundled workflow)
247
+ kit kit list-commands # 87 commands (bundled workflow)
248
+ kit kit list-skills # 49 skills (bundled workflow)
249
+ kit kit get agent planner
250
+ kit kit search "milestone" # fuzzy match across all kinds
251
+ ```
252
+
253
+ ### `kit sync ...` — project into an IDE
254
+
255
+ ```bash
256
+ kit sync targets # list supported IDEs + capabilities
257
+ kit sync status claude-code # see which capability paths exist in cwd
258
+ kit sync install claude-code # write the kit into the cwd as Claude Code expects
259
+ kit sync install cursor --mode copy # copy mode (no link to canonical)
260
+ kit sync install codex --dry-run # preview without writing
261
+ kit sync remove claude-code # remove only files generated by kit-mcp (uses STUB_MARKER)
262
+ kit sync watch claude-code cursor # watch kit/ → resync to listed IDEs on every change
263
+ kit sync watch --all # watch + auto-detect every IDE already present in cwd
264
+ ```
265
+
266
+ **Modes:**
267
+ - `reference` (default) — writes a stub that links back to `kit/`. Edit canonical → all IDEs see the change.
268
+ - `copy` — duplicates content. Use when shipping a frozen snapshot of the kit.
269
+
270
+ **Per-IDE projection** — what each target receives:
271
+
272
+ | IDE | rules → | agents → | commands → | skills → | framework → | hooks → |
273
+ |---|---|---|---|---|---|---|
274
+ | Claude Code | `CLAUDE.md` | `.claude/agents/*.md` | `.claude/commands/*.md` | `.claude/skills/*/` | `.claude/framework/**` | `.claude/hooks/**` |
275
+ | Cursor | `.cursor/rules/*.mdc` | `.cursor/agents/*.md` | — | — | — | — |
276
+ | Codex | `AGENTS.md` | — | — | `.codex/skills/*/` | — | — |
277
+ | Gemini CLI | `GEMINI.md` | — | — | `.gemini/skills/*/` | — | — |
278
+ | Copilot | `.github/copilot-instructions.md` | `.github/agents/*.agent` | — | `.github/skills/*/` | — | — |
279
+ | Windsurf | `.windsurf/rules/*.md` | `.windsurf/agents/*.md` | — | `.windsurf/skills/*/` | — | — |
280
+ | Antigravity | `.agents/rules/*.md` | `.agents/agents/*.md` | — | `.agents/workflows/*/` | — | — |
281
+ | Trae | `.trae/rules/*.md` | `.trae/agents/*.md` | — | — | — | — |
282
+
283
+ A capability marked `—` is not supported by that IDE. Adding a new IDE = one entry in [`src/core/registry.js`](src/core/registry.js).
284
+
285
+ **About `framework` and `hooks`:** these are *mirror-tree* capabilities — the entire `kit/framework/` and `kit/hooks/` subtrees are copied verbatim into `.claude/framework/` and `.claude/hooks/`. They're needed by the bundled workflow because slash-commands like `/novo-marco` reference framework files via paths like `@./.claude/framework/workflows/new-milestone.md`. A `.kit-mcp-managed` marker is written at the root of each managed tree so `kit sync remove` can clean up safely without touching directories you authored yourself.
286
+
287
+ ### `kit install ...` — register kit-mcp into an IDE's MCP config
288
+
289
+ ```bash
290
+ kit install targets # list IDEs that support MCP config
291
+ kit install dry-run claude-code --scope user --via npx # preview the JSON/TOML
292
+ kit install write claude-code --scope user --via npx # portable: uses `npx @luanpdd/kit-mcp`
293
+ kit install write claude-code --scope project --via local # local clone: uses ./bin/mcp.js absolute path
294
+ kit install write claude-code --scope user --via global # assumes `npm install -g @luanpdd/kit-mcp`
295
+ kit install write # no target: opens an interactive selector (TTY)
296
+ kit install write claude-code --yes # CI: skip the confirm prompt
297
+ ```
298
+
299
+ Since v1.1, `install write` always **previews** the JSON/TOML it's about to write and asks you to confirm. Pass `--yes` (CI mode) or `--json` to bypass the prompt. Without a target argument in TTY mode, you get an arrow-key selector listing all 8 IDEs.
300
+
301
+ `--via` decides how the IDE will invoke the server:
302
+
303
+ | Mode | Command in IDE config | When to use |
304
+ |---|---|---|
305
+ | `npx` (recommended) | `npx -y @luanpdd/kit-mcp` | Portable — works on any machine |
306
+ | `local` | `node /abs/path/to/clone/bin/mcp.js` | You're hacking on kit-mcp itself |
307
+ | `global` | `kit-mcp` | After `npm install -g @luanpdd/kit-mcp` — fastest startup |
308
+
309
+ ### `kit reverse-sync ...` — bring IDE edits back to the canonical kit
310
+
311
+ If you edited an agent/command/skill/framework/hook **directly inside the IDE's folder** (`.claude/agents/foo.md`, `.claude/framework/workflows/bar.md`, `.claude/hooks/baz.js`, …) instead of in your kit, this brings those edits back so the canonical absorbs them.
312
+
313
+ ```bash
314
+ kit reverse-sync detect claude-code --project-root .
315
+ kit reverse-sync apply claude-code --project-root . --strategy merge --dry-run
316
+ kit reverse-sync apply claude-code --project-root . --strategy merge
317
+ kit reverse-sync apply claude-code --project-root . --strategy overwrite --only agent/foo
318
+ kit reverse-sync apply claude-code --project-root . --strategy overwrite --only framework/workflows/new-milestone.md
319
+ ```
320
+
321
+ **Strategies:** `skip` (list-only), `merge` (canonical frontmatter + edited body — for agents/commands/skills), `overwrite`, `rename` (preserve both as `-from-{ide}.md`).
322
+
323
+ **Mirror-tree caps (`framework`, `hooks`):** files have no frontmatter, so `merge` degenerates to `overwrite` (with a note). The `.kit-mcp-managed` marker is automatically excluded from candidates. Filter individual files with `--only framework/<rel>` or `--only hooks/<file>`.
324
+
325
+ ### `kit gates ...` — reusable workflow gates
326
+
327
+ ```bash
328
+ kit gates list # all gates with stage + blocking flag
329
+ kit gates get regression # full markdown of one gate
330
+ kit gates for-stage pre-verify # gates that run before the verify step
331
+ kit gates run secrets-scan --project-root . # interactive: shows the script, asks y/N, runs
332
+ kit gates run secrets-scan --project-root . --yes # non-interactive (CI)
333
+ kit gates run confidence --no-interactive # manual gates → verdict=manual when not interactive
334
+ ```
335
+
336
+ **Verdicts:** `passed` (exit 0), `block` (exit≠0 + blocking), `warn` (exit≠0 + non-blocking), `manual` (no shell), `skipped` (declined).
337
+
338
+ Author runnable gates with a `bash` code-fence under `## Check`:
339
+
340
+ ````markdown
341
+ ---
342
+ id: my-gate
343
+ stage: pre-verify
344
+ blocking: true
345
+ description: ...
346
+ ---
347
+ ## Check
348
+ ```bash
349
+ test -f package.json && npm test
350
+ ```
351
+ ````
352
+
353
+ ### `kit forensics ...` — failure dataset, replays & LLM-driven prompt evolution
354
+
355
+ ```bash
356
+ # Aggregate failures across debug/, verifications, forensics
357
+ kit forensics collect --project-root .
358
+ kit forensics summarize --project-root .
359
+ kit forensics write-learnings --project-root .
360
+
361
+ # LLM pass: read learnings + current agent, propose minimal prompt edits
362
+ kit forensics reflect --agent <name> --project-root . --dry-run
363
+ kit forensics reflect --agent <name> --project-root .
364
+ kit forensics reflect --agent <name> --project-root . --apply
365
+
366
+ # Replays
367
+ kit forensics list-replays --project-root .
368
+ kit forensics load-replay <id> --project-root .
369
+ ```
370
+
371
+ `reflect` requires `ANTHROPIC_API_KEY` (override model with `KIT_REFLECT_MODEL`, max tokens with `KIT_REFLECT_MAX_TOKENS`). Without the key, `--dry-run` saves the assembled prompt for manual paste.
372
+
373
+ The proposal is always saved to `.planning/learnings/{agent}.proposal.md` first; the canonical is only modified after explicit confirmation (or `--apply`). MCP `forensics.reflect` never auto-applies.
374
+
375
+ ### `kit ui ...` — live process viewer (sidecar) — _new in 1.2_
376
+
377
+ A tiny localhost web app that streams what kit-mcp is doing while your IDE drives it. Strictly opt-in: ignore it and v1.1 behavior is unchanged.
378
+
379
+ ```bash
380
+ # In one terminal — keeps running until Ctrl+C
381
+ kit ui start
382
+
383
+ # In another terminal (or via Claude Code / Cursor) — runs as before, but events
384
+ # are now also broadcast to the sidecar window
385
+ kit sync install claude-code
386
+
387
+ # Tools too: pass autoSpawn:true on the MCP side, or just `kit ui start` first
388
+ kit ui status
389
+ kit ui stop
390
+ ```
391
+
392
+ What you get:
393
+
394
+ - A single browser tab at `http://127.0.0.1:7100` (or the next free port up to 7199)
395
+ - Live event stream over Server-Sent Events — `tool_invocation`, `progress`, `error`, `milestone`, `run.start`, `run.end`
396
+ - Filters by event type and substring; pause/resume; auto-scroll; dark mode tracks the OS
397
+ - The sidecar shuts itself down after 30 minutes of idle; `--idle-ms 0` disables that
398
+
399
+ **Auto-spawn from MCP tools.** Pass `autoSpawn: true` in the inputSchema of `sync` (action=install), `reverse-sync` (action=apply), or `gates` (action=run). The MCP server will spawn `bin/ui.js` detached, wait for it to come online, open your default browser, and stream that tool's progress. Trivial tools (`kit list-*`, `forensics`, `install`) deliberately don't accept `autoSpawn` — the overhead isn't worth it.
400
+
401
+ **Opt-out always available.** From the CLI: pass `--no-ui` or set `KIT_MCP_NO_UI=1`. The sidecar is never started behind your back; it's only used when a lockfile is already present (someone ran `kit ui start` or `autoSpawn: true`).
402
+
403
+ **Security model.** Sidecar binds to `127.0.0.1` literally — never `0.0.0.0`, never `localhost` (which resolves to `::1` on Windows). Every route validates the `Host` header to mitigate DNS rebinding. CSP is strict (`default-src 'self'; …; frame-ancestors 'none'`). Paths in payloads are scrubbed (`$HOME → ~`, `<projectRoot> → <project>`) so screenshots don't leak directory structure. No persistence, no TLS, no auth — single-user dev workstation only. Full threat model in [`docs/sidecar-security.md`](docs/sidecar-security.md).
404
+
405
+ **First-run quirks.** Windows Defender / macOS firewall may prompt the first time `kit ui start` binds. Approving "Private networks" is enough — the server doesn't accept anything from outside loopback regardless. On WSL, `kit ui start` opens the URL in the Windows host browser via `wslview`. In CI / SSH / `TERM=dumb`, browser launch is suppressed and the URL is printed to stderr instead.
406
+
407
+ ---
408
+
409
+ ## MCP usage
410
+
411
+ Once registered (`kit install write <ide> --via npx`), the IDE's agent gets 6 MCP tools, all using **action-based dispatch** — one tool, many actions, low context cost.
412
+
413
+ | Tool | Actions |
414
+ |---|---|
415
+ | `kit` | `list-agents`, `list-commands`, `list-skills`, `get`, `search` |
416
+ | `sync` | `targets`, `status`, `install`, `remove` |
417
+ | `reverse-sync` | `detect`, `apply` |
418
+ | `gates` | `list`, `get`, `for-stage` |
419
+ | `forensics` | `collect`, `summarize`, `write-learnings`, `reflect`, `list-replays`, `record-replay`, `load-replay`, `annotate-replay` |
420
+ | `install` | `targets`, `install`, `dry-run` |
421
+
422
+ ### Example calls (from inside an MCP client)
423
+
424
+ ```jsonc
425
+ { "tool": "kit", "arguments": { "action": "list-agents" } }
426
+ { "tool": "sync", "arguments": { "action": "install", "target": "claude-code", "projectRoot": "/abs" } }
427
+ { "tool": "gates", "arguments": { "action": "for-stage", "stage": "pre-verify" } }
428
+ { "tool": "forensics", "arguments": { "action": "write-learnings", "projectRoot": "/abs" } }
429
+ { "tool": "reverse-sync", "arguments": { "action": "detect", "target": "claude-code", "projectRoot": "/abs" } }
430
+ ```
431
+
432
+ ---
433
+
434
+ ## Harness usage (programmatic)
435
+
436
+ The `core/` modules are pure functions, no transport coupling:
437
+
438
+ ```javascript
439
+ import { listKit, searchKit } from '@luanpdd/kit-mcp/src/core/kit.js';
440
+ import { syncTo, statusOf } from '@luanpdd/kit-mcp/src/core/sync.js';
441
+ import { listGates, gatesForStage } from '@luanpdd/kit-mcp/src/core/gates.js';
442
+ import { runGate } from '@luanpdd/kit-mcp/src/core/gate-runner.js';
443
+ import { detectReverse, applyReverse } from '@luanpdd/kit-mcp/src/core/reverse-sync.js';
444
+ import { watchKit } from '@luanpdd/kit-mcp/src/core/watch.js';
445
+ import { collectFailures, writeLearnings } from '@luanpdd/kit-mcp/src/core/failures.js';
446
+ import { reflect } from '@luanpdd/kit-mcp/src/core/reflect.js';
447
+
448
+ // Browse the kit
449
+ const kit = await listKit('/path/to/kit');
450
+ console.log(kit.agents.length, 'agents');
451
+
452
+ // Sync to multiple IDEs in parallel
453
+ await Promise.all([
454
+ syncTo('claude-code', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
455
+ syncTo('cursor', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
456
+ syncTo('codex', { projectRoot: '/proj/foo', kitRoot: '/path/to/kit' }),
457
+ ]);
458
+
459
+ // Watch and resync
460
+ const w = await watchKit(['claude-code'], { projectRoot: '/proj/foo' });
461
+ // ... later: await w.stop();
462
+ ```
463
+
464
+ This is what dotcontext calls "the harness" — a runtime layer used both by CLI and MCP.
465
+
466
+ ---
467
+
468
+ ## Adding things
469
+
470
+ ### Add a new agent / command / skill
471
+
472
+ Drop a file (or folder, for skills) into your `kit/`:
473
+
474
+ ```bash
475
+ # kit/agents/refactor-suggester.md
476
+ cat > kit/agents/refactor-suggester.md <<'EOF'
477
+ ---
478
+ name: refactor-suggester
479
+ description: Scans a directory and suggests safe refactors with diff previews.
480
+ tools: Read, Glob, Grep
481
+ ---
482
+ You are a refactoring assistant ...
483
+ EOF
484
+
485
+ # Re-sync (or use `kit sync watch` for automatic)
486
+ kit sync install claude-code --project-root /your/project
487
+ ```
488
+
489
+ ### Add a new gate
490
+
491
+ ```bash
492
+ cat > gates/bundle-size.md <<'EOF'
493
+ ---
494
+ id: bundle-size
495
+ stage: post-verify
496
+ blocking: false
497
+ description: Warn if the production bundle grew more than 10% versus the previous phase.
498
+ ---
499
+ ## Check
500
+ ```bash
501
+ # your script here; cwd will be --project-root
502
+ EOF
503
+ ```
504
+
505
+ The gate appears in `kit gates list` immediately and is runnable with `kit gates run bundle-size`.
506
+
507
+ ### Add a new IDE target
508
+
509
+ Open [`src/core/registry.js`](src/core/registry.js) and add an entry to `TARGETS`:
510
+
511
+ ```javascript
512
+ 'my-new-ide': {
513
+ label: 'My New IDE',
514
+ rules: { path: 'MY_RULES.md', mode: 'single' },
515
+ agents: { path: '.myide/agents/', mode: 'multi', extension: '.md' },
516
+ commands: null,
517
+ skills: { path: '.myide/skills/', mode: 'multi-dir' },
518
+ mcpConfig:{ path: '.myide/mcp.json', strategy: 'merge-mcpServers-json',
519
+ userPath: '~/.myide/mcp.json', userKey: 'mcpServers' },
520
+ },
521
+ ```
522
+
523
+ That's the entire change. `kit sync install my-new-ide` and `kit install write my-new-ide` work immediately.
524
+
525
+ ---
526
+
527
+ ## How the sync stays in sync
528
+
529
+ When you run `sync install <ide> --mode reference`, kit-mcp writes stubs like:
530
+
531
+ ```markdown
532
+ ---
533
+ name: example-reviewer
534
+ description: ...
535
+ ---
536
+
537
+ <!-- kit-mcp:reference -->
538
+ # example-reviewer
539
+
540
+ > Canonical source: [`../../kit/agents/example-reviewer.md`](../../kit/agents/example-reviewer.md)
541
+ > Edit the source file in the kit, not this stub.
542
+ ```
543
+
544
+ The IDE reads the **frontmatter** (preserved verbatim) for the metadata it needs, and the body points back at the canonical file. Edit `kit/agents/example-reviewer.md` once; running `sync install` again refreshes timestamps but the link is unchanged.
545
+
546
+ The `STUB_MARKER` (`<!-- kit-mcp:reference -->`) lets `sync remove` clean up only files we wrote, never touching anything you authored manually. It also lets `reverse-sync detect` recognize stubs vs user-edited content.
547
+
548
+ ---
549
+
550
+ ## Releasing (maintainers)
551
+
552
+ The repo auto-publishes to npm via GitHub Actions whenever a version tag (`v*`) is pushed.
553
+
554
+ ### One-time setup
555
+
556
+ 1. **Create the GitHub repo** (if not already):
557
+ ```bash
558
+ gh repo create luanpdd/kit-mcp --public --source . --push
559
+ ```
560
+
561
+ 2. **Generate an npm token** at https://www.npmjs.com/settings/luanpdd/tokens
562
+ - Type: **Granular Access Token**
563
+ - Permissions: **Read and write** for `@luanpdd/*` scope
564
+ - **Allow this token to bypass 2FA**: ✅ enabled (required for CI)
565
+
566
+ 3. **Add the token as a GitHub secret**:
567
+ ```bash
568
+ gh secret set NPM_TOKEN
569
+ # paste the npm_xxxxx token when prompted
570
+ ```
571
+
572
+ ### Release flow
573
+
574
+ ```bash
575
+ npm version patch # or minor / major — bumps + commits + tags
576
+ git push --follow-tags
577
+ # GitHub Action runs CLI smoke tests, then `npm publish --provenance`
578
+ ```
579
+
580
+ The publish workflow refuses to ship if `package.json` version doesn't match the tag.
581
+
582
+ The CI workflow runs CLI smoke tests on **Ubuntu / macOS / Windows × Node 20 / 22** on every PR and push to `main`.
583
+
584
+ ---
585
+
586
+ ## Design notes — what we adapted from dotcontext, what we didn't
587
+
588
+ **Adapted (load-bearing simplifications):**
589
+
590
+ 1. **Single registry table** — `src/core/registry.js`. Adding an IDE = one entry, not a new adapter file. Capability differences handled by `null`, not `if/else`.
591
+ 2. **Markdown references over copies** — edit the canonical, all targets see it.
592
+ 3. **Action-based MCP dispatching** — 6 tools instead of 30+. Small surface, easy to remember.
593
+ 4. **CLI ↔ harness ↔ MCP** — `core/` is pure, CLI and MCP are thin transports.
594
+
595
+ **Adapted but reshaped:**
596
+
597
+ 5. **Failure dataset** — `forensics collect/summarize/write-learnings` aggregates `debug/resolved/`, failed `*-VERIFICATION.md`, `forensics/*` into per-agent learning docs.
598
+ 6. **Reflect (LLM pass)** — `forensics reflect` feeds learnings + current agent into an LLM and proposes minimal prompt edits.
599
+ 7. **Replays** — `forensics record-replay / load-replay` for tight prompt iteration.
600
+ 8. **Gates as named files** — extracted into `gates/*.md` with explicit verdict format. Runnable with `gates run`.
601
+
602
+ **Not adapted (over-engineered for a personal kit):**
603
+
604
+ - PREVC state machine, role assignments, sensors/contracts/policies/datasets — too much for personal use.
605
+ - Built-in agents/skills hardcoded — yours come from your `kit/`.
606
+
607
+ ---
608
+
609
+ ## Roadmap (open ideas)
610
+
611
+ - HTTP transport for IDEs that don't speak stdio MCP.
612
+ - `forensics reflect` with diff visual instead of full content.
613
+ - `kit gates run --all` aggregating verdicts of every gate at a stage.
614
+ - Dependabot config to keep `chokidar` and `@modelcontextprotocol/sdk` current.
615
+ - `kit sync watch` exposed via MCP (long-running tool challenge).
616
+
617
+ PRs welcome.
618
+
619
+ ---
620
+
621
+ ## Tests
622
+
623
+ Built on `node:test` (zero dependencies). Two suites:
624
+
625
+ ```bash
626
+ npm test # unit — kit parser, sync (all modes), reverse-sync, gates, registry
627
+ npm run test:integration # integration — spawns bin/cli.js end-to-end on a temp project
628
+ npm run test:all # both
629
+ ```
630
+
631
+ Plus the original quick smokes:
632
+
633
+ ```bash
634
+ node bin/cli.js kit list-agents | head -5 # 47 bundled agents
635
+ node bin/cli.js sync targets # 8 IDEs
636
+ node bin/cli.js gates list # 20 gates
637
+ node bin/cli.js install dry-run claude-code --via npx
638
+ ```
639
+
640
+ CI runs unit + integration + smoke + MCP boot on Ubuntu / macOS / Windows × Node 20 / 22 on every push and PR.
641
+
642
+ ---
643
+
644
+ ## License
645
+
646
+ MIT — see [LICENSE](LICENSE).
647
+
648
+ Copyright © 2026 luanpdd.