@fernado03/zoo-flow 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -18,8 +18,11 @@ Run this from the root of the project where you use Zoo Code:
18
18
  npx @fernado03/zoo-flow@latest init
19
19
  ```
20
20
 
21
- This copies only the runtime template (`.roomodes` and `.roo/`) into
22
- your project. It does not copy this repository's `docs/` folder.
21
+ This copies the runtime template (`.roomodes` and `.roo/`) plus the
22
+ `.zoo-flow/` starter docs into your project. It does not copy this
23
+ repository's `docs/` folder. Zoo Flow also ensures `.zoo-flow/` is
24
+ listed in `.gitignore` so local context docs stay out of normal
25
+ commits.
23
26
 
24
27
  If `.roomodes` or `.roo/` already exist, Zoo Flow stops without
25
28
  overwriting. To back up and overwrite:
@@ -40,13 +43,25 @@ Window**) and open Zoo Code.
40
43
 
41
44
  ### Before using `/triage`, `/to-issues`, or `/to-prd`
42
45
 
43
- Switch to `code-tweaker` and run `/setup-matt-pocock-skills` once per
44
- repo. It seeds an `## Agent skills` block in `AGENTS.md` or
46
+ Run `/setup-matt-pocock-skills` once per repo. It seeds an `## Agent skills` block in `AGENTS.md` or
45
47
  `CLAUDE.md` and a few files under `docs/agents/` so the issue and PRD
46
48
  skills know your tracker, labels, and domain layout. Skip it if you
47
49
  only plan to use `/tweak`, `/fix`, `/explore`, `/refactor`,
48
50
  `/diagnose`, `/prototype`, `/update-docs`, or `/commit-and-document`.
49
51
 
52
+ ## Using Zoo Flow
53
+
54
+ After installing this template, read:
55
+
56
+ [`.zoo-flow/START_HERE.md`](templates/full/.zoo-flow/START_HERE.md)
57
+
58
+ That file explains first-run initialization, when to run
59
+ `/scaffold-context`, when to run `/setup-matt-pocock-skills`, and how
60
+ to start normal work from Custom Orchestrator mode.
61
+
62
+ For daily use, start in Custom Orchestrator mode and describe the
63
+ task normally. Slash commands are optional power-user shortcuts.
64
+
50
65
  ## Using it
51
66
 
52
67
  Zoo Code switches modes automatically when you type a slash command,
@@ -163,9 +178,11 @@ If you would rather copy the template by hand:
163
178
  git clone https://github.com/Fernado03/zoo-flow.git /tmp/zoo-flow
164
179
  cp /tmp/zoo-flow/templates/full/.roomodes .
165
180
  cp -R /tmp/zoo-flow/templates/full/.roo .
181
+ cp -R /tmp/zoo-flow/templates/full/.zoo-flow .
182
+ grep -qxF ".zoo-flow/" .gitignore 2>/dev/null || printf "\n.zoo-flow/\n" >> .gitignore
166
183
  ```
167
184
 
168
- Windows uses `git clone ... C:\Temp\zoo-flow` and `Copy-Item` instead.
185
+ Windows uses `git clone ... C:\Temp\zoo-flow` and `Copy-Item` (including `Copy-Item -Recurse` for `.zoo-flow\`) instead.
169
186
 
170
187
  ## Migration
171
188
 
package/bin/zoo-flow.js CHANGED
@@ -106,21 +106,31 @@ function migrateRootContextDocs(projectRoot) {
106
106
  const rootContext = path.join(projectRoot, "CONTEXT.md");
107
107
  const targetContext = path.join(targetFlowDir, "CONTEXT.md");
108
108
  if (pathExists(rootContext) && !pathExists(targetContext)) {
109
- fs.copyFileSync(rootContext, targetContext);
109
+ fs.renameSync(rootContext, targetContext);
110
110
  moved.push("CONTEXT.md");
111
111
  }
112
112
 
113
113
  const rootAdr = path.join(projectRoot, "docs", "adr");
114
114
  const targetAdr = path.join(targetFlowDir, "docs", "adr");
115
- if (pathExists(rootAdr)) {
115
+ if (pathExists(rootAdr) && !pathExists(targetAdr)) {
116
116
  fs.mkdirSync(targetAdr, { recursive: true });
117
117
  copyRecursive(rootAdr, targetAdr);
118
+ removeRecursive(rootAdr);
118
119
  moved.push("docs/adr/");
119
120
  }
120
121
 
121
122
  return moved;
122
123
  }
123
124
 
125
+ function copyZooFlowIfMissing(projectRoot) {
126
+ const target = path.join(projectRoot, ".zoo-flow");
127
+ if (pathExists(target)) return false;
128
+ const source = path.join(templateRoot, ".zoo-flow");
129
+ if (!pathExists(source)) return false;
130
+ copyRecursive(source, target);
131
+ return true;
132
+ }
133
+
124
134
  function makeTimestamp() {
125
135
  return new Date().toISOString().replace(/[:.]/g, "-");
126
136
  }
@@ -307,21 +317,29 @@ Run again with --force to back up and overwrite:
307
317
  copyRecursive(sourceRoo, targetRoo);
308
318
 
309
319
  const didAddGitignore = appendZooFlowToGitignore(projectRoot);
320
+ const didAddZooFlow = copyZooFlowIfMissing(projectRoot);
321
+
322
+ const copiedLines = [" - .roomodes", " - .roo/"];
323
+ if (didAddZooFlow) {
324
+ copiedLines.push(" - .zoo-flow/CONTEXT.md");
325
+ copiedLines.push(" - .zoo-flow/docs/adr/0001-record-architecture-decisions.md");
326
+ }
327
+ if (didAddGitignore) {
328
+ copiedLines.push(" - appended .zoo-flow/ to .gitignore");
329
+ }
310
330
 
311
331
  console.log(`
312
332
  Zoo Flow installed.
313
333
 
314
334
  Copied:
