@eltonssouza/development-utility-kit 1.0.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 (137) hide show
  1. package/.claude/agents/analyst.md +198 -0
  2. package/.claude/agents/backend-developer.md +126 -0
  3. package/.claude/agents/brain-keeper.md +229 -0
  4. package/.claude/agents/code-reviewer.md +181 -0
  5. package/.claude/agents/database-engineer.md +94 -0
  6. package/.claude/agents/devops-engineer.md +141 -0
  7. package/.claude/agents/frontend-developer.md +97 -0
  8. package/.claude/agents/gate-keeper.md +118 -0
  9. package/.claude/agents/migrator.md +291 -0
  10. package/.claude/agents/mobile-developer.md +80 -0
  11. package/.claude/agents/n8n-specialist.md +94 -0
  12. package/.claude/agents/product-owner.md +115 -0
  13. package/.claude/agents/qa-engineer.md +232 -0
  14. package/.claude/agents/release-engineer.md +204 -0
  15. package/.claude/agents/scaffold.md +87 -0
  16. package/.claude/agents/security-engineer.md +199 -0
  17. package/.claude/agents/sprint-runner.md +44 -0
  18. package/.claude/agents/stack-resolver.md +84 -0
  19. package/.claude/agents/tech-lead.md +182 -0
  20. package/.claude/agents/update-template.md +54 -0
  21. package/.claude/agents/ux-designer.md +118 -0
  22. package/.claude/settings.json +44 -0
  23. package/.claude/skills/README.md +332 -0
  24. package/.claude/skills/active-project/SKILL.md +129 -0
  25. package/.claude/skills/api-integration-test/SKILL.md +64 -0
  26. package/.claude/skills/auto-test-guard/SKILL.md +237 -0
  27. package/.claude/skills/auto-test-guard/resources/backend-tests.md +20 -0
  28. package/.claude/skills/auto-test-guard/resources/e2e-tests.md +24 -0
  29. package/.claude/skills/auto-test-guard/resources/execution-report.md +49 -0
  30. package/.claude/skills/auto-test-guard/resources/frontend-tests.md +18 -0
  31. package/.claude/skills/auto-test-guard/resources/initial-setup.md +108 -0
  32. package/.claude/skills/auto-test-guard/resources/run-suite.md +48 -0
  33. package/.claude/skills/auto-test-guard/resources/senior-gate.md +19 -0
  34. package/.claude/skills/brain-keeper/SKILL.md +60 -0
  35. package/.claude/skills/brain-keeper/obsidian/app.json +9 -0
  36. package/.claude/skills/brain-keeper/obsidian/appearance.json +4 -0
  37. package/.claude/skills/brain-keeper/obsidian/core-plugins.json +20 -0
  38. package/.claude/skills/brain-keeper/obsidian/daily-notes.json +5 -0
  39. package/.claude/skills/brain-keeper/obsidian/graph.json +32 -0
  40. package/.claude/skills/brain-keeper/obsidian/snippets/folder-colors.css +90 -0
  41. package/.claude/skills/brain-keeper/obsidian/templates.json +5 -0
  42. package/.claude/skills/brain-keeper/templates/README.md +51 -0
  43. package/.claude/skills/brain-keeper/templates/adr.md +40 -0
  44. package/.claude/skills/brain-keeper/templates/bug.md +35 -0
  45. package/.claude/skills/brain-keeper/templates/daily.md +38 -0
  46. package/.claude/skills/brain-keeper/templates/feature.md +62 -0
  47. package/.claude/skills/brain-keeper/templates/meeting.md +34 -0
  48. package/.claude/skills/brain-keeper/templates/tech-debt.md +21 -0
  49. package/.claude/skills/caveman/SKILL.md +187 -0
  50. package/.claude/skills/create-stack-pack/SKILL.md +281 -0
  51. package/.claude/skills/grill-me/SKILL.md +79 -0
  52. package/.claude/skills/honcho-memory/SKILL.md +207 -0
  53. package/.claude/skills/honcho-memory/docs/api-endpoints-verified.md +75 -0
  54. package/.claude/skills/honcho-memory/hooks/on-prompt-submit.js +221 -0
  55. package/.claude/skills/honcho-memory/hooks/on-stop.js +193 -0
  56. package/.claude/skills/honcho-memory/lib/honcho-client.js +363 -0
  57. package/.claude/skills/honcho-memory/lib/memory-injector.js +93 -0
  58. package/.claude/skills/honcho-memory/package.json +32 -0
  59. package/.claude/skills/honcho-memory/scripts/cli.js +370 -0
  60. package/.claude/skills/honcho-memory/scripts/setup.js +109 -0
  61. package/.claude/skills/honcho-memory/tests/t001-api-endpoints-verified.test.js +89 -0
  62. package/.claude/skills/honcho-memory/tests/t002-structure.test.js +97 -0
  63. package/.claude/skills/honcho-memory/tests/t003-honcho-client.test.js +162 -0
  64. package/.claude/skills/honcho-memory/tests/t004-soft-delete.test.js +259 -0
  65. package/.claude/skills/honcho-memory/tests/t005-memory-injector.test.js +175 -0
  66. package/.claude/skills/honcho-memory/tests/t006-on-prompt-submit.test.js +215 -0
  67. package/.claude/skills/honcho-memory/tests/t007-on-stop.test.js +165 -0
  68. package/.claude/skills/honcho-memory/tests/t008-cli.test.js +214 -0
  69. package/.claude/skills/honcho-memory/tests/t009-setup.test.js +232 -0
  70. package/.claude/skills/honcho-memory/tests/t010-skill-md.test.js +114 -0
  71. package/.claude/skills/honcho-memory/tests/t011-settings-hooks.test.js +105 -0
  72. package/.claude/skills/honcho-memory/tests/t012-docs-update.test.js +106 -0
  73. package/.claude/skills/honcho-memory/tests/t013-smoke-e2e.test.js +90 -0
  74. package/.claude/skills/pair-debug/SKILL.md +288 -0
  75. package/.claude/skills/prd-ready-check/SKILL.md +58 -0
  76. package/.claude/skills/project-manager/SKILL.md +167 -0
  77. package/.claude/skills/quality-standards/SKILL.md +201 -0
  78. package/.claude/skills/quick-feature/SKILL.md +264 -0
  79. package/.claude/skills/run-sprint/SKILL.md +342 -0
  80. package/.claude/skills/scaffold/SKILL.md +58 -0
  81. package/.claude/skills/stack-discovery/SKILL.md +159 -0
  82. package/.claude/skills/test-coverage-auditor/SKILL.md +59 -0
  83. package/.claude/skills/to-issues/SKILL.md +163 -0
  84. package/.claude/skills/to-prd/SKILL.md +130 -0
  85. package/.claude/skills/update-template/SKILL.md +254 -0
  86. package/.claude/stacks/CODEOWNERS +30 -0
  87. package/.claude/stacks/README.md +88 -0
  88. package/.claude/stacks/_template.md +116 -0
  89. package/.claude/stacks/java/spring-boot-3.md +376 -0
  90. package/.claude/stacks/java/spring-boot-4.md +438 -0
  91. package/.claude/stacks/typescript/angular-18.md +420 -0
  92. package/.claude/stacks/typescript/angular-19.md +397 -0
  93. package/.claude/stacks/typescript/angular-21.md +494 -0
  94. package/CLAUDE.md +453 -0
  95. package/README.md +391 -0
  96. package/bin/cli.js +773 -0
  97. package/bin/lib/backup.js +62 -0
  98. package/bin/lib/detect-stack.js +476 -0
  99. package/bin/lib/help.js +233 -0
  100. package/bin/lib/identity.js +108 -0
  101. package/bin/lib/local-dir.js +69 -0
  102. package/bin/lib/manifest.js +236 -0
  103. package/bin/lib/sync-all.js +394 -0
  104. package/bin/lib/version-check.js +398 -0
  105. package/dashboard/db.js +199 -0
  106. package/dashboard/package.json +22 -0
  107. package/dashboard/public/app.js +709 -0
  108. package/dashboard/public/content/docs/agents-reference.en.md +911 -0
  109. package/dashboard/public/content/docs/architecture-overview.en.md +260 -0
  110. package/dashboard/public/content/docs/autonomy-matrix.en.md +186 -0
  111. package/dashboard/public/content/docs/git-flow.en.md +525 -0
  112. package/dashboard/public/content/docs/honcho-memory.en.md +394 -0
  113. package/dashboard/public/content/docs/hooks-reference.en.md +420 -0
  114. package/dashboard/public/content/docs/pipeline.en.md +400 -0
  115. package/dashboard/public/content/docs/quality-gate.en.md +315 -0
  116. package/dashboard/public/content/docs/skills-reference.en.md +500 -0
  117. package/dashboard/public/content/docs/stack-rules.en.md +362 -0
  118. package/dashboard/public/content/docs/troubleshooting.en.md +637 -0
  119. package/dashboard/public/content/manifest.json +102 -0
  120. package/dashboard/public/content/manual/backend.en.md +1138 -0
  121. package/dashboard/public/content/manual/existing-project.en.md +831 -0
  122. package/dashboard/public/content/manual/frontend.en.md +1065 -0
  123. package/dashboard/public/content/manual/fullstack.en.md +1508 -0
  124. package/dashboard/public/content/manual/mobile.en.md +866 -0
  125. package/dashboard/public/index.html +108 -0
  126. package/dashboard/public/style.css +610 -0
  127. package/dashboard/public/vendor/marked.min.js +69 -0
  128. package/dashboard/rtk.js +143 -0
  129. package/dashboard/server-app.js +403 -0
  130. package/dashboard/server.js +104 -0
  131. package/dashboard/test/sprint1.test.js +406 -0
  132. package/dashboard/test/sprint2.test.js +571 -0
  133. package/dashboard/test/sprint3.test.js +560 -0
  134. package/package.json +33 -0
  135. package/scripts/hooks/subagent-telemetry.sh +14 -0
  136. package/scripts/hooks/telemetry-writer.js +250 -0
  137. package/scripts/latest-versions.json +56 -0
