@fernado03/zoo-flow 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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +326 -0
  3. package/bin/zoo-flow.js +358 -0
  4. package/package.json +44 -0
  5. package/templates/full/.roo/commands/caveman.md +7 -0
  6. package/templates/full/.roo/commands/commit-and-document.md +202 -0
  7. package/templates/full/.roo/commands/diagnose.md +7 -0
  8. package/templates/full/.roo/commands/explore.md +13 -0
  9. package/templates/full/.roo/commands/feature.md +24 -0
  10. package/templates/full/.roo/commands/fix.md +19 -0
  11. package/templates/full/.roo/commands/grill-me.md +7 -0
  12. package/templates/full/.roo/commands/grill-with-docs.md +7 -0
  13. package/templates/full/.roo/commands/handoff.md +8 -0
  14. package/templates/full/.roo/commands/improve-codebase-architecture.md +7 -0
  15. package/templates/full/.roo/commands/prototype.md +9 -0
  16. package/templates/full/.roo/commands/refactor.md +17 -0
  17. package/templates/full/.roo/commands/setup-matt-pocock-skills.md +7 -0
  18. package/templates/full/.roo/commands/tdd.md +9 -0
  19. package/templates/full/.roo/commands/to-issues.md +7 -0
  20. package/templates/full/.roo/commands/to-prd.md +7 -0
  21. package/templates/full/.roo/commands/triage.md +7 -0
  22. package/templates/full/.roo/commands/tweak.md +9 -0
  23. package/templates/full/.roo/commands/update-docs.md +130 -0
  24. package/templates/full/.roo/commands/write-a-skill.md +7 -0
  25. package/templates/full/.roo/commands/zoom-out.md +7 -0
  26. package/templates/full/.roo/rules/00-paths.md +17 -0
  27. package/templates/full/.roo/rules/01-command-protocol.md +25 -0
  28. package/templates/full/.roo/rules/03-manual-reply-protocol.md +13 -0
  29. package/templates/full/.roo/rules-code-tweaker/00-scope.md +7 -0
  30. package/templates/full/.roo/rules-code-tweaker/01-completion.md +14 -0
  31. package/templates/full/.roo/rules-custom-orchestrator/00-routing.md +14 -0
  32. package/templates/full/.roo/rules-custom-orchestrator/01-delegation-message.md +12 -0
  33. package/templates/full/.roo/rules-system-architect/00-scope.md +9 -0
  34. package/templates/full/.roo/rules-system-architect/01-feature-prototype.md +10 -0
  35. package/templates/full/.roo/rules-system-architect/02-completion.md +11 -0
  36. package/templates/full/.roo/skills/docs/adr/0001-explicit-setup-pointer-only-for-hard-dependencies.md +18 -0
  37. package/templates/full/.roo/skills/engineering/README.md +12 -0
  38. package/templates/full/.roo/skills/engineering/diagnose/SKILL.md +73 -0
  39. package/templates/full/.roo/skills/engineering/diagnose/scripts/hitl-loop.template.sh +41 -0
  40. package/templates/full/.roo/skills/engineering/grill-with-docs/ADR-FORMAT.md +33 -0
  41. package/templates/full/.roo/skills/engineering/grill-with-docs/CONTEXT-FORMAT.md +45 -0
  42. package/templates/full/.roo/skills/engineering/grill-with-docs/SKILL.md +32 -0
  43. package/templates/full/.roo/skills/engineering/improve-codebase-architecture/DEEPENING.md +24 -0
  44. package/templates/full/.roo/skills/engineering/improve-codebase-architecture/HTML-REPORT.md +88 -0
  45. package/templates/full/.roo/skills/engineering/improve-codebase-architecture/INTERFACE-DESIGN.md +45 -0
  46. package/templates/full/.roo/skills/engineering/improve-codebase-architecture/LANGUAGE.md +34 -0
  47. package/templates/full/.roo/skills/engineering/improve-codebase-architecture/SKILL.md +43 -0
  48. package/templates/full/.roo/skills/engineering/prototype/LOGIC.md +28 -0
  49. package/templates/full/.roo/skills/engineering/prototype/SKILL.md +27 -0
  50. package/templates/full/.roo/skills/engineering/prototype/UI.md +53 -0
  51. package/templates/full/.roo/skills/engineering/setup-matt-pocock-skills/SKILL.md +77 -0
  52. package/templates/full/.roo/skills/engineering/setup-matt-pocock-skills/domain.md +36 -0
  53. package/templates/full/.roo/skills/engineering/setup-matt-pocock-skills/issue-tracker-github.md +21 -0
  54. package/templates/full/.roo/skills/engineering/setup-matt-pocock-skills/issue-tracker-gitlab.md +23 -0
  55. package/templates/full/.roo/skills/engineering/setup-matt-pocock-skills/issue-tracker-local.md +20 -0
  56. package/templates/full/.roo/skills/engineering/setup-matt-pocock-skills/triage-labels.md +11 -0
  57. package/templates/full/.roo/skills/engineering/tdd/SKILL.md +52 -0
  58. package/templates/full/.roo/skills/engineering/tdd/deep-modules.md +9 -0
  59. package/templates/full/.roo/skills/engineering/tdd/interface-design.md +6 -0
  60. package/templates/full/.roo/skills/engineering/tdd/mocking.md +17 -0
  61. package/templates/full/.roo/skills/engineering/tdd/refactoring.md +9 -0
  62. package/templates/full/.roo/skills/engineering/tdd/tests.md +12 -0
  63. package/templates/full/.roo/skills/engineering/to-issues/SKILL.md +45 -0
  64. package/templates/full/.roo/skills/engineering/to-prd/SKILL.md +58 -0
  65. package/templates/full/.roo/skills/engineering/triage/AGENT-BRIEF.md +43 -0
  66. package/templates/full/.roo/skills/engineering/triage/OUT-OF-SCOPE.md +37 -0
  67. package/templates/full/.roo/skills/engineering/triage/SKILL.md +79 -0
  68. package/templates/full/.roo/skills/engineering/tweak/SKILL.md +17 -0
  69. package/templates/full/.roo/skills/engineering/zoom-out/SKILL.md +7 -0
  70. package/templates/full/.roo/skills/in-progress/README.md +8 -0
  71. package/templates/full/.roo/skills/in-progress/review/SKILL.md +39 -0
  72. package/templates/full/.roo/skills/in-progress/writing-beats/SKILL.md +32 -0
  73. package/templates/full/.roo/skills/in-progress/writing-fragments/SKILL.md +45 -0
  74. package/templates/full/.roo/skills/in-progress/writing-shape/SKILL.md +50 -0
  75. package/templates/full/.roo/skills/misc/README.md +6 -0
  76. package/templates/full/.roo/skills/misc/git-guardrails-claude-code/SKILL.md +64 -0
  77. package/templates/full/.roo/skills/misc/git-guardrails-claude-code/scripts/block-dangerous-git.sh +25 -0
  78. package/templates/full/.roo/skills/misc/migrate-to-shoehorn/SKILL.md +37 -0
  79. package/templates/full/.roo/skills/misc/scaffold-exercises/SKILL.md +61 -0
  80. package/templates/full/.roo/skills/misc/setup-pre-commit/SKILL.md +62 -0
  81. package/templates/full/.roo/skills/personal/README.md +6 -0
  82. package/templates/full/.roo/skills/personal/edit-article/SKILL.md +13 -0
  83. package/templates/full/.roo/skills/personal/obsidian-vault/SKILL.md +39 -0
  84. package/templates/full/.roo/skills/productivity/README.md +6 -0
  85. package/templates/full/.roo/skills/productivity/caveman/SKILL.md +28 -0
  86. package/templates/full/.roo/skills/productivity/grill-me/SKILL.md +13 -0
  87. package/templates/full/.roo/skills/productivity/handoff/SKILL.md +14 -0
  88. package/templates/full/.roo/skills/productivity/write-a-skill/SKILL.md +52 -0
  89. package/templates/full/.roomodes +47 -0