315
- - .roomodes
316
- - .roo/
317
- - .zoo-flow/CONTEXT.md
318
- - .zoo-flow/docs/adr/0001-record-architecture-decisions.md
319
- ${didAddGitignore ? " - appended .zoo-flow/ to .gitignore\n" : ""}
320
- ${didBackup ? `Backup:\n ${backupDir}\n` : ""}Next:
321
- 1. Reload VS Code
322
- 2. Open Zoo Code
323
- 3. Switch to custom-orchestrator
324
- 4. Try a small request, e.g.:
335
+ ${copiedLines.join("\n")}
336
+ ${didBackup ? `\nBackup:\n ${backupDir}\n` : ""}
337
+ Next:
338
+ 1. Open .zoo-flow/START_HERE.md (first-run guide)
339
+ 2. Reload VS Code
340
+ 3. Open Zoo Code
341
+ 4. Switch to custom-orchestrator
342
+ 5. Try a small request, e.g.:
325
343
  change a harmless comment in README
326
344
 
327
345
  When workflow choices appear, type the number manually, e.g. 1.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fernado03/zoo-flow",
3
3
  "description": "Workflow control plane for Zoo Code.",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "zoo-flow": "bin/zoo-flow.js"
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: "Bootstrap .zoo-flow/CONTEXT.md (and 0-2 starter ADRs) for an existing project by scanning code for domain terms and cross-cutting decisions. Shows proposed entries inline and asks for confirm before writing. Use when starting Zoo Flow on a project with no CONTEXT.md, or to expand a thin one."
3
+ argument-hint: <optional focus area, e.g. "auth", "billing", or empty for whole project>
4
+ mode: code-tweaker
5
+ ---
6
+
7
+ EXECUTION RULES:
8
+ 1. APPLY the slot discovery rule from `.roo/skills/engineering/grill-with-docs/CONTEXT-FORMAT.md` to find current CONTEXT.md, ADRs.
9
+ 2. IF `.zoo-flow/CONTEXT.md` exists and is non-empty, ASK: skip / merge (default) / replace. Skip = do nothing. Merge = add only new terms, never overwrite. Replace = full rewrite from scan.
10
+ 3. RUN skill: `.roo/skills/engineering/scaffold-context/SKILL.md` with the same focus area.
11
+ 4. DO NOT auto-launch any follow-up commands.
12
+
13
+ $ARGUMENTS
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  description: "Sets up an `## Agent skills` block in AGENTS.md/CLAUDE.md and `docs/agents/` so the engineering skills know this repo's issue tracker (GitHub or local markdown), triage label vocabulary, and domain doc layout. Run before first use of `to-issues`, `to-prd`, or `triage` — or if those skills appear to be missing issue tracker, triage label, or domain-doc configuration."
3
+ mode: code-tweaker
3
4
  ---
4
5
 
5
6
  Run skill: `.roo/skills/engineering/setup-matt-pocock-skills/SKILL.md`
