@abarcenas/ai-workflow-template 1.44.0 → 1.46.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 (68) hide show
  1. package/.agents/config/README.md +43 -0
  2. package/.agents/config/domain.md +37 -0
  3. package/.agents/instructions/agent.instructions.md +10 -10
  4. package/.agents/instructions/learned-knowledge.instructions.md +170 -0
  5. package/.agents/instructions/memory-bank.instructions.md +11 -0
  6. package/.agents/skills/caveman-compress/README.md +2 -0
  7. package/.agents/skills/caveman-compress/SECURITY.md +3 -1
  8. package/.agents/skills/caveman-compress/SKILL.md +4 -0
  9. package/.agents/skills/caveman-compress/scripts/compress.py +9 -2
  10. package/.agents/skills/compress/SKILL.md +4 -0
  11. package/.agents/skills/compress/scripts/compress.py +9 -2
  12. package/.agents/skills/domain-modeling/ADR-FORMAT.md +47 -0
  13. package/.agents/skills/domain-modeling/GLOSSARY-FORMAT.md +60 -0
  14. package/.agents/skills/domain-modeling/SKILL.md +74 -0
  15. package/.agents/skills/grill-me/SKILL.md +7 -0
  16. package/.agents/skills/grill-with-docs/SKILL.md +7 -0
  17. package/.agents/skills/grilling/SKILL.md +28 -0
  18. package/.agents/skills/prototype/LOGIC.md +67 -0
  19. package/.agents/skills/prototype/SKILL.md +26 -0
  20. package/.agents/skills/prototype/UI.md +112 -0
  21. package/.github/workflows/npm-publish.yml +10 -0
  22. package/.github/workflows/pr-test.yml +31 -0
  23. package/.opencode/agents/architect.agent.md +0 -1
  24. package/.opencode/agents/coder.agent.md +0 -1
  25. package/.opencode/agents/deployer.agent.md +0 -1
  26. package/.opencode/agents/designer.agent.md +0 -1
  27. package/.opencode/agents/e2e-tester.agent.md +0 -1
  28. package/.opencode/agents/implementer.agent.md +0 -1
  29. package/.opencode/agents/orchestrator/feature-pipeline.agent.md +0 -1
  30. package/.opencode/agents/orchestrator/orchestrator.agent.md +68 -4
  31. package/.opencode/agents/orchestrator/tdd-orchestrator.agent.md +0 -1
  32. package/.opencode/agents/plan.agent.md +0 -1
  33. package/.opencode/agents/researcher.agent.md +0 -1
  34. package/.opencode/agents/reviewer.agent.md +0 -1
  35. package/.opencode/agents/scope.agent.md +299 -0
  36. package/.opencode/agents/tracker.agent.md +0 -1
  37. package/.opencode/agents/unit-tester.agent.md +0 -1
  38. package/AGENTS.md +44 -5
  39. package/README.md +6 -3
  40. package/package.json +1 -1
  41. package/scripts/bump-version.js +7 -0
  42. package/scripts/bump-version.test.js +238 -0
  43. package/scripts/mcp/playwright-mcp-launcher.js +55 -29
  44. package/scripts/mcp/playwright-mcp-launcher.test.js +217 -0
  45. package/scripts/mcp-memory-server.js +93 -76
  46. package/scripts/mcp-memory-server.test.js +398 -0
  47. package/scripts/memory-cli.test.js +297 -0
  48. package/scripts/memory-index.js +119 -31
  49. package/scripts/memory-index.test.js +1173 -0
  50. package/scripts/normalize-memory.js +26 -1
  51. package/scripts/normalize-memory.test.js +753 -0
  52. package/scripts/setup/discover.test.js +124 -2
  53. package/scripts/setup/hooks.test.js +188 -1
  54. package/scripts/setup/husky-init.test.js +311 -0
  55. package/scripts/setup/index.js +35 -5
  56. package/scripts/setup/index.test.js +279 -0
  57. package/scripts/setup/knowledgebase.test.js +100 -0
  58. package/scripts/setup/skills-phase.js +568 -0
  59. package/scripts/setup/skills-phase.test.js +1274 -0
  60. package/scripts/setup/sync-phase.js +6 -1
  61. package/scripts/setup/sync-phase.test.js +180 -2
  62. package/scripts/setup/ui.test.js +579 -0
  63. package/scripts/setup/utils.test.js +586 -0
  64. package/scripts/sync-unit.test.js +1342 -0
  65. package/scripts/sync.js +540 -246
  66. package/scripts/sync.test.js +283 -0
  67. package/scripts/vocab-sync.test.js +88 -0
  68. package/skills-lock.json +90 -0
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: domain-modeling
3
+ description: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
4
+ ---
5
+
6
+ # Domain Modeling
7
+
8
+ Actively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `GLOSSARY.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)
9
+
10
+ ## File structure
11
+
12
+ Most repos have a single context:
13
+
14
+ ```
15
+ /
16
+ ├── GLOSSARY.md
17
+ ├── docs/
18
+ │ └── adr/
19
+ │ ├── 0001-event-sourced-orders.md
20
+ │ └── 0002-postgres-for-write-model.md
21
+ └── src/
22
+ ```
23
+
24
+ If a `GLOSSARY-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
25
+
26
+ ```
27
+ /
28
+ ├── GLOSSARY-MAP.md
29
+ ├── docs/
30
+ │ └── adr/ ← system-wide decisions
31
+ ├── src/
32
+ │ ├── ordering/
33
+ │ │ ├── GLOSSARY.md
34
+ │ │ └── docs/adr/ ← context-specific decisions
35
+ │ └── billing/
36
+ │ ├── GLOSSARY.md
37
+ │ └── docs/adr/
38
+ ```
39
+
40
+ Create files lazily: only when you have something to write. If no `GLOSSARY.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
41
+
42
+ ## During the session
43
+
44
+ ### Challenge against the glossary
45
+
46
+ When the user uses a term that conflicts with the existing language in `GLOSSARY.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?"
47
+
48
+ ### Sharpen fuzzy language
49
+
50
+ When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account': do you mean the Customer or the User? Those are different things."
51
+
52
+ ### Discuss concrete scenarios
53
+
54
+ When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
55
+
56
+ ### Cross-reference with code
57
+
58
+ When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?"
59
+
60
+ ### Update GLOSSARY.md inline
61
+
62
+ When a term is resolved, update `GLOSSARY.md` right there. Don't batch these up: capture them as they happen. Use the format in [GLOSSARY-FORMAT.md](./GLOSSARY-FORMAT.md).
63
+
64
+ `GLOSSARY.md` should be totally devoid of implementation details. Do not treat `GLOSSARY.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
65
+
66
+ ### Offer ADRs sparingly
67
+
68
+ Only offer to create an ADR when all three are true:
69
+
70
+ 1. **Hard to reverse**: the cost of changing your mind later is meaningful
71
+ 2. **Surprising without context**: a future reader will wonder "why did they do it this way?"
72
+ 3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
73
+
74
+ If any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: grill-me
3
+ description: A relentless interview to sharpen a plan or design.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ Call the Skill tool with "grilling".
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: grill-with-docs
3
+ description: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ Call the Skill tool twice, for "grilling" and "domain-modeling".
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: grilling
3
+ description: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
4
+ ---
5
+
6
+ Interview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.
7
+
8
+ Work the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.
9
+
10
+ Format a round like so:
11
+
12
+ ```
13
+ ❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
14
+
15
+ ➡️ <your recommended answer>
16
+
17
+ ---
18
+
19
+ ❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
20
+
21
+ ➡️ <your recommended answer>
22
+ ```
23
+
24
+ Each round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.
25
+
26
+ Finding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.
27
+
28
+ The session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.
@@ -0,0 +1,67 @@
1
+ # Logic Prototype
2
+
3
+ A single, self-contained HTML file (a **shareable demo**) that lets anyone drive a state model by clicking buttons. Use this when the question is about **business logic, state transitions, or data shape**: the kind of thing that looks reasonable on paper but only feels wrong once you push it through real cases.
4
+
5
+ Because it's one file with nothing to install, you can hand it to a non-developer (a designer, a PM, a domain expert) and let them feel the model for themselves. So it speaks their language, not the code's.
6
+
7
+ ## When this is the right shape
8
+
9
+ - "I'm not sure if this state machine handles the edge case where X then Y."
10
+ - "Does this data model actually let me represent the case where..."
11
+ - "I want to feel out what the API should look like before writing it."
12
+ - Anything where someone wants to **press buttons and watch state change**.
13
+
14
+ If the question is "what should this look like," this is the wrong branch. Use [UI.md](UI.md).
15
+
16
+ ## Process
17
+
18
+ ### 1. State the question
19
+
20
+ Before writing code, write down what state model and what question you're prototyping. One paragraph, at the top of the demo (in a visible intro, not just a comment). A logic prototype that answers the wrong question is pure waste, so make the question explicit so it can be checked later, whether the user is watching now or returning to it AFK.
21
+
22
+ ### 2. Isolate the logic in a portable module
23
+
24
+ Put the actual logic (the bit that's answering the question) in a single `<script>` block written as a small, pure module that could be lifted out and dropped into the real codebase later. The page around it is throwaway; this module isn't.
25
+
26
+ The right shape depends on the question:
27
+
28
+ - **A pure reducer**: `(state, action) => state`. Good when actions are discrete events and state is a single value.
29
+ - **A state machine**: explicit states and transitions. Good when "which actions are even legal right now" is part of the question.
30
+ - **A small set of pure functions** over a plain data type. Good when there's no implicit current state, just transformations.
31
+ - **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.
32
+
33
+ Pick whichever shape best fits the question being asked, *not* whichever is easiest to wire to a page. Keep it pure: no DOM, no `document`, no button handlers reaching inside it. The page calls into it; nothing flows the other direction. This is what makes the prototype useful past its own lifetime: once the question's answered, the validated reducer / machine / function set lifts into the real module on its own.
34
+
35
+ ### 3. Build the shareable HTML file
36
+
37
+ One file, plain HTML/CSS/JS: no framework, no bundler, no server, everything inline so it opens by double-click and survives being emailed around. Anyone should be able to run it by opening it.
38
+
39
+ Write it for a non-developer. Every label is in **domain language**, not code: buttons and state read like the business, not the reducer. Explain in plain words what's happening.
40
+
41
+ Lay it out with a clean hierarchy, top to bottom:
42
+
43
+ 1. **Title and one-line explanation** of what this demo lets you explore (the question from step 1).
44
+ 2. **Current state**: the full relevant state, rendered as a readable panel (labelled fields, not a raw JSON dump), re-rendered after every click so the change is visible. Where it helps a non-developer follow, call out what just changed.
45
+ 3. **Free-play buttons**: one button per action, always available, so anyone can poke at the model in any order. Each click dispatches its action and re-renders the state.
46
+ 4. **Guided walkthroughs**: a set of **scenarios**, one per tab. Each tab holds a short plain-language description of the scenario (the situation it sets up and what to watch for) and underneath it, the ordered **buttons to press** for that scenario. Each step is a real button: clicking it performs that action and moves to the next step. Starting a walkthrough resets to a known initial state so the scenario runs the same way every time.
47
+
48
+ Choose scenarios that demonstrate the awkward cases, the ones hard to reason about on paper: the happy path, a tricky edge case, an attempt at something that should be illegal.
49
+
50
+ Keep it beautiful but restrained: clean typography, generous spacing, one accent colour. No animations, no gimmicks: nothing that competes with the state and the buttons.
51
+
52
+ ### 4. Hand it over
53
+
54
+ Send them the file, or open it for them. They'll click through the walkthroughs and free-play whenever they get to it; the interesting moments are when they say "wait, that shouldn't be possible" or "huh, I assumed X would be different"; those are the bugs in the _idea_, which is the whole point. If they want new actions or a new scenario, add them. Prototypes evolve.
55
+
56
+ ### 5. Capture the answer and the prototype
57
+
58
+ Once the prototype has answered its question, capture the answer, then capture the prototype the way the [SKILL](SKILL.md) describes. The logic-specific mapping: the validated reducer / machine / function set lifts into the real module (the decision, absorbed); the HTML shell rides along to the throwaway branch that keeps the prototype as a primary source, and being one self-contained file, it stays trivially re-runnable there.
59
+
60
+ ## Anti-patterns
61
+
62
+ - **Don't add tests.** A prototype that needs tests is no longer a prototype.
63
+ - **Don't wire it to the real database.** Use in-memory state unless the question is specifically about persistence.
64
+ - **Don't generalise.** No "what if we wanted to support X later." The prototype answers one question.
65
+ - **Don't blur the logic and the page together.** If the pure module references the DOM, `document`, or button handlers, it's no longer liftable. Keep the page as a thin shell over a pure module.
66
+ - **Don't reach for a framework, bundler, or server.** One file the recipient double-clicks; a React app or a dev server defeats "shareable".
67
+ - **Don't ship the HTML shell into production.** The page is optimised for being clicked through by hand. The logic module behind it is the bit worth keeping.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: prototype
3
+ description: Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
4
+ ---
5
+
6
+ # Prototype
7
+
8
+ A prototype is **throwaway code that answers a question**. The question decides the shape.
9
+
10
+ ## Pick a branch
11
+
12
+ Identify which question is being answered, using the user's prompt, the surrounding code, or by asking if the user is around:
13
+
14
+ - **"Does this logic / state model feel right?"** → [LOGIC.md](LOGIC.md). Build a single shareable HTML file (free-play buttons plus tabbed guided walkthroughs) that pushes the state machine through cases that are hard to reason about on paper, and that a non-developer can drive.
15
+ - **"What should this look like?"** → [UI.md](UI.md). Generate several radically different UI variations on a single route, switchable via a URL search param and a floating bottom bar.
16
+
17
+ The two branches produce very different artifacts, so getting this wrong wastes the whole prototype. If the question is genuinely ambiguous and the user isn't reachable, default to whichever branch better matches the surrounding code (a backend module → logic; a page or component → UI) and state the assumption at the top of the prototype.
18
+
19
+ ## Rules that apply to both
20
+
21
+ 1. **Throwaway from day one, and clearly marked as such.** Locate the prototype code close to where it will actually be used (next to the module or page it's prototyping for) so context is obvious, but name it so a casual reader can see it's a prototype, not production. For throwaway UI routes, obey whatever routing convention the project already uses; don't invent a new top-level structure.
22
+ 2. **Trivial to run.** A UI prototype starts from one command in the project's task runner: `pnpm <name>`, `python <path>`, `bun <path>`, etc. A logic demo is a single HTML file the user double-clicks. Either way, no thinking required to start it.
23
+ 3. **No persistence by default.** State lives in memory. Persistence is the thing the prototype is _checking_, not something it should depend on. If the question explicitly involves a database, hit a scratch DB or a local file with a clear "PROTOTYPE, wipe me" name.
24
+ 4. **Skip the polish.** No tests, no error handling beyond what makes the prototype _runnable_, no abstractions. The point is to learn something fast.
25
+ 5. **Surface the state.** After every action (logic) or on every variant switch (UI), print or render the full relevant state so the user can see what changed.
26
+ 6. **Capture it when done.** Fold any validated decision into the real code, then capture the prototype itself as a **primary source**: commit it to a throwaway branch, out of main, and leave a context pointer to that branch on the implementation issue. Capture the answer too (the verdict and the question it settled) in the issue or a commit. The main branch keeps only the validated decision.
@@ -0,0 +1,112 @@
1
+ # UI Prototype
2
+
3
+ Generate **several radically different UI variations** on a single route, switchable from a floating bottom bar. The user flips between variants in the browser, picks one (or steals bits from each), then throws the rest away.
4
+
5
+ If the question is about logic/state rather than what something looks like, this is the wrong branch. Use [LOGIC.md](LOGIC.md).
6
+
7
+ ## When this is the right shape
8
+
9
+ - "What should this page look like?"
10
+ - "I want to see a few options for this dashboard before committing."
11
+ - "Try a different layout for the settings screen."
12
+ - Any time the user would otherwise spend a day picking between three vague mockups in their head.
13
+
14
+ ## Two sub-shapes: strongly prefer sub-shape A
15
+
16
+ A UI prototype is much easier to judge when it's **butting up against the rest of the app**: real header, real sidebar, real data, real density. A throwaway route on its own is a vacuum: every variant looks fine in isolation. Default to sub-shape A whenever there's a plausible existing page to host the variants. Only reach for sub-shape B if the prototype genuinely has no nearby home.
17
+
18
+ ### Sub-shape A: adjustment to an existing page (preferred)
19
+
20
+ The route already exists. Variants are rendered **on the same route**, gated by a `?variant=` URL search param. The existing data fetching, params, and auth all stay. Only the rendering swaps. This is the default; pick it unless there's a specific reason not to.
21
+
22
+ If the prototype is for something that doesn't yet have a page but *would naturally live inside one* (a new section of the dashboard, a new card on the settings screen, a new step in an existing flow), it's still sub-shape A. Mount the variants inside the host page.
23
+
24
+ ### Sub-shape B: a new page (last resort)
25
+
26
+ Only use this when the thing being prototyped genuinely has no existing page to live inside (e.g. an entirely new top-level surface, or a flow that can't be embedded anywhere sensible).
27
+
28
+ Create a **throwaway route** following whatever routing convention the project already uses. Don't invent a new top-level structure. Name it so it's obviously a prototype (e.g. include the word `prototype` in the path or filename). Same `?variant=` pattern.
29
+
30
+ Before committing to sub-shape B, sanity-check: is there really no existing page this could be embedded in? An empty route hides design problems that a populated one would expose.
31
+
32
+ In both sub-shapes the floating bottom bar is identical.
33
+
34
+ ## Process
35
+
36
+ ### 1. State the question and pick N
37
+
38
+ Default to **3 variants**. More than 5 stops being radically different and starts being noise, so cap there.
39
+
40
+ Write down the plan in one line, in the prototype's location or a top-of-file comment:
41
+
42
+ > "Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route."
43
+
44
+ This works whether the user is here to push back or not.
45
+
46
+ ### 2. Generate radically different variants
47
+
48
+ Draft each variant. Hold each one to:
49
+
50
+ - The page's purpose and the data it has access to.
51
+ - The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).
52
+ - A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.
53
+
54
+ Variants must be **structurally different**: different layout, different information hierarchy, different primary affordance, not just different colours. Three slightly-tweaked card grids isn't a UI prototype, it's wallpaper. If two drafts come out too similar, redo one with explicit "do not use a card grid" guidance.
55
+
56
+ ### 3. Wire them together
57
+
58
+ Create a single switcher component on the route:
59
+
60
+ ```tsx
61
+ // pseudo-code, adapt to the project's framework
62
+ const variant = searchParams.get('variant') ?? 'A';
63
+ return (
64
+ <>
65
+ {variant === 'A' && <VariantA {...data} />}
66
+ {variant === 'B' && <VariantB {...data} />}
67
+ {variant === 'C' && <VariantC {...data} />}
68
+ <PrototypeSwitcher variants={['A','B','C']} current={variant} />
69
+ </>
70
+ );
71
+ ```
72
+
73
+ For sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.
74
+
75
+ For sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.
76
+
77
+ ### 4. Build the floating switcher
78
+
79
+ A small fixed-position bar at the bottom-centre of the screen with three pieces:
80
+
81
+ - **Left arrow**: cycles to the previous variant (wraps around).
82
+ - **Variant label**: shows the current variant key and, if the variant exports a name, that name too. e.g. `B (Sidebar layout)`.
83
+ - **Right arrow**: cycles forward (wraps around).
84
+
85
+ Behaviour:
86
+
87
+ - Clicking an arrow updates the URL search param (use the framework's router, e.g. `router.replace` on Next, `navigate` on React Router, etc) so the variant is shareable and reload-stable.
88
+ - Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.
89
+ - Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.
90
+ - Hidden in production builds: gate on `process.env.NODE_ENV !== 'production'` or an equivalent check, so a stray prototype merge can't ship the bar to users.
91
+
92
+ Put the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.
93
+
94
+ ### 5. Hand it over
95
+
96
+ Surface the URL (and the `?variant=` keys). The user will flip through whenever they get to it. The interesting feedback is usually **"I want the header from B with the sidebar from C"**, which is the actual design they want.
97
+
98
+ ### 6. Capture the answer and clean up
99
+
100
+ Once a variant has won, capture the answer (which variant and why), then capture the prototype the way the [SKILL](SKILL.md) describes. Fold the winner into the real code and move the rest onto the throwaway branch, not into main:
101
+
102
+ - **Sub-shape A**: fold the winner into the existing page; drop the losing variants and the switcher from main.
103
+ - **Sub-shape B**: promote the winning variant to a real route; drop the throwaway route and the switcher from main.
104
+
105
+ The full set of variants is the primary source, so it lands on the throwaway branch, not the bin, since variant components and the switcher left in the main branch rot fast and confuse the next reader.
106
+
107
+ ## Anti-patterns
108
+
109
+ - **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.
110
+ - **Sharing too much code between variants.** A shared `<Header>` is fine; a shared `<Layout>` defeats the point. Each variant should be free to throw out the layout.
111
+ - **Wiring variants to real mutations.** Read-only prototypes are fine. If a variant needs to mutate, point it at a stub: the question is "what should this look like", not "does the backend work".
112
+ - **Promoting the prototype directly to production.** The variant code was written under prototype constraints (no tests, minimal error handling). Rewrite it properly when you fold it in.
@@ -22,6 +22,16 @@ jobs:
22
22
  - name: Run unit tests
23
23
  run: npm run test:unit
24
24
 
25
+ - name: Install Playwright browsers
26
+ run: npx playwright install --with-deps chromium
27
+
28
+ - name: Run Playwright tests
29
+ run: npm test
30
+ env:
31
+ CI: true
32
+ # The config defaults to headed mode; CI runners have no display.
33
+ HEADLESS: 'true'
34
+
25
35
  - name: Publish to npm
26
36
  run: npm publish --access public
27
37
  env:
@@ -21,3 +21,34 @@ jobs:
21
21
 
22
22
  - name: Run unit tests
23
23
  run: npm run test:unit
24
+
25
+ playwright:
26
+ runs-on: ubuntu-latest
27
+ env:
28
+ CI: true
29
+ # The config defaults to headed mode; CI runners have no display.
30
+ HEADLESS: 'true'
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+
34
+ - uses: actions/setup-node@v4
35
+ with:
36
+ node-version: '22'
37
+ cache: 'npm'
38
+
39
+ - name: Install dependencies
40
+ run: npm ci
41
+
42
+ - name: Install Playwright browsers
43
+ run: npx playwright install --with-deps chromium
44
+
45
+ - name: Run Playwright tests
46
+ run: npm test
47
+
48
+ - name: Upload Playwright report
49
+ if: failure()
50
+ uses: actions/upload-artifact@v4
51
+ with:
52
+ name: playwright-report
53
+ path: playwright-report/
54
+ retention-days: 7
@@ -6,7 +6,6 @@ permission:
6
6
  search: allow
7
7
  "memory-bank/*": allow
8
8
  "knowledgebase/*": allow
9
- model: deepseek/deepseek-v4-pro
10
9
  ---
11
10
 
12
11
  # Architect - System Design
@@ -8,7 +8,6 @@ permission:
8
8
  execute: "allow"
9
9
  "memory-bank/*": allow
10
10
  "knowledgebase/*": allow
11
- model: deepseek/deepseek-v4-flash
12
11
  ---
13
12
 
14
13
  # Coder - Implementation
@@ -9,7 +9,6 @@ permission:
9
9
  "github/*": allow
10
10
  "memory-bank/*": allow
11
11
  "knowledgebase/*": allow
12
- model: deepseek/deepseek-v4-flash
13
12
  ---
14
13
 
15
14
  # Deployer - Release Engineering
@@ -6,7 +6,6 @@ permission:
6
6
  search: "allow"
7
7
  "memory-bank/*": allow
8
8
  "knowledgebase/*": allow
9
- model: deepseek/deepseek-v4-flash
10
9
  ---
11
10
 
12
11
  # Designer - UI/UX
@@ -7,7 +7,6 @@ permission:
7
7
  "chrome-devtools/*": allow
8
8
  "memory-bank/*": allow
9
9
  "knowledgebase/*": allow
10
- model: deepseek/deepseek-v4-flash
11
10
  ---
12
11
 
13
12
  # E2E Tester - Browser Automation
@@ -8,7 +8,6 @@ permission:
8
8
  execute: allow
9
9
  "memory-bank/*": allow
10
10
  "knowledgebase/*": allow
11
- model: deepseek/deepseek-v4-pro
12
11
  ---
13
12
 
14
13
  # Implementer - Implementation Planning
@@ -8,7 +8,6 @@ permission:
8
8
  todo: allow
9
9
  "memory-bank/*": allow
10
10
  "knowledgebase/*": allow
11
- model: deepseek/deepseek-v4-pro
12
11
  ---
13
12
 
14
13
  # Feature Pipeline
@@ -13,7 +13,6 @@ permission:
13
13
  "chrome-devtools/*": allow
14
14
  "memory-bank/*": allow
15
15
  "knowledgebase/*": allow
16
- model: deepseek/deepseek-v4-pro
17
16
  ---
18
17
 
19
18
  # Orchestrator - Multi-Agent Workflow
@@ -26,12 +25,13 @@ You are a master orchestration agent that coordinates specialized sub-agents to
26
25
  - **basePath**: Root directory for the work (defaults to current workspace)
27
26
  - **logFile**: Path to the orchestration log (defaults to `docs/.orchestrator-log.md`)
28
27
  - **autoConfirm**: If `true`, execute all pipeline steps without pausing. If `false`, ask the user before each delegation. (Default: `false`)
29
- - **confirmationGates**: Agents whose output requires mandatory user confirmation before the pipeline advances to the next step. Confirmation is requested *after* the agent produces its output, regardless of `autoConfirm`. Default: `["researcher", "implementer"]`
28
+ - **confirmationGates**: Agents whose output requires mandatory user confirmation before the pipeline advances to the next step. Confirmation is requested *after* the agent produces its output, regardless of `autoConfirm`. Default: `["researcher", "implementer", "scope"]`. `scope` is included because its output is a set of open questions that only the user can answer — the gate is structural, not merely a post-output checkpoint (see Step 2a).
30
29
 
31
30
  ## Sub-Agent Registry
32
31
 
33
32
  | Role | Agent File | subagent_type | Typical Tools | When to Deploy |
34
33
  |---|---|---|---|---|
34
+ | scope | `scope.agent.md` | `scope` | read, search, edit, skill, question (no `execute` — never builds or runs anything) | Underspecified request, vague or unmeasurable success criteria, unknown boundaries, or an explicit request to narrow scope; runs the scoping interview only — never designs or builds |
35
35
  | researcher | `researcher.agent.md` | `researcher` | read, search, web, ddg-search/*, context7/* (read-only — no edit, no execute) | Technical unknowns, library evaluation, spike investigation |
36
36
  | architect | `architect.agent.md` | `architect` | read, search (no edit — design docs only) | System design, component architecture, data flow planning |
37
37
  | implementer | `implementer.agent.md` | `implementer` | read, search, edit, execute | Translating plans into actionable implementation steps |
@@ -83,6 +83,7 @@ All project context reading (memory bank, architecture docs, learned knowledge)
83
83
 
84
84
  Based on the analysis, build an ordered list of sub-agent delegations. Common patterns:
85
85
 
86
+ - **Foggy feature**: scope ⏸️ → researcher ⏸️ → implementer ⏸️ → architect → coder → unit-tester → e2e-tester → reviewer → deployer
86
87
  - **Full feature**: researcher ⏸️ → implementer ⏸️ → architect → coder → unit-tester → e2e-tester → reviewer → deployer
87
88
  - **Quick fix**: coder → unit-tester → reviewer
88
89
  - **Research spike**: researcher ⏸️ → architect
@@ -93,8 +94,71 @@ Based on the analysis, build an ordered list of sub-agent delegations. Common pa
93
94
 
94
95
  **Note:** ⏸️ marks a *confirmation gate* — the orchestrator will pause after that agent's output and wait for user confirmation before proceeding.
95
96
 
97
+ **Scope insertion:** `scope` may also be inserted at the front of *any* pattern above when the request is underspecified. See Step 2a for the exact insertion rule, the always-interactive override, the round-trip protocol, and the prototype hand-off.
98
+
96
99
  You may skip, reorder, or parallelize steps based on the request. Document your reasoning in the log.
97
100
 
101
+ ### Step 2a: Scope Insertion, Interactivity, and Hand-Off
102
+
103
+ `scope` is the front door for underspecified work. It narrows the problem through numbered-question rounds and terminates with a spike document (`docs/spike-<feature>.md`) that `researcher` and `implementer` already accept as input. It never designs, plans, or builds.
104
+
105
+ #### Insertion rule (REQ-09)
106
+
107
+ Insert `scope` at the front of the pipeline when **any** of these is true:
108
+
109
+ - The request has no clear specification, or several plausible interpretations.
110
+ - Success criteria are vague or unmeasurable ("make it faster", "clean this up").
111
+ - The boundary of the change is unknown, or the orchestrator cannot name the files/components to change.
112
+ - The user explicitly asks to narrow scope, grill the request, or write a spike first.
113
+
114
+ Do **not** insert `scope` when **any** of these is true:
115
+
116
+ - The request carries a concrete spec with testable acceptance criteria.
117
+ - An existing plan or spike file already settles the open decisions.
118
+ - The change is mechanical (rename, version bump, formatting, dependency update) and its scope is unambiguous.
119
+
120
+ When in doubt, prefer inserting `scope` — a short interview is cheaper than building the wrong feature.
121
+
122
+ **Execution override:** for a `scope` step, use the round protocol below instead of the generic Step 4 delegation template.
123
+
124
+ #### Always-interactive rule (REQ-10, D-06)
125
+
126
+ `scope` is a mandatory pause point **regardless of `autoConfirm`**. `autoConfirm: true` must never skip it, and the orchestrator must never let the agency answer the scope agent's questions on the user's behalf — no "assume reasonable defaults", no inferred answers, no silence-as-consent. A grilling agent that answers its own questions is broken by definition. This is why `scope` is in the `confirmationGates` default list: its gate is structural (the pipeline cannot advance without human answers), not just a post-output checkpoint.
127
+
128
+ For every scope round, the orchestrator must:
129
+
130
+ 1. Present the returned numbered questions **verbatim** to the user, including each recommended answer.
131
+ 2. Collect the user's answers (a bare "yes" accepts the recommendation).
132
+ 3. Append the answers to the draft file, delegating that write to a sub-agent if needed — the orchestrator itself never writes files.
133
+ 4. Re-delegate with **only the draft path** plus the previous step summary. Do not replay the conversation; the draft is the whole handoff.
134
+
135
+ #### Round-trip protocol
136
+
137
+ One delegation is one round. Delegate the round with these inputs:
138
+
139
+ ```text
140
+ Agent: "Scope - Feature Scoping" (.opencode/agents/scope.agent.md)
141
+ work_unit: {feature}
142
+ basePath: {basePath}
143
+ draftPath: docs/spike-<feature>.draft.md
144
+ feature: <feature>
145
+ Previous step context: {previous_step_summary}
146
+ ```
147
+
148
+ The agent returns exactly one of two statuses:
149
+
150
+ - **`Status: QUESTIONS (round N)`** — relay the questions to the user (see above), record the answers in the draft, then delegate another round with the same `draftPath`. Repeat until termination. Do not cap the number of rounds; the agent decides when the frontier is empty.
151
+ - **`Status: TERMINATED`** — the agent has written `docs/spike-<feature>.md`. Capture the output path and hand that spike to `researcher` as the required input. When the spike's recommended next step says no external evidence is needed, hand it straight to `implementer` instead.
152
+
153
+ #### Prototype hand-off (REQ-11)
154
+
155
+ The scope agent never builds prototypes — it has no command-execution permission. When a round returns `prototype needed: <question>`, read the branch that follows it:
156
+
157
+ - **`logic`** — delegate to `coder` to build a throwaway prototype that answers the state-model or data-flow question.
158
+ - **`UI`** — delegate to `designer` to produce a UI prototype or design spec.
159
+
160
+ Pass the prototype question, the draft path, and the scope context to the delegate. When the prototype result comes back, append the evidence to the draft (again delegating the write) and re-delegate the scope round with only the draft path, so the agent can record the evidence and recompute its frontier.
161
+
98
162
  ### Step 3: Initialize Log
99
163
 
100
164
  Create or append to the log file at `{logFile}` with:
@@ -110,7 +174,7 @@ For each step in the pipeline:
110
174
  2. **If autoConfirm is true**: Proceed immediately. Log that the step is starting.
111
175
  3. Look up the step's `subagent_type` from the Sub-Agent Registry table (e.g., `researcher`, `architect`, `implementer`, `coder`, `designer`, `unit-tester`, `e2e-tester`, `reviewer`, `deployer`, `tracker`).
112
176
  4. **If the step is "coder"**: Check whether the latest implementer plan contains parallel batch annotations (look for `**Batch` or `Parallel` in the plan file). See "Parallel Coder Execution" below.
113
- 5. **Otherwise**: Invoke the sub-agent using the Task tool with `subagent_type` matching the step's type (NOT `"general"`) and the following prompt structure:
177
+ 5. **Otherwise** (except `scope`, which uses the Step 2a round protocol): Invoke the sub-agent using the Task tool with `subagent_type` matching the step's type (NOT `"general"`) and the following prompt structure:
114
178
 
115
179
  ```
