jdi-cli 0.1.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 (159) hide show
  1. package/AGENTS.md +209 -0
  2. package/ARCHITECTURE.md +210 -0
  3. package/COMMANDS.md +241 -0
  4. package/CREATE-EXAMPLE.md +385 -0
  5. package/CREATE.md +315 -0
  6. package/EXTENSION.md +141 -0
  7. package/LICENSE +21 -0
  8. package/MEMORY.md +471 -0
  9. package/PORTABILITY.md +438 -0
  10. package/README.md +789 -0
  11. package/bin/git-hooks/post-commit +16 -0
  12. package/bin/git-hooks/pre-commit +21 -0
  13. package/bin/jdi-build.ps1 +381 -0
  14. package/bin/jdi-build.sh +332 -0
  15. package/bin/jdi-doctor.ps1 +403 -0
  16. package/bin/jdi-doctor.sh +400 -0
  17. package/bin/jdi-install-caveman.ps1 +97 -0
  18. package/bin/jdi-install-caveman.sh +99 -0
  19. package/bin/jdi-install-playwright.ps1 +319 -0
  20. package/bin/jdi-install-playwright.sh +284 -0
  21. package/bin/jdi-install.ps1 +154 -0
  22. package/bin/jdi-install.sh +132 -0
  23. package/bin/jdi-uninstall.ps1 +309 -0
  24. package/bin/jdi-uninstall.sh +264 -0
  25. package/bin/jdi-update.ps1 +215 -0
  26. package/bin/jdi-update.sh +209 -0
  27. package/bin/jdi.js +460 -0
  28. package/bin/lib/jdi-monitor.ps1 +66 -0
  29. package/bin/lib/jdi-monitor.sh +74 -0
  30. package/bin/lib/jdi-truncate.ps1 +96 -0
  31. package/bin/lib/jdi-truncate.sh +99 -0
  32. package/bin/lib/ui.js +197 -0
  33. package/core/agents/jdi-adopter.md +465 -0
  34. package/core/agents/jdi-architect.md +894 -0
  35. package/core/agents/jdi-asker.md +153 -0
  36. package/core/agents/jdi-bootstrap.md +247 -0
  37. package/core/agents/jdi-planner.md +254 -0
  38. package/core/agents/jdi-researcher.md +303 -0
  39. package/core/commands/jdi-adopt.md +155 -0
  40. package/core/commands/jdi-bootstrap.md +81 -0
  41. package/core/commands/jdi-create.md +80 -0
  42. package/core/commands/jdi-discuss.md +80 -0
  43. package/core/commands/jdi-do.md +200 -0
  44. package/core/commands/jdi-loop.md +315 -0
  45. package/core/commands/jdi-new.md +131 -0
  46. package/core/commands/jdi-plan.md +73 -0
  47. package/core/commands/jdi-ship.md +146 -0
  48. package/core/commands/jdi-verify.md +159 -0
  49. package/core/skills/clean-code/SKILL.md +261 -0
  50. package/core/skills/dry/SKILL.md +150 -0
  51. package/core/skills/frontend-rules/SKILL.md +386 -0
  52. package/core/skills/frontend-validator/SKILL.md +567 -0
  53. package/core/skills/kiss/SKILL.md +178 -0
  54. package/core/skills/solid/SKILL.md +281 -0
  55. package/core/skills/yagni/SKILL.md +207 -0
  56. package/core/templates/agent.md +72 -0
  57. package/core/templates/doer-specialist.md +216 -0
  58. package/core/templates/reviewer-specialist.md +405 -0
  59. package/core/templates/skill.md +66 -0
  60. package/package.json +70 -0
  61. package/runtimes/antigravity/agents.md +74 -0
  62. package/runtimes/antigravity/skills/clean-code/SKILL.md +252 -0
  63. package/runtimes/antigravity/skills/dry/SKILL.md +141 -0
  64. package/runtimes/antigravity/skills/frontend-rules/SKILL.md +376 -0
  65. package/runtimes/antigravity/skills/frontend-validator/SKILL.md +559 -0
  66. package/runtimes/antigravity/skills/jdi-adopt/SKILL.md +155 -0
  67. package/runtimes/antigravity/skills/jdi-adopter/SKILL.md +436 -0
  68. package/runtimes/antigravity/skills/jdi-architect/SKILL.md +872 -0
  69. package/runtimes/antigravity/skills/jdi-asker/SKILL.md +125 -0
  70. package/runtimes/antigravity/skills/jdi-asker/references/context-template.md +34 -0
  71. package/runtimes/antigravity/skills/jdi-asker/references/decision-format.md +19 -0
  72. package/runtimes/antigravity/skills/jdi-asker/scripts/find_phase_dir.sh +25 -0
  73. package/runtimes/antigravity/skills/jdi-bootstrap/SKILL.md +81 -0
  74. package/runtimes/antigravity/skills/jdi-create/SKILL.md +80 -0
  75. package/runtimes/antigravity/skills/jdi-discuss/SKILL.md +80 -0
  76. package/runtimes/antigravity/skills/jdi-discuss/scripts/run_command.sh +62 -0
  77. package/runtimes/antigravity/skills/jdi-do/SKILL.md +200 -0
  78. package/runtimes/antigravity/skills/jdi-loop/SKILL.md +315 -0
  79. package/runtimes/antigravity/skills/jdi-new/SKILL.md +131 -0
  80. package/runtimes/antigravity/skills/jdi-plan/SKILL.md +73 -0
  81. package/runtimes/antigravity/skills/jdi-planner/SKILL.md +225 -0
  82. package/runtimes/antigravity/skills/jdi-researcher/SKILL.md +274 -0
  83. package/runtimes/antigravity/skills/jdi-ship/SKILL.md +146 -0
  84. package/runtimes/antigravity/skills/jdi-verify/SKILL.md +159 -0
  85. package/runtimes/antigravity/skills/kiss/SKILL.md +169 -0
  86. package/runtimes/antigravity/skills/solid/SKILL.md +272 -0
  87. package/runtimes/antigravity/skills/yagni/SKILL.md +198 -0
  88. package/runtimes/claude/CLAUDE.md +91 -0
  89. package/runtimes/claude/agents/jdi-adopter.md +430 -0
  90. package/runtimes/claude/agents/jdi-architect.md +864 -0
  91. package/runtimes/claude/agents/jdi-asker.md +119 -0
  92. package/runtimes/claude/agents/jdi-bootstrap.md +213 -0
  93. package/runtimes/claude/agents/jdi-planner.md +221 -0
  94. package/runtimes/claude/agents/jdi-researcher.md +269 -0
  95. package/runtimes/claude/commands/jdi-adopt.md +155 -0
  96. package/runtimes/claude/commands/jdi-bootstrap.md +81 -0
  97. package/runtimes/claude/commands/jdi-create.md +80 -0
  98. package/runtimes/claude/commands/jdi-discuss.md +80 -0
  99. package/runtimes/claude/commands/jdi-do.md +200 -0
  100. package/runtimes/claude/commands/jdi-loop.md +315 -0
  101. package/runtimes/claude/commands/jdi-new.md +131 -0
  102. package/runtimes/claude/commands/jdi-plan.md +73 -0
  103. package/runtimes/claude/commands/jdi-ship.md +146 -0
  104. package/runtimes/claude/commands/jdi-verify.md +159 -0
  105. package/runtimes/claude/settings.example.json +132 -0
  106. package/runtimes/claude/skills/clean-code/SKILL.md +247 -0
  107. package/runtimes/claude/skills/dry/SKILL.md +136 -0
  108. package/runtimes/claude/skills/frontend-rules/SKILL.md +369 -0
  109. package/runtimes/claude/skills/frontend-validator/SKILL.md +553 -0
  110. package/runtimes/claude/skills/kiss/SKILL.md +164 -0
  111. package/runtimes/claude/skills/solid/SKILL.md +267 -0
  112. package/runtimes/claude/skills/yagni/SKILL.md +193 -0
  113. package/runtimes/copilot/agents/jdi-adopter.agent.md +430 -0
  114. package/runtimes/copilot/agents/jdi-architect.agent.md +864 -0
  115. package/runtimes/copilot/agents/jdi-asker.agent.md +119 -0
  116. package/runtimes/copilot/agents/jdi-bootstrap.agent.md +213 -0
  117. package/runtimes/copilot/agents/jdi-planner.agent.md +221 -0
  118. package/runtimes/copilot/agents/jdi-researcher.agent.md +269 -0
  119. package/runtimes/copilot/copilot-instructions.md +80 -0
  120. package/runtimes/copilot/prompts/jdi-adopt.prompt.md +155 -0
  121. package/runtimes/copilot/prompts/jdi-bootstrap.prompt.md +81 -0
  122. package/runtimes/copilot/prompts/jdi-create.prompt.md +80 -0
  123. package/runtimes/copilot/prompts/jdi-discuss.prompt.md +80 -0
  124. package/runtimes/copilot/prompts/jdi-do.prompt.md +200 -0
  125. package/runtimes/copilot/prompts/jdi-loop.prompt.md +315 -0
  126. package/runtimes/copilot/prompts/jdi-new.prompt.md +131 -0
  127. package/runtimes/copilot/prompts/jdi-plan.prompt.md +73 -0
  128. package/runtimes/copilot/prompts/jdi-ship.prompt.md +146 -0
  129. package/runtimes/copilot/prompts/jdi-verify.prompt.md +159 -0
  130. package/runtimes/opencode/AGENTS.md +87 -0
  131. package/runtimes/opencode/agents/jdi-adopter.md +434 -0
  132. package/runtimes/opencode/agents/jdi-architect.md +861 -0
  133. package/runtimes/opencode/agents/jdi-asker.md +123 -0
  134. package/runtimes/opencode/agents/jdi-bootstrap.md +217 -0
  135. package/runtimes/opencode/agents/jdi-planner.md +225 -0
  136. package/runtimes/opencode/agents/jdi-researcher.md +273 -0
  137. package/runtimes/opencode/commands/jdi-adopt.md +155 -0
  138. package/runtimes/opencode/commands/jdi-bootstrap.md +81 -0
  139. package/runtimes/opencode/commands/jdi-create.md +80 -0
  140. package/runtimes/opencode/commands/jdi-discuss.md +80 -0
  141. package/runtimes/opencode/commands/jdi-do.md +200 -0
  142. package/runtimes/opencode/commands/jdi-loop.md +315 -0
  143. package/runtimes/opencode/commands/jdi-new.md +131 -0
  144. package/runtimes/opencode/commands/jdi-plan.md +73 -0
  145. package/runtimes/opencode/commands/jdi-ship.md +146 -0
  146. package/runtimes/opencode/commands/jdi-verify.md +159 -0
  147. package/runtimes/opencode/opencode.example.jsonc +169 -0
  148. package/runtimes/opencode/skills/clean-code/SKILL.md +247 -0
  149. package/runtimes/opencode/skills/dry/SKILL.md +136 -0
  150. package/runtimes/opencode/skills/frontend-rules/SKILL.md +369 -0
  151. package/runtimes/opencode/skills/frontend-validator/SKILL.md +553 -0
  152. package/runtimes/opencode/skills/kiss/SKILL.md +164 -0
  153. package/runtimes/opencode/skills/solid/SKILL.md +267 -0
  154. package/runtimes/opencode/skills/yagni/SKILL.md +193 -0
  155. package/templates-jdi-folder/config.json +18 -0
  156. package/templates-jdi-folder/registry.md +31 -0
  157. package/templates-jdi-folder/reviewers.md +33 -0
  158. package/templates-jdi-folder/skills-registry.md +32 -0
  159. package/templates-jdi-folder/specialists.md +39 -0