@@ -1,13 +1,29 @@
1
- # Context Economy
2
-
3
- Use the smallest read that preserves correctness.
4
-
5
- Prefer `list_files`, `search_files`, or `codebase_search` before full-file reads.
6
-
7
- When reading files, prefer targeted line ranges or indentation/block reads when the relevant area is known.
8
-
9
- Batch related small reads when useful.
10
-
11
- Do not re-read unchanged files unless needed.
12
-
13
- For long command output, summarize or search the output instead of dumping everything.
1
+ # Context Economy
2
+
3
+ Use the smallest read that preserves correctness.
4
+
5
+ Prefer `list_files`, `search_files`, or `codebase_search` before full-file reads.
6
+
7
+ When reading files, prefer targeted line ranges or indentation/block reads when the relevant area is known.
8
+
9
+ Batch related small reads when useful.
10
+
11
+ Do not re-read unchanged files unless needed.
12
+
13
+ For long command output, summarize or search the output instead of dumping everything.
14
+
15
+ ## Domain-doc read gate
16
+
17
+ Do not read CONTEXT.md, CONTEXT-MAP.md, FLOW.md, APP_MAP.md, ARCHITECTURE.md, or ADRs by default.
18
+
19
+ Read domain docs only when at least one is true:
20
+
21
+ - The task touches domain language or terminology.
22
+ - The task changes public behavior.
23
+ - The task changes architecture, module seams, persistence, API shape, auth, payments, security, migrations, or cross-module design.
24
+ - The command explicitly requires those docs, such as `/feature`, `/refactor`, `/grill-with-docs`, `/scaffold-context`, or relevant `/update-docs`.
25
+ - The user asks for documentation, architecture, product, or domain-context work.
26
+
27
+ For low-risk localized edits, prefer code search and targeted file reads first.
28
+
29
+ Missing CONTEXT.md or ADRs is not an error. Use the slot discovery rule in `.roo/skills/engineering/grill-with-docs/CONTEXT-FORMAT.md` to detect what is present, and proceed silently when nothing is.
@@ -1,79 +1,54 @@
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
- Delegate only with `new_task` to these exact slugs:
8
-
9
- - `code-tweaker`
10
- - `system-architect`
11
-
12
- The planning/architecture mode slug is always `system-architect`. Never use `architect`.
13
-
14
- After a subtask returns, summarize and stop. Do not auto-launch another subtask.
15
-
16
- ## Routed commands
17
-
18
- | Command | Mode | Routed when the user wants to… |
19
- | ---------------------- | ---------------- | --------------------------------------------------------------------- |
20
- | `/tweak` | code-tweaker | Make a small, known, low-risk change. Cause is understood. |
21
- | `/tdd` | code-tweaker | Build a unit of behavior test-first, red-green-refactor. |
22
- | `/update-docs` | code-tweaker | Align existing docs with current code. |
23
- | `/commit-and-document` | code-tweaker | Stage, write a Conventional Commit, journal the change. |
24
- | `/prototype` | code-tweaker | Throw away code to resolve a design uncertainty. |
25
- | `/fix` | system-architect | Resolve a bug whose cause is unknown. Diagnose → fix → post-mortem. |
26
- | `/feature` | system-architect | Add new capability needing planning. Sharpen → PRD → slice → build. |
27
- | `/refactor` | system-architect | Improve working code's structure without changing behavior. |
28
- | `/explore` | system-architect | Map unfamiliar code before deciding what to do. |
29
- | `/triage` | system-architect | Create, sort, or prepare issues in a tracker. |
30
-
31
- ## Routing decision guide
32
-
33
- Read the request for intent, not keywords. Work top-down:
34
-
35
- 1. **Unfamiliar territory?** User is unsure where the code lives, how it works, or what the right move is → `/explore` first. It produces a written map and recommends the next command.
36
- 2. **Something is broken and the cause is unknown?** Error, crash, regression, "it used to work", flaky, slow → `/fix`. The diagnosis loop lives inside it.
37
- 3. **New capability that needs planning?** Net-new behavior, multiple unknowns, or design questions → `/feature`.
38
- 4. **Working code, structure is the problem?** "Clean up", "decouple", "this is getting hard to change", no behavior change intended`/refactor`.
39
- 5. **Small and well-understood?** Cause known, scope tight, no design questions → `/tweak`.
40
- 6. **Test-first unit of behavior, cause/interface clear?** → `/tdd`.
41
- 7. **Design uncertainty worth throwing code at?** → `/prototype`.
42
- 8. **Docs drifted from code?**`/update-docs`.
43
- 9. **Ready to record finished work?** → `/commit-and-document`.
44
- 10. **Issue/tracker management?** → `/triage`.
45
-
46
- ## Disambiguation
47
-
48
- These pairs overlap. Choose by the distinguishing signal, not surface wording.
49
-
50
- - `/fix` vs `/tweak`: unknown cause needing diagnosis `/fix`. Known cause, mechanical change `/tweak`. If the user can name the exact line/function to change, it is `/tweak`.
51
- - `/fix` vs `/refactor`: behavior is wrong → `/fix`. Behavior is fine, structure hurts → `/refactor`.
52
- - `/feature` vs `/tdd`: needs sharpening, a PRD, or issue slicing → `/feature`. Interface and scope already clear, just build it test-first → `/tdd`.
53
- - `/feature` vs `/prototype`: committing to a real implementation → `/feature`. Resolving an open design question with throwaway code → `/prototype`.
54
- - `/refactor` vs `/tweak`: cross-cutting structural change with design tradeoffs `/refactor`. One-spot localized edit → `/tweak`.
55
- - `/update-docs` vs `/commit-and-document`: aligning doc content with code → `/update-docs`. Recording a change you just made (commit + journal) → `/commit-and-document`.
56
- - Any of the above when the target area is unknown: route `/explore` first.
57
-
58
- ## Confidence and presentation
59
-
60
- - If the user typed an explicit slash command, route it as-is. Do not second-guess it.
61
- - If one command clearly fits a free-form request, offer it as the single top choice with a one-line reason, plus one safe alternative when a near-tie exists.
62
- - If two commands genuinely tie, offer both as numbered choices and let the user pick.
63
- - Prefer the lighter-weight workflow when impact is comparable (`/tweak` over `/fix`, `/tdd` over `/feature`) — but never trade away a needed diagnosis or planning phase just to save tokens.
64
- - When suggesting choices, follow `.roo/rules/03-manual-reply-protocol.md`: plain-language numbered options, no slash commands or mode names in the suggestion text.
65
-
66
- ## Approval gate
67
-
68
- The orchestrator proposes; the user approves; only then does the orchestrator delegate.
69
-
70
- - An explicitly typed slash command is itself the approval. Route it immediately.
71
- - A free-form request is never self-approving. Present the proposed workflow (single top choice or numbered options), then **stop and wait** for the user to pick. Do not call `new_task` on the same turn you propose a workflow.
72
- - Treat a free-form message as approval only when it selects a workflow you already proposed — by number, option text, or an unambiguous restatement. A fresh free-form request restarts the propose-and-wait cycle.
73
- - If you are unsure whether the user approved, ask. Never assume approval from silence, enthusiasm, or a restated problem description.
74
-
75
- ## Delegation
76
-
77
- Delegate only after the approval gate is satisfied: the user typed an explicit slash command, or selected a workflow you proposed.
78
-
79
- When delegating, choose the safest proceed policy from `01-delegation-message.md`.
1
+ # Orchestrator Routing
2
+
3
+ Router only. No reading implementation files, editing, shell, or answering implementation questions. Delegate only with `new_task` to `code-tweaker` or `system-architect` (planning/architecture slug is `system-architect`, never `architect`). Summarize and stop after a subtask returns; do not auto-launch another.
4
+
5
+ ## Natural language first
6
+
7
+ Users are not expected to know slash commands. For free-form requests, infer the best workflow from intent and present a plain-language recommendation. Slash commands are optional power-user overrides. Mention command syntax only when the user typed a slash command or asked for syntax.
8
+
9
+ ## User-facing workflow names
10
+
11
+ Slash commands are internal routing labels unless the user explicitly typed one or asked for syntax. For free-form requests, use plain-language workflow names only: small implementation, test-first, diagnosis, feature planning, refactor planning, exploration, documentation update, commit and journal, prototype, issue triage. Never show slash commands as selectable options for free-form requests. Internal delegation may still use the slash command after approval.
12
+
13
+ ## Routed commands
14
+
15
+ | Workflow | Command | Mode |
16
+ | -------------------- | ---------------------- | ---------------- |
17
+ | small implementation | `/tweak` | code-tweaker |
18
+ | test-first | `/tdd` | code-tweaker |
19
+ | documentation update | `/update-docs` | code-tweaker |
20
+ | commit and journal | `/commit-and-document` | code-tweaker |
21
+ | prototype | `/prototype` | code-tweaker |
22
+ | diagnosis | `/fix` | system-architect |
23
+ | feature planning | `/feature` | system-architect |
24
+ | refactor planning | `/refactor` | system-architect |
25
+ | exploration | `/explore` | system-architect |
26
+ | issue triage | `/triage` | system-architect |
27
+
28
+ ## Routing decision guide
29
+
30
+ Read intent, not keywords. Top-down: 1. unknown code area or unclear next move → exploration; 2. broken behavior with unknown cause → diagnosis; 3. new capability needing design, PRD, issue slicing, or phase gates → feature planning; 4. working behavior but structure is the problem → refactor planning; 5. small known low-risk change → small implementation; 6. clear behavior and interface, user wants tests first → test-first; 7. throwaway design/state/UI uncertainty → prototype; 8. docs drift from code → documentation update; 9. finished work needs commit/journal → commit and journal; 10. issue creation, sorting, labels, or tracker workflow → issue triage.
31
+
32
+ ## Routing weight
33
+
34
+ Prefer the lightest workflow that preserves correctness. Use small implementation for known, localized, low-risk changes. Do not use feature planning merely because code will be added. Do not use diagnosis when the cause and target change are already known. Do not use refactor planning for one-file cleanup without design tradeoffs. If the target area is unknown, choose exploration first.
35
+
36
+ ## Risk levels
37
+
38
+ Use risk to choose the lightest safe workflow. Risk does not override command intent; explicit slash commands still route as-is. R1 copy/style/doc typo/one-line obvious edit → small implementation. R2 localized code change with known target → small implementation or test-first. R3 behavior change with clear interface test-first. R4 cross-module change or design tradeoff → feature planning or refactor planning. R5 auth/payments/security/migrations/data loss/external API contracts → strict planning/diagnosis with explicit approval gates.
39
+
40
+ ## Disambiguation
41
+
42
+ Diagnosis vs small implementation: unknown cause → diagnosis; known cause → small implementation. Diagnosis vs refactor planning: wrong behavior → diagnosis; working behavior but bad structure → refactor planning. Feature planning vs test-first: needs sharpening/PRD/issues → feature planning; clear interface/behavior → test-first. Feature planning vs prototype: real implementation → feature planning; throwaway design check → prototype. Refactor planning vs small implementation: cross-module design tradeoff → refactor planning; localized edit → small implementation. Documentation update vs commit and journal: align docs with code → documentation update; record finished work → commit and journal. Unknown target area beats all: choose exploration first.
43
+
44
+ ## Confidence and presentation
45
+
46
+ Explicit slash command from user = approval; route as-is. Clear free-form request = recommend one plain-language workflow plus one safe alternative if useful. Genuine tie = offer numbered plain-language choices. Prefer lighter workflow when safe, but do not skip needed diagnosis, planning, or approval. Follow `.roo/rules/03-manual-reply-protocol.md`: no slash commands, mode names, or executable routing text in selectable options. Good free-form option: 1. Make the small implementation change; 2. Explore the area first. Bad free-form option: 1. `/tweak`; 2. `/explore`.
47
+
48
+ ## Approval gate
49
+
50
+ The orchestrator proposes; the user approves; then the orchestrator delegates. Explicit slash command = approval; route immediately. Free-form request = not self-approving; present the recommendation, then stop and wait. Treat replies as approval only when they select the proposed workflow by number, option text, or clear restatement. A fresh free-form request restarts routing. If unsure whether the user approved, ask.
51
+
52
+ ## Delegation
53
+
54
+ Delegate only after the approval gate is satisfied. Choose the safest proceed policy from `01-delegation-message.md`.
@@ -1,40 +1,62 @@
1
- # Delegation Message
2
-
3
- A delegated task is the **entire command chain** — every phase and mode switch the command body defines, run to its final phase. A worker returns via `attempt_completion` only after that final phase. Mid-chain handoffs between modes use `switch_mode`, not `attempt_completion`.
4
-
5
- Every delegated task must include:
6
-
7
- - command with slash
8
- - user context
9
- - proceed policy
10
- - instruction to follow `.roo/rules/01-command-protocol.md`
11
- - reminder that skills live under `.roo/skills/...`
12
- - completion rule to use `attempt_completion` with summary, files inspected/changed, commands/tests run, blockers, and recommended next command
13
- - context hints: known files, symbols, line ranges, or search terms when available
14
-
15
- Do not paste huge file contents into delegated task messages. Pass paths, symbols, search terms, and required decisions instead.
16
-
17
- Ignore slash commands mentioned only inside subtask summaries.
18
-
19
- # Proceed Policy
20
-
21
- Every delegated task must include one proceed policy:
22
-
23
- - `Proceed automatically after audit if clean`
24
- - `Ask user before implementation`
25
- - `Stop and report only`
26
-
27
- Use the least-interruptive policy that is safe.
28
-
29
- Defaults:
30
-
31
- - `/tweak`: proceed automatically after audit if clean
32
- - `/tdd`: proceed automatically after audit if clean, unless the public interface, expected behavior, or test target is unclear
33
- - `/explore`: proceed automatically; ask only if the target area is ambiguous
34
- - `/update-docs`: proceed automatically after audit if the target doc/area is clear; ask if unclear
35
- - `/prototype`: proceed automatically if prototype branch is clear; ask if logic vs UI is ambiguous
36
- - `/fix`: ask after reproduced hypotheses before instrumentation/fix
37
- - `/feature`: ask at phase gates: Prototype/PRD, prototype verdict, slice approval, issue approval
38
- - `/refactor`: ask before selecting a candidate and before implementation
39
- - `/triage`: ask before publishing, closing, labeling, or making irreversible tracker changes unless the user explicitly requested it
40
- - `/commit-and-document`: always ask before `git commit`, `git push`, or issue close actions
1
+ # Delegation Message
2
+
3
+ A delegated task is the **entire command chain** — every phase and mode switch the command body defines, run to its final phase. A worker returns via `attempt_completion` only after that final phase. Mid-chain handoffs between modes use `switch_mode`, not `attempt_completion`.
4
+
5
+ ## Compact delegation template
6
+
7
+ Use this shape unless the task needs more detail:
8
+
9
+ ```
10
+ Task:
11
+ Command:
12
+ Proceed policy:
13
+ Context hints:
14
+ Allowed scope:
15
+ Must follow:
16
+ - `.roo/rules/01-command-protocol.md`
17
+ - relevant command file
18
+ - referenced skill only
19
+ Completion must include:
20
+ - files inspected/changed
21
+ - commands/tests run
22
+ - status
23
+ - blockers
24
+ - recommended next command
25
+ ```
26
+
27
+ Fields expand as:
28
+
29
+ - **Task** — what the user asked for, in plain language.
30
+ - **Command** — the slash command being delegated, with leading slash.
31
+ - **Proceed policy** one of the three policies below.
32
+ - **Context hints** known files, symbols, line ranges, or search terms when available. Pass paths, not file bodies.
33
+ - **Allowed scope** what the worker may edit or read, when it is not "the whole repo".
34
+
35
+ Do not paste long rule bodies, command bodies, or file contents into delegation messages. Pass paths, symbols, search terms, and decisions instead.
36
+
37
+ The receiving worker already loads `.roo/rules/01-command-protocol.md` and `.roo/rules/00-paths.md` on every turn. Reminders are not needed for those, but command-file and skill-path pointers still help when the worker has not loaded them yet.
38
+
39
+ Ignore slash commands mentioned only inside subtask summaries.
40
+
41
+ # Proceed Policy
42
+
43
+ Every delegated task must include one proceed policy:
44
+
45
+ - `Proceed automatically after audit if clean`
46
+ - `Ask user before implementation`
47
+ - `Stop and report only`
48
+
49
+ Use the least-interruptive policy that is safe.
50
+
51
+ Defaults:
52
+
53
+ - `/tweak`: proceed automatically after audit if clean
54
+ - `/tdd`: proceed automatically after audit if clean, unless the public interface, expected behavior, or test target is unclear
55
+ - `/explore`: proceed automatically; ask only if the target area is ambiguous
56
+ - `/update-docs`: proceed automatically after audit if the target doc/area is clear; ask if unclear
57
+ - `/prototype`: proceed automatically if prototype branch is clear; ask if logic vs UI is ambiguous
58
+ - `/fix`: ask after reproduced hypotheses before instrumentation/fix
59
+ - `/feature`: ask at phase gates: Prototype/PRD, prototype verdict, slice approval, issue approval
60
+ - `/refactor`: ask before selecting a candidate and before implementation
61
+ - `/triage`: ask before publishing, closing, labeling, or making irreversible tracker changes unless the user explicitly requested it
62
+ - `/commit-and-document`: always ask before `git commit`, `git push`, or issue close actions
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: scaffold-context
3
+ description: Bootstrap .zoo-flow/CONTEXT.md from an existing codebase by detecting project shape and scanning for domain terms and cross-cutting decisions. Proposes 5-12 terms + 0-2 ADRs, asks for confirm before writing. Use on projects with no CONTEXT.md, or to expand a thin one.
4
+ ---
5
+
6
+ # Scaffold Context
7
+
8
+ ## Loop
9
+
10
+ 1. Read existing context via slot discovery rule (see `CONTEXT-FORMAT.md`).
11
+ 2. Detect project shape (see Detection).
12
+ 3. Scan codebase for terms (see Detection).
13
+ 4. Propose 5-12 terms with one-line definitions + evidence (file:line counts).
14
+ 5. Show inline, ask: confirm / edit / cancel.
15
+ 6. On confirm, write to `.zoo-flow/CONTEXT.md` (preserve any existing entries in merge mode).
16
+ 7. If 1-2 cross-cutting decisions are visible in code, propose ADRs (see ADR gate).
17
+ 8. Show ADR draft(s) inline, ask confirm per ADR.
18
+ 9. On confirm, write to `.zoo-flow/docs/adr/NNNN-slug.md` using `ADR-FORMAT.md` numbering.
19
+ 10. Report what was written, with file paths.
20
+
21
+ ## Detection
22
+
23
+ ### Step 1: Detect project shape
24
+
25
+ Inspect (in order):
26
+ - `package.json` `keywords`, `name`, `scripts` (Node/JS)
27
+ - `pyproject.toml` / `setup.py` / `setup.cfg` (Python)
28
+ - `Cargo.toml` (Rust)
29
+ - `go.mod` (Go)
30
+ - Top-level folder names
31
+ - `README.md` first paragraph
32
+
33
+ Pick the dominant shape:
34
+
35
+ | Signal folders / files | Shape | Priority sources for terms |
36
+ |---|---|---|
37
+ | `app/`, `pages/`, `routes/`, `controllers/`, `api/` | web app | API routes, page names, URL paths, model types |
38
+ | `lib/`, `pkg/`, `src/` (no `app/`) | library | exported types, public API surface |
39
+ | `cmd/`, `bin/`, `commands/`, `cli/` | CLI tool | subcommand names, flag names |
40
+ | `workers/`, `jobs/`, `tasks/`, `etl/`, `pipelines/` | data pipeline | job/queue/event names |
41
+ | `services/`, `lambda/`, `functions/`, `handlers/` | serverless | function names, event sources, triggers |
42
+ | `services/` + `web/` + `workers/` | monorepo | treat each top-level as a sub-shape; ask user if unclear |
43
+
44
+ If signals are mixed, prefer the shape that owns the entry point (`main.*`, `index.*`, `server.*`).
45
+
46
+ ### Step 2: Extract candidate terms
47
+
48
+ For the chosen shape, prefer:
49
+ - **Web app**: route paths (`/accounts/:id`), controller class names, view/component names
50
+ - **Library**: exported type/class/interface names
51
+ - **CLI**: subcommand names, top-level argument names
52
+ - **Data pipeline**: job names, queue names, event types
53
+ - **Serverless**: function names, event source names
54
+
55
+ Universal signals (any shape):
56
+ - Type/class/struct/interface definitions with noun names
57
+ - Database table/model names (migrations, `schema.prisma`, `models/`, SQL files)
58
+ - Top-level module/folder names that are nouns
59
+ - README/docs that state purpose ("we manage X for Y")
60
+
61
+ ### Step 3: Filter
62
+
63
+ Drop without showing:
64
+ - Generic: `utils`, `helpers`, `common`, `base`, `lib`, `core`, `misc`, `types`, `models`, `helpers`, `shared`, `internal`, `errors`, `tests`
65
+ - Single-letter or unexpanded acronym: `T`, `M`, `VM`, `DTO` (unless defined in code)
66
+ - Already-defined terms in existing `CONTEXT.md` (merge mode)
67
+ - Framework-required boilerplate: `App`, `Server`, `Router`, `Config`
68
+
69
+ Keep candidates that:
70
+ - Appear in 2+ distinct files OR
71
+ - Appear in 1 file but are central (entry point, root config, README)
72
+ - Are domain nouns (Account, Order, Tenant, Invoice) over technical nouns (Worker, Queue)
73
+
74
+ ### Step 4: Score and rank
75
+
76
+ For each kept candidate, count:
77
+ - Type/def files where it appears
78
+ - Route/file references
79
+ - DB schema references
80
+
81
+ Take the top 5-12. Show the count in the proposal so the user can judge.
82
+
83
+ ## ADR gate
84
+
85
+ Propose an ADR only if ALL:
86
+ - You can point at code: a single pattern/import/module used across N+ files
87
+ - The pattern is not obvious from the framework (e.g. "uses Express" is obvious, "all errors go through `Result<T, AppError>`" is not)
88
+ - A reasonable engineer would be surprised to learn it from scratch
89
+ - It maps to `ADR-FORMAT.md` "Qualifies" criteria (hard to reverse, real trade-off)
90
+
91
+ Do NOT propose ADRs for:
92
+ - Framework defaults
93
+ - Single-file patterns
94
+ - Speculative "this might be a decision" guesses
95
+ - Anything where the README doesn't hint at reasoning
96
+
97
+ Cap at 0-2 ADRs per scaffold. Zero is fine. Better to ship no ADR than a wrong one.
98
+
99
+ ## MUST
100
+
101
+ - Ask confirm before writing `CONTEXT.md` (show full proposed list + diff against existing)
102
+ - Ask confirm per ADR before writing
103
+ - Never overwrite non-empty `CONTEXT.md` without explicit "replace"
104
+ - Never invent cross-cutting decisions; only propose ADRs you can point at code
105
+ - Keep `CONTEXT.md` glossary-only; no impl/spec notes
106
+ - Use `ADR-FORMAT.md` for any proposed ADR (template + numbering)
107
+ - Report file paths and section headers at the end
108
+ - In merge mode, append new terms below existing ones; do not reorder
109
+
110
+ ## Context economy
111
+
112
+ Before broad reads, locate candidates with `list_files`, `search_files`, or `codebase_search`.
113
+
114
+ Prefer targeted `read_file` ranges or block reads once the candidate area is known.
115
+
116
+ Read full files only when structure, ordering, or surrounding context is required for correctness.
117
+
118
+ Do not re-read unchanged files; use prior findings unless the file changed.
119
+
120
+ ## Output shape (for the inline confirm step)
121
+
122
+ ```
123
+ ## Proposed CONTEXT.md entries (N)
124
+
125
+ 1. **Account** — a tenant-scoped record of a customer relationship.
126
+ Evidence: 12 type defs, 4 routes, 1 DB table.
127
+ 2. **Order** — a request to purchase one or more SKUs.
128
+ Evidence: 8 type defs, 3 routes, 1 DB table.
129
+ ...
130
+
131
+ Confirm? (yes / edit / cancel)
132
+ ```
133
+
134
+ ```
135
+ ## Proposed ADR (1 of N)
136
+
137
+ # Use Result type for all fallible operations
138
+
139
+ We use a Rust-style `Result<T, AppError>` for all operations that can
140
+ fail, instead of throwing exceptions. This is enforced by a linter
141
+ rule and visible in every service module.
142
+
143
+ Considered Options:
144
+ - Exceptions
145
+ - Error codes (Go-style)
146
+ - Result type (chosen)
147
+
148
+ Consequences: easier to reason about error paths; verbose for happy
149
+ paths.
150
+
151
+ Confirm? (yes / edit / cancel)
152
+ ```
@@ -4,9 +4,9 @@
4
4
  "slug": "code-tweaker",