@@ -0,0 +1,260 @@
1
+ # Architecture overview
2
+
3
+ The development-utility-kit is a harness for fullstack development with Claude Code and Cowork. The architecture is **deliberately simple**: two functional layers (Skills + Agents), a single entry point (the Skill that matches the prompt), and a cross-cutting Hooks layer that intercepts tools and prompts.
4
+
5
+ There is no command layer. The `commands/` layer was removed on 2026-05-25 and replaced by the catch-all Skill `project-manager`, which routes any prompt without a specific skill to the correct specialist agent.
6
+
7
+ This document describes the mental model you need to understand why a prompt about "create endpoint" ends up executing code in `backend-developer`, or why a request to "run sprint 3" dispatches `qa-engineer`, `backend-developer`, `frontend-developer`, and `gate-keeper` in parallel.
8
+
9
+ ## Macro model
10
+
11
+ ```
12
+ ┌──────────────────────────────────────────┐
13
+ │ USER PROMPT │
14
+ │ "create endpoint for product signup" │
15
+ └────────────────────┬─────────────────────┘
16
+
17
+
18
+ ┌────────────────────────────────────────────┐
19
+ │ UserPromptSubmit hook │
20
+ │ scripts/hooks/prompt-gate-reminder.sh │
21
+ │ injects [HONCHO MEMORY] + gate reminders │
22
+ └────────────────────┬───────────────────────┘
23
+
24
+
25
+ ┌────────────────────────────────────────────┐
26
+ │ SKILL MATCHER (Cowork / Claude Code) │
27
+ │ matches keywords against description: of │
28
+ │ skills in .claude/skills/<slug>/SKILL.md │
29
+ └────────────────────┬───────────────────────┘
30
+
31
+ ┌────────────────┴────────────────┐
32
+ │ │
33
+ ▼ ▼
34
+ specific skill matched no specific skill matched
35
+ e.g. run-sprint, grill-me, ▼
36
+ bootstrap-fullstack project-manager (catch-all)
37
+ │ picks ONE specialist agent
38
+ │ from the routing table
39
+ ▼ │
40
+ └─────────────────┬───────────────┘
41
+
42
+ ┌────────────────────────────────────────────┐
43
+ │ AGENT DISPATCH │
44
+ │ Skill calls Task(subagent_type="<agent>") │
45
+ │ Agent runs on declared model: │
46
+ │ Opus (decision) / Sonnet (impl) / Haiku │
47
+ └────────────────────┬───────────────────────┘
48
+
49
+
50
+ ┌────────────────────────────────────────────┐
51
+ │ Agent tool calls (Read/Edit/Bash/Write) │
52
+ │ PreToolUse hooks block dangerous actions │
53
+ │ PostToolUse hooks run prettier + reminder │
54
+ └────────────────────┬───────────────────────┘
55
+
56
+
57
+ ┌────────────────────────────────────────────┐
58
+ │ gate-keeper agent validates thresholds │
59
+ │ Stop hook reminds brain-keeper │
60
+ │ SubagentStop hook records telemetry │
61
+ └────────────────────────────────────────────┘
62
+ ```
63
+
64
+ ## Layer 1 — Skills
65
+
66
+ Skills are the **single entry point** of the harness. Each Skill lives at `.claude/skills/<slug>/SKILL.md` with YAML frontmatter describing when it triggers:
67
+
68
+ ```yaml
69
+ ---
70
+ name: run-sprint
71
+ description: |
72
+ Triggers when the user says "run sprint X", "execute the sprint",
73
+ "rodar sprint 3", or any phrase asking to execute a sprint from
74
+ docs/plans/PLAN_*.md. Owns the orchestration of sprint execution
75
+ with checkpoints and parallel delegation.
76
+ ---
77
+ ```
78
+
79
+ The Cowork classifier (and the Claude Code matcher) reads the `description` field of each skill and automatically picks the skill that best matches the user prompt. You do not have to invoke the skill manually — just describe the task.
80
+
81
+ To force a specific skill, use `/skill <name>` in Claude Code or mention it explicitly: `use the analyst skill`.
82
+
83
+ ### Skill types
84
+
85
+ - **Orchestration skills**: `run-sprint`, `grill-me`, `bootstrap-fullstack`, `auto-test-guard`, `prd-ready-check`. They have multiple stages with checkpoints (⏸️) and map each stage to an agent.
86
+ - **Routing skills**: `project-manager`. Catch-all fallback that analyzes the prompt and dispatches to ONE specialist agent via Task tool.
87
+ - **Passive skills**: `caveman` (telegraphic style, always active), `honcho-memory` (persistent memory, injects `[HONCHO MEMORY]` into every prompt via hook).
88
+ - **Product skills**: `to-prd`, `to-issues`. Convert artifacts between pipeline stages.
89
+ - **Adoption skills**: `update-template`, `active-project`. Synchronize projects with the latest harness version.
90
+
91
+ The complete skill table lives in [Skills reference](skills-reference).
92
+
93
+ ## Layer 2 — Agents
94
+
95
+ Agents are the **specialized executors** per domain. Each agent lives at `.claude/agents/<name>.md` with frontmatter declaring:
96
+
97
+ ```yaml
98
+ ---
99
+ name: backend-developer
100
+ description: |
101
+ Implements Java 25 + Spring Boot 4 backend code — controllers,
102
+ services, DTOs, repositories, security configuration. Delegated to
103
+ by sprint-runner and project-manager.
104
+ tools: Read, Edit, Write, Bash, Grep, Glob
105
+ model: claude-sonnet-4-6
106
+ ---
107
+ ```
108
+
109
+ The `model:` field is mandatory. The model-per-agent rule (defined in `CLAUDE.md`):
110
+
111
+ | Model | When to use | Agents |
112
+ |---|---|---|
113
+ | **Opus 4.7** | Irreversible decision, macro technical veto | `product-owner`, `tech-lead`, `security-engineer` |
114
+ | **Sonnet 4.6** | Implementation, decomposition, review, test, UI, recording | `architect`, `analyst`, `backend-developer`, `frontend-developer`, `mobile-developer`, `n8n-specialist`, `ux-designer`, `database-engineer`, `devops-engineer`, `qa-engineer`, `code-reviewer`, `gate-keeper`, `test-coverage-auditor`, `prd-ready-check`, `api-integration-test`, `sprint-runner`, `brain-keeper`, `auditor`, `release-engineer`, `migrator` |
115
+ | **Haiku 4.5** | Scaffold, template, mechanical sync | `scaffold`, `update-template` |
116
+
117
+ Invocation happens via the Task tool, inside a Skill:
118
+
119
+ ```text
120
+ Task(
121
+ subagent_type="backend-developer",
122
+ description="Implement product controller",
123
+ prompt="Implement POST /api/v1/products per PLAN_product.md, Sprint 1, task T2..."
124
+ )
125
+ ```
126
+
127
+ A Skill can dispatch multiple agents in parallel (when there is no dependency) or in series (when one agent's output feeds the next). This is the Skill's responsibility, not the agents'.
128
+
129
+ The complete agent table lives in [Agents reference](agents-reference).
130
+
131
+ ## Passive skills (always on)
132
+
133
+ Two skills run silently on every prompt without needing a keyword match:
134
+
135
+ ### caveman
136
+
137
+ Output style skill. Reduces tokens by 65-75% by dropping articles, filler, and pleasantries. Modes:
138
+
139
+ - `caveman ultra` — code (default for code).
140
+ - `caveman full` — markdown `.md` (default for `.md`).
141
+ - `caveman lite` — contracts / PRDs (more explanatory).
142
+ - `stop caveman` — turns it off.
143
+
144
+ ### honcho-memory
145
+
146
+ Persistent cross-session memory skill via Honcho v3 self-hosted. On every prompt, it injects a `[HONCHO MEMORY]` block containing:
147
+
148
+ - **Peer-scoped**: explicit and inferred user preferences (e.g. "prefers bash over PowerShell", "works on CockroachDB").
149
+ - **Session-scoped**: current project context (e.g. "feature in progress: product signup").
150
+
151
+ Injection happens via the `UserPromptSubmit` hook calling `prompt-gate-reminder.sh`, which fetches the memory from Honcho and prepends it to the prompt before the model receives it. If Honcho is offline, the skill degrades gracefully — the prompt proceeds without the block. Details in [Honcho memory](honcho-memory).
152
+
153
+ ## Hooks layer (cross-cutting)
154
+
155
+ Hooks live in `.claude/settings.json` and dispatch scripts in `scripts/hooks/`. They are synchronous interceptors that run before or after tools, prompts, or responses:
156
+
157
+ | Hook | Matcher | Script | Function |
158
+ |---|---|---|---|
159
+ | `PreToolUse` | `Bash` | `pre-push-guard.sh` | Blocks `git push` directly to `main`/`develop` |
160
+ | `PreToolUse` | `Bash` | `block-test-deletion.sh` | Blocks `rm` commands on test files |
161
+ | `PostToolUse` | `Edit\|MultiEdit\|Write` | inline (prettier) | Formats `.ts`/`.tsx`/`.html`/`.scss`/`.css` after edit |
162
+ | `PostToolUse` | `Edit\|MultiEdit\|Write` | `post-edit-test-reminder.sh` | Reminds to run tests after edits in production code |
163
+ | `UserPromptSubmit` | `*` | `prompt-gate-reminder.sh` | Injects `[HONCHO MEMORY]` + senior+ gate reminder |
164
+ | `Stop` | `*` | `stop-brain-reminder.sh` | Reminds to invoke `brain-keeper` at end of a PLAN |
165
+ | `Notification` | `*` | inline (notify-send / osascript) | Notifies desktop when Claude needs attention |
166
+
167
+ Full details in [Hooks reference](hooks-reference).
168
+
169
+ ## Canonical directories
170
+
171
+ ```
172
+ project/
173
+ ├── .claude/
174
+ │ ├── agents/ agents — domain executors (.md)
175
+ │ ├── skills/ skills — entry points (one folder each)
176
+ │ ├── settings.json permissions + hooks configuration
177
+ │ └── honcho/ local Honcho memory configuration
178
+
179
+ ├── docs/
180
+ │ ├── brain/ Obsidian vault (daily, features, decisions, bugs, tech-debt, MOC)
181
+ │ │ └── .obsidian/ Obsidian config (with per-folder color snippet)
182
+ │ ├── plans/ PLAN_*.md generated by analyst
183
+ │ ├── prd/ PRD_*.md generated by to-prd
184
+ │ ├── discovery/ DISCOVERY_*.md generated by grill-me
185
+ │ ├── issues/ ISSUES_*.md generated by to-issues
186
+ │ └── decisions/ ADR-NNN-<slug>.md (Architecture Decision Records)
187
+
188
+ ├── dashboard/ local interface (Vite + Vue) for telemetry + docs
189
+ │ └── public/content/docs/ the docs you are reading now
190
+
191
+ ├── scripts/
192
+ │ ├── hooks/ hooks invoked by .claude/settings.json
193
+ │ ├── new-project.bat Windows interactive wrapper
194
+ │ ├── new-project.sh bash interactive wrapper
195
+ │ ├── lint-harness.sh structural lint of the harness
196
+ │ └── verify-integrity.sh verifies that .claude/ is consistent
197
+
198
+ ├── backend/ Java 25 + Spring Boot 4 code (when type=backend|fullstack)
199
+ ├── frontend/ Angular 21 code (when type=frontend|fullstack)
200
+ └── CLAUDE.md source of truth — instructions for Claude in the project
201
+ ```
202
+
203
+ ## Prompt → response flow (step by step)
204
+
205
+ Follow what happens when you type `"create endpoint for product signup"`:
206
+
207
+ 1. **UserPromptSubmit hook** fires — `prompt-gate-reminder.sh` calls Honcho via HTTP, gets relevant memory, prepends `[HONCHO MEMORY]` to the prompt.
208
+ 2. **Skill matcher** analyzes the enriched prompt. No specific orchestrator skill keyword → falls into `project-manager` (catch-all).
209
+ 3. **project-manager** reads the prompt, consults the routing table, decides: "backend implementation" → picks `backend-developer`.
210
+ 4. **Task tool** dispatches `backend-developer` (Sonnet 4.6 model) with the full prompt + PLAN/PRD context if any.
211
+ 5. **backend-developer** executes: reads CLAUDE.md, consults the PLAN, picks the package (`com.company.product.web`), generates controller + DTOs + service + Flyway migration.
212
+ 6. **PreToolUse hooks** run on each Bash: `pre-push-guard` blocks push to main; `block-test-deletion` blocks `rm` on tests.
213
+ 7. **PostToolUse hooks** run on each Edit/Write: prettier formats the file; `post-edit-test-reminder` reminds the agent to invoke `qa-engineer`.
214
+ 8. **gate-keeper** (called by the `auto-test-guard` skill at the end) runs JaCoCo coverage, PIT mutation, ESLint, Lighthouse. If any threshold fails, it blocks.
215
+ 9. **Stop hook** fires `stop-brain-reminder.sh` reminding `brain-keeper` to record the feature in the Obsidian vault.
216
+ 10. **SubagentStop hook** (future/optional) records telemetry per agent in `dashboard/data/telemetry.json` via `telemetry-writer.js`.
217
+
218
+ ## Cowork and Claude Code CLI integration
219
+
220
+ Both Cowork desktop and Claude Code CLI consume the same `.claude/` from the project. This means:
221
+
222
+ - Skills created in the harness work in both environments with no modification.
223
+ - Hooks declared in `.claude/settings.json` only work where the runtime supports hooks (Claude Code CLI has full support; Cowork has partial support depending on version).
224
+ - Permissions declared in `.claude/settings.json > permissions.allow` are respected by both.
225
+
226
+ Rule of thumb: **if Cowork alone covers it, use Cowork**. If you need bash hooks, terminal, or CI automation, use Claude Code CLI on the same project.
227
+
228
+ ## Telemetry
229
+
230
+ Subagent telemetry is recorded via the `SubagentStop` hook (not configured by default — opt-in). The flow:
231
+
232
+ ```
233
+ agent ends → SubagentStop hook → subagent-telemetry.sh
234
+ → telemetry-writer.js
235
+ → dashboard/data/telemetry.json
236
+ → dashboard renders metrics at /telemetry
237
+ ```
238
+
239
+ Captured metrics: agent name, model used, tokens in/out, duration, success/failure, tool calls made. Useful to understand cost per feature and identify agents that are taking too long.
240
+
241
+ ## Design principles
242
+
243
+ 1. **Two layers, no more**. Skill (entry) + Agent (executor). End of story. Adding a third layer requires an ADR approved by `tech-lead`.
244
+ 2. **Specific skill wins over catch-all**. If `run-sprint` matched, `project-manager` does not run.
245
+ 3. **Hooks are for policy, not logic**. Hooks block dangerous actions, format code, inject memory. Business logic lives in agents.
246
+ 4. **Each agent declares its model**. Opus is expensive and rare. Sonnet is the default. Haiku for mechanical work.
247
+ 5. **Everything is a file on disk**. `.claude/` is versioned. Harness changes are commits.
248
+
249
+ ## Cross-references
250
+
251
+ - [Agents reference](agents-reference) — full catalog of the 22 agents + responsibilities + model
252
+ - [Skills reference](skills-reference) — catalog of skills + triggers + outputs
253
+ - [Hooks reference](hooks-reference) — scripts in `scripts/hooks/` + matchers + behavior
254
+ - [Honcho memory](honcho-memory) — architecture of persistent cross-session memory
255
+ - [Autonomy matrix](autonomy-matrix) — who decides what, when to escalate
256
+ - [Pipeline](pipeline) — canonical pipeline from discovery to delivery
257
+ - [Quality gate](quality-gate) — non-negotiable senior+ thresholds
258
+ - [Stack rules](stack-rules) — mandatory versions and conventions
259
+ - [Git Flow](git-flow) — branch model and PRs
260
+ - [Troubleshooting](troubleshooting) — common issues and fixes
@@ -0,0 +1,186 @@
1
+ # Autonomy Matrix
2
+
3
+ The autonomy matrix is the **master rule** governing how the harness behaves. It defines who decides what and eliminates unnecessary interruptions of the human.
4
+
5
+ ## Fundamental principle
6
+
7
+ > **Non-negotiable**: agents decide on their own. Asking the human = rare exception. No "I wonder if the user wants X or Y" — the responsible agent **decides and proceeds**.
8
+
9
+ This principle exists because interrupting the human on every technical decision destroys the productivity the harness was built to deliver. If a `backend-developer` stops on every choice between `@Transactional(REQUIRED)` vs `@Transactional(REQUIRES_NEW)`, the flow dies. The decision is technical, lives inside the agent, and the agent decides.
10
+
11
+ When the agent really lacks information, it **does not ask** — it picks the most defensible option given available context, documents the choice in an ADR (if macro) or comment (if tactical), and moves on.
12
+
13
+ ## Full table — who decides what
14
+
15
+ | Domain | Agent | Behavior |
16
+ |---|---|---|
17
+ | Product, scope, rule, UX, flow, priority, MVP, persona, API contract | `product-owner` | **Decides alone.** |
18
+ | Stack, pattern, refactor, lib, tool, debt, organization, final review | `tech-lead` | **Decides alone.** Approves/blocks merges. |
19
+ | Macro architecture, bounded context, integration | `architect` → `tech-lead` | Architect proposes, TL decides. |
20
+ | DB schema, index, migration, performance | `database-engineer` → `tech-lead` (if cross-cutting) | DB engineer decides; TL approves if it affects >1 context. |
21
+ | Security, vuln, OWASP, LGPD | `security-engineer` | **Technical veto** on high/critical — blocks merge without human. |
22
+ | Infra, cost, deploy, CI/CD | `devops-engineer` → `tech-lead` (if > R$ 200/month) | DevOps decides, except for relevant cost. |
23
+ | UI, microinteraction, tokens, a11y | `ux-designer` → `product-owner` (flow/scope) | UX decides "how visual", PO decides "what". |
24
+ | Implementation | `backend-developer` / `frontend-developer` / `mobile-developer` | Implement what TL defined. Product question → PO. Technical question → TL. **Do not escalate to human.** |
25
+ | Tests, coverage, gate | `gate-keeper` | Blocks if senior+ gate fails. Returns to developer. |
26
+ | Triage between agents | `tech-lead` | Conflict between developers → TL. Conflict TL × PO → joint negotiation. |
27
+
28
+ ### Why this structure?
29
+
30
+ The table is built around two authority poles:
31
+
32
+ - **`product-owner`** — supreme product authority. Decides everything that is "what" (scope, rule, priority).
33
+ - **`tech-lead`** — supreme technical authority. Decides everything that is "how" (stack, pattern, organization).
34
+
35
+ Everything else fits below these two poles:
36
+
37
+ ```
38
+ ┌─────────────┐ ┌─────────────┐
39
+ │product-owner│ ◄────► │ tech-lead │
40
+ │ (Opus) │ negotiates │ (Opus) │
41
+ └──────┬──────┘ └──────┬──────┘
42
+ │ │
43
+ ┌────────────┴──────┐ ┌────────────┼─────────────┐
44
+ │ │ │ │ │
45
+ ▼ ▼ ▼ ▼ ▼
46
+ ux-designer architect database- devops- security-
47
+ (Sonnet) (Sonnet) engineer engineer engineer
48
+ (Sonnet) (Sonnet) (Opus, veto)
49
+ │ │ │ │ │
50
+ └──────────┬───────┴──────────────┴─────────────┴────────────┘
51
+
52
+ backend-developer / frontend-developer / mobile-developer
53
+ (Sonnet)
54
+
55
+
56
+ qa-engineer ◄─── gate-keeper (Sonnet, blocks)
57
+ (Sonnet)
58
+ ```
59
+
60
+ ## When to escalate to the human (and ONLY when)
61
+
62
+ ### `product-owner` escalates ONLY in 4 situations:
63
+
64
+ 1. **Irreversible action on real customer data** — delete/overwrite with no recovery, drop table in prod, LGPD purge without backup.
65
+ 2. **Relevant financial cost** — sign a paid SaaS, change cloud tier, hire a service that becomes recurring OpEx.
66
+ 3. **Breaking change on a PUBLIC contract already published** — v1 endpoint with external clients consuming, schema change on a published event.
67
+ 4. **Identity/brand change approved by another area** — change product name, logo, public URL.
68
+
69
+ ### `tech-lead` escalates ONLY in 3 situations:
70
+
71
+ 1. **Technical requirement conflict not resolvable with grounding** — PO requests X but the current stack cannot support X at all without rewrite.
72
+ 2. **Breaking change on a production public contract** — coordinate maintenance window with external client.
73
+ 3. **Infra cost > R$ 200/month additional** — provision new managed instance, scale DB tier, hire paid CDN.
74
+
75
+ ### `security-engineer` escalates ONLY in:
76
+
77
+ - **Irreversible PII purge** — when it finds a leak and needs to wipe real customer data with no undo.
78
+
79
+ For everything else (high/critical vuln, OWASP Top 10, missing security header, vulnerable dependency), `security-engineer` **technically vetoes** the merge without needing the human.
80
+
81
+ ### Specialists NEVER escalate to the human
82
+
83
+ The 17 specialist agents (analyst, architect, backend-developer, frontend-developer, mobile-developer, database-engineer, devops-engineer, qa-engineer, code-reviewer, ux-designer, n8n-specialist, sprint-runner, scaffold, release-engineer, migrator, auditor, brain-keeper) **DO NOT escalate to human**.
84
+
85
+ The rule is:
86
+ - **Product** doubt → escalate to `product-owner`.
87
+ - **Technical** doubt → escalate to `tech-lead`.
88
+ - Each decides within its domain without consulting anyone else.
89
+
90
+ ## Form of escalation (when justified)
91
+
92
+ When PO or TL needs to escalate (in the 4+3 cases above), the rule is **non-negotiable**:
93
+
94
+ > Never an open question. Always **proposal + recommendation + impact of the opposite decision**.
95
+
96
+ ### Correct example
97
+
98
+ > "Provision managed Redis Cluster (+R$ 380/month) to support 10x traffic in 6 months. I recommend approving now; if we keep single-node, cache queues in 2 months and p95 climbs to 800ms."
99
+
100
+ This form:
101
+ - Presents a concrete proposal (managed Redis Cluster).
102
+ - Has numeric cost (+R$ 380/month).
103
+ - Has explicit recommendation (approve now).
104
+ - Has impact of the opposite decision (queue + p95 800ms in 2 months).
105
+
106
+ The human reads this in 10 seconds and decides. No back and forth.
107
+
108
+ ### Wrong example
109
+
110
+ > "Should we use Redis Cluster or stay on single-node?"
111
+
112
+ This form is **forbidden**. No proposal, no recommendation, no impact. It transfers the technical decision back to the human without grounding. `tech-lead` must reformulate before escalating.
113
+
114
+ ## Anti-pattern "asking the human"
115
+
116
+ The examples below show up frequently in miscalibrated agents. In all of them, the correct form is the agent deciding and moving on.
117
+
118
+ ### Anti-pattern 1 — Trivial technical choice
119
+
120
+ | Wrong | Correct |
121
+ |---|---|
122
+ | "Do you prefer `UUID v4` or `UUID v7` for the PK?" | Agent picks `UUID v7` (Postgres 17 default + natural temporal ordering). Moves on. If relevant, documents in an ADR. |
123
+ | "Should I use `@Transactional` or `@Transactional(readOnly=true)` on this service?" | Agent analyzes: has writes? `@Transactional`. Read-only? `@Transactional(readOnly=true)`. Decides. |
124
+
125
+ ### Anti-pattern 2 — Implementation choice
126
+
127
+ | Wrong | Correct |
128
+ |---|---|
129
+ | "Can I create POST /products or do you prefer PUT?" | Signup = POST (standard REST). Agent decides. |
130
+ | "Should I use `RestClient` or `WebClient` for this HTTP client?" | TL already decided (CLAUDE.md): `RestClient` for sync, `WebClient` for reactive. Agent reads and follows. |
131
+
132
+ ### Anti-pattern 3 — UX choice
133
+
134
+ | Wrong | Correct |
135
+ |---|---|
136
+ | "Modal or drawer for the edit form?" | `ux-designer` consults design tokens + current project pattern, picks one, moves on. No pattern? Modal (more conservative). |
137
+ | "Primary button blue or green?" | `ux-designer` uses the color tokens already defined in the project. No token? Creates one following the ng-bootstrap pattern. |
138
+
139
+ ### Anti-pattern 4 — Test choice
140
+
141
+ | Wrong | Correct |
142
+ |---|---|
143
+ | "Should I write unit or integration tests for this service?" | Senior+ gate requires line coverage >= 85% + branches >= 80%. Agent writes whatever is needed to hit the threshold, prioritizes unit (pyramid), adds integration where the service crosses a boundary. |
144
+ | "Should I skip the a11y test on this component?" | NEVER. A11y serious/critical = 0. No exception. Agent writes the test. |
145
+
146
+ ## Conflicts between agents
147
+
148
+ The matrix does not by itself resolve conflicts that cross domains. For that there are three protocols:
149
+
150
+ ### Specialist × specialist conflict
151
+
152
+ Example: `backend-developer` wants to expose `OffsetDateTime`, `frontend-developer` wants `Instant`. They disagree on the API contract.
153
+
154
+ **Protocol**: `tech-lead` triages. Since API contract is technical, TL decides and both follow. If TL determines it affects product (user-visible change in timezone), TL takes it to `product-owner` for validation.
155
+
156
+ ### Specialist × `tech-lead` conflict
157
+
158
+ Example: `database-engineer` wants hash partitioning, `tech-lead` imposes range. DB engineer thinks it will perform worse in production.
159
+
160
+ **Protocol**: TL is the technical authority. DB engineer presents the analysis as **proposal + recommendation + opposite impact**. If TL still maintains the decision, it ends. If DB engineer demonstrates via benchmark that the decision has critical impact (e.g. hot partition in 2 weeks), TL reconsiders — no wounded ego, no falling back to the human.
161
+
162
+ ### `tech-lead` × `product-owner` conflict
163
+
164
+ Example: PO wants feature X in 1 sprint, TL says the auth layer needs a refactor first — 2 additional sprints.
165
+
166
+ **Protocol**: joint negotiation. PO and TL exchange **proposals + impacts**:
167
+ - PO: "feature X now, refactor later — clients have been asking for 3 months."
168
+ - TL: "feature X without refactor implies role leakage between tenants — LGPD risk."
169
+ - They negotiate until they reach: minimum refactor in the current sprint (role auth only) + feature X in parallel.
170
+
171
+ If they cannot agree, **PO has final say on scope, TL has final say on technical**. If conflict persists, they jointly escalate to human as a governance item (rare).
172
+
173
+ ## Executive summary
174
+
175
+ - Agents decide on their own. Default = decision.
176
+ - Human is only interrupted in 4 (PO) + 3 (TL) + 1 (security) absolute cases.
177
+ - Specialists never escalate to human — they escalate to PO or TL.
178
+ - Every escalation has a fixed form: proposal + recommendation + impact.
179
+ - Conflicts between agents resolve by TL triage, with PO as product arbiter.
180
+
181
+ ## Cross-references
182
+
183
+ - [Agents reference](agents-reference) — full list of the 22 agents + model + responsibilities
184
+ - [Pipeline](pipeline) — where and how each agent shows up in the end-to-end flow
185
+ - [Quality gate](quality-gate) — thresholds that `gate-keeper` and `security-engineer` enforce without human
186
+ - [Architecture overview](architecture-overview) — 2-layer macro model