package/EXTENSION.md ADDED
@@ -0,0 +1,141 @@
1
+ # JDI — Extension
2
+
3
+ Como evoluir o JDI sem inflar. 2 caminhos:
4
+
5
+ 1. **Per-project specialists** (`/jdi-bootstrap`) — gera doer/reviewer customizados pro projeto. Caminho normal.
6
+ 2. **Agents/skills genericos no core** (`/jdi-create`) — cria agent ou skill novo no `core/`. So contributors do JDI fonte.
7
+
8
+ ## Caminho 1: `/jdi-bootstrap` (per-project)
9
+
10
+ Roda no projeto consumindo JDI, apos `/jdi-new`.
11
+
12
+ ```
13
+ cd meu-projeto
14
+ /jdi-new "API REST .NET 10"
15
+ /jdi-bootstrap
16
+ ```
17
+
18
+ Architect modo specialist:
19
+ 1. Le `.jdi/PROJECT.md`
20
+ 2. Faz 6 perguntas (test framework, build/test commands, coverage min, lint, conventions)
21
+ 3. Gera `.jdi/agents/jdi-doer-{slug}.md` e `.jdi/agents/jdi-reviewer-{slug}.md`
22
+ 4. Atualiza routing
23
+ 5. Commit
24
+
25
+ Doer/reviewer ficam **pequenos** (~150-200 linhas cada) porque so cobrem 1 stack.
26
+
27
+ ### Multi-stack (frontend + backend)
28
+
29
+ Atualmente `/jdi-bootstrap` cria 1 doer agregado. Pra projetos com backend + frontend:
30
+
31
+ **Workaround atual:**
32
+ - Doer agregado conhece ambas stacks (mais verbose, ainda menor que doer 100% generico)
33
+ - OU: rode `/jdi-bootstrap` 2 vezes com slugs distintos (ex: `myapp-backend` + `myapp-frontend`)
34
+ - Doer correto invocado por matching de `files_modified` no PLAN.md (futuro: `/jdi-do` faz routing automatico)
35
+
36
+ **Roadmap:** multi-doer nativo em versao futura.
37
+
38
+ ## Caminho 2: `/jdi-create` (core)
39
+
40
+ So contributors do JDI fonte usam. Cria agent ou skill GENERICO no `core/`.
41
+
42
+ ```
43
+ cd /path/to/jdi-source
44
+ /jdi-create "skill com convencoes EF Core 9"
45
+ /jdi-create "specialist pra Rust com cargo + clippy"
46
+ ```
47
+
48
+ Architect modo create:
49
+ 1. 8 perguntas (problema, trigger, input, output, reuso, decision-loop, custo, tools)
50
+ 2. Classificacao automatica:
51
+ - `agent` — tem decision loop proprio
52
+ - `skill` — procedimento reusavel sem loop
53
+ - `composite` — agent + skill
54
+ 3. Validacao com user (approve / edit / cancel)
55
+ 4. Geracao em `core/agents/` ou `core/skills/`
56
+ 5. Build + install
57
+ 6. Commit + audit em `.jdi/registry.md`
58
+
59
+ ## Anti-padroes
60
+
61
+ Architect bloqueia ou avisa em:
62
+
63
+ - **Nome generico** ("review-code", "doer", "checker") — pede foco especifico
64
+ - **Specialist por feature** ("auth-specialist") — redireciona pra phase
65
+ - **Skill > 500 linhas estimadas** — sugere agent
66
+ - **Agent sem decision loop** — sugere skill
67
+ - **Soft cap > 15 agents core ou > 25 skills** — avisa, nao bloqueia
68
+ - **Nome colide com agent/skill existente** — obriga renomear
69
+
70
+ ## Quando criar agent vs skill
71
+
72
+ | Pergunta | Agent | Skill |
73
+ |---|---|---|
74
+ | Tem decision loop? | sim | nao |
75
+ | Multiplos callers? | nao (1 caller fica natural) | sim (varios agents reusam) |
76
+ | Output proprio (file)? | sim | nao (modifica pai) |
77
+ | Privilegios proprios? | sim | herda do pai |
78
+ | Tamanho tipico | 100-500 linhas | 50-200 linhas |
79
+
80
+ Em duvida -> agent. Refatora pra skill depois se virar reusavel.
81
+
82
+ ## Quando criar specialist vs usar generico
83
+
84
+ | Cenario | Specialist | Doer generico |
85
+ |---|---|---|
86
+ | Stack conhecida e estavel | x | - |
87
+ | Multi-stack mesmo projeto | x (1 por stack) | - |
88
+ | Convencoes especificas (naming, error handling) | x | - |
89
+ | Codigo legacy com regras unicas | x | - |
90
+ | Projeto experimental, nao definido | - | x |
91
+ | POC rapido (vai jogar fora) | - | x |
92
+
93
+ JDI default = specialist. Generico eh fallback.
94
+
95
+ ## Checklist pra novo specialist
96
+
97
+ Apos `/jdi-bootstrap` rodar, conferir:
98
+
99
+ - [ ] `.jdi/agents/jdi-doer-{slug}.md` existe e tem regras especificas (nao default genericas)
100
+ - [ ] `.jdi/agents/jdi-reviewer-{slug}.md` existe com gates 1-6 customizados
101
+ - [ ] `.jdi/specialists.md` tem linha do doer
102
+ - [ ] `.jdi/reviewers.md` tem linha do reviewer
103
+ - [ ] `.jdi/registry.md` tem entrada R-N audit trail
104
+ - [ ] STATE.md tem `specialists_ready: true`
105
+
106
+ Se algum falta, rode bootstrap de novo (idempotente — pergunta antes de sobrescrever).
107
+
108
+ ## Checklist pra novo agent core
109
+
110
+ Apos `/jdi-create` rodar, conferir:
111
+
112
+ - [ ] `core/agents/jdi-{nome}.md` ou `core/skills/{nome}/SKILL.md` existe
113
+ - [ ] Frontmatter completo (name, description, runtime_intent, tools_canonical, triggers, runtime_overrides)
114
+ - [ ] `<role>`, `<process>`, `<rules>`, `<output>` blocks presentes
115
+ - [ ] Build rodou (runtimes/ tem o agent novo nos 4 runtimes)
116
+ - [ ] Install rodou (runtime ativo tem o agent)
117
+ - [ ] `.jdi/registry.md` tem entrada R-N
118
+
119
+ ## Manutencao
120
+
121
+ Specialists envelhecem com o projeto (stack muda, conventions evoluem). Pra atualizar:
122
+
123
+ ```
124
+ # Edita manual:
125
+ edit .jdi/agents/jdi-doer-{slug}.md
126
+
127
+ # OU: regera (perde customizacoes manuais)
128
+ rm .jdi/agents/jdi-doer-{slug}.md
129
+ /jdi-bootstrap
130
+ ```
131
+
132
+ Recomendacao: edita manual pra mudancas pequenas (novas conventions). Regera so se stack mudou drasticamente.
133
+
134
+ ## Limites duros
135
+
136
+ - Max 5 agents core (atual: 5)
137
+ - Max 4 templates em `core/templates/` (atual: 4)
138
+ - Soft cap 25 skills core (atual: 0 — JDI nao usa skills no core ainda)
139
+ - Per-project: sem limite formal de specialists (mas projeto realista tem 1-3)
140
+
141
+ JDI cresce **com cuidado**. Se vai passar dos limites, considera fork dedicado em vez de inflar o core.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alison Amorim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/MEMORY.md ADDED
@@ -0,0 +1,471 @@
1
+ # JDI — State Schema
2
+
3
+ State em arquivo plano. Sem DB. Sem servidor. Markdown + YAML frontmatter quando precisa.
4
+
5
+ Decisoes locked ficam em `DECISIONS.md`. Audit trail dos specialists/agents criados ficam em `registry.md`. Aprendizado de phase fica em `SUMMARY.md` e `REVIEW.md` por phase.
6
+
7
+ ## Arvore completa
8
+
9
+ ```
10
+ .jdi/
11
+ +-- PROJECT.md visao + stack + code-design LOCKED. Imutavel apos /jdi-new
12
+ +-- ROADMAP.md phases sequencial, status por linha
13
+ +-- STATE.md current_phase + next_step + flags. Atualizado por comandos
14
+ +-- DECISIONS.md append-only. ADR mini. D-1, D-2, ...
15
+ +-- config.json token/context budget + thresholds. Editavel
16
+ +-- specialists.md routing per-project (gerado por /jdi-bootstrap)
17
+ +-- reviewers.md routing per-project
18
+ +-- registry.md audit trail (R-1, R-2, ...) — tudo que /jdi-create ou /jdi-bootstrap criou
19
+ +-- todos.md scope creep capturado pelo asker (opcional)
20
+ +-- agents/ per-project specialists
21
+ | +-- jdi-doer-{slug}.md
22
+ | +-- jdi-reviewer-{slug}.md
23
+ +-- phases/
24
+ | +-- 01-setup-api/
25
+ | | +-- CONTEXT.md saida do /jdi-discuss (asker)
26
+ | | +-- PLAN.md saida do /jdi-plan (planner)
27
+ | | +-- SUMMARY.md saida do /jdi-do (doer)
28
+ | | +-- REVIEW.md saida do /jdi-verify (reviewer)
29
+ | | +-- LOOP.md audit trail do /jdi-loop (so se ralph mode foi usado)
30
+ | +-- 02-...
31
+ +-- archive/ phases antigas movidas (opcional)
32
+ ```
33
+
34
+ Nada de `templates-jdi-folder/` copiado pra `.jdi/`. Files sao gerados direto pelos comandos:
35
+ - `/jdi-new` cria PROJECT, ROADMAP, STATE, DECISIONS, config.json, .gitattributes
36
+ - `/jdi-bootstrap` cria specialists.md, reviewers.md, registry.md + agents/*
37
+
38
+ Excecao: `config.json` eh copiado direto de `templates-jdi-folder/config.json` (defaults estaveis) — `/jdi-new` so copia se ausente. User edita pra customizar budget.
39
+
40
+ ---
41
+
42
+ ## PROJECT.md
43
+
44
+ ```markdown
45
+ # {project_name}
46
+
47
+ ## Visao
48
+ 1-3 linhas. O que o projeto resolve.
49
+
50
+ ## Tipo
51
+ web app | cli | api | lib | mobile
52
+
53
+ ## Stack
54
+ - Linguagem: {linguagem + versao}
55
+ - Framework: {framework + versao}
56
+ - Dependencias chave: {lista}
57
+
58
+ ## Code Design
59
+ **LOCKED:** {DDD | Vertical Slice | Hexagonal | Clean | The Method}
60
+
61
+ Decidido em /jdi-new (D-1). Nao mudar.
62
+
63
+ ## Slug
64
+ {project_slug} # usado em commits, branches, specialist names
65
+
66
+ ## Research notes (opcional)
67
+ - {fato 1}
68
+ - {fato 2}
69
+
70
+ ## Constraints globais
71
+ - Coverage minimo 80%
72
+ - Conventional Commits
73
+ - Atomic commits por task
74
+ - Idioma: codigo en, discussao pt-BR
75
+ ```
76
+
77
+ **Quem edita:** `/jdi-new` cria. Posterior: edit manual (sem comando dedicado). Agentes nao mexem.
78
+
79
+ **Tamanho:** max 80 linhas. Conciso.
80
+
81
+ ---
82
+
83
+ ## ROADMAP.md
84
+
85
+ ```markdown
86
+ # {project_name} — Roadmap
87
+
88
+ ## Status
89
+ current_phase: 1
90
+ total_phases: {N}
91
+
92
+ ## Phases
93
+
94
+ ### Phase 1: {nome}
95
+ - **Slug:** 01-{slug}
96
+ - **Status:** done | ready | pending
97
+ - **Goal:** 1 linha
98
+ - **Verdict:** APPROVED | APPROVED_WITH_WARNINGS | BLOCKED (so apos /jdi-verify)
99
+ ```
100
+
101
+ **Quem edita:** `/jdi-new` cria. `/jdi-ship` atualiza status. `/jdi-discuss` pode editar pra clarificar goal (raro).
102
+
103
+ ---
104
+
105
+ ## STATE.md
106
+
107
+ ```markdown
108
+ # {project_name} — State
109
+
110
+ project_slug: {slug}
111
+ specialists_ready: true | false
112
+ current_phase: 1
113
+ phase_status: ready | discussed | planned | executed | verified | done | looping | paused | blocked
114
+ phase_verdict: APPROVED | APPROVED_WITH_WARNINGS | BLOCKED (apos verify)
115
+ next_step: /jdi-discuss 1
116
+ ```
117
+
118
+ **Quem edita:** todos os comandos atualizam apos rodar.
119
+
120
+ **Lifespan:** sobrescreve a cada commit do orchestrator. Sem historico — git log cobre.
121
+
122
+ **Status especificos do `/jdi-loop`:**
123
+ - `looping` — `/jdi-loop` em execucao (ralph mode), LOOP.md tem detalhe de iter atual
124
+ - `paused` — user escolheu "Ajustar plano" no human gate, edita PLAN.md/CONTEXT.md e re-roda /jdi-loop
125
+ - `blocked` — `/jdi-verify` retornou BLOCKED OU `/jdi-loop` foi escalated/killed (revisao humana necessaria)
126
+
127
+ ---
128
+
129
+ ## config.json
130
+
131
+ ```json
132
+ {
133
+ "$schema_version": "1.1",
134
+ "context_window": 200000,
135
+ "thresholds": {
136
+ "warn_pct": 60,
137
+ "critical_pct": 70
138
+ },
139
+ "budgets": {
140
+ "max_context_chars": 6000,
141
+ "max_plan_chars": 12000,
142
+ "max_summary_chars": 8192
143
+ },
144
+ "compaction": {
145
+ "keep_phases": 2,
146
+ "archive_after": 5
147
+ },
148
+ "coverage_min": 80
149
+ }
150
+ ```
151
+
152
+ **Quem edita:** `/jdi-new` escreve direto via Write se ausente (default inline no prompt do comando). `templates-jdi-folder/config.json` eh a referencia canonica do default, shipped pelo pacote npm. User edita manualmente apos. Comandos so leem.
153
+
154
+ **Campos:**
155
+ - `context_window` — janela do model em uso. 200k = default (Claude Sonnet/Opus). 1_000_000 pra 1M-window models.
156
+ - `thresholds.warn_pct` — quando orchestrator avisa "context aquecendo". Default 60%.
157
+ - `thresholds.critical_pct` — quando orchestrator sugere `/jdi-thread`. Default 70% (zona de fracture, baseado em pesquisa de context rot).
158
+ - `budgets.max_*_chars` — caps usados por commands ao truncar artefatos antes de inline. Heuristica: ~4 chars/token.
159
+ - `compaction.keep_phases` — quantas phases anteriores ficam ativas em `.jdi/phases/`. Resto vai pra `.jdi/archive/`.
160
+ - `compaction.archive_after` — phases acima deste delta movem pra archive (executado por `/jdi-ship`).
161
+ - `coverage_min` — overrideavel por PROJECT.md. Reviewer usa.
162
+
163
+ **Lifespan:** vida do projeto. Versionado em git.
164
+
165
+ **Lido por:** `/jdi-do`, `/jdi-plan`, `/jdi-verify`, `/jdi-ship` (para compaction). Specialists (doer/reviewer) leem `coverage_min`.
166
+
167
+ ---
168
+
169
+ ## DECISIONS.md
170
+
171
+ ```markdown
172
+ # {project_name} — Decisoes locked
173
+
174
+ D-1 (2026-05-09): Code design = Vertical Slice. Justificativa: ...
175
+ D-2 (2026-05-09, phase 1): Tests project setup ja na phase 1. Razao: ...
176
+ D-3 (2026-05-09, phase 1): Connection string via dotnet user-secrets em dev. ...
177
+ D-4 (2026-05-10, phase 2): Validacao via FluentValidation. Razao: ...
178
+ ```
179
+
180
+ **Quem edita:** APPEND-ONLY. `/jdi-new` cria com D-1. `/jdi-discuss` adiciona D-XX por phase.
181
+
182
+ **Regras:**
183
+ - D-X nunca volta — decisao locked = imutavel
184
+ - Cada D-X tem data + phase (se aplicavel) + justificativa em 1 linha
185
+
186
+ ---
187
+
188
+ ## specialists.md
189
+
190
+ ```markdown
191
+ | Stack | Agent | Trigger |
192
+ |---|---|---|
193
+ | .NET 10 + React 19 (todo-app) | jdi-doer-todo-app | default executor pra phases do todo-app |
194
+ | Rust (rust-cli) | jdi-doer-rust-cli | files *.rs |
195
+ ```
196
+
197
+ **Quem edita:** `/jdi-bootstrap` cria/append. Ou edit manual pra multi-stack.
198
+
199
+ **Uso:** `/jdi-do N` consulta pra resolver qual doer invocar.
200
+
201
+ ---
202
+
203
+ ## reviewers.md
204
+
205
+ ```markdown
206
+ | Agent | Trigger | Bloqueia ship? |
207
+ |---|---|---|
208
+ | jdi-reviewer-todo-app | /jdi-verify | sim, se BLOCKED |
209
+ ```
210
+
211
+ **Quem edita:** `/jdi-bootstrap` cria/append.
212
+
213
+ **Uso:** `/jdi-verify N` consulta pra resolver qual reviewer invocar.
214
+
215
+ ---
216
+
217
+ ## registry.md
218
+
219
+ ```markdown
220
+ ## R-1 (2026-05-09)
221
+ **Tipo:** specialist (doer + reviewer)
222
+ **Slug:** todo-app
223
+ **Stack:** .NET 10 + React 19
224
+ **Files:** .jdi/agents/jdi-doer-todo-app.md, .jdi/agents/jdi-reviewer-todo-app.md
225
+
226
+ ## R-2 (2026-05-15)
227
+ **Tipo:** agent
228
+ **Nome:** jdi-rust-specialist
229
+ **Criado por:** /jdi-create (no repo JDI)
230
+ **Por que:** demanda real de users com projetos Rust
231
+ **Files:** core/agents/jdi-rust-specialist.md
232
+ **Integration:** .jdi/specialists.md
233
+ ```
234
+
235
+ **Quem edita:** APPEND-ONLY. `/jdi-bootstrap` adiciona R-N. `/jdi-create` adiciona R-N (no repo JDI fonte).
236
+
237
+ ---
238
+
239
+ ## todos.md (opcional)
240
+
241
+ ```markdown
242
+ # Scope creep
243
+
244
+ - [ ] (phase 2) usuario pediu auth — mover pra phase futura
245
+ - [ ] (phase 3) refactor de N+1 query no GET /todos — issue #42
246
+ ```
247
+
248
+ **Quem edita:** `/jdi-discuss` (asker) append quando user pede coisa fora do escopo.
249
+
250
+ ---
251
+
252
+ ## phases/{NN-slug}/CONTEXT.md
253
+
254
+ ```markdown
255
+ # Phase {N}: {nome} — Context
256
+
257
+ ## Goal (do ROADMAP)
258
+ {texto}
259
+
260
+ ## Decisoes locked desta phase
261
+
262
+ ### D-X: {titulo curto}
263
+ {justificativa 1-3 linhas}
264
+
265
+ ### D-Y: ...
266
+
267
+ ## Canonical refs
268
+ - {url ou path}
269
+
270
+ ## Scope creep capturado em todos.md
271
+ {lista, ou "(nenhum)"}
272
+ ```
273
+
274
+ **Quem edita:** `/jdi-discuss` cria.
275
+
276
+ **Tamanho:** max 1500 tokens (~80 linhas). Conciso.
277
+
278
+ ---
279
+
280
+ ## phases/{NN-slug}/PLAN.md
281
+
282
+ ```markdown
283
+ # Phase {N}: {nome} — Plan
284
+
285
+ ## Goal
286
+ {do ROADMAP}
287
+
288
+ ## Decisoes locked (do CONTEXT.md)
289
+ - D-X: ...
290
+ - D-Y: ...
291
+
292
+ ## Tasks
293
+
294
+ ### Wave 1 (paralelo possivel)
295
+
296
+ #### T-{N}.1: {objetivo curto}
297
+ - **Files modified:** `{path1}`, `{path2}`
298
+ - **Acceptance:**
299
+ - {criterio 1}
300
+ - {criterio 2}
301
+ - **Dependencies:** none
302
+ - **Test:** {qual teste}
303
+ - **Status:** pending | completed | blocked
304
+
305
+ ### Wave 2
306
+
307
+ #### T-{N}.2: ...
308
+ - **Dependencies:** T-{N}.1
309
+
310
+ ## Execution
311
+ - Total tasks: {M}
312
+ - Waves: {W}
313
+
314
+ ## Files modified (todas tasks)
315
+ - {file1}
316
+ - {file2}
317
+
318
+ ## Test requirements
319
+ - {tipo}: {comando}
320
+ - Coverage minimo: {%}
321
+ ```
322
+
323
+ **Quem edita:** `/jdi-plan` cria. `/jdi-do` atualiza `Status:` de cada task.
324
+
325
+ **Tamanho:** max 200 linhas. Conciso.
326
+
327
+ ---
328
+
329
+ ## phases/{NN-slug}/SUMMARY.md
330
+
331
+ ```markdown
332
+ # Phase {N}: {nome} — Summary
333
+
334
+ **Status:** complete | partial
335
+ **Tasks:** {done}/{total} completas, {blocked} blocked
336
+
337
+ ## Tasks executadas
338
+ - T-{N}.1: ...
339
+ - T-{N}.2: ...
340
+
341
+ ## Tasks blocked (se houver)
342
+ - T-{N}.X: razao
343
+
344
+ ## Files modified
345
+ - ...
346
+
347
+ ## Tests
348
+ - Backend: dotnet test - {N} passing
349
+ - Frontend: vitest - {N} passing
350
+ - Coverage: {%}
351
+ ```
352
+
353
+ **Quem edita:** `/jdi-do` cria ao final.
354
+
355
+ ---
356
+
357
+ ## phases/{NN-slug}/REVIEW.md
358
+
359
+ ```markdown
360
+ # Phase {N}: Review
361
+
362
+ **Veredicto:** APPROVED | APPROVED_WITH_WARNINGS | BLOCKED
363
+
364
+ ## Gates
365
+ | Gate | Status | Detalhes |
366
+ |---|---|---|
367
+ | 1. Build | PASS/BLOCK | ... |
368
+ | 2. Tests | PASS/BLOCK | {X}/{Y} passing |
369
+ | 3. Coverage | PASS/BLOCK | {%}, threshold {COVERAGE_MIN}% |
370
+ | 4. Lint | PASS/WARN | ... |
371
+ | 5. Security | PASS/WARN/BLOCK | ... |
372
+ | 6. Consistency | PASS/WARN | ... |
373
+
374
+ ## Blockers (se houver)
375
+ - ...
376
+
377
+ ## Warnings (se houver)
378
+ - ...
379
+
380
+ ## Recomendacao
381
+ {texto curto sobre o que fazer}
382
+ ```
383
+
384
+ **Quem edita:** `/jdi-verify` cria.
385
+
386
+ ---
387
+
388
+ ## phases/{NN-slug}/LOOP.md (opcional, so com /jdi-loop)
389
+
390
+ ```markdown
391
+ ---
392
+ phase: {N}
393
+ iter: 3
394
+ total_resets: 1
395
+ status: running | converged | escalated | paused | killed
396
+ max_iter_per_round: 5
397
+ max_resets: 3
398
+ created_at: 2026-05-10T10:30:00-03:00
399
+ ---
400
+
401
+ ## History (append-only)
402
+
403
+ - iter 1: BLOCKED, hash=abc123def4, commit=f8d2a1, ts=2026-05-10T10:31:00-03:00
404
+ - iter 2: BLOCKED, hash=abc123def4, commit=a91c33, ts=2026-05-10T10:33:00-03:00 ← oscillation!
405
+ - iter 3: BLOCKED, hash=de45ef9012, commit=2b3d77, ts=2026-05-10T10:36:00-03:00
406
+ - iter 4: BLOCKED, hash=de45ef9012, commit=8e1c44, ts=2026-05-10T10:38:00-03:00
407
+ - iter 5: BLOCKED, hash=11aa22bb33, commit=4f9e21, ts=2026-05-10T10:40:00-03:00
408
+ --- RESET 1 em 2026-05-10T10:42:00-03:00 ---
409
+ - iter 1: APPROVED_WITH_WARNINGS, hash=00ff11ee22, commit=c1d2e3, ts=2026-05-10T10:45:00-03:00
410
+ ```
411
+
412
+ **Quem edita:** `/jdi-loop` cria/append. Ninguem mais toca.
413
+
414
+ **Regras:**
415
+ - Frontmatter `iter` + `total_resets` + `status` sao MUTAVEIS (sobrescreve)
416
+ - Bloco `## History` eh APPEND-ONLY (audit trail completo, oscillation detection precisa)
417
+ - `hash` = SHA256 truncado dos blockers/warnings normalizados — pra comparar iter N vs N-1
418
+ - `status: converged` => phase pode prosseguir pra `/jdi-ship`
419
+ - `status: killed` => hard cap atingido, requer revisao humana de PLAN/CONTEXT
420
+ - `status: escalated|paused` => user interveio, re-rodar `/jdi-loop {N}` retoma
421
+
422
+ **States transitions:**
423
+ ```
424
+ running → converged (verdict APPROVED ou APPROVED_WITH_WARNINGS)
425
+ running → escalated (user escolheu abort no human gate)
426
+ running → paused (user escolheu ajustar plan no human gate)
427
+ running → killed (total_resets >= max_resets)
428
+ escalated|paused → running (re-rodar /jdi-loop retoma)
429
+ ```
430
+
431
+ ---
432
+
433
+ ## Niveis de memoria
434
+
435
+ | Nivel | Arquivo | Lifespan |
436
+ |---|---|---|
437
+ | Projeto | `PROJECT.md` | Vida do projeto (immutable apos /jdi-new) |
438
+ | Roadmap | `ROADMAP.md` | Vida do projeto (atualiza com /jdi-ship) |
439
+ | Config | `config.json` | Vida do projeto, editavel manual |
440
+ | Decisao | `DECISIONS.md` | Append-only, nunca apaga |
441
+ | Routing | `specialists.md`, `reviewers.md` | Append-only |
442
+ | Audit | `registry.md` | Append-only |
443
+ | Sessao | `STATE.md` | Sobrescreve |
444
+ | Phase | `phases/NN/CONTEXT.md`, `PLAN.md`, `SUMMARY.md`, `REVIEW.md` | Vida da phase |
445
+ | Loop | `phases/NN/LOOP.md` | Vida da phase, append-only, so com /jdi-loop |
446
+ | Backlog | `todos.md` | Append-only, opcional |
447
+
448
+ **Sem MEMORY.md generico (v1).** Era catch-all que ficava bagunçado. Substituido por:
449
+ - DECISIONS.md (decisoes formais)
450
+ - registry.md (criacoes de agents/specialists)
451
+ - SUMMARY.md por phase (aprendizado de execucao)
452
+ - REVIEW.md por phase (warns/blockers como aprendizado)
453
+
454
+ ---
455
+
456
+ ## Read-depth por nivel (token budget)
457
+
458
+ Regra dura — referencia em `ARCHITECTURE.md > Read-depth scaling`. Resumo aqui pra quem le so MEMORY.md:
459
+
460
+ | Distancia da phase atual | Read permitido |
461
+ |---|---|
462
+ | Phase atual (`current_phase`) | Corpo inteiro |
463
+ | Phase anterior (`current_phase - 1`) | Frontmatter + veredict do REVIEW apenas |
464
+ | `<= current_phase - 2` | Nao ler corpo. Listar/`head` apenas |
465
+ | `.jdi/archive/` | Tratar como phase distante. Nao ler corpo |
466
+
467
+ PROJECT.md, ROADMAP.md, DECISIONS.md, config.json: leitura full **permitida** sempre — sao curtos por design e estaveis (bons candidatos a prompt cache prefix).
468
+
469
+ Excecoes:
470
+ - `jdi-asker` le ate 2 CONTEXT.md anteriores (regra do agent)
471
+ - `jdi-verify N` le PLAN.md de phase N-1 se task atual referencia `D-XX` daquela phase (rastreabilidade)