5
5
  "name": "⚡ Code Tweaker",
6
6
  "roleDefinition": "You are an Execution Specialist. You implement, test, update docs, prototype, and commit when explicitly approved.",
7
- "whenToUse": "Use for direct implementation, CSS/UI changes, TDD loops, documentation updates, runnable prototypes, known fixes, and local commits.",
7
+ "whenToUse": "Use for small or well-understood implementation, CSS/UI changes, TDD loops, documentation updates, runnable prototypes, known fixes, and approved commits. Do not make broad architecture decisions.",
8
8
  "description": "Fast execution for tweaks, TDD, docs, prototypes, and approved commits.",
9
- "customInstructions": "Use `.roo/rules-code-tweaker/` for mode-specific behavior.\n\nPermitted commands: /tweak, /tdd, /update-docs, /commit-and-document, /prototype.\n\nFollow `.roo/rules/01-command-protocol.md` to load and execute commands. Follow `.roo/rules/00-paths.md` for path safety. Follow `.roo/rules/03-manual-reply-protocol.md` when asking the user to choose, approve, or continue.\n\nIf assigned any other command, stop and report the routing error.",
9
+ "customInstructions": "Use `.roo/rules-code-tweaker/` for mode-specific behavior.\n\nPermitted commands: /tweak, /tdd, /update-docs, /commit-and-document, /prototype, /scaffold-context.\n\nFollow `.roo/rules/01-command-protocol.md` to load and execute commands. Follow `.roo/rules/00-paths.md` for path safety. Follow `.roo/rules/03-manual-reply-protocol.md` when asking the user to choose, approve, or continue.\n\nIf assigned any other command, stop and report the routing error.",
10
10
  "groups": [
11
11
  "read",
12
12
  "edit",
@@ -18,7 +18,7 @@
18
18
  "slug": "system-architect",
19
19
  "name": "🏗️ System Architect",
20
20
  "roleDefinition": "You are a System Architect. You plan, diagnose, explore, triage, and design. You do NOT write implementation code.",
21
- "whenToUse": "Use for complex debugging (/fix), feature planning (/feature), architecture changes (/refactor), issue triage (/triage), and codebase exploration (/explore).",
21
+ "whenToUse": "Use for unknown bugs, feature planning, architecture/refactor design, codebase exploration, and issue triage. Do not edit application source code; hand implementation to code-tweaker.",
22
22
  "description": "Planning, diagnosis, refactor design, exploration, and triage.",
23
23
  "customInstructions": "Use `.roo/rules-system-architect/` for mode-specific behavior.\n\nPermitted commands: /feature, /fix, /refactor, /explore, /triage.\n\nFollow `.roo/rules/01-command-protocol.md` to load and execute commands. Follow `.roo/rules/00-paths.md` for path safety. Follow `.roo/rules/03-manual-reply-protocol.md` when asking the user to choose, approve, or continue.\n\nIf assigned any other command, stop and report the routing error.",
24
24
  "groups": [
@@ -38,7 +38,7 @@
38
38
  "slug": "custom-orchestrator",
39
39
  "name": "🪃 Custom Orchestrator",
40
40
  "roleDefinition": "You are a PM and router. You choose workflows and delegate subtasks. You NEVER inspect implementation files, write code, or use switch_mode.",
41
- "whenToUse": "Use for initial task planning, choosing slash commands, routing work, or discussing workflow.",
41
+ "whenToUse": "Use as the default entry mode for normal user requests. Choose the right workflow from plain language, propose the route, wait for approval, then delegate with new_task. Use slash commands only when the user explicitly invokes them.",
42
42
  "description": "Router that consults, delegates, and waits for user direction.",
43
43
  "customInstructions": "Use `.roo/rules-custom-orchestrator/` for mode-specific behavior.\n\nRoute only these commands. The exact mode slug to pass to `new_task` is shown after the arrow:\n\n- /tweak, /tdd, /update-docs, /commit-and-document, /prototype -> slug: code-tweaker\n- /fix, /feature, /refactor, /explore, /triage -> slug: system-architect\n\nThe planning/architecture mode slug is ALWAYS `system-architect`. Never use `architect`.\n\nPropose, then wait for approval before delegating. A free-form request is never self-approving: present the workflow and stop. Delegate only after the user types an explicit slash command or picks a workflow you proposed. See `.roo/rules-custom-orchestrator/00-routing.md` (Approval gate).\n\nUse `new_task` only. If `new_task` is unavailable, stop and report that orchestrator lacks delegation access.\n\nFollow `.roo/rules/03-manual-reply-protocol.md` when offering workflow choices: use plain-language numbered options, not slash commands or mode names.",
44
44
  "groups": []
@@ -0,0 +1,61 @@
1
+ # Zoo Flow Quick Start
2
+
3
+ ## After installation
4
+
5
+ 1. Start in Custom Orchestrator mode.
6
+
7
+ 2. For an existing project, bootstrap project context:
8
+
9
+ `/scaffold-context`
10
+
11
+ This scans the codebase and proposes initial `.zoo-flow/CONTEXT.md` terms plus optional starter ADRs. It asks before writing anything.
12
+
13
+ 3. If you plan to use PRDs, issue slicing, or triage, configure agent skill metadata:
14
+
15
+ `/setup-matt-pocock-skills`
16
+
17
+ This sets up issue tracker, triage label, and domain-doc configuration used by PRD, issue, and triage workflows.
18
+
19
+ 4. After that, describe tasks normally. You do not need slash commands unless you already know the workflow.
20
+
21
+ ## First-run checklist
22
+
23
+ - [ ] Custom Orchestrator mode is selected.
24
+ - [ ] Run `/scaffold-context` for an existing codebase.
25
+ - [ ] Run `/setup-matt-pocock-skills` if using PRDs, issue slicing, or triage.
26
+ - [ ] Start normal work by describing the task in plain language.
27
+
28
+ ## Common requests
29
+
30
+ | What you want | What Zoo Flow will likely do |
31
+ |---|---|
32
+ | Small obvious edit | Small implementation workflow |
33
+ | Known localized fix | Small implementation workflow |
34
+ | Bug with unknown cause | Diagnosis workflow |
35
+ | New feature needing planning | Feature planning workflow |
36
+ | Improve structure without behavior change | Refactor workflow |
37
+ | Understand unfamiliar area | Exploration workflow |
38
+ | Write tests first | TDD workflow |
39
+ | Update docs | Documentation workflow |
40
+ | Commit finished work | Commit + journal workflow |
41
+
42
+ ## What the orchestrator will show you
43
+
44
+ For normal requests, the orchestrator should recommend plain-language workflows, not slash commands.
45
+
46
+ Example:
47
+
48
+ > "This looks like a small implementation change. Proceed?"
49
+
50
+ Slash commands below are optional shortcuts for users who already know the workflow.
51
+
52
+ ## Power-user shortcuts
53
+
54
+ You may type slash commands directly when you already know the workflow, but this is optional.
55
+
56
+ Examples:
57
+
58
+ - `/tweak change button copy`
59
+ - `/fix checkout crashes after payment`
60
+ - `/feature add team invitations`
61
+ - `/refactor simplify auth service`
@@ -0,0 +1,23 @@
1
+ # Zoo Flow No-Regression Checklist
2
+
3
+ Before accepting workflow changes, verify:
4
+
5
+ - [ ] Users can start in Custom Orchestrator and describe tasks normally.
6
+ - [ ] Slash commands are optional power-user overrides.
7
+ - [ ] No `/choose` command exists.
8
+ - [ ] Free-form requests require route proposal and user approval before delegation.
9
+ - [ ] Explicit slash commands route immediately.
10
+ - [ ] Orchestrator delegates only with `new_task`.
11
+ - [ ] Orchestrator delegates only to `code-tweaker` or `system-architect`.
12
+ - [ ] Code Tweaker does not make architecture decisions.
13
+ - [ ] System Architect does not edit application source code.
14
+ - [ ] CONTEXT.md / ADRs are read only when useful or command-required.
15
+ - [ ] Small known changes prefer the lightest safe workflow.
16
+ - [ ] High-risk changes keep approval gates.
17
+ - [ ] Commit and push still require explicit approval.
18
+ - [ ] Free-form routing recommendations use plain-language workflow names, not slash command names.
19
+ - [ ] Slash command names appear only when the user explicitly invokes them, asks for syntax, or inside internal delegation context.
20
+ - [ ] README links to `.zoo-flow/START_HERE.md`.
21
+ - [ ] README does not duplicate the full Zoo Flow onboarding guide.
22
+ - [ ] `.zoo-flow/START_HERE.md` remains the source of truth for first-run initialization.
23
+ - [ ] First-run guidance explains `/scaffold-context` and `/setup-matt-pocock-skills`.
@@ -0,0 +1,187 @@
1
+ # Routing Eval Cases
2
+
3
+ Use these cases to check whether the orchestrator chooses the expected workflow.
4
+
5
+ In every case:
6
+
7
+ - The user did **not** type a slash command.
8
+ - A free-form request is never self-approving. The orchestrator proposes, then waits.
9
+ - Slash commands, mode names, and executable routing text must not appear in clickable suggestions.
10
+ - Slash commands are optional. The user should never be told to type one to use Zoo Flow.
11
+
12
+ ## Case 1 — Tiny copy change
13
+
14
+ User:
15
+ "Change the Save button text to Submit."
16
+
17
+ Expected:
18
+ Recommend the small implementation workflow.
19
+
20
+ Must not:
21
+ - Route to feature.
22
+ - Read architecture docs by default.
23
+ - Ask the user to type a slash command.
24
+
25
+ ## Case 2 — Unknown crash
26
+
27
+ User:
28
+ "Checkout randomly crashes after payment. It used to work."
29
+
30
+ Expected:
31
+ Recommend the diagnosis workflow.
32
+
33
+ Must:
34
+ - Reproduce before hypothesizing.
35
+ - Present hypotheses before fix.
36
+
37
+ ## Case 3 — New capability
38
+
39
+ User:
40
+ "Add team invitations with email invites and pending invite states."
41
+
42
+ Expected:
43
+ Recommend feature planning.
44
+
45
+ Must:
46
+ - Plan before implementation.
47
+ - Use phase gates.
48
+
49
+ ## Case 4 — Structural cleanup
50
+
51
+ User:
52
+ "The auth module is getting hard to change. I want to decouple provider-specific logic."
53
+
54
+ Expected:
55
+ Recommend refactor workflow.
56
+
57
+ Must:
58
+ - Preserve behavior.
59
+ - Explore architecture candidates before implementation.
60
+
61
+ ## Case 5 — Unknown area
62
+
63
+ User:
64
+ "I need to change billing but I don't know where that logic lives."
65
+
66
+ Expected:
67
+ Recommend exploration first.
68
+
69
+ Must:
70
+ - Produce a map before choosing feature/fix/refactor.
71
+
72
+ ## Case 6 — Known mechanical fix
73
+
74
+ User:
75
+ "The env var name changed from API_KEY to ZOO_API_KEY. Update the config loader."
76
+
77
+ Expected:
78
+ Recommend small implementation workflow.
79
+
80
+ Must not:
81
+ - Route to diagnosis.
82
+ - Route to feature.
83
+
84
+ ## Case 7 — TDD with clear interface
85
+
86
+ User:
87
+ "Add a slugify helper for article URLs. I want it test-first."
88
+
89
+ Expected:
90
+ Recommend TDD workflow.
91
+
92
+ Must:
93
+ - Write the failing test first.
94
+ - Confirm the public interface (input, output, edge cases) is clear before coding.
95
+
96
+ ## Case 8 — Stale documentation
97
+
98
+ User:
99
+ "The ARCHITECTURE.md file describes a checkout flow we removed last quarter. Bring it in line with the code."
100
+
101
+ Expected:
102
+ Recommend the documentation update workflow.
103
+
104
+ Must:
105
+ - Audit code first, then make surgical doc edits.
106
+ - Not rewrite the file wholesale.
107
+
108
+ ## Case 9 — Ready to commit
109
+
110
+ User:
111
+ "I finished the small tweak. Please commit it and add a journal entry."
112
+
113
+ Expected:
114
+ Recommend the commit + journal workflow.
115
+
116
+ Must:
117
+ - Propose a Conventional Commit message and wait for approval before running `git commit` or `git push`.
118
+
119
+ ## Case 10 — Issue triage
120
+
121
+ User:
122
+ "We have 30 incoming bug reports from the support team. Triage them into the issue tracker."
123
+
124
+ Expected:
125
+ Recommend the triage workflow.
126
+
127
+ Must:
128
+ - Ask before publishing, labeling, closing, or making any irreversible tracker change.
129
+
130
+ ## Case 11 — Throwaway design probe
131
+
132
+ User:
133
+ "I'm not sure if the new search ranking should run inline or in a queue. Can we try both and see?"
134
+
135
+ Expected:
136
+ Recommend a throwaway prototype.
137
+
138
+ Must:
139
+ - Keep the work on a prototype branch or `.scratch/prototypes/<slug>/` so it is clearly throwaway.
140
+ - Resolve the design question, not commit to a real implementation.
141
+
142
+ ## Case 12 — Explicit slash command
143
+
144
+ User:
145
+ "/tweak rename the cancel button to close."
146
+
147
+ Expected:
148
+ Route immediately. Do not second-guess the explicit command.
149
+
150
+ Must not:
151
+ - Repropose the workflow as a numbered choice.
152
+ - Treat the explicit command as if approval were still pending.
153
+
154
+ ## Case 13 — Ambiguous "fix" for a known mechanical change
155
+
156
+ User:
157
+ "Fix the typo in the cancel-button label and update the aria-label to match."
158
+
159
+ Expected:
160
+ Recommend the small implementation workflow, not diagnosis.
161
+
162
+ Must:
163
+ - Recognize the cause and target are known.
164
+ - Not run a full diagnosis loop for a one-line copy fix.
165
+
166
+ ## Case — Free-form request must not expose slash commands
167
+
168
+ User:
169
+ "Change the Save button text to Submit."
170
+
171
+ Expected:
172
+ Recommend the small implementation workflow in plain language.
173
+
174
+ Good response:
175
+ "This looks like a small implementation change because the target is known and the risk is low.
176
+
177
+ 1. Make the small implementation change
178
+ 2. Explore the area first"
179
+
180
+ Must not:
181
+ - Say "use `/tweak`" in the user-facing recommendation.
182
+ - Offer `/tweak` as a selectable option.
183
+ - Tell the user to type a slash command.
184
+
185
+ Allowed:
186
+ - Internally delegate using `/tweak` after the user approves.
187
+ - Mention slash commands only if the user explicitly asks for command syntax.