116
180
  This phase must be performed as the agent "{agent_name}" defined in ".opencode/agents/{agent_file}".
@@ -129,7 +193,7 @@ IMPORTANT:
129
193
  6. Capture the sub-agent's response summary.
130
194
  7. Update the log file with: step name, status (SUCCESS/SKIPPED/FAILED), duration, artifacts produced, key findings.
131
195
  8. If a required step fails, stop the pipeline and report to the user.
132
- 9. **Confirmation Gate**: If the current agent is in the `confirmationGates` list (default: `["researcher", "implementer"]`):
196
+ 9. **Confirmation Gate**: If the current agent is in the `confirmationGates` list (default: `["researcher", "implementer", "scope"]`):
133
197
  - Present the agent's output summary (key findings, files produced, artifacts) to the user.
134
198
  - Ask: **"{agent_name} output is ready. Review the summary above. Confirm to proceed to the next step?"**
135
199
  - **Do not advance** to the next pipeline step until the user explicitly confirms.
@@ -8,7 +8,6 @@ permission:
8
8
  todo: allow
9
9
  "memory-bank/*": allow
10
10
  "knowledgebase/*": allow
11
- model: deepseek/deepseek-v4-pro
12
11
  ---
13
12
 
14
13
  # TDD Orchestrator - Test-Driven Development
@@ -9,7 +9,6 @@ permission:
9
9
  question: allow
10
10
  webfetch: allow
11
11
  websearch: allow
12
- model: deepseek/deepseek-v4-pro
13
12
  ---
14
13
 
15
14
  # Plan Mode - Strategic Planning & Architecture Assistant
@@ -9,7 +9,6 @@ permission:
9
9
  "context7/*": allow
10
10
  "memory-bank/*": allow
11
11
  "knowledgebase/*": allow
12
- model: deepseek/deepseek-v4-pro
13
12
  ---
14
13
 
15
14
  # Technical spike research mode
@@ -8,7 +8,6 @@ permission:
8
8
  "github/*": allow
9
9
  "memory-bank/*": allow
10
10
  "knowledgebase/*": allow
11
- model: deepseek/deepseek-v4-flash
12
11
  ---
13
12
 
14
13
  # Reviewer - Code Quality