@@ -0,0 +1,14 @@
1
+ # Code Tweaker Completion
2
+
3
+ If created by `custom-orchestrator` via `new_task`, use `attempt_completion` when done or blocked.
4
+
5
+ Include:
6
+
7
+ - what was done
8
+ - files changed or inspected
9
+ - commands/tests run
10
+ - status
11
+ - blockers
12
+ - recommended next command
13
+
14
+ Before running `git commit` or `git push`, halt and wait for explicit user approval. Never push unless explicitly asked.
@@ -0,0 +1,14 @@
1
+ # Orchestrator Routing
2
+
3
+ The orchestrator is a router only.
4
+
5
+ Do not inspect implementation files, edit files, run shell commands, or answer technical implementation questions directly.
6
+
7
+ If the user gives a technical request without an explicit command, offer 1-2 numbered workflow choices and ask for a typed number.
8
+
9
+ Delegate only with `new_task` to:
10
+
11
+ - `code-tweaker`
12
+ - `system-architect`
13
+
14
+ After a subtask returns, summarize and stop. Do not auto-launch another subtask.
@@ -0,0 +1,12 @@
1
+ # Delegation Message
2
+
3
+ Every delegated task must include:
4
+
5
+ - command with slash
6
+ - normalized command name
7
+ - user context
8
+ - instruction to follow `.roo/rules/01-command-protocol.md`
9
+ - reminder that skills live under `.roo/skills/...`
10
+ - completion rule to use `attempt_completion` with summary, files inspected/changed, commands/tests run, blockers, and recommended next command
11
+
12
+ Ignore slash commands mentioned only inside subtask summaries.
@@ -0,0 +1,9 @@
1
+ # System Architect Scope
2
+
3
+ Plan, diagnose, explore, refactor-design, and triage.
4
+
5
+ Do not edit application source code.
6
+
7
+ Edits are limited to Markdown files, `.scratch/`, and `docs/`.
8
+
9
+ Use `switch_mode` to `code-tweaker` for implementation, test-writing, runnable prototypes, or source-code edits.
@@ -0,0 +1,10 @@
1
+ # Feature Prototype Handoff
2
+
3
+ During `/feature`, do not run prototype implementation directly.
4
+
5
+ If the user chooses Prototype:
6
+
7
+ 1. Summarize the prototype question and constraints.
8
+ 2. Use `switch_mode` to `code-tweaker`.
9
+ 3. Have `code-tweaker` execute `/prototype`.
10
+ 4. Resume architecture flow after the prototype result returns.
@@ -0,0 +1,11 @@
1
+ # System Architect Completion
2
+
3
+ Use `switch_mode` to `code-tweaker` for same-window implementation handoffs.
4
+
5
+ If created by `custom-orchestrator` via `new_task`, use `attempt_completion` when the delegated task is complete or blocked.
6
+
7
+ Do not use `attempt_completion` to avoid required implementation work.
8
+
9
+ Halt for explicit user approval before testing a bug hypothesis, finalizing an architecture plan, publishing issues, or making irreversible decisions.
10
+
11
+ If diagnosis fails after 3 attempts, halt and request user intervention with attempts, evidence, and needed input.
@@ -0,0 +1,18 @@
1
+ # ADR-0001: Explicit setup pointer only for hard dependencies
2
+
3
+ RULE: explicit `/setup-matt-pocock-skills` pointer only for hard deps.
4
+
5
+ MUST include pointer:
6
+ - `to-issues`
7
+ - `to-prd`
8
+ - `triage`
9
+
10
+ Required wording: mapping/config should exist; run `/setup-matt-pocock-skills` if missing.
11
+
12
+ MUST NOT include pointer:
13
+ - `diagnose`
14
+ - `tdd`
15
+ - `improve-codebase-architecture`
16
+ - `zoom-out`
17
+
18
+ Soft deps: reference glossary/ADRs only.
@@ -0,0 +1,12 @@
1
+ # Engineering
2
+
3
+ - **[diagnose](./diagnose/SKILL.md)** — Repro loop → hypotheses → probes → fix → regression.
4
+ - **[grill-with-docs](./grill-with-docs/SKILL.md)** — Grill plan; update glossary/ADRs.
5
+ - **[triage](./triage/SKILL.md)** — Issue state machine.
6
+ - **[improve-codebase-architecture](./improve-codebase-architecture/SKILL.md)** — Deep-module candidates.
7
+ - **[setup-matt-pocock-skills](./setup-matt-pocock-skills/SKILL.md)** — Seed tracker/labels/domain docs.
8
+ - **[tdd](./tdd/SKILL.md)** — Red-green-refactor slices.
9
+ - **[to-issues](./to-issues/SKILL.md)** — Plan/PRD → tracer issues.
10
+ - **[to-prd](./to-prd/SKILL.md)** — Context → PRD issue.
11
+ - **[zoom-out](./zoom-out/SKILL.md)** — Map modules/callers.
12
+ - **[prototype](./prototype/SKILL.md)** — Throwaway logic/UI prototype.
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: diagnose
3
+ description: Disciplined diagnosis loop for hard bugs and performance regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test. Use when user says "diagnose this" / "debug this", reports a bug, says something is broken/throwing/failing, or describes a performance regression.
4
+ ---
5
+
6
+ # Diagnose
7
+
8
+ RULE: glossary + ADRs. Skip phase only with explicit reason. DO NOT hypothesise before deterministic loop.
9
+
10
+ ## 1. Feedback loop
11
+
12
+ MUST build fast pass/fail loop. Try order:
13
+ 1. Failing test at bug-reaching seam.
14
+ 2. Curl/HTTP script vs dev server.
15
+ 3. CLI fixture + stdout diff.
16
+ 4. Headless browser: DOM/console/network assertions.
17
+ 5. Replay trace/request/payload/event log.
18
+ 6. Throwaway minimal subsystem harness.
19
+ 7. Property/fuzz loop.
20
+ 8. `git bisect run` harness.
21
+ 9. Differential loop: old vs new/config A vs B.
22
+ 10. HITL bash script from `scripts/hitl-loop.template.sh`.
23
+
24
+ Rules:
25
+ - MUST make loop faster/sharper/deterministic.
26
+ - Flake: run 100x, parallelise, stress, add sleeps, raise repro rate.
27
+ - 3 failed loop attempts → STOP; ask env/HAR/log/core/screen recording/temp prod instrumentation.
28
+
29
+ ## 2. Reproduce
30
+
31
+ 1. Run loop.
32
+ 2. Match symptom to report.
33
+ 3. Confirm repeatability/flake rate.
34
+ 4. Capture exact error/output/timing.
35
+ 5. DO NOT continue until reproduced.
36
+
37
+ ## 3. Hypotheses
38
+
39
+ 1. Generate 3–5 ranked falsifiable hypotheses.
40
+ 2. Format: `If {cause}, then {probe/change} will {observable result}`.
41
+ 3. Drop vague hypotheses.
42
+ 4. Show ranked list.
43
+ 5. User AFK → proceed top hypothesis.
44
+
45
+ ## 4. Instrument
46
+
47
+ 1. Map one probe to one hypothesis.
48
+ 2. Change one variable at a time.
49
+ 3. Prefer debugger/REPL.
50
+ 4. Else add targeted logs only.
51
+ 5. Tag logs `[DEBUG-xxxx]`.
52
+ 6. DO NOT log everything.
53
+ 7. Perf: baseline/profiler/query plan before logs.
54
+
55
+ ## 5. Fix + regression
56
+
57
+ 1. If correct seam exists, write regression test before fix.
58
+ 2. Correct seam = real call-site bug pattern.
59
+ 3. If seam shallow/missing, document architecture gap.
60
+ 4. Watch regression fail.
61
+ 5. Apply minimal fix.
62
+ 6. Watch regression pass.
63
+ 7. Rerun original loop.
64
+
65
+ ## 6. Cleanup
66
+
67
+ MUST finish:
68
+ - [ ] Original repro passes.
69
+ - [ ] Regression passes or missing seam documented.
70
+ - [ ] `[DEBUG-...]` logs removed.
71
+ - [ ] Throwaway harnesses deleted/moved.
72
+ - [ ] Winning hypothesis stated in commit/PR.
73
+ - [ ] Seam/locality blocker → recommend `/improve-codebase-architecture`.
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env bash
2
+ # Human-in-the-loop reproduction loop.
3
+ # Copy this file, edit the steps below, and run it.
4
+ # The agent runs the script; the user follows prompts in their terminal.
5
+ #
6
+ # Usage:
7
+ # bash hitl-loop.template.sh
8
+ #
9
+ # Two helpers:
10
+ # step "<instruction>" → show instruction, wait for Enter
11
+ # capture VAR "<question>" → show question, read response into VAR
12
+ #
13
+ # At the end, captured values are printed as KEY=VALUE for the agent to parse.
14
+
15
+ set -euo pipefail
16
+
17
+ step() {
18
+ printf '\n>>> %s\n' "$1"
19
+ read -r -p " [Enter when done] " _
20
+ }
21
+
22
+ capture() {
23
+ local var="$1" question="$2" answer
24
+ printf '\n>>> %s\n' "$question"
25
+ read -r -p " > " answer
26
+ printf -v "$var" '%s' "$answer"
27
+ }
28
+
29
+ # --- edit below ---------------------------------------------------------
30
+
31
+ step "Open the app at http://localhost:3000 and sign in."
32
+
33
+ capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
34
+
35
+ capture ERROR_MSG "Paste the error message (or 'none'):"
36
+
37
+ # --- edit above ---------------------------------------------------------
38
+
39
+ printf '\n--- Captured ---\n'
40
+ printf 'ERRORED=%s\n' "$ERRORED"
41
+ printf 'ERROR_MSG=%s\n' "$ERROR_MSG"
@@ -0,0 +1,33 @@
1
+ # ADR Format
2
+
3
+ Path: `docs/adr/NNNN-slug.md`. Create dir lazily.
4
+
5
+ ## Template
6
+
7
+ ```md
8
+ # {Short title}
9
+
10
+ {1-3 sentences: context, decision, why.}
11
+ ```
12
+
13
+ Optional:
14
+ - `Status: proposed | accepted | deprecated | superseded by ADR-NNNN`
15
+ - `Considered Options`
16
+ - `Consequences`
17
+
18
+ ## Numbering
19
+
20
+ 1. Scan `docs/adr/`.
21
+ 2. Find max `NNNN`.
22
+ 3. Create next number.
23
+
24
+ ## Gate
25
+
26
+ Offer ADR only if all:
27
+ - Hard to reverse.
28
+ - Surprising without context.
29
+ - Real trade-off.
30
+
31
+ Qualifies: architecture shape; cross-context integration; lock-in tech; scope ownership; non-obvious deviation/constraint/rejected option.
32
+
33
+ DO NOT create ADR for obvious/easy/no-tradeoff choices.
@@ -0,0 +1,45 @@
1
+ # CONTEXT.md Format
2
+
3
+ ## Shape
4
+
5
+ ```md
6
+ # {Context Name}
7
+
8
+ {1-2 sentences: context purpose.}
9
+
10
+ ## Language
11
+
12
+ **Order**:
13
+ {1-2 sentence definition}
14
+ _Avoid_: Purchase, transaction
15
+
16
+ ## Flagged ambiguities
17
+
18
+ **Account** means Customer here, not User.
19
+ ```
20
+
21
+ ## Rules
22
+
23
+ - MUST pick canonical term; aliases under `_Avoid_`.
24
+ - MUST flag ambiguity + resolution.
25
+ - Define term in 1–2 sentences: what it is, not behavior.
26
+ - Include relationships/cardinality when obvious.
27
+ - Include domain terms only; exclude generic programming terms.
28
+ - Group under headings when useful.
29
+ - Include example dialogue.
30
+
31
+ ## Layout
32
+
33
+ Single-context:
34
+ - `CONTEXT.md`
35
+ - `docs/adr/`
36
+
37
+ Multi-context:
38
+ - `CONTEXT-MAP.md`
39
+ - Per-context `CONTEXT.md` + optional `docs/adr/`
40
+
41
+ Detection:
42
+ 1. If `CONTEXT-MAP.md`, read map + relevant contexts.
43
+ 2. Else if root `CONTEXT.md`, use it.
44
+ 3. Else create root `CONTEXT.md` lazily on first resolved term.
45
+ 4. If context ambiguous, ask.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: grill-with-docs
3
+ description: Grilling session that challenges your plan against the existing domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when user wants to stress-test a plan against their project's language and documented decisions.
4
+ ---
5
+
6
+ # Grill With Docs
7
+
8
+ ## Loop
9
+
10
+ 1. Read relevant `CONTEXT.md`/`CONTEXT-MAP.md` + ADRs.
11
+ 2. Ask one question at a time.
12
+ 3. Include recommended answer.
13
+ 4. Inspect code instead of asking when code can answer.
14
+ 5. Continue until design branches resolved.
15
+ 6. Update docs inline when terms/decisions crystallise.
16
+
17
+ ## Docs
18
+
19
+ - Single-context: root `CONTEXT.md`, root `docs/adr/`.
20
+ - Multi-context: root `CONTEXT-MAP.md` → per-context `CONTEXT.md` + ADRs.
21
+ - Create docs lazily only when recording needed.
22
+
23
+ ## MUST
24
+
25
+ - Challenge glossary conflicts.
26
+ - Sharpen fuzzy/overloaded terms.
27
+ - Use scenarios/edge cases.
28
+ - Cross-check claims against code.
29
+ - Surface code/doc contradictions.
30
+ - Update `CONTEXT.md` immediately for resolved terms.
31
+ - Keep `CONTEXT.md` glossary-only; no impl/spec notes.
32
+ - Offer ADR only when hard to reverse + surprising + real trade-off; use `ADR-FORMAT.md`.
@@ -0,0 +1,24 @@
1
+ # Deepening
2
+
3
+ Vocabulary: `LANGUAGE.md`.
4
+
5
+ ## Dependency categories
6
+
7
+ 1. In-process: pure/local memory/no I/O → deepen directly; test interface.
8
+ 2. Local-substitutable: local stand-in exists → test with stand-in; keep seam internal unless callers need it.
9
+ 3. Remote owned: owned network service → port at seam; prod adapter HTTP/gRPC/queue; test adapter in-memory; logic inside deep module.
10
+ 4. True external: third-party → inject port; tests use mock adapter.
11
+
12
+ ## Seam rules
13
+
14
+ - One adapter = hypothetical seam; avoid.
15
+ - Two adapters = real seam; allow.
16
+ - Internal seams stay private.
17
+ - DO NOT expose test seams through external interface.
18
+
19
+ ## Tests
20
+
21
+ - Replace shallow-module unit tests with deep-module interface tests.
22
+ - Interface is test surface.
23
+ - Assert observable outcomes only.
24
+ - Tests must survive internal refactor.
@@ -0,0 +1,88 @@
1
+ # HTML Report Format
2
+
3
+ RULE: Write one self-contained HTML file in OS temp dir. Static only except Tailwind CDN + Mermaid CDN.
4
+
5
+ ## Scaffold
6
+
7
+ ```html
8
+ <!doctype html>
9
+ <html lang="en">
10
+ <head>
11
+ <meta charset="utf-8" />
12
+ <title>Architecture review — {{repo name}}</title>
13
+ <script src="https://cdn.tailwindcss.com"></script>
14
+ <script type="module">
15
+ import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
16
+ mermaid.initialize({ startOnLoad: true, theme: "neutral", securityLevel: "loose" });
17
+ </script>
18
+ <style>
19
+ .seam { stroke-dasharray: 4 4; }
20
+ .leak { stroke: #dc2626; }
21
+ .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }
22
+ </style>
23
+ </head>
24
+ <body class="bg-stone-50 text-slate-900 font-sans">
25
+ <main class="max-w-5xl mx-auto px-6 py-12 space-y-12">
26
+ <header>...</header>
27
+ <section id="candidates" class="space-y-10">...</section>
28
+ <section id="top-recommendation">...</section>
29
+ </main>
30
+ </body>
31
+ </html>
32
+ ```
33
+
34
+ ## Header
35
+
36
+ Include: repo, date, legend: solid box=module; dashed line=seam; red arrow=leakage; dark thick box=deep module.
37
+
38
+ ## Candidate `<article>`
39
+
40
+ MUST include:
41
+ - Title.
42
+ - Badges: `Strong`/`Worth exploring`/`Speculative`; dependency category.
43
+ - Monospace files list.
44
+ - Before/after diagram side-by-side.
45
+ - Problem: one sentence.
46
+ - Solution: one sentence.
47
+ - Wins: bullets, max 6 words.
48
+ - ADR callout if conflict/reopen.
49
+
50
+ ## Diagrams
51
+
52
+ Use best fit:
53
+ - Mermaid graph/flow/sequence for call/dependency graphs.
54
+ - Hand-built boxes + SVG arrows if Mermaid layout fails.
55
+ - Cross-section for stacked shallow layers.
56
+ - Mass diagram for interface vs implementation size.
57
+ - Call-graph collapse for before tree → after deep module.
58
+
59
+ Mermaid example:
60
+
61
+ ```html
62
+ <div class="rounded-lg border border-slate-200 bg-white p-4">
63
+ <pre class="mermaid">
64
+ flowchart LR
65
+ A[OrderHandler] --> B[OrderValidator]
66
+ B --> C[OrderRepo]
67
+ C -.leak.-> D[PricingClient]
68
+ classDef leak stroke:#dc2626,stroke-width:2px;
69
+ class C,D leak
70
+ </pre>
71
+ </div>
72
+ ```
73
+
74
+ ## Style
75
+
76
+ - Sparse; visual; whitespace.
77
+ - Accents: emerald/indigo; red leakage; amber warnings.
78
+ - Diagrams ~320px high.
79
+ - Module labels: `text-xs uppercase tracking-wider`.
80
+
81
+ ## Top recommendation
82
+
83
+ Include candidate name, one-sentence reason, anchor link.
84
+
85
+ ## Vocabulary
86
+
87
+ Use: module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.
88
+ Avoid: component, service, unit, API, signature, boundary, layer, wrapper.
@@ -0,0 +1,45 @@
1
+ # Interface Design
2
+
3
+ Use after candidate selected + user wants interface options.
4
+
5
+ ## 1. Frame
6
+
7
+ Present:
8
+ - New-interface constraints.
9
+ - Dependencies + categories from `DEEPENING.md`.
10
+ - Rough illustrative code sketch only.
11
+
12
+ Proceed immediately.
13
+
14
+ ## 2. Spawn 3+ parallel sub-agents
15
+
16
+ Each agent: radically different interface.
17
+
18
+ Include:
19
+ - Candidate files/modules.
20
+ - Coupling details.
21
+ - Dependency category.
22
+ - Hidden implementation behind seam.
23
+ - Architecture vocab from `LANGUAGE.md`.
24
+ - Domain vocab from `CONTEXT.md`.
25
+
26
+ Variants:
27
+ 1. Min interface: 1–3 entry points, max leverage.
28
+ 2. Max flexibility: many use cases/extensions.
29
+ 3. Common caller: default case trivial.
30
+ 4. Ports/adapters: if cross-seam deps exist.
31
+
32
+ Each output MUST include:
33
+ 1. Interface: types/methods/params/invariants/ordering/errors.
34
+ 2. Usage example.
35
+ 3. Hidden implementation.
36
+ 4. Dependency/adapters strategy.
37
+ 5. Trade-offs: leverage high/thin.
38
+
39
+ ## 3. Present
40
+
41
+ 1. Present designs sequentially.
42
+ 2. Compare depth/locality/seam placement.
43
+ 3. Recommend strongest.
44
+ 4. Propose hybrid if better.
45
+ 5. Be opinionated.
@@ -0,0 +1,34 @@
1
+ # Language
2
+
3
+ RULE: Use exact terms. Avoid substitutions.
4
+
5
+ ## Terms
6
+
7
+ **Module**: thing with interface + implementation; any scale. Avoid: unit, component, service.
8
+
9
+ **Interface**: all caller knowledge: types, invariants, ordering, error modes, config, perf. Avoid: API, signature.
10
+
11
+ **Implementation**: code inside module. Use **adapter** only for seam role.
12
+
13
+ **Depth**: leverage at interface. Deep = much behaviour behind small interface. Shallow = interface near implementation.
14
+
15
+ **Seam**: place where behaviour changes without editing there; where module interface lives. Avoid: boundary.
16
+
17
+ **Adapter**: concrete thing satisfying interface at seam.
18
+
19
+ **Leverage**: caller gain from depth.
20
+
21
+ **Locality**: maintainer gain from depth; change/bugs/knowledge/verification concentrate.
22
+
23
+ ## Rules
24
+
25
+ - Depth belongs to interface, not implementation size.
26
+ - Internal seams may exist; external seam is caller interface.
27
+ - Deletion test: deleting shallow module removes complexity; deleting deep module pushes complexity to callers.
28
+ - Interface is test surface.
29
+ - One adapter = hypothetical seam; two adapters = real seam.
30
+ - Module has one interface.
31
+ - Depth creates leverage + locality.
32
+ - DO NOT frame depth as implementation-lines/interface-lines.
33
+ - DO NOT equate interface with TypeScript `interface` only.
34
+ - DO NOT use boundary; use seam/interface.
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: improve-codebase-architecture
3
+ description: Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.
4
+ ---
5
+
6
+ # Improve Codebase Architecture
7
+
8
+ RULE: Use `LANGUAGE.md` terms. Use glossary. Respect ADRs; surface only reopen-worthy conflicts.
9
+
10
+ ## Explore
11
+
12
+ 1. Read relevant `CONTEXT.md`/`CONTEXT-MAP.md`.
13
+ 2. Read relevant ADRs.
14
+ 3. Explore code organically.
15
+ 4. Find friction:
16
+ - Concept requires many-module bouncing.
17
+ - Module shallow: interface ≈ implementation.
18
+ - Pure fns exist only for tests; no locality.
19
+ - Tight modules leak across seams.
20
+ - Tests absent/hard through current interface.
21
+ 5. Apply deletion test.
22
+ 6. Keep candidates where deepening improves leverage/locality/testability.
23
+
24
+ ## Report
25
+
26
+ 1. Temp dir: `$TMPDIR` else `/tmp` (Windows `%TEMP%`).
27
+ 2. Write fresh `{tmpdir}/architecture-review-{timestamp}.html`.
28
+ 3. Use Tailwind CDN + Mermaid CDN.
29
+ 4. Include candidate cards with before/after visuals.
30
+ 5. Per candidate include: files/modules; problem; solution; locality/leverage/testing benefits; diagram; strength `Strong`/`Worth exploring`/`Speculative`; ADR conflict only if real.
31
+ 6. Include Top recommendation.
32
+ 7. Open file: Linux `xdg-open {path}`, macOS `open {path}`, Windows `start {path}`.
33
+ 8. Tell user absolute path.
34
+ 9. DO NOT propose interfaces yet.
35
+ 10. Ask: `Which of these would you like to explore?`
36
+
37
+ ## After candidate chosen
38
+
39
+ 1. Walk constraints/deps/seam/hidden implementation/surviving tests.
40
+ 2. If module name introduces unresolved domain term, update `CONTEXT.md` lazily.
41
+ 3. If term sharpened, update `CONTEXT.md` immediately.
42
+ 4. Durable rejected reason useful later → offer ADR.
43
+ 5. Interface options requested → run `INTERFACE-DESIGN.md`.
@@ -0,0 +1,28 @@
1
+ # Logic Prototype
2
+
3
+ Use for business logic/state/data-model questions.
4
+
5
+ ## Process
6
+
7
+ 1. State question in README/top comment: state model? uncertainty?
8
+ 2. Use host language/runtime/tooling; ask if unclear.
9
+ 3. Isolate portable pure logic: reducer, state machine, pure fns, or class/module with small surface.
10
+ 4. DO NOT put terminal/IO/console in logic module.
11
+ 5. Build minimal TUI:
12
+ - Init in-memory state.
13
+ - Render whole frame on start and after each action.
14
+ - State first, shortcuts second.
15
+ - ANSI bold/dim ok.
16
+ - Read one key/line at a time.
17
+ - Loop until quit.
18
+ 6. Add one command via existing task runner: `pnpm run {prototype-name}`.
19
+ 7. If no runner, document command at top of README.
20
+ 8. Hand over run command.
21
+ 9. If verdict unknown, write `NOTES.md` beside prototype.
22
+
23
+ ## Rules
24
+
25
+ - No tests.
26
+ - No real DB unless persistence is question; then scratch DB/file clearly marked prototype.
27
+ - No generalising.
28
+ - TUI shell throwaway; portable logic may be lifted.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: prototype
3
+ description: Build a throwaway prototype to flesh out a design before committing to it. Routes between two branches — a runnable terminal app for state/business-logic questions, or several radically different UI variations toggleable from one route. Use when the user wants to prototype, sanity-check a data model or state machine, mock up a UI, explore design options, or says "prototype this", "let me play with it", "try a few designs".
4
+ ---
5
+
6
+ # Prototype
7
+
8
+ RULE: Prototype answers one question. Throw away or absorb after answer.
9
+
10
+ ## Branch
11
+
12
+ - Logic/state/data-model → `LOGIC.md`.
13
+ - Visual/layout/UI → `UI.md`.
14
+ - Ambiguous → ask.
15
+ - User AFK → infer + state assumption.
16
+
17
+ ## Rules
18
+
19
+ 1. Mark throwaway clearly.
20
+ 2. Place near real module/page.
21
+ 3. Follow existing routing/tooling.
22
+ 4. Provide one run command.
23
+ 5. Default no persistence; state in memory.
24
+ 6. Persistence target → scratch DB/file named `PROTOTYPE — wipe me` or equivalent.
25
+ 7. No polish: no tests, minimal errors, no abstractions.
26
+ 8. Surface full relevant state after each action/variant switch.
27
+ 9. Done → capture answer in commit/ADR/issue/`NOTES.md`; delete or fold into real code.