regent-code 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +38 -0
- package/.opencode/INSTALL.md +82 -0
- package/.opencode/agents/regent-explore.md +10 -0
- package/.opencode/agents/regent-general.md +8 -0
- package/.opencode/commands/accept.md +15 -0
- package/.opencode/commands/delegate.md +16 -0
- package/.opencode/commands/diagnose.md +19 -0
- package/.opencode/commands/orchestrate.md +22 -0
- package/.opencode/commands/plan.md +20 -0
- package/.opencode/commands/research.md +12 -0
- package/.opencode/commands/review.md +23 -0
- package/.opencode/commands/ship.md +18 -0
- package/.opencode/commands/spec.md +18 -0
- package/.opencode/commands/status.md +13 -0
- package/.opencode/commands/tdd.md +18 -0
- package/.opencode/commands/verify.md +18 -0
- package/.opencode/package.json +6 -0
- package/.opencode/plugins/regent.js +1623 -0
- package/.opencode/skills/code-review/SKILL.md +89 -0
- package/.opencode/skills/diagnose/SKILL.md +118 -0
- package/.opencode/skills/grilling/SKILL.md +59 -0
- package/.opencode/skills/handoff/SKILL.md +61 -0
- package/.opencode/skills/merge-conflicts/SKILL.md +39 -0
- package/.opencode/skills/orchestrator/SKILL.md +206 -0
- package/.opencode/skills/prototype/SKILL.md +40 -0
- package/.opencode/skills/ship/SKILL.md +42 -0
- package/.opencode/skills/spec/SKILL.md +61 -0
- package/.opencode/skills/tdd/SKILL.md +102 -0
- package/.opencode/skills/tickets/SKILL.md +71 -0
- package/.opencode/skills/using-regent/SKILL.md +71 -0
- package/.opencode/skills/verification-before-completion/SKILL.md +82 -0
- package/.opencode/skills/wizard/SKILL.md +45 -0
- package/.opencode/skills/worktrees/SKILL.md +39 -0
- package/.opencode/skills/zoom-out/SKILL.md +38 -0
- package/.prettierignore +2 -0
- package/.prettierrc +7 -0
- package/AGENTS.md +38 -0
- package/CONSTITUTION.md +101 -0
- package/LICENSE +21 -0
- package/README.md +264 -0
- package/docs/contributing.md +86 -0
- package/docs/superpowers/plans/windows-guardrail/plan.md +49 -0
- package/docs/superpowers/plans/windows-guardrail/tasks.md +58 -0
- package/docs/superpowers/specs/2026-06-12-regent-health-audit-design.md +49 -0
- package/docs/superpowers/specs/2026-08-26-windows-guardrail.md +66 -0
- package/eslint.config.js +23 -0
- package/handoff.md +100 -0
- package/mcp/cli.js +9 -0
- package/mcp/index.js +805 -0
- package/mcp/install.js +204 -0
- package/mcp/prompts.js +99 -0
- package/mcp/shared.js +428 -0
- package/package.json +52 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: "Adversarial two-axis review of a diff since a fixed point: Standards (does it follow this repo's documented standards?) and Spec (does it implement the originating issue?). Findings are severity-ranked, the reviewer defaults to REJECT, and approval must be earned. Use when the orchestrator runs the Phase 3 two-stage review (spec compliance + code quality via separate fresh delegate calls), at Phase 4 verify, or on /regent/review."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review — Inspector (监官)
|
|
7
|
+
|
|
8
|
+
Two-axis review of the diff between `HEAD` and a fixed point the orchestrator or sovereign supplies:
|
|
9
|
+
|
|
10
|
+
- **Standards**: does the code conform to this repo's documented coding standards?
|
|
11
|
+
- **Spec**: does the code faithfully implement the originating issue / spec?
|
|
12
|
+
|
|
13
|
+
Both axes run as **parallel sub-agents** (separate fresh `delegate` calls) so they don't pollute each other's context, then this skill aggregates their findings.
|
|
14
|
+
|
|
15
|
+
**Default posture: REJECT.** Approval is earned, not given. Rubber-stamping is the failure mode this review exists to prevent; every review ends in an explicit `approved` or `changes_requested`.
|
|
16
|
+
|
|
17
|
+
Invoked by the orchestrator Phase 3 two-stage review (spec compliance + code quality via separate fresh `delegate` calls) and Phase 4, and by `/regent/review`.
|
|
18
|
+
|
|
19
|
+
## Process
|
|
20
|
+
|
|
21
|
+
### 1. Pin the fixed point
|
|
22
|
+
|
|
23
|
+
Whatever the user said is the fixed point (commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it. Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, merge-base comparison). Note commits via `git log <fixed-point>..HEAD --oneline`. Confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty — a bad ref or empty diff fails here, not inside two parallel sub-agents.
|
|
24
|
+
|
|
25
|
+
### 2. Identify the spec source
|
|
26
|
+
|
|
27
|
+
Look in this order:
|
|
28
|
+
|
|
29
|
+
1. Issue references in commit messages (`#123`, `Closes #45`, GitLab `!67`) — fetch via the tracker the `tickets` skill uses.
|
|
30
|
+
2. A path the user passed as an argument.
|
|
31
|
+
3. A spec file under `docs/` (also `docs/superpowers/specs/`), `specs/`, or `.scratch/` matching the branch name or feature.
|
|
32
|
+
4. If nothing is found, ask where the spec is. If there isn't one, the **Spec** sub-agent is skipped and reports "no spec available".
|
|
33
|
+
|
|
34
|
+
### 3. Identify the standards sources + smell baseline
|
|
35
|
+
|
|
36
|
+
Anything in the repo that documents how code should be written — `CODING_STANDARDS.md`, `CONTRIBUTING.md`, and Regent's `CONSTITUTION.md` / `AGENTS.md`. The Standards axis always carries the **smell baseline** below: a fixed set of Fowler smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it: **the repo overrides** (a documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell) and **always a judgement call** (each smell is a labelled heuristic, "possible Feature Envy", never a hard violation; skip anything tooling enforces).
|
|
37
|
+
|
|
38
|
+
- **Mysterious Name**: a name that doesn't reveal what it does or holds → rename it; no honest name means murky design.
|
|
39
|
+
- **Duplicated Code**: the same logic shape in more than one hunk or file → extract the shared shape, call it from both.
|
|
40
|
+
- **Feature Envy**: a method that reaches into another object's data more than its own → move it onto the data it envies.
|
|
41
|
+
- **Data Clumps**: the same few fields or params keep travelling together → bundle them into one type, pass that.
|
|
42
|
+
- **Primitive Obsession**: a primitive or string standing in for a domain concept → give the concept its own small type.
|
|
43
|
+
- **Repeated Switches**: the same switch/if-cascade on the same type recurs across the change → polymorphism, or one map both sites share.
|
|
44
|
+
- **Shotgun Surgery**: one logical change forces scattered edits across many files → gather what changes together into one module.
|
|
45
|
+
- **Divergent Change**: one file or module edited for several unrelated reasons → split so each changes for one reason.
|
|
46
|
+
- **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have → delete it; inline back.
|
|
47
|
+
- **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on → hide the walk behind one method.
|
|
48
|
+
- **Middle Man**: a class or function that mostly just delegates onward → cut it, call the real target direct.
|
|
49
|
+
- **Refused Bequest**: a subclass or implementer ignoring or overriding most of what it inherits → drop the inheritance, use composition.
|
|
50
|
+
|
|
51
|
+
### 4. Re-run the project's gates yourself
|
|
52
|
+
|
|
53
|
+
Before any verdict: run format check, lint, typecheck, tests (or the repo's verify script) fresh and **read the output yourself**. Report it. A red gate is a blocking P0 finding on its own — the reviewer never trusts the implementer's word that gates pass.
|
|
54
|
+
|
|
55
|
+
### 5. Spawn both sub-agents in parallel
|
|
56
|
+
|
|
57
|
+
**Standards sub-agent prompt**: the diff command + commit list; the standards-source files from step 3 **plus the smell baseline pasted in full** (the sub-agent has no other access to it); the brief: "Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
|
|
58
|
+
|
|
59
|
+
**Spec sub-agent prompt**: the diff command + commit list; the path or fetched contents of the spec; the brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
|
|
60
|
+
|
|
61
|
+
If the spec is missing, skip the Spec sub-agent and note this in the final report.
|
|
62
|
+
|
|
63
|
+
### 6. Risk-tiered expert escalation
|
|
64
|
+
|
|
65
|
+
When the diff touches **security / authz / concurrency / migrations / data contracts / public interfaces**, escalate that axis to expert scrutiny — deeper checks: trust boundaries, race conditions, migration reversibility, API compatibility. Say so in the verdict ("expert escalated: authz").
|
|
66
|
+
|
|
67
|
+
### 7. Aggregate + verdict
|
|
68
|
+
|
|
69
|
+
Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings — the two axes are deliberately separate (see _Why two axes_).
|
|
70
|
+
|
|
71
|
+
**Finding format** (stable IDs persist across cycles; a finding's history stays traceable):
|
|
72
|
+
|
|
73
|
+
`**<ID>** | <severity> | blocking: <yes/no> | <title> | <path:line> | impact: <what breaks> | evidence: <quote / command output> | remediation: <fix>`
|
|
74
|
+
|
|
75
|
+
Severity: **P0** blocking (breakage, data corruption, exploitable); **P1** high (wrong behaviour or clear standard breach); **P2** medium (quality concern); **P3** low (nit). P0 always blocks; P1 blocks unless pre-existing and out of scope; P2/P3 never block.
|
|
76
|
+
|
|
77
|
+
**Cap: the 5 most important findings**, highest severity first — an independent blocker beyond the cap is included and labelled. **Verdict:** `approved` only when no blocking findings; otherwise `changes_requested` with the findings list.
|
|
78
|
+
|
|
79
|
+
**Cycle cap:** after 3 `changes_requested` cycles on the same diff, stop. Escalate to the sovereign: what each cycle found, what changed, why no agreement. Don't keep re-reviewing.
|
|
80
|
+
|
|
81
|
+
**Independent take (advisory only):** if a second provider/model is reachable (e.g. via MCP), optionally consult it for an independent take on the diff — one line in the verdict. It can raise doubts, never override.
|
|
82
|
+
|
|
83
|
+
End with a one-line summary: total findings per axis, and the worst issue _within each axis_. Don't pick a single winner across axes — that's the reranking the separation exists to prevent.
|
|
84
|
+
|
|
85
|
+
## Why two axes
|
|
86
|
+
|
|
87
|
+
A change can pass one axis and fail the other: code that follows every standard but implements the wrong thing → **Standards pass, Spec fail**; code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail**. Reporting them separately stops one axis from masking the other.
|
|
88
|
+
|
|
89
|
+
At Phase 4 the evidence gate (`verify` + `changed-files`) confirms scope and evidence; this review supplies the judgement pass. `changed-files` from the session tells you which subagent work is actually in the diff.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagnose
|
|
3
|
+
description: Use when the user reports a bug, failure, unexpected behavior, flaky behavior, or performance regression.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnose — Inspector (监官)
|
|
7
|
+
|
|
8
|
+
Iron Law of the Inspector: NO FIX WITHOUT ROOT CAUSE. Governed by CONSTITUTION.md Principle I (Think Before Decree).
|
|
9
|
+
|
|
10
|
+
## The Iron Law
|
|
11
|
+
|
|
12
|
+
**NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.**
|
|
13
|
+
|
|
14
|
+
Symptom fixes are not fixes. They are deferred failures. Every phase must complete before the next. The only exception: production is on fire and a quick rollback/containment is the responsible call. Even then, you return for root cause when the fire is out.
|
|
15
|
+
|
|
16
|
+
## Phase 1 — Build a feedback loop
|
|
17
|
+
|
|
18
|
+
**This is the real skill.** Everything else is mechanical. If you have a fast, deterministic, agent-runnable pass/fail signal for the bug, you will find the cause. If you don't, staring at code will not help. Spend disproportionate effort here.
|
|
19
|
+
|
|
20
|
+
Construction methods, in order of preference:
|
|
21
|
+
|
|
22
|
+
1. **Failing test** at the seam that reaches the bug — unit, integration, e2e
|
|
23
|
+
2. **CLI invocation** with a fixture input, diff stdout against known-good snapshot
|
|
24
|
+
3. **Curl / HTTP script** against a running dev server
|
|
25
|
+
4. **Headless browser script** (Playwright) — drive the UI, assert on DOM/console/network
|
|
26
|
+
5. **Throwaway harness** — minimal system subset that exercises the bug path
|
|
27
|
+
6. **Replay a captured trace** — save real payload/event log, replay through the code path
|
|
28
|
+
7. **Property / fuzz loop** — 1000 random inputs when the bug is "sometimes wrong"
|
|
29
|
+
8. **Bisection harness** — automate "boot at state X, check, repeat" for git bisect run
|
|
30
|
+
9. **Differential loop** — old-version vs new-version, same input, diff outputs
|
|
31
|
+
10. **HITL script** — last resort. Script drives a human through structured steps
|
|
32
|
+
|
|
33
|
+
When the bug is non-deterministic, your goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100x, add stress, narrow timing windows. A 50% flake is debuggable. 1% is not.
|
|
34
|
+
|
|
35
|
+
**If you cannot build a feedback loop, stop.** Say so explicitly. List what you tried. Ask the user for: access to the reproducing environment, a captured artifact, or permission to add production instrumentation. Do not proceed to Phase 2.
|
|
36
|
+
|
|
37
|
+
### Iterate on the loop itself
|
|
38
|
+
|
|
39
|
+
Once you have _a_ loop, improve it:
|
|
40
|
+
|
|
41
|
+
- Faster? Cache setup, narrow scope, skip unrelated init.
|
|
42
|
+
- Sharper signal? Assert on the specific symptom, not "didn't crash."
|
|
43
|
+
- More deterministic? Pin time, seed RNG, isolate filesystem.
|
|
44
|
+
|
|
45
|
+
A 2-second deterministic loop is a debugging superpower. A 30-second flaky loop is barely better than nothing.
|
|
46
|
+
|
|
47
|
+
## Phase 2 — Reproduce
|
|
48
|
+
|
|
49
|
+
Run the loop. Watch the bug appear.
|
|
50
|
+
|
|
51
|
+
Confirm:
|
|
52
|
+
|
|
53
|
+
- [ ] The failure matches what the **user** described — not a different failure nearby
|
|
54
|
+
- [ ] Reproducible across multiple runs (or high enough rate for non-deterministic bugs)
|
|
55
|
+
- [ ] Exact symptom captured (error message, wrong output, timing) so the fix can be verified against it
|
|
56
|
+
|
|
57
|
+
## Phase 3 — Hypothesise
|
|
58
|
+
|
|
59
|
+
Generate **3–5 ranked hypotheses** before testing any single one. Single-hypothesis generation anchors on the first plausible idea.
|
|
60
|
+
|
|
61
|
+
Each hypothesis must be **falsifiable**: state the prediction it makes.
|
|
62
|
+
|
|
63
|
+
> Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
|
|
64
|
+
|
|
65
|
+
If you cannot state the prediction, the hypothesis is a vibe. Discard or sharpen it.
|
|
66
|
+
|
|
67
|
+
**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly. Don't block on it if they're AFK — proceed with your ranking.
|
|
68
|
+
|
|
69
|
+
## Phase 4 — Instrument
|
|
70
|
+
|
|
71
|
+
Each probe maps to a specific prediction from Phase 3. Change one variable at a time.
|
|
72
|
+
|
|
73
|
+
Tool preference:
|
|
74
|
+
|
|
75
|
+
1. **Debugger / REPL inspection** — one breakpoint beats ten logs
|
|
76
|
+
2. **Targeted logs** at the boundaries that distinguish hypotheses
|
|
77
|
+
3. Never "log everything and grep"
|
|
78
|
+
|
|
79
|
+
**Tag every debug log** with a unique prefix: `[DEBUG-a4f2]`. Cleanup becomes a single grep. Untagged logs survive; tagged logs die.
|
|
80
|
+
|
|
81
|
+
For performance regressions, logs are usually misleading. Establish a baseline measurement first, then bisect. Measure first, fix second.
|
|
82
|
+
|
|
83
|
+
## Phase 5 — Fix + regression test
|
|
84
|
+
|
|
85
|
+
Write the regression test **before the fix** — but only at a **correct seam**. A correct seam is one where the test exercises the real bug pattern as it occurs at the call site.
|
|
86
|
+
|
|
87
|
+
If no correct seam exists, that is itself the finding. Note it. The architecture prevents locking down the bug.
|
|
88
|
+
|
|
89
|
+
If a correct seam exists:
|
|
90
|
+
|
|
91
|
+
1. Turn the minimised repro into a failing test at that seam
|
|
92
|
+
2. Watch it fail
|
|
93
|
+
3. Apply the fix
|
|
94
|
+
4. Watch it pass
|
|
95
|
+
5. Re-run the Phase 1 feedback loop against the original scenario
|
|
96
|
+
|
|
97
|
+
## Phase 6 — Cleanup + post-mortem
|
|
98
|
+
|
|
99
|
+
Required before declaring done:
|
|
100
|
+
|
|
101
|
+
- [ ] Original repro no longer reproduces (re-run Phase 1 loop)
|
|
102
|
+
- [ ] Regression test passes (or absence of a seam is documented)
|
|
103
|
+
- [ ] All `[DEBUG-...]` instrumentation removed
|
|
104
|
+
- [ ] Throwaway prototypes deleted or moved to a clearly-marked debug location
|
|
105
|
+
- [ ] The correct hypothesis is stated in the commit/PR message
|
|
106
|
+
|
|
107
|
+
**Then ask: what would have prevented this bug?** If the answer involves architectural change (no good test seam, tangled callers, hidden coupling), flag it for the improve-codebase-architecture skill. Make this recommendation after the fix is in — you have more information now than when you started.
|
|
108
|
+
|
|
109
|
+
## Red Flags
|
|
110
|
+
|
|
111
|
+
| Behavior | Problem |
|
|
112
|
+
| ----------------------------------------------- | -------------------------------------------------- |
|
|
113
|
+
| Searching for "similar bugs" online | You don't have root cause. You're guessing. |
|
|
114
|
+
| Changing code before running the loop | You don't know what you're fixing. |
|
|
115
|
+
| "This might be the issue, let me try something" | That's not a hypothesis. That's a guess. |
|
|
116
|
+
| Fixing the symptom, not the cause | The bug will reappear in a different form. |
|
|
117
|
+
| 3+ failed fix attempts | Question your understanding. Escalate. |
|
|
118
|
+
| Adding code instead of tests | Coverage without a red-green cycle proves nothing. |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grilling
|
|
3
|
+
description: Interview the user in frontier rounds to stress-test a plan, decision, or idea. Use when the orchestrator Phase 1 Clarify step interrogates the design tree, or when the user uses any "grill" phrasing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Grilling — Strategist (谋官)
|
|
7
|
+
|
|
8
|
+
Regent court's CEO on interrogation duty. Replaces the orchestrator's one-question-at-a-time clarifying with design-tree rounds. Governed by CONSTITUTION.md Principles I (Think Before Decree) and IV (Goal-Driven Execution).
|
|
9
|
+
|
|
10
|
+
## When invoked
|
|
11
|
+
|
|
12
|
+
- Orchestrator Phase 1, step "Clarify" — run grilling before `spec` writes the artifact.
|
|
13
|
+
- Any "grill me", "stress-test this", or similar phrasing from the user.
|
|
14
|
+
|
|
15
|
+
## The design tree
|
|
16
|
+
|
|
17
|
+
Interview the user relentlessly until you reach a shared understanding. Map every decision as a **design tree**: each decision branches into the decisions that hang off it.
|
|
18
|
+
|
|
19
|
+
## Rounds
|
|
20
|
+
|
|
21
|
+
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. Ask the whole frontier in one round. Number each question and give your recommended answer for each. Then wait for the user's answers before the next round.
|
|
22
|
+
|
|
23
|
+
Format a round like so:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
|
|
27
|
+
|
|
28
|
+
➡️ <your recommended answer>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
|
|
33
|
+
|
|
34
|
+
➡️ <your recommended answer>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Each round, the user's answers reshape 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.
|
|
38
|
+
|
|
39
|
+
## Facts are yours; decisions are theirs
|
|
40
|
+
|
|
41
|
+
Finding **facts** is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, codebase, external docs), dispatch `explore`, `research`, or `delegate` subagents to find it. Do not ask the user for anything you could look up.
|
|
42
|
+
|
|
43
|
+
Do not block on it: a running exploration is an unsettled prerequisite — only the questions downstream of it wait for the subagent to report. Ask the rest of the frontier now.
|
|
44
|
+
|
|
45
|
+
The **decisions** are the user's: put each to them and wait.
|
|
46
|
+
|
|
47
|
+
## Done
|
|
48
|
+
|
|
49
|
+
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. Then pass to `spec`, which writes the spec artifact for Phase 1's design gate.
|
|
50
|
+
|
|
51
|
+
## Red flags
|
|
52
|
+
|
|
53
|
+
| Behavior | Problem |
|
|
54
|
+
| ----------------------------------------------------------- | ---------------------------------------------------- |
|
|
55
|
+
| Asking the user for a fact you could look up | Fact-finding is your job. Deciding is theirs. |
|
|
56
|
+
| Asking a question that depends on a question still open | Wrong round. It belongs to the frontier after that question settles. |
|
|
57
|
+
| Omitting the recommended answer | You are a strategist, not a questionnaire. Recommend. |
|
|
58
|
+
| Acting before the user confirms shared understanding | The interview is not done. Nothing is approved. |
|
|
59
|
+
| One question at a time | Rounds. The whole frontier, numbered, in one message. |
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: handoff
|
|
3
|
+
description: Compact the current conversation into a handoff document in the OS temp directory so a fresh agent can continue a Regent run. Use when a run crosses sessions (context limit, crash, continuation) or when the user asks to hand off.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Handoff — Publisher (布官)
|
|
7
|
+
|
|
8
|
+
Conversation compaction for a fresh agent. The Publisher's continuity artifact: a run that crosses sessions must resume with zero state loss and zero re-reading of the source material. Governed by CONSTITUTION.md Principle IV (Goal-Driven Execution).
|
|
9
|
+
|
|
10
|
+
## When invoked
|
|
11
|
+
|
|
12
|
+
- Orchestrator / Publisher when a run crosses sessions: context limit, crash, or continuation in a new session.
|
|
13
|
+
- Offered in the report's Next options. Never invoke mid-phase without the sovereign's call.
|
|
14
|
+
|
|
15
|
+
## Write the document
|
|
16
|
+
|
|
17
|
+
Artifact: `<topic>-handoff.md` in the operating system's temporary directory — NOT the workspace. Filename from the run's topic slug. Sections, in order:
|
|
18
|
+
|
|
19
|
+
### Current state
|
|
20
|
+
|
|
21
|
+
- Phase reached (Phase 1..5) and which gates passed
|
|
22
|
+
- Exact paths: spec (`docs/superpowers/specs/YYYY-MM-DD-<topic>.md`), plan (`docs/superpowers/plans/<slug>/plan.md` + `tasks.md`), run state (`docs/superpowers/run/state.json`)
|
|
23
|
+
- Open tasks, their blocking edges, and the current frontier
|
|
24
|
+
|
|
25
|
+
### Evidence summary
|
|
26
|
+
|
|
27
|
+
- **Verified** — backed by fresh `verify` output or reproduced command output
|
|
28
|
+
- **Unverified** — subagents changed files but no verification ran; flag via `changed-files`
|
|
29
|
+
- **Stale** — verified earlier but the codebase moved; check `verify` output's `evidence_gate.freshness`
|
|
30
|
+
|
|
31
|
+
### Open blockers / concerns
|
|
32
|
+
|
|
33
|
+
Blocked tasks, `done_with_concerns` notes, escalated items, assumptions the user has not confirmed. Mark severity per item.
|
|
34
|
+
|
|
35
|
+
### Next action
|
|
36
|
+
|
|
37
|
+
Exactly ONE permitted next step per the pipeline: clarify, plan, execute, verify, accept, ship, or wait-for-sovereign. Never more. `/regent/status` enumerates the same set; `/regent/accept` records human acceptance; `/regent/ship` is the evidence-gated deliver. Offer one, wait for the sovereign's call.
|
|
38
|
+
|
|
39
|
+
### Suggested skills
|
|
40
|
+
|
|
41
|
+
Which bundled skills the next agent should load, BY NAME: `orchestrator`, `grilling`, `spec`, `tickets`, `tdd`, `diagnose`, `prototype`, `zoom-out`, `verification-before-completion`, `code-review`, `worktrees`, `wizard`, `merge-conflicts`, `ship`. Pick only the ones the next phase needs; do not dump the catalog.
|
|
42
|
+
|
|
43
|
+
## Rules
|
|
44
|
+
|
|
45
|
+
- Reference spec, plan, ADRs, issues, commits by path — never duplicate their content. The handoff is a map, not the territory.
|
|
46
|
+
- Redact secrets: authorization headers, keys, passwords, JWTs, `sk-` / `ghp_` / `xoxb` / `AKIA` patterns, PII. Never paste a secret to "preserve context"; redact it and flag where it is needed.
|
|
47
|
+
- If the user passed arguments, treat them as the next session's focus and tailor: which phase, which tasks, what to verify.
|
|
48
|
+
|
|
49
|
+
## Completion criteria
|
|
50
|
+
|
|
51
|
+
The file exists in the OS temp directory, every section above is present, no secrets, no duplicated artifact content, exactly one next action — and a fresh agent can continue the run from the file alone.
|
|
52
|
+
|
|
53
|
+
## Red flags
|
|
54
|
+
|
|
55
|
+
| Behavior | Problem |
|
|
56
|
+
| ------------------------------------------ | --------------------------------------------------- |
|
|
57
|
+
| Writing the handoff into the workspace | Not a deliverable. It pollutes the repo. |
|
|
58
|
+
| Restating the spec or plan in prose | Duplication goes stale. Reference by path. |
|
|
59
|
+
| Listing more than one permitted next step | Violates the pipeline's one-action rule. |
|
|
60
|
+
| Pasting a secret in the name of context | Leak. Redact, and flag where it is needed. |
|
|
61
|
+
| Guessing evidence status | Run `changed-files` and check freshness; report what is actual. |
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merge-conflicts
|
|
3
|
+
description: "Use when you need to resolve an in-progress git merge or rebase conflict."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Merge Conflicts — Fleet Commander (舰官)
|
|
7
|
+
|
|
8
|
+
Resolving a conflict means preserving two intents in one tree, not picking a winner. Invoked by the orchestrator in Phase 3 integration — after `worktrees` merges or parallel lanes return — and whenever a merge or rebase conflict blocks the run.
|
|
9
|
+
|
|
10
|
+
**Regent guardrail:** `git reset --hard` and `git clean -f` are blocked. Resolve, never discard. Throwing one side's work away is not a resolution; it's data loss wearing a resolution's clothes.
|
|
11
|
+
|
|
12
|
+
## What kind of conflict
|
|
13
|
+
|
|
14
|
+
Name the shape before opening the file; each resolves differently:
|
|
15
|
+
|
|
16
|
+
- **Content conflict** — both sides edited the same lines. Source of truth is the intent behind each edit (step 2).
|
|
17
|
+
- **Add/add** — both branches created the same path. Either the two versions belong side by side under different names, or one is a duplicate of the other.
|
|
18
|
+
- **Rename/delete or rename/edit** — one side moved a file while the other deleted or edited it. Decide the file's fate; never resurrect silently.
|
|
19
|
+
|
|
20
|
+
## Resolve
|
|
21
|
+
|
|
22
|
+
1. **See the current state** of the merge/rebase. Check git history, and the conflicting files. Confirm which branches or lanes are merging — `worktrees` integration queues these one at a time, so map each conflict marker back to its lane and branch (`regent/<taskId>`).
|
|
23
|
+
|
|
24
|
+
2. **Find the primary sources** for each conflict. Understand deeply why each change was made, and what the original intent was. Read the commit messages, check the PRs, check original issues/tickets — via the tracker the `tickets` skill uses — and re-read the plan and spec: `docs/superpowers/plans/<slug>/tasks.md` and `docs/superpowers/specs/`. If a lane's task description doesn't explain the change, the task text does.
|
|
25
|
+
|
|
26
|
+
3. **Resolve each hunk.** Preserve both intents where possible. Where incompatible, pick the one matching the merge's stated goal and note the trade-off. Do **not** invent new behaviour. Always resolve; never `--abort`.
|
|
27
|
+
|
|
28
|
+
4. Discover the project's **automated checks** and run them, typically typecheck, then tests, then format. Fix anything the merge broke. Run them yourself and read the output — fresh evidence or it didn't happen, per `verification-before-completion`. A merge is not green because it compiled once.
|
|
29
|
+
|
|
30
|
+
5. **Finish the merge/rebase.** Stage everything and commit. If rebasing, continue the rebase process until all commits are rebased. Note the resolution and its trade-offs in the commit message; after integration the Inspector's `code-review` may review the merged diff against the spec.
|
|
31
|
+
|
|
32
|
+
## After
|
|
33
|
+
|
|
34
|
+
- Record the outcome: what conflicted, what resolution you chose, and why. The Publisher's report (`ship`) carries it forward.
|
|
35
|
+
- Re-run the full gate set once more after the last commit: format, lint, typecheck, tests — gates before, gates after.
|
|
36
|
+
|
|
37
|
+
**Escalation:** a conflict between two lanes whose intents are genuinely incompatible is a plan-level decision, not a hunk-level one. Stop, describe both intents to the sovereign, and let the plan change — do not pick a winner silently.
|
|
38
|
+
|
|
39
|
+
**Completion criterion:** every hunk resolved with both intents preserved (or the trade-off named), checks green, merge/rebase finished, resolution notes recorded.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orchestrator
|
|
3
|
+
description: Use when the user states a goal and Regent should run clarify, plan, execute, verify, and report.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Orchestrator — Court Concierge
|
|
7
|
+
|
|
8
|
+
Convenes the right minister for each phase. Constitution at `CONSTITUTION.md` defines who serves when. Chain of command:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
Sovereign → Strategist → Architect → Fleet Commander + Inspector → Publisher
|
|
12
|
+
↘ Mentor (any time)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Each phase gated. No gate bypass.
|
|
16
|
+
|
|
17
|
+
## Domain awareness
|
|
18
|
+
|
|
19
|
+
Before any phase, check domain documentation:
|
|
20
|
+
|
|
21
|
+
- `CONSTITUTION.md` at repo root? Read it. Defines Regent identity, court roles, iron laws.
|
|
22
|
+
- `CONTEXT.md` at repo root? Read it. Defines project vocabulary.
|
|
23
|
+
- `docs/adr/` exists? Read relevant ADRs. Records decisions not to relitigate.
|
|
24
|
+
- `UBIQUITOUS_LANGUAGE.md` exists? Read it. Use its terms precisely.
|
|
25
|
+
- **Use project domain language** in every plan, file name, variable.
|
|
26
|
+
|
|
27
|
+
Create files lazily: CONTEXT.md when you resolve a term, `docs/adr/` when you make a decision.
|
|
28
|
+
|
|
29
|
+
## The 5 Phases
|
|
30
|
+
|
|
31
|
+
### Phase 1 — Clarify (Strategist 谋官)
|
|
32
|
+
|
|
33
|
+
Regent court's CEO. Sees through weak framing. Asks "why" until real problem emerges. Governed by CONSTITUTION.md principles (Think Before Decree).
|
|
34
|
+
|
|
35
|
+
**1. Explore project context.** Before asking any questions, understand what exists:
|
|
36
|
+
|
|
37
|
+
- Read `CONTEXT.md`, `docs/adr/`, `UBIQUITOUS_LANGUAGE.md` for domain vocabulary
|
|
38
|
+
- Read `README.md`, `package.json`, recent commits for project state
|
|
39
|
+
- Run `explore(query="project structure")` for codebase layout
|
|
40
|
+
- Run `research(...)` for existing patterns if relevant
|
|
41
|
+
|
|
42
|
+
**2. Assess scope.** If the request describes multiple independent subsystems, flag it immediately. Do not spend questions refining details when the project needs decomposition first. Each subsystem gets its own clarify → plan → execute cycle.
|
|
43
|
+
|
|
44
|
+
**3. Grill the goal.** Load the `grilling` skill. Work the design tree in frontier rounds: number each question, give a recommended answer, and wait. Facts come from `research`/`explore`/`delegate` — never ask the user what the agent can look up. Decisions are the user's. Stop only when the frontier is empty and the user confirms shared understanding.
|
|
45
|
+
|
|
46
|
+
**4. Propose approaches.** Present 2-3 with trade-offs. Recommend one and explain why.
|
|
47
|
+
|
|
48
|
+
**5. Present design.** Cover architecture, components, data flow, error handling, testing. Break the system into smaller units with clear boundaries and defined interfaces. After each section, ask whether it looks right.
|
|
49
|
+
|
|
50
|
+
**6. Write the spec.** Load the `spec` skill. Produce `docs/superpowers/specs/YYYY-MM-DD-<topic>.md` (Problem Statement, Solution, User Stories, Implementation Decisions, Testing Decisions, Out of Scope, Further Notes). Sketch the test seams and confirm them with the user. No file paths or code in the spec — decisions only.
|
|
51
|
+
|
|
52
|
+
**7. Self-review.** Check for: placeholders (TBD/TODO), contradictions, scope creep, ambiguity.
|
|
53
|
+
|
|
54
|
+
**Gate:** Ask "Is this design correct?" Do not proceed without user confirmation.
|
|
55
|
+
**Output:** `docs/superpowers/specs/YYYY-MM-DD-<topic>.md` — the `requirements` source for Phase 4 `verify()` and the input to Phase 2's `tickets`.
|
|
56
|
+
|
|
57
|
+
### Phase 2 — Plan (Architect 构官)
|
|
58
|
+
|
|
59
|
+
Regent court's staff engineer. Spots missing edge cases, locks architecture. Governed by CONSTITUTION.md principles (Simplicity is Sovereign).
|
|
60
|
+
|
|
61
|
+
**1. Scan available skills.** Check which loaded skills match the task. Load any that apply: TDD for code implementation, Diagnose for bug investigation, Prototype for design exploration, `spec`/`tickets` for artifact production, `code-review` for the review gates, `worktrees` for parallel isolation, `wizard` for human-only steps.
|
|
62
|
+
|
|
63
|
+
**2. Gather intelligence.** Before constructing the plan:
|
|
64
|
+
|
|
65
|
+
- `explore()` to understand files and modules that will be touched
|
|
66
|
+
- `research()` for technology choices, library APIs, or patterns
|
|
67
|
+
- `delegate()` for deep dives into specific subsystems
|
|
68
|
+
|
|
69
|
+
**3. Build and persist the task plan.** Load the `tickets` skill. Produce `docs/superpowers/plans/<slug>/plan.md` (dependency levels, parallelization strategy, files to create/modify) and `tasks.md` (task id, title, end-to-end deliverable, blocked_by, acceptance criteria). Each task must have:
|
|
70
|
+
|
|
71
|
+
- **File scope** — 1-3 files maximum. If more are needed, split the task.
|
|
72
|
+
- **Time estimate** — 2-15 minutes per task. If longer, split it.
|
|
73
|
+
- **Clear "done" definition** — what it produces and how to verify it.
|
|
74
|
+
- **Dependency level** — which tasks can run in parallel (Level 1) vs sequentially (Level N), with blocking edges.
|
|
75
|
+
|
|
76
|
+
Dependency mapping:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Level 1 (no deps, parallel): Level 2 (deps on L1, sequential):
|
|
80
|
+
A. Define types C. Implement service
|
|
81
|
+
B. Write test stubs D. Wire up endpoints
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- Level 1 tasks → `delegate_many()` for parallel execution
|
|
85
|
+
- Level N tasks → `delegate()` sequentially after dependencies resolve
|
|
86
|
+
- Two or more Level-1 tasks with disjoint file scopes → isolate via `worktrees` (cap 3 concurrent; overlap oracle before dispatch)
|
|
87
|
+
|
|
88
|
+
**No placeholders.** Every step must be concrete: exact file paths, function names, commands to run. No "Add appropriate error handling" (which errors? where?), "Write tests for the above" (which tests? what scenarios?), "Implement later." If a step is not specific enough to delegate to a subagent, it is not a step.
|
|
89
|
+
|
|
90
|
+
**Quiz the user** on task granularity and blocking edges before locking the artifacts. Iterate until approved — the plan artifacts are what Phase 3 walks and what survives session handoffs.
|
|
91
|
+
|
|
92
|
+
**Gate:** Present the plan to the user. Include task tree with dependency levels, parallelization strategy, files to create/modify. Ask "Does this plan look right?" Do not proceed without approval.
|
|
93
|
+
|
|
94
|
+
### Phase 3 — Execute (Fleet Commander 舰官)
|
|
95
|
+
|
|
96
|
+
Walk dependency graph:
|
|
97
|
+
|
|
98
|
+
- **Level 1** (no deps) → `delegate_many()` parallel; when scopes are disjoint, run them in isolated worktrees per the `worktrees` skill (cap 3; overlap oracle first)
|
|
99
|
+
- **Level N** (deps on prior) → `delegate()` sequential
|
|
100
|
+
- **Human-only steps** (provisioning, credentials, third-party dashboards, one-off migrations) → `wizard`; do not guess at steps only the sovereign can perform
|
|
101
|
+
- **Merge/integration** → merge each lane on the main worktree, run checks; any conflict → `merge-conflicts` (resolve, never `--abort`)
|
|
102
|
+
|
|
103
|
+
**Subagent prompt structure.** Each implementer receives:
|
|
104
|
+
|
|
105
|
+
- Task description — exact text from the plan, including file paths
|
|
106
|
+
- Context — scene-setting, dependencies, architecture decisions that affect this task
|
|
107
|
+
- Expected output — what "done" looks like for this task
|
|
108
|
+
|
|
109
|
+
Result handling:
|
|
110
|
+
|
|
111
|
+
| Status | Action |
|
|
112
|
+
| -------------------- | --------------------------------------- |
|
|
113
|
+
| `done` | Continue. Mark complete. |
|
|
114
|
+
| `done_with_concerns` | Note concern. Continue unless critical. |
|
|
115
|
+
| `needs_context` | Provide context, re-delegate. |
|
|
116
|
+
| `blocked` | PAUSE. Assess. Escalate to user. |
|
|
117
|
+
|
|
118
|
+
**Two-stage review (for non-trivial tasks).** Load the `code-review` skill for any task where correctness is critical:
|
|
119
|
+
|
|
120
|
+
1. **Spec compliance review** — independent check: are all requirements implemented? Any YAGNI? Any misunderstandings?
|
|
121
|
+
2. **Code quality review** — independent check: clear responsibility per file? Proper decomposition? Follows conventions?
|
|
122
|
+
|
|
123
|
+
The implementer and reviewers must be separate subagents (fresh `delegate()` calls). Do not let the implementer self-review as a substitute. The reviewer's default posture is REJECT — approval is earned. Findings: P0-P3 severity, ≤5 findings, stable IDs, path:line evidence. Verdict `changes_requested` → fix loop; 3 cycles → escalate to the sovereign.
|
|
124
|
+
|
|
125
|
+
Partial failure:
|
|
126
|
+
|
|
127
|
+
- **Non-critical:** Note, continue.
|
|
128
|
+
- **Critical:** Retry once. Fail again → PAUSE, escalate.
|
|
129
|
+
|
|
130
|
+
**Stagnation detection (DECOMPOSE → RE-PLAN → ASK).** If a task shows no progress after 3 delegate attempts:
|
|
131
|
+
1. **DECOMPOSE** — break the task into smaller pieces
|
|
132
|
+
2. **RE-PLAN** — reassess the approach and file scope
|
|
133
|
+
3. **ASK** — present options to the user with recommendation
|
|
134
|
+
Do not keep retrying the same approach. Blind persistence after stagnation is waste.
|
|
135
|
+
|
|
136
|
+
**Evidence tracking.** Every `delegate()` call records files changed. When execution completes, use the `changed-files` tool to verify what was touched before passing to Inspector. If files changed without a verification step, the evidence gate flags it.
|
|
137
|
+
|
|
138
|
+
**Gate:** All tasks resolve before Phase 4.
|
|
139
|
+
|
|
140
|
+
### Phase 4 — Verify (Inspector 监官)
|
|
141
|
+
|
|
142
|
+
Call `verify()` with:
|
|
143
|
+
|
|
144
|
+
- `requirements` = captured during Clarify
|
|
145
|
+
- `implementation_context` = summary from Phase 3
|
|
146
|
+
- `session_id` = optional, marks evidence as verified
|
|
147
|
+
|
|
148
|
+
Use checklist format for requirements (category headers with `- [x]` items). The verify tool supports this natively.
|
|
149
|
+
|
|
150
|
+
**Evidence gate check.** Run `changed-files()` to see what subagents touched. Then check the gate's `freshness` grades: any **stale** verified evidence (files changed after verification) fails the gate — verified evidence must match what is on disk right now. Unverified changes and stale evidence both block Phase 5.
|
|
151
|
+
|
|
152
|
+
Decision:
|
|
153
|
+
|
|
154
|
+
- **Compliant** → Phase 5
|
|
155
|
+
- **Minor issues** → fix, re-verify
|
|
156
|
+
- **Major issues** → PAUSE, escalate
|
|
157
|
+
|
|
158
|
+
Delegate verifiers per requirement if scope large. Fresh command output or repro evidence required before Phase 5.
|
|
159
|
+
|
|
160
|
+
**Review verdict gate.** For non-trivial work, require the `code-review` verdict: `approved` (no P0/P1 findings) before Phase 5; `changes_requested` → fix loop, max 3 cycles.
|
|
161
|
+
|
|
162
|
+
**Gate:** Fresh verification evidence required.
|
|
163
|
+
|
|
164
|
+
### Phase 5 — Report & Loop (Publisher 布官)
|
|
165
|
+
|
|
166
|
+
Regent court's release engineer. Ships, documents, closes loops.
|
|
167
|
+
|
|
168
|
+
**Evidence gate first.** Do not write a report without fresh verification evidence. Run verification commands yourself or collect `verify()` output. Evidence comes first; interpretation follows.
|
|
169
|
+
|
|
170
|
+
**Report format** (keep under 12 lines):
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
### Achievements (with evidence)
|
|
174
|
+
- [requirement] — evidence (test output, verify result, reproduction passes)
|
|
175
|
+
- [requirement] — evidence
|
|
176
|
+
|
|
177
|
+
### Pending / Issues
|
|
178
|
+
- [unresolved item] — what it needs
|
|
179
|
+
- [issue found] — severity
|
|
180
|
+
|
|
181
|
+
### Next
|
|
182
|
+
1. [option] — brief rationale
|
|
183
|
+
2. [option] — brief rationale
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Options.** Present 2-3 choices with your recommendation:
|
|
187
|
+
|
|
188
|
+
- **New goal** → loop to Phase 1
|
|
189
|
+
- **Fix issues** → loop to Phase 3 (execute)
|
|
190
|
+
- **Done** → present the acceptance line; when the sovereign accepts (`/regent/accept` records it in `docs/superpowers/run/state.json`), offer `/regent/ship` — the evidence-gated commit/push/PR lane. Merging stays the sovereign's call.
|
|
191
|
+
|
|
192
|
+
**Session continuity.** If the run must cross sessions (context budget, interruption, continuation), produce a `handoff` document: current phase, artifact paths, evidence summary, exactly one permitted next action, suggested skills by name. A `handoff` reference also belongs in the report's Next options when the work continues later.
|
|
193
|
+
|
|
194
|
+
**Wait for input.** Do not assume the next step. Loop back based on user direction.
|
|
195
|
+
|
|
196
|
+
## Rationalization Prevention
|
|
197
|
+
|
|
198
|
+
| "Reason" to skip | Reality |
|
|
199
|
+
| -------------------------------------- | ------------------------------------------------------------------- |
|
|
200
|
+
| "This is too simple for a plan" | Simple plans catch assumptions. Two minutes saves two hours. |
|
|
201
|
+
| "I already know the design" | Write it down. The exercise reveals gaps. |
|
|
202
|
+
| "The user just wants it done" | They want it done RIGHT. Discipline is speed. |
|
|
203
|
+
| "Phase skipping saves time" | Gates exist because the cost of rework > cost of gate. |
|
|
204
|
+
| "Let me just start coding" | Coding without design produces waste. Stop. |
|
|
205
|
+
| "I can verify at the end" | Verify at every gate. End-of-pipeline surprises are expensive. |
|
|
206
|
+
| "The user is AFK, I'll proceed anyway" | Blocked phases exist for a reason. Wait or document the assumption. |
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prototype
|
|
3
|
+
description: Use when design is unknown, the user wants a prototype, or a throwaway experiment should answer a logic or UI question.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Prototype — Fleet Commander (舰官)
|
|
7
|
+
|
|
8
|
+
Throwaway code that answers a question before committing to build. Fleet Commander's reconnaissance tool. Governed by CONSTITUTION.md Principle II (Simplicity is Sovereign).
|
|
9
|
+
|
|
10
|
+
## The principle
|
|
11
|
+
|
|
12
|
+
A prototype is **disposable by design**. The question it answers is the only output worth keeping. If you are not answering a question, do not prototype. If you are not willing to throw it away, you are not prototyping — you are building production code badly.
|
|
13
|
+
|
|
14
|
+
## Pick a branch
|
|
15
|
+
|
|
16
|
+
Identify which question the prototype answers:
|
|
17
|
+
|
|
18
|
+
- **"Does this logic / state model feel right?"** → Build a tiny interactive terminal app that pushes the state machine through edge cases hard to reason about on paper. Use the project's language. No persistence. State lives in memory.
|
|
19
|
+
|
|
20
|
+
- **"What should this look like?"** → Generate several radically different UI variations, switchable via a single route. Use the project's routing conventions. No persistence. No test setup.
|
|
21
|
+
|
|
22
|
+
If the question is genuinely ambiguous and the user is not reachable, default to logic if the surrounding code is backend, UI if the surrounding code is frontend. State the assumption at the top of the prototype.
|
|
23
|
+
|
|
24
|
+
## Rules
|
|
25
|
+
|
|
26
|
+
1. **Throwaway from day one.** Name it so a casual reader knows it is a prototype, not production. Locate it near the module it prototypes for.
|
|
27
|
+
|
|
28
|
+
2. **One command to run.** Whatever the project's existing task runner supports. `pnpm <name>`, `python <path>`, `bun <path>` — one command, no ceremony.
|
|
29
|
+
|
|
30
|
+
3. **No persistence by default.** State lives in memory. Persistence is the thing the prototype is checking, not a dependency of the prototype.
|
|
31
|
+
|
|
32
|
+
4. **Skip polish.** No tests, no error handling beyond what makes it runnable, no abstractions. The goal is learning, not quality.
|
|
33
|
+
|
|
34
|
+
5. **Surface the state.** After every action, print or render the full relevant state. The user needs to see what changed.
|
|
35
|
+
|
|
36
|
+
6. **Delete or absorb when done.** When the question is answered, either delete the prototype or fold the validated decision into real code. Do not leave it rotting.
|
|
37
|
+
|
|
38
|
+
## When done
|
|
39
|
+
|
|
40
|
+
Capture the answer in something durable: commit message, ADR, issue, or a `NOTES.md` next to the prototype. Include the question and the verdict. Then delete the prototype.
|