devrites 1.19.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/.claude-plugin/marketplace.json +24 -0
- package/.claude-plugin/plugin.json +43 -0
- package/CHANGELOG.md +391 -0
- package/LICENSE +56 -0
- package/NOTICE.md +18 -0
- package/README.md +582 -0
- package/SECURITY.md +193 -0
- package/bin/devrites.mjs +100 -0
- package/docs/architecture.md +272 -0
- package/docs/cli-mcp.md +57 -0
- package/docs/command-map.md +143 -0
- package/docs/flow.md +360 -0
- package/docs/release.md +29 -0
- package/docs/skills.md +214 -0
- package/docs/usage.md +325 -0
- package/install.sh +359 -0
- package/mcp/devrites-mcp.mjs +103 -0
- package/pack/.claude/agents/devrites-code-reviewer.md +50 -0
- package/pack/.claude/agents/devrites-doubt-reviewer.md +55 -0
- package/pack/.claude/agents/devrites-frontend-reviewer.md +52 -0
- package/pack/.claude/agents/devrites-performance-reviewer.md +47 -0
- package/pack/.claude/agents/devrites-plan-reviewer.md +79 -0
- package/pack/.claude/agents/devrites-security-auditor.md +53 -0
- package/pack/.claude/agents/devrites-simplifier-reviewer.md +75 -0
- package/pack/.claude/agents/devrites-slice-wright.md +181 -0
- package/pack/.claude/agents/devrites-spec-reviewer.md +72 -0
- package/pack/.claude/agents/devrites-strategy-reviewer.md +62 -0
- package/pack/.claude/agents/devrites-test-analyst.md +47 -0
- package/pack/.claude/hooks/devrites-a1-guard.sh +81 -0
- package/pack/.claude/hooks/devrites-allow.sh +44 -0
- package/pack/.claude/hooks/devrites-cursor.sh +28 -0
- package/pack/.claude/hooks/devrites-orient.sh +53 -0
- package/pack/.claude/hooks/devrites-redwatch.sh +39 -0
- package/pack/.claude/hooks/devrites-refresh-indexes.sh +127 -0
- package/pack/.claude/hooks/devrites-reviewer-readonly.sh +28 -0
- package/pack/.claude/hooks/devrites-statusline.sh +18 -0
- package/pack/.claude/hooks/devrites-stop-gate.sh +45 -0
- package/pack/.claude/hooks/devrites-wright-scope.sh +35 -0
- package/pack/.claude/hooks/hooks.json +52 -0
- package/pack/.claude/rules/README.md +48 -0
- package/pack/.claude/rules/afk-hitl.md +245 -0
- package/pack/.claude/rules/agents.md +98 -0
- package/pack/.claude/rules/anti-patterns.md +48 -0
- package/pack/.claude/rules/code-review.md +38 -0
- package/pack/.claude/rules/coding-style.md +55 -0
- package/pack/.claude/rules/context-hygiene.md +97 -0
- package/pack/.claude/rules/core.md +119 -0
- package/pack/.claude/rules/development-workflow.md +40 -0
- package/pack/.claude/rules/documentation.md +27 -0
- package/pack/.claude/rules/error-handling.md +33 -0
- package/pack/.claude/rules/git-workflow.md +35 -0
- package/pack/.claude/rules/hooks.md +38 -0
- package/pack/.claude/rules/patterns.md +45 -0
- package/pack/.claude/rules/performance.md +27 -0
- package/pack/.claude/rules/prose-style.md +101 -0
- package/pack/.claude/rules/security.md +63 -0
- package/pack/.claude/rules/testing.md +88 -0
- package/pack/.claude/rules/tooling.md +72 -0
- package/pack/.claude/settings.json +53 -0
- package/pack/.claude/skills/devrites-api-interface/SKILL.md +45 -0
- package/pack/.claude/skills/devrites-audit/SKILL.md +73 -0
- package/pack/.claude/skills/devrites-browser-proof/SKILL.md +38 -0
- package/pack/.claude/skills/devrites-debug-recovery/SKILL.md +50 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/build-the-loop.md +47 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/cleanup-and-classify.md +17 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/hypotheses.md +17 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/instrumentation.md +21 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/regression-test.md +31 -0
- package/pack/.claude/skills/devrites-doubt/SKILL.md +75 -0
- package/pack/.claude/skills/devrites-frontend-craft/SKILL.md +96 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/craft.md +59 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/design-references.md +116 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/fullstack.md +45 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/quality-standards.md +215 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/reuse-first.md +59 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/shape.md +60 -0
- package/pack/.claude/skills/devrites-interview/SKILL.md +81 -0
- package/pack/.claude/skills/devrites-lib/SKILL.md +76 -0
- package/pack/.claude/skills/devrites-lib/scripts/analyze.sh +78 -0
- package/pack/.claude/skills/devrites-lib/scripts/check-acceptance.sh +75 -0
- package/pack/.claude/skills/devrites-lib/scripts/close-out.sh +47 -0
- package/pack/.claude/skills/devrites-lib/scripts/conventions.py +273 -0
- package/pack/.claude/skills/devrites-lib/scripts/coverage.sh +51 -0
- package/pack/.claude/skills/devrites-lib/scripts/devrites.sh +69 -0
- package/pack/.claude/skills/devrites-lib/scripts/doctor.sh +92 -0
- package/pack/.claude/skills/devrites-lib/scripts/evidence-fresh.sh +63 -0
- package/pack/.claude/skills/devrites-lib/scripts/footprint.sh +45 -0
- package/pack/.claude/skills/devrites-lib/scripts/learnings.sh +74 -0
- package/pack/.claude/skills/devrites-lib/scripts/mutation-gate.sh +52 -0
- package/pack/.claude/skills/devrites-lib/scripts/package-existence.sh +68 -0
- package/pack/.claude/skills/devrites-lib/scripts/preamble.sh +76 -0
- package/pack/.claude/skills/devrites-lib/scripts/progress.sh +103 -0
- package/pack/.claude/skills/devrites-lib/scripts/readiness.sh +62 -0
- package/pack/.claude/skills/devrites-lib/scripts/reconcile.sh +123 -0
- package/pack/.claude/skills/devrites-lib/scripts/resolve.sh +279 -0
- package/pack/.claude/skills/devrites-lib/scripts/stuck.sh +67 -0
- package/pack/.claude/skills/devrites-lib/scripts/test-integrity.sh +87 -0
- package/pack/.claude/skills/devrites-lib/scripts/tick-afk.sh +52 -0
- package/pack/.claude/skills/devrites-prose-craft/SKILL.md +105 -0
- package/pack/.claude/skills/devrites-prose-craft/reference/banned-phrases.md +95 -0
- package/pack/.claude/skills/devrites-prose-craft/reference/examples.md +88 -0
- package/pack/.claude/skills/devrites-prose-craft/reference/structures.md +134 -0
- package/pack/.claude/skills/devrites-refresh-indexes/SKILL.md +54 -0
- package/pack/.claude/skills/devrites-source-driven/SKILL.md +36 -0
- package/pack/.claude/skills/devrites-ux-shape/SKILL.md +121 -0
- package/pack/.claude/skills/devrites-ux-shape/reference/brief-template.md +93 -0
- package/pack/.claude/skills/devrites-ux-shape/reference/visual-direction-probe.md +48 -0
- package/pack/.claude/skills/rite/SKILL.md +135 -0
- package/pack/.claude/skills/rite/reference/menu.md +32 -0
- package/pack/.claude/skills/rite-adopt/SKILL.md +83 -0
- package/pack/.claude/skills/rite-adopt/reference/adoption.md +58 -0
- package/pack/.claude/skills/rite-adopt/reference/anti-patterns.md +19 -0
- package/pack/.claude/skills/rite-autocomplete/SKILL.md +96 -0
- package/pack/.claude/skills/rite-autocomplete/reference/decision-policy.md +35 -0
- package/pack/.claude/skills/rite-autocomplete/reference/loop.md +54 -0
- package/pack/.claude/skills/rite-autocomplete/reference/stop-conditions.md +59 -0
- package/pack/.claude/skills/rite-build/SKILL.md +261 -0
- package/pack/.claude/skills/rite-build/reference/afk-discipline.md +145 -0
- package/pack/.claude/skills/rite-build/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-build/reference/checkpoint-protocol.md +149 -0
- package/pack/.claude/skills/rite-build/reference/evidence-standard.md +32 -0
- package/pack/.claude/skills/rite-build/reference/frontend-trigger.md +39 -0
- package/pack/.claude/skills/rite-build/reference/one-slice-cycle.md +38 -0
- package/pack/.claude/skills/rite-build/reference/spec-drift-guard.md +43 -0
- package/pack/.claude/skills/rite-build/reference/tdd.md +26 -0
- package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +115 -0
- package/pack/.claude/skills/rite-define/SKILL.md +157 -0
- package/pack/.claude/skills/rite-define/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-define/reference/gates.md +152 -0
- package/pack/.claude/skills/rite-define/reference/plan-template.md +65 -0
- package/pack/.claude/skills/rite-doctor/SKILL.md +50 -0
- package/pack/.claude/skills/rite-frame/SKILL.md +116 -0
- package/pack/.claude/skills/rite-frame/reference/failure-modes.md +68 -0
- package/pack/.claude/skills/rite-handoff/SKILL.md +95 -0
- package/pack/.claude/skills/rite-handoff/reference/handoff-template.md +34 -0
- package/pack/.claude/skills/rite-learn/SKILL.md +82 -0
- package/pack/.claude/skills/rite-plan/SKILL.md +82 -0
- package/pack/.claude/skills/rite-plan/reference/anti-patterns.md +24 -0
- package/pack/.claude/skills/rite-plan/reference/dependency-graph.md +33 -0
- package/pack/.claude/skills/rite-plan/reference/replan-and-repair.md +42 -0
- package/pack/.claude/skills/rite-plan/reference/slicing.md +52 -0
- package/pack/.claude/skills/rite-plan/reference/task-breakdown.md +34 -0
- package/pack/.claude/skills/rite-polish/SKILL.md +90 -0
- package/pack/.claude/skills/rite-polish/reference/anti-ai-slop.md +177 -0
- package/pack/.claude/skills/rite-polish/reference/anti-patterns.md +27 -0
- package/pack/.claude/skills/rite-polish/reference/backend-polish.md +80 -0
- package/pack/.claude/skills/rite-polish/reference/browser-polish-evidence.md +31 -0
- package/pack/.claude/skills/rite-polish/reference/code.md +85 -0
- package/pack/.claude/skills/rite-polish/reference/design-system-discovery.md +35 -0
- package/pack/.claude/skills/rite-polish/reference/harden-checklist.md +109 -0
- package/pack/.claude/skills/rite-polish/reference/ui.md +136 -0
- package/pack/.claude/skills/rite-pressure-test/SKILL.md +43 -0
- package/pack/.claude/skills/rite-prototype/SKILL.md +87 -0
- package/pack/.claude/skills/rite-prove/SKILL.md +120 -0
- package/pack/.claude/skills/rite-prove/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-prove/reference/browser-proof.md +26 -0
- package/pack/.claude/skills/rite-prove/reference/failure-triage.md +25 -0
- package/pack/.claude/skills/rite-prove/reference/proof-ladder.md +26 -0
- package/pack/.claude/skills/rite-prove/reference/test-command-discovery.md +30 -0
- package/pack/.claude/skills/rite-quick/SKILL.md +81 -0
- package/pack/.claude/skills/rite-resolve/SKILL.md +113 -0
- package/pack/.claude/skills/rite-resolve/reference/answer-protocol.md +114 -0
- package/pack/.claude/skills/rite-review/SKILL.md +170 -0
- package/pack/.claude/skills/rite-review/reference/anti-patterns.md +32 -0
- package/pack/.claude/skills/rite-review/reference/cognitive-load.md +90 -0
- package/pack/.claude/skills/rite-review/reference/feature-scoped-review.md +26 -0
- package/pack/.claude/skills/rite-review/reference/five-axis-review.md +46 -0
- package/pack/.claude/skills/rite-review/reference/nielsen-heuristics.md +130 -0
- package/pack/.claude/skills/rite-review/reference/parallel-dispatch.md +62 -0
- package/pack/.claude/skills/rite-review/reference/performance-review.md +28 -0
- package/pack/.claude/skills/rite-review/reference/security-review.md +32 -0
- package/pack/.claude/skills/rite-seal/SKILL.md +183 -0
- package/pack/.claude/skills/rite-seal/reference/anti-patterns.md +27 -0
- package/pack/.claude/skills/rite-seal/reference/conventions-ledger.md +63 -0
- package/pack/.claude/skills/rite-seal/reference/final-evidence.md +72 -0
- package/pack/.claude/skills/rite-seal/reference/go-no-go.md +37 -0
- package/pack/.claude/skills/rite-seal/reference/parallel-dispatch.md +69 -0
- package/pack/.claude/skills/rite-seal/reference/risk-and-rollback.md +30 -0
- package/pack/.claude/skills/rite-seal/reference/seal-template.md +36 -0
- package/pack/.claude/skills/rite-ship/SKILL.md +120 -0
- package/pack/.claude/skills/rite-ship/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-ship/reference/close-out.md +31 -0
- package/pack/.claude/skills/rite-ship/reference/design-memory.md +120 -0
- package/pack/.claude/skills/rite-ship/reference/git-ship.md +42 -0
- package/pack/.claude/skills/rite-ship/reference/ship-template.md +33 -0
- package/pack/.claude/skills/rite-spec/SKILL.md +126 -0
- package/pack/.claude/skills/rite-spec/reference/acceptance-criteria.md +31 -0
- package/pack/.claude/skills/rite-spec/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-spec/reference/interview-patterns.md +56 -0
- package/pack/.claude/skills/rite-spec/reference/investigation.md +64 -0
- package/pack/.claude/skills/rite-spec/reference/question-protocol.md +61 -0
- package/pack/.claude/skills/rite-spec/reference/references-intake.md +57 -0
- package/pack/.claude/skills/rite-spec/reference/spec-checklists.md +73 -0
- package/pack/.claude/skills/rite-spec/reference/spec-template.md +124 -0
- package/pack/.claude/skills/rite-spec/reference/state-workspace.md +159 -0
- package/pack/.claude/skills/rite-status/SKILL.md +101 -0
- package/pack/.claude/skills/rite-temper/SKILL.md +119 -0
- package/pack/.claude/skills/rite-temper/reference/anti-patterns.md +29 -0
- package/pack/.claude/skills/rite-temper/reference/review-dimensions.md +65 -0
- package/pack/.claude/skills/rite-temper/reference/scope-modes.md +53 -0
- package/pack/.claude/skills/rite-temper/reference/significance.md +46 -0
- package/pack/.claude/skills/rite-temper/reference/strategy-template.md +90 -0
- package/pack/.claude/skills/rite-vet/SKILL.md +155 -0
- package/pack/.claude/skills/rite-vet/reference/anti-patterns.md +29 -0
- package/pack/.claude/skills/rite-vet/reference/artifacts.md +135 -0
- package/pack/.claude/skills/rite-vet/reference/cross-model.md +41 -0
- package/pack/.claude/skills/rite-vet/reference/depth.md +53 -0
- package/pack/.claude/skills/rite-vet/reference/eng-lenses.md +48 -0
- package/pack/.claude/skills/rite-vet/reference/review-axes.md +167 -0
- package/pack/.claude/skills/rite-zoom-out/SKILL.md +75 -0
- package/package.json +68 -0
- package/scripts/build-release-tarball.sh +74 -0
- package/scripts/check-cross-refs.py +121 -0
- package/scripts/check-no-global-writes.sh +44 -0
- package/scripts/check-rule-uniqueness.sh +73 -0
- package/scripts/devrites-detect.sh +175 -0
- package/scripts/eval-runner.py +273 -0
- package/scripts/grade-feature.sh +104 -0
- package/scripts/install-lib.sh +83 -0
- package/scripts/pin.sh +166 -0
- package/scripts/render-eval-summary.py +48 -0
- package/scripts/run-evals.sh +149 -0
- package/scripts/run-outcome-evals.sh +49 -0
- package/scripts/scan-pack-security.py +209 -0
- package/scripts/scan-supply-chain-iocs.py +127 -0
- package/scripts/supply-chain-iocs.json +11 -0
- package/scripts/sync-version.sh +56 -0
- package/scripts/validate-frontmatter.py +149 -0
- package/scripts/validate-workflow-security.py +86 -0
- package/scripts/validate.sh +234 -0
- package/uninstall.sh +137 -0
- package/update.sh +196 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# AFK discipline — running `/rite-build` unattended without burning the trunk
|
|
2
|
+
|
|
3
|
+
AFK mode is `.devrites/AFK` present. It lets `/rite-build` chain slices without per-slice
|
|
4
|
+
user input. The discipline below is what keeps an AFK loop from drifting into damage.
|
|
5
|
+
|
|
6
|
+
The core principles are borrowed from established autonomous-coding loops (Ralph Wiggum,
|
|
7
|
+
Claude Code auto mode):
|
|
8
|
+
|
|
9
|
+
1. **Feedback loops are the trust substrate.** No green tests / types / lint → no
|
|
10
|
+
"built" status. The loop can't declare victory if the lights are red.
|
|
11
|
+
2. **Always cap iterations.** Stochastic systems + infinite loops = unsafe. `max_slices`
|
|
12
|
+
is the hard counter.
|
|
13
|
+
3. **Promote pre-action gates, demote post-action gates.** Code that lands without a
|
|
14
|
+
gate is a finding; gates after the fact are review queues.
|
|
15
|
+
4. **AFK widens what's automatic, never what's irreversible.** Destructive work, auth
|
|
16
|
+
boundaries, public API breaks always pause regardless of the sentinel.
|
|
17
|
+
|
|
18
|
+
## The sentinel file
|
|
19
|
+
|
|
20
|
+
`.devrites/AFK` (presence = AFK). Optional YAML body:
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
max_slices: 10 # read-only INITIAL budget; seeds state.md on first AFK build
|
|
24
|
+
notify: "ntfy.sh/my-topic" # shell command run on awaiting_human transition
|
|
25
|
+
allow_gates: [advisory, validating] # gate severities AFK may auto-handle
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`.devrites/AFK` is **read-only config** — never rewritten in place. `max_slices` is the
|
|
29
|
+
initial budget; the mutable remaining count lives in `state.md` as `AFK slices remaining:
|
|
30
|
+
<n>`, seeded from `max_slices` on the first AFK build and decremented by `tick-afk.sh`
|
|
31
|
+
(see "Iteration cap").
|
|
32
|
+
|
|
33
|
+
Defaults when keys are omitted:
|
|
34
|
+
- `max_slices`: unlimited (a missing cap is risky — see "Always cap iterations").
|
|
35
|
+
- `notify`: none.
|
|
36
|
+
- `allow_gates`: `[advisory]`.
|
|
37
|
+
|
|
38
|
+
To disable AFK temporarily, delete the file. The next `/rite-build` boots straight back
|
|
39
|
+
into HITL.
|
|
40
|
+
|
|
41
|
+
## Iteration cap
|
|
42
|
+
|
|
43
|
+
`/rite-build`'s **record step** (workflow step 6) decrements `state.md`'s `AFK slices
|
|
44
|
+
remaining` by 1 each time a slice is marked `built`, by running
|
|
45
|
+
`bash .claude/skills/devrites-lib/scripts/tick-afk.sh <state.md path>`. The script reads the
|
|
46
|
+
field, decrements, writes it back, prints the new value, and **exits `3` when it hits 0**.
|
|
47
|
+
The cap is enforced by `tick-afk.sh`, not by prose — when it exits 3:
|
|
48
|
+
|
|
49
|
+
- `/rite-build` treats exit 3 as a forced HITL stop:
|
|
50
|
+
```
|
|
51
|
+
AFK cap reached. Raise `state.md` `AFK slices remaining` or remove the sentinel to continue.
|
|
52
|
+
```
|
|
53
|
+
- The workspace stays consistent — no half-built slice, no pending question.
|
|
54
|
+
|
|
55
|
+
Step 0 re-derives the remaining budget from `state.md` (seeding it from `.devrites/AFK`
|
|
56
|
+
`max_slices` on the first AFK build); `max_slices` itself is read-only and never rewritten.
|
|
57
|
+
|
|
58
|
+
The cap is intentional: a missing or large cap **must be a conscious choice**. Ralph's
|
|
59
|
+
rule: 5-10 iterations for small tasks, 30-50 for larger ones. Don't ship "unlimited" as
|
|
60
|
+
the default for a job you haven't observed running once HITL.
|
|
61
|
+
|
|
62
|
+
## Fail-on-red
|
|
63
|
+
|
|
64
|
+
The **fail-on-red step** (workflow step 5) refuses to mark a slice `built` if targeted tests /
|
|
65
|
+
types / lint are red. The reasoning:
|
|
66
|
+
|
|
67
|
+
- A red signal means either the slice's contract is wrong or the failing code is. Neither
|
|
68
|
+
is something AFK can resolve.
|
|
69
|
+
- Marking it `built` and letting the AFK loop chain to the next slice burns the trunk —
|
|
70
|
+
the next slice builds on broken state.
|
|
71
|
+
|
|
72
|
+
The fail-on-red path:
|
|
73
|
+
|
|
74
|
+
1. Append a question to `questions.md` with `gate: blocking`, the SLA of the slice, and a
|
|
75
|
+
crisp `question:` field naming what failed.
|
|
76
|
+
2. Set `state.md` `Status: awaiting_human` and the `Awaiting human` block.
|
|
77
|
+
3. Fire the `notify:` hook if defined.
|
|
78
|
+
4. STOP.
|
|
79
|
+
|
|
80
|
+
The user resolves via `/rite-resolve` after diagnosing or re-planning.
|
|
81
|
+
|
|
82
|
+
## Irreversible-risk list (always pause)
|
|
83
|
+
|
|
84
|
+
Regardless of `allow_gates`, AFK invokes the checkpoint protocol when the slice touches
|
|
85
|
+
any of:
|
|
86
|
+
|
|
87
|
+
- Destructive data migration (drop column, drop table, irreversible backfill).
|
|
88
|
+
- Auth / authz boundary change (new role, changed permission check, new public auth endpoint).
|
|
89
|
+
- Public API break (response shape change, removed endpoint, changed status code semantics).
|
|
90
|
+
- External-service contract change (webhook payload, partner-facing schema).
|
|
91
|
+
- Filesystem destructive operation outside the workspace (`rm -rf` of project paths,
|
|
92
|
+
rewriting `.gitignore`-listed paths, deleting fixtures).
|
|
93
|
+
- Anything the slice's `Gate: blocking` plus `tasks.md` `Why HITL:` flags as irreversible.
|
|
94
|
+
|
|
95
|
+
The list is the same one Claude Code auto-mode's transcript classifier protects — adapted
|
|
96
|
+
to DevRites's workspace shape.
|
|
97
|
+
|
|
98
|
+
## The `notify:` hook contract
|
|
99
|
+
|
|
100
|
+
The hook is a single shell command run on the `awaiting_human` transition. Environment
|
|
101
|
+
the hook receives:
|
|
102
|
+
|
|
103
|
+
| Var | Value |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `DEVRITES_QID` | the new qid (e.g. `q-2026-05-28-001`) |
|
|
106
|
+
| `DEVRITES_GATE` | `advisory` / `validating` / `blocking` / `escalating` |
|
|
107
|
+
| `DEVRITES_SLICE` | `<N — name>` |
|
|
108
|
+
| `DEVRITES_SLUG` | active feature slug |
|
|
109
|
+
| `DEVRITES_QUESTION` | the checkpoint text |
|
|
110
|
+
| `DEVRITES_PROPOSED` | the proposed answer |
|
|
111
|
+
|
|
112
|
+
The hook is best-effort: non-zero exit does **not** roll back the pause. Failures are
|
|
113
|
+
logged to `evidence.md` so the user sees them on return.
|
|
114
|
+
|
|
115
|
+
Example targets:
|
|
116
|
+
- `curl -d "$DEVRITES_QID: $DEVRITES_QUESTION" ntfy.sh/my-topic`
|
|
117
|
+
- `osascript -e "display notification \"$DEVRITES_QUESTION\" with title \"DevRites: $DEVRITES_GATE\""`
|
|
118
|
+
- `pb push "$DEVRITES_SLUG: $DEVRITES_QUESTION"` (via pushbullet CLI)
|
|
119
|
+
|
|
120
|
+
DevRites owns no notification logic — the hook is a seam, not a feature.
|
|
121
|
+
|
|
122
|
+
## When to leave AFK
|
|
123
|
+
|
|
124
|
+
Drop the sentinel before:
|
|
125
|
+
|
|
126
|
+
- A novel feature where you have not yet seen `/rite-build` work on this codebase HITL —
|
|
127
|
+
Ralph's progression: HITL first → refine prompt → AFK once trusted.
|
|
128
|
+
- A risky slice you marked `Mode: HITL` and want to walk through interactively even if
|
|
129
|
+
the gate is technically `validating`.
|
|
130
|
+
- Any time you'd rather review per-slice than batch-resolve afterwards.
|
|
131
|
+
|
|
132
|
+
AFK is a **bias toward continuing**, not a vow. Re-enter it whenever the next stretch of
|
|
133
|
+
work is bulk + low-stakes.
|
|
134
|
+
|
|
135
|
+
## What AFK does NOT do
|
|
136
|
+
|
|
137
|
+
- It does not bypass `/rite-prove`, `/rite-review`, or `/rite-seal`. Those gates are
|
|
138
|
+
feature-scoped and always run when their phase runs.
|
|
139
|
+
- It does not skip `/rite-plan repair` on Spec Drift Guard fires.
|
|
140
|
+
- It does not skip `devrites-source-driven` checks. Uncertain framework behavior still
|
|
141
|
+
triggers the doc lookup.
|
|
142
|
+
- It does not skip `evidence.md` writes. AFK runs that don't record evidence are
|
|
143
|
+
unproven and get rejected at `/rite-prove` regardless.
|
|
144
|
+
|
|
145
|
+
The sentinel widens *human pauses*, nothing else.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# rite-build — anti-patterns
|
|
2
|
+
|
|
3
|
+
Load this when standing a non-trivial implementation decision, or when the
|
|
4
|
+
agent feels reluctance toward stopping after one slice, applying TDD, or
|
|
5
|
+
calling `devrites-doubt`.
|
|
6
|
+
|
|
7
|
+
Pack-wide rationalizations + red flags (incl. tests-later, defensive checks,
|
|
8
|
+
generic AI naming, drive-by refactors): see
|
|
9
|
+
[rules/anti-patterns.md](../../../rules/anti-patterns.md).
|
|
10
|
+
|
|
11
|
+
## Phase-specific rationalizations
|
|
12
|
+
|
|
13
|
+
| Excuse | Rebuttal |
|
|
14
|
+
|---|---|
|
|
15
|
+
| "Slices 1 and 2 are related; let me do both." | One slice, then stop. Full stop. The user asks for the next. |
|
|
16
|
+
| "It's faster to skip `devrites-doubt` for this small change." | Doubt is cheapest *before* the decision is standing. After is debugging. |
|
|
17
|
+
|
|
18
|
+
## Red Flags
|
|
19
|
+
|
|
20
|
+
- About to start slice N+1 without the user asking.
|
|
21
|
+
- Skipping `devrites-doubt` on a branching, boundary, data-model, auth, public-API, or migration decision.
|
|
22
|
+
- Adding a dependency or a second design system without recording rationale in `decisions.md`.
|
|
23
|
+
- Writing a `try/catch` block wider than what you actually handle.
|
|
24
|
+
- A comment that restates what the next line does.
|
|
25
|
+
- Touching files that aren't in `touched-files.md` for "tidiness".
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Checkpoint protocol — what `/rite-build` does when a slice is HITL
|
|
2
|
+
|
|
3
|
+
When `/rite-build` reaches a slice with `Mode: HITL`, it does **not** start writing code. It
|
|
4
|
+
surfaces the checkpoint as a ranked **option set** and resolves it **before** any code lands:
|
|
5
|
+
|
|
6
|
+
- **Human present (interactive)** — ask inline via `AskUserQuestion` (the option set below).
|
|
7
|
+
The human picks; record the pick to `questions.md` (`answered`) + `decisions.md`, clear the
|
|
8
|
+
gate, and **continue building in place** — no STOP, no `/rite-resolve` round-trip.
|
|
9
|
+
- **Human absent / AFK-pausing / notify-only** — persist the checkpoint (`questions.md` open +
|
|
10
|
+
`state.md` `Awaiting human`), fire the `notify:` hook, and **stop**. Resume later via
|
|
11
|
+
`/rite-resolve` (or `--batch`).
|
|
12
|
+
|
|
13
|
+
Either way the pause is **pre-action**, not post-action: code never lands before the gate.
|
|
14
|
+
|
|
15
|
+
## Render contract
|
|
16
|
+
|
|
17
|
+
The checkpoint must be rendered in user-facing output **and** persisted to the workspace.
|
|
18
|
+
Both are required — the output is for the human in the room (or the notification target),
|
|
19
|
+
the persisted form is for the next session or the AFK observer.
|
|
20
|
+
|
|
21
|
+
### User-facing render — the option set
|
|
22
|
+
|
|
23
|
+
Present the checkpoint as an `AskUserQuestion` with a ranked **option set**
|
|
24
|
+
(`afk-hitl.md` → "Option set"): 2–4 options, **recommended first** + labelled `(Recommended)`,
|
|
25
|
+
each option's description carrying the dimension-tagged rationale + the trade-off it accepts,
|
|
26
|
+
plus the escape hatch. The header names the slice + gate:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Slice <N — name> — HITL (<gate>, SLA <SLA>). <Checkpoint text from tasks.md>
|
|
30
|
+
|
|
31
|
+
▸ 1. <recommended> (Recommended)
|
|
32
|
+
logic: … · infra: … · business: … · architecture: … (+ security/UX/risk if in scope)
|
|
33
|
+
2. <alternative> — <rationale + the trade-off it accepts>
|
|
34
|
+
3. <alternative> — <rationale>
|
|
35
|
+
4. Something else — I'll describe it
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The recommended option (#1) is **required** — a checkpoint without a recommendation is a worse
|
|
39
|
+
interrupt than one with shape; the human reacts to a ranked draft faster than to a blank prompt
|
|
40
|
+
(the "give the human something to approve" rule). The recommendation reflects *this* project
|
|
41
|
+
(its conventions, stack, scale), not a generic default. On an interactive pick, resolve in
|
|
42
|
+
place; when persisting a pause instead, the same set is written to `questions.md` `options:`
|
|
43
|
+
and the resume line is `/rite-resolve <qid> "<answer>"` (or `--drop <qid> "<reason>"`).
|
|
44
|
+
|
|
45
|
+
### Workspace mutations
|
|
46
|
+
|
|
47
|
+
In one atomic write (one `state.md` rewrite + one `questions.md` append):
|
|
48
|
+
|
|
49
|
+
1. **`questions.md` append:**
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
## q-<YYYY-MM-DD>-<NNN>
|
|
53
|
+
status: open
|
|
54
|
+
slice: <N — name>
|
|
55
|
+
gate: <gate from tasks.md>
|
|
56
|
+
question: <Checkpoint text from tasks.md>
|
|
57
|
+
options: | # the ranked set, recommended first (matches the render)
|
|
58
|
+
1. <recommended> (Recommended) — logic: … · infra: … · business: … · architecture: …
|
|
59
|
+
2. <alternative> — <rationale>
|
|
60
|
+
proposed: <the recommended option restated; matches option 1>
|
|
61
|
+
raised_at: <iso>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
2. **`state.md` updates:**
|
|
65
|
+
|
|
66
|
+
```markdown
|
|
67
|
+
- Status: awaiting_human
|
|
68
|
+
- Active slice: <N — name>
|
|
69
|
+
- Slice mode: HITL
|
|
70
|
+
- Next step: /rite-resolve <qid> "<answer>"
|
|
71
|
+
|
|
72
|
+
## Awaiting human
|
|
73
|
+
- qid: <q-...-NNN>
|
|
74
|
+
- gate: <gate>
|
|
75
|
+
- question: <Checkpoint text>
|
|
76
|
+
- proposed: <one-paragraph best-guess>
|
|
77
|
+
- raised_at: <iso>
|
|
78
|
+
- blocking_slices: [<list, from `Blocked by` lookups>]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. **`notify:` hook (if `.devrites/AFK` defines one):** export all six env vars from the
|
|
82
|
+
canonical contract in [`afk-discipline.md`](afk-discipline.md) (the `notify:` hook
|
|
83
|
+
contract table is the source of truth):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
DEVRITES_QID="$qid" \
|
|
87
|
+
DEVRITES_GATE="$gate" \
|
|
88
|
+
DEVRITES_SLICE="$slice_id" \
|
|
89
|
+
DEVRITES_SLUG="$slug" \
|
|
90
|
+
DEVRITES_QUESTION="$question" \
|
|
91
|
+
DEVRITES_PROPOSED="$proposed" \
|
|
92
|
+
sh -c "$notify_cmd"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The hook fires after the workspace write so the notification target sees a workspace
|
|
96
|
+
that already records the pause. Failures in the hook **do not** roll back the pause —
|
|
97
|
+
the gate is authoritative; the notification is best-effort.
|
|
98
|
+
|
|
99
|
+
## qid generation
|
|
100
|
+
|
|
101
|
+
Format: `q-YYYY-MM-DD-NNN`, where `NNN` is the next sequential integer for that date in
|
|
102
|
+
`questions.md`. For the write side, call
|
|
103
|
+
`bash .claude/skills/devrites-lib/scripts/resolve.sh next-qid <questions.md path>` — it
|
|
104
|
+
counts existing `## q-YYYY-MM-DD-` headers for today, prints the next zero-padded id, and
|
|
105
|
+
refuses to print an id whose header already exists. Use that id verbatim so each qid is
|
|
106
|
+
unique within the date.
|
|
107
|
+
|
|
108
|
+
## When AFK is active
|
|
109
|
+
|
|
110
|
+
If `.devrites/AFK` exists and the slice's `Gate` is in `allow_gates`, `/rite-build` does
|
|
111
|
+
**not** invoke the checkpoint protocol. Instead:
|
|
112
|
+
|
|
113
|
+
- For `advisory`: log a `gate: advisory` entry to `questions.md`, record the trade-off in
|
|
114
|
+
`decisions.md`, and **dispatch the wright** to build the slice (workflow step 3).
|
|
115
|
+
- For `validating` (only when `allow_gates` includes it): **dispatch the wright** (step 3); on
|
|
116
|
+
return, write a `gate: validating` entry to `questions.md`, mark the slice
|
|
117
|
+
`built (pending review)` in `state.md`, and continue. A slice's only states are `pending` and `built` —
|
|
118
|
+
acceptance is proven at the **feature** level by `/rite-prove` (recorded in
|
|
119
|
+
`evidence.md`), not per slice. The `built (pending review)` slice is not done until the
|
|
120
|
+
open `validating` gate resolves via `/rite-resolve`; an open `validating` gate is a
|
|
121
|
+
NO-GO at seal.
|
|
122
|
+
|
|
123
|
+
For gates in `allow_gates`, AFK **auto-picks the recommended option** (option 1 of the set)
|
|
124
|
+
instead of pausing, recording it as above. For `blocking` and `escalating` (and every
|
|
125
|
+
irreversible-risk item), AFK **always** invokes the checkpoint protocol — the sentinel does
|
|
126
|
+
not unlock these gates — **unless `allow_irreversible: true`** is set, which makes AFK
|
|
127
|
+
auto-pick the recommendation on *every* gate, irreversible included (maximal autonomy, opt-in;
|
|
128
|
+
see `afk-hitl.md`). See `afk-discipline.md` for the irreversible-risk list.
|
|
129
|
+
|
|
130
|
+
## Multi-question pauses
|
|
131
|
+
|
|
132
|
+
The current protocol is **one question per pause**. If a slice has multiple HITL
|
|
133
|
+
checkpoints, split it into sub-slices via `/rite-plan reslice` so each pause is
|
|
134
|
+
single-question. Multi-question pauses are reserved future shape; `Awaiting human` is
|
|
135
|
+
written as a single block.
|
|
136
|
+
|
|
137
|
+
## What NOT to do
|
|
138
|
+
|
|
139
|
+
- **Don't write code first and pause after.** The pre-action rule is the whole point.
|
|
140
|
+
- **Don't render the checkpoint without persisting.** Output without `state.md` + `questions.md`
|
|
141
|
+
updates means the workspace lies on `/clear`.
|
|
142
|
+
- **Don't self-answer a question that *paused* for a human.** When a gate stopped the session
|
|
143
|
+
(an AFK queue, or a HITL pause the human walked away from), `/rite-resolve` requires an
|
|
144
|
+
explicit answer — the agent doesn't confirm its own `proposed:` on resume. This is distinct
|
|
145
|
+
from the two legitimate auto-resolutions: an interactive `AskUserQuestion` pick the human
|
|
146
|
+
just made, and an AFK auto-pick of the recommended option on a gate `allow_gates` permits.
|
|
147
|
+
- **Don't bundle the `notify:` hook output into chat.** Fire-and-forget; the chat already
|
|
148
|
+
has the user-facing render.
|
|
149
|
+
- **Don't fire `notify:` on `advisory`-downgraded entries.** It's reserved for true pauses.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Evidence standard
|
|
2
|
+
|
|
3
|
+
Evidence beats confidence. A slice isn't built until there's a record that proves it.
|
|
4
|
+
|
|
5
|
+
## What counts as evidence
|
|
6
|
+
- A **command + its output**: `npm test src/export.test.ts` → `3 passing`.
|
|
7
|
+
- A **build/typecheck/lint** result for touched code.
|
|
8
|
+
- **Runtime observation**: a request/response, a log line, a CLI output.
|
|
9
|
+
- **Browser evidence** for UI (see `devrites-browser-proof`): route, viewport,
|
|
10
|
+
screenshot path (opened and described), console state, interaction path.
|
|
11
|
+
|
|
12
|
+
## What does NOT count
|
|
13
|
+
- "It should work" / "this looks right" / "I'm confident".
|
|
14
|
+
- A green test you never saw fail (for new behavior).
|
|
15
|
+
- "No type errors" as proof that a *feature* works (it proves types, not behavior).
|
|
16
|
+
- A screenshot path you didn't open.
|
|
17
|
+
|
|
18
|
+
## Record format (`evidence.md`, append-only)
|
|
19
|
+
```markdown
|
|
20
|
+
## Slice <N> — <name> (<date>)
|
|
21
|
+
- cmd: <command>
|
|
22
|
+
result: <pass/fail + key output line>
|
|
23
|
+
- observation: <what you saw at runtime>
|
|
24
|
+
- browser: see browser-evidence.md (if UI)
|
|
25
|
+
- gaps: <what remains unproven, if anything>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Honesty rules
|
|
29
|
+
- If a test fails, record the failure and the output — don't hide it.
|
|
30
|
+
- If a step was skipped (no browser available, command not found), say so and record
|
|
31
|
+
the manual verification steps instead.
|
|
32
|
+
- Unproven acceptance criteria stay unchecked. The seal will catch them.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Frontend trigger
|
|
2
|
+
|
|
3
|
+
A slice is **frontend/UI** if it touches or plans to touch any of:
|
|
4
|
+
|
|
5
|
+
- React / TSX / JSX; Vue, Svelte, Astro, Angular;
|
|
6
|
+
- Rails Slim / Haml / ERB views; any server-rendered template;
|
|
7
|
+
- CSS, SCSS, Tailwind, design tokens, theme files;
|
|
8
|
+
- components, forms, layout, navigation, dashboard, landing/marketing page;
|
|
9
|
+
- UI copy, empty states, error states, onboarding, settings;
|
|
10
|
+
- screenshots, mockups, visual direction;
|
|
11
|
+
- browser behavior, responsive behavior, accessibility, frontend performance.
|
|
12
|
+
|
|
13
|
+
## When triggered
|
|
14
|
+
- `/rite-spec` applies **`devrites-ux-shape`** (spec step 3a) to write the feature-level
|
|
15
|
+
**`design-brief.md`** before any code — design direction, key states, interaction model,
|
|
16
|
+
optional Figma/image visual-direction probe.
|
|
17
|
+
- `/rite-build` applies **`devrites-frontend-craft`**, building **to** that `design-brief.md`
|
|
18
|
+
(register detection, refine the brief per slice, existing design system, all states,
|
|
19
|
+
anti-AI-slop) before/while implementing.
|
|
20
|
+
- `/rite-prove` applies **`devrites-browser-proof`** (proof ladder + evidence schema).
|
|
21
|
+
- `/rite-polish` runs the full **normalize + polish** workflow.
|
|
22
|
+
- `/rite-review` and `/rite-seal` include frontend UX / a11y / responsive / design-
|
|
23
|
+
system checks.
|
|
24
|
+
|
|
25
|
+
## Fullstack (UI slice that also needs backend)
|
|
26
|
+
If the slice spans both layers, it's both a frontend **and** a backend slice. Define the
|
|
27
|
+
**API/data contract first** (`devrites-api-interface`), build it as one **vertical slice**
|
|
28
|
+
(DB → service → API → UI), apply the engineering rules to the backend and
|
|
29
|
+
`devrites-frontend-craft` to the UI, map each contract error to a real UI state, and
|
|
30
|
+
**prove both layers** (contract tests + browser proof). See
|
|
31
|
+
`devrites-frontend-craft/reference/fullstack.md`.
|
|
32
|
+
|
|
33
|
+
## When NOT triggered
|
|
34
|
+
Pure backend/data/CLI/infra slices skip craft and browser proof — but still get tests
|
|
35
|
+
and evidence. If unsure whether a slice is "UI enough", treat copy/empty/error states
|
|
36
|
+
and any rendered output as UI.
|
|
37
|
+
|
|
38
|
+
Mark `Frontend craft required: yes/no` and `Browser proof required: yes/no` on the
|
|
39
|
+
slice in `tasks.md` so the trigger is explicit, not rediscovered each cycle.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# One-slice cycle
|
|
2
|
+
|
|
3
|
+
The discipline that makes large features manageable: build one thin slice, leave it
|
|
4
|
+
working and proven, stop. Never implement the whole feature in one pass.
|
|
5
|
+
|
|
6
|
+
## The cycle
|
|
7
|
+
The orchestrator (`/rite-build`) gates and records; the **wright** writes. See
|
|
8
|
+
[`wright-dispatch.md`](wright-dispatch.md).
|
|
9
|
+
```
|
|
10
|
+
SELECT → orchestrator: restate slice goal + acceptance + scope boundary; HITL gate (pause pre-code)
|
|
11
|
+
(SHAPE) → orchestrator: if UI and no design-brief.md, shape it (devrites-ux-shape) before dispatch
|
|
12
|
+
DISPATCH → hand the slice contract to devrites-slice-wright (fresh context). Inside the wright:
|
|
13
|
+
ORIENT → load only the files this slice touches; learn the project's idiom; reuse-first
|
|
14
|
+
(RED) → if behavior change: write the failing test first
|
|
15
|
+
IMPLEMENT → smallest complete version; match conventions; devrites-frontend-craft for UI
|
|
16
|
+
VERIFY → targeted tests (+ types/lint/build); fail-on-red; return artifact — code + tests only
|
|
17
|
+
(DOUBT) → orchestrator, on return: devrites-doubt each non-trivial decision the wright stood up
|
|
18
|
+
PROVE → orchestrator: fail-on-red check on the wright's gates; browser proof for UI
|
|
19
|
+
RECORD → orchestrator: state.md, evidence.md, touched-files.md (the canonical writer)
|
|
20
|
+
STOP → report + recommend next; do not start slice N+1
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Why stop after one slice
|
|
24
|
+
- Keeps the diff reviewable (~one capability, roughly ≤100 lines of meaningful change).
|
|
25
|
+
- Surfaces integration/drift problems while they're cheap.
|
|
26
|
+
- Gives the user a decision point — they may reprioritize, reslice, or polish now.
|
|
27
|
+
- Prevents the "90% done" pile-up where nothing is actually proven.
|
|
28
|
+
|
|
29
|
+
## Restate the scope boundary
|
|
30
|
+
Before coding, write what this slice will and will **not** touch. This is the contract
|
|
31
|
+
you check yourself against — anything outside it is scope creep or a drift event.
|
|
32
|
+
|
|
33
|
+
## When the slice can't be completed cleanly
|
|
34
|
+
- Discovered the plan is wrong → **Spec Drift Guard** (stop, record, classify, maybe
|
|
35
|
+
ask, `/rite-plan` repair).
|
|
36
|
+
- Slice is bigger than one cycle → stop and `/rite-plan reslice`.
|
|
37
|
+
- Blocked on a failing dependency → record in `state.md`, `/rite-plan unblock`.
|
|
38
|
+
Never power through by guessing.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Spec Drift Guard (build phase)
|
|
2
|
+
|
|
3
|
+
Active throughout `/rite-build`. The spec is living, not sacred — but you may not
|
|
4
|
+
silently code against a plan you know is wrong. This is the canonical Spec Drift Guard;
|
|
5
|
+
other phases reference it here.
|
|
6
|
+
|
|
7
|
+
## Drift has occurred when
|
|
8
|
+
- the spec says X but the code makes X impossible/wrong;
|
|
9
|
+
- the plan assumes a file/API/component/route/model/command that doesn't exist;
|
|
10
|
+
- tests show the acceptance criteria are incomplete or wrong;
|
|
11
|
+
- browser evidence shows the intended UX doesn't work as described;
|
|
12
|
+
- an official doc contradicts the planned approach;
|
|
13
|
+
- the design system / existing UX pattern contradicts the planned UI;
|
|
14
|
+
- a missing user decision that affects product behavior surfaces.
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
```
|
|
18
|
+
1. STOP coding.
|
|
19
|
+
2. Record in drift.md (assumed vs observed, when).
|
|
20
|
+
3. Classify: requirement ambiguity | implementation-plan error | codebase reality
|
|
21
|
+
mismatch | design-system mismatch | test/evidence mismatch | external-doc mismatch
|
|
22
|
+
| user-decision required.
|
|
23
|
+
4. Local repair that preserves behavior/scope/architecture/data/UX/security/migration?
|
|
24
|
+
YES → log in drift.md + decisions.md, /rite-plan repair, resume.
|
|
25
|
+
NO → ask the user (format below). Don't continue on the old plan.
|
|
26
|
+
5. Run /rite-plan repair before resuming.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## User question format
|
|
30
|
+
```
|
|
31
|
+
I hit spec drift:
|
|
32
|
+
- Spec/plan assumed: ...
|
|
33
|
+
- Code/evidence shows: ...
|
|
34
|
+
- Why it matters: ...
|
|
35
|
+
|
|
36
|
+
Which direction should DevRites take?
|
|
37
|
+
1. Keep the requirement, change architecture by ...
|
|
38
|
+
2. Adjust the requirement to match existing behavior ...
|
|
39
|
+
3. Split into a follow-up feature ...
|
|
40
|
+
4. Custom: describe the intended behavior
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Never continue coding on a known-wrong plan. Always re-plan before resuming.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# TDD / Prove-It pattern
|
|
2
|
+
|
|
3
|
+
When a slice changes behavior, prove the change with a test that fails first — so you
|
|
4
|
+
know the test can fail, and that your code is what makes it pass.
|
|
5
|
+
|
|
6
|
+
## Red → Green → Refactor
|
|
7
|
+
1. **Red** — write the smallest test that expresses the new behavior. Run it; watch it
|
|
8
|
+
fail for the *expected* reason (not a typo/import error).
|
|
9
|
+
2. **Green** — write the minimum code to pass. Resist gold-plating.
|
|
10
|
+
3. **Refactor** — clean up with the test as a safety net. Re-run; stay green.
|
|
11
|
+
|
|
12
|
+
## Prove-It (when strict TDD doesn't fit)
|
|
13
|
+
For code where a test-first flow is awkward (exploratory glue, config, some UI), still
|
|
14
|
+
produce evidence:
|
|
15
|
+
- Capture the current (wrong/absent) behavior — a failing assertion, a screenshot, a
|
|
16
|
+
log line.
|
|
17
|
+
- Make the change.
|
|
18
|
+
- Capture the new behavior the same way. The before/after pair *is* the proof.
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
- Use the project's existing test framework and commands (discovered in `spec.md` →
|
|
22
|
+
"Commands discovered"). Don't introduce a new test runner to prove a slice.
|
|
23
|
+
- One behavior per test; name it for the behavior, not the function.
|
|
24
|
+
- A green test you never saw fail proves nothing — always see red first.
|
|
25
|
+
- Don't delete or weaken a failing test to "pass". If it's wrong, that may be drift.
|
|
26
|
+
- Record the test command + result in `evidence.md`.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Slice-wright dispatch
|
|
2
|
+
|
|
3
|
+
How `/rite-build` hands the **build core** of one slice to `devrites-slice-wright` — the
|
|
4
|
+
fresh-context, **write-capable** executor under `.claude/agents/`. Loaded on demand by
|
|
5
|
+
`/rite-build`; not a skill itself. Sibling of
|
|
6
|
+
[`../../rite-seal/reference/parallel-dispatch.md`](../../rite-seal/reference/parallel-dispatch.md)
|
|
7
|
+
(the read-only reviewer fan-out) — same isolation principle, opposite direction: this one
|
|
8
|
+
**writes**.
|
|
9
|
+
|
|
10
|
+
Pattern: the orchestrator owns the **gates and the workspace**; the wright owns the **writing**.
|
|
11
|
+
Brief it precisely, in a clean context, with only the slice contract — then doubt, record, and
|
|
12
|
+
gate its return.
|
|
13
|
+
|
|
14
|
+
## Why a fresh context writes the slice
|
|
15
|
+
The orchestrator's window is full of spec investigation, planning, prior slices, and tool
|
|
16
|
+
output — the exact "lost-in-the-middle" load that degrades instruction-following and pulls the
|
|
17
|
+
model toward generic code. The wright starts clean and sees only the contract, so it holds the
|
|
18
|
+
slice boundary strictly and writes to the *project's* idiom instead of drifting. Single-threaded
|
|
19
|
+
by design: **one** wright per slice, never a parallel fan-out of writers — concurrent writers
|
|
20
|
+
make conflicting implicit decisions and produce incoherent code.
|
|
21
|
+
|
|
22
|
+
## The contract `/rite-build` sends
|
|
23
|
+
One `Task` call to `devrites-slice-wright` carrying everything the writer needs and nothing it
|
|
24
|
+
doesn't:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Build one slice of the active DevRites feature. You have a clean context — this contract is
|
|
28
|
+
the whole job.
|
|
29
|
+
|
|
30
|
+
Workspace: .devrites/work/<slug>/
|
|
31
|
+
Slice: <id — name>
|
|
32
|
+
Goal: <one or two sentences>
|
|
33
|
+
Acceptance criteria: <the slice's criteria, verbatim>
|
|
34
|
+
Scope boundary: <what it WILL and will NOT touch>
|
|
35
|
+
Mode: <HITL | AFK> (+ AFK budget note if a cap is set)
|
|
36
|
+
|
|
37
|
+
Targets (stay inside these — from touched-files.md): <paths>
|
|
38
|
+
Interfaces / signatures to match: <if any>
|
|
39
|
+
Read yourself: spec.md, plan.md, decisions.md, assumptions.md, rite-polish/reference/anti-ai-slop.md<, design-brief.md if UI>
|
|
40
|
+
Rules in scope (.claude/rules/): coding-style, error-handling, testing, patterns<, security if input/auth/data><, performance if hot path / query / large payload>
|
|
41
|
+
Test completeness: write ≥1 asserting test for EVERY interactive element + user flow in this
|
|
42
|
+
slice's test-plan.md interaction inventory, each at the right level (fields/elements →
|
|
43
|
+
unit/component; critical journeys → one E2E; never one-per-field). No element ships
|
|
44
|
+
unverified — testing.md "Completeness". If the slice has no test-plan inventory, derive the
|
|
45
|
+
element/flow list from the slice's own UI surface and cover it the same way.
|
|
46
|
+
|
|
47
|
+
Apply your documented discipline (orient → RED → implement smallest complete → verify →
|
|
48
|
+
return). Frontend slice → build to design-brief.md with devrites-frontend-craft. Uncertain
|
|
49
|
+
framework fact → verify at the source. Code + tests only — do NOT write the workspace
|
|
50
|
+
bookkeeping files; return that data. Return your structured artifact, not your transcript.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Rules:
|
|
54
|
+
- **One `Task` call, one wright.** Never dispatch two writers on the same slice.
|
|
55
|
+
- **No author reasoning beyond the contract.** Give the slice spec, not your analysis of *how*
|
|
56
|
+
to code it — a clean, undirected read is the point.
|
|
57
|
+
- **Name the boundary explicitly.** The scope boundary is the single most load-bearing field; an
|
|
58
|
+
underspecified one is the main cause of drift.
|
|
59
|
+
|
|
60
|
+
## On return — the orchestrator's job (don't delegate these)
|
|
61
|
+
**You never edit source here.** The wright is the only writer of code + tests; you write only
|
|
62
|
+
`.devrites/` bookkeeping. Every remedy below is **continue the same wright once** or **stop +
|
|
63
|
+
escalate** — never an inline patch. You snapshotted the tree before dispatch (`reconcile.sh
|
|
64
|
+
snapshot`); the reconcile check in step 4 proves no source changed outside the wright's claimed
|
|
65
|
+
set.
|
|
66
|
+
|
|
67
|
+
1. **Doubt the surfaced decisions.** For each entry in the wright's `Decisions stood`, apply
|
|
68
|
+
`devrites-doubt` (→ `devrites-doubt-reviewer`) before accepting — the writer must not grade
|
|
69
|
+
its own decisions. The wright's return is the not-yet-load-bearing moment (slice not `built`,
|
|
70
|
+
not merged), so this post-return doubt is still pre-commit. Irreversible-risk items always
|
|
71
|
+
pause — and an irreversible item that the wright filed under `Decisions stood` instead of
|
|
72
|
+
`Escalation` is a protocol violation: pause and re-dispatch with it flagged out-of-bounds,
|
|
73
|
+
don't doubt-and-accept.
|
|
74
|
+
2. **Honor escalations.** A non-empty `Escalation` → do **not** mark the slice built. Write the
|
|
75
|
+
`questions.md` entry + `state.md` `Awaiting human` (blocking gate), or route a scope change
|
|
76
|
+
through `/rite-plan repair` (Spec Drift Guard). You are the canonical writer of these files.
|
|
77
|
+
3. **Fail-on-red.** If `Gates` show red (or the wright couldn't verify), the slice is **not
|
|
78
|
+
built** — and you do **not** fix the code. First remedy: **continue the same wright once**
|
|
79
|
+
(`SendMessage`, carrying the failing gate + real output) so it fixes in its own context —
|
|
80
|
+
objective failures only (red gate / type / lint / missing coverage / UI browser-proof fail),
|
|
81
|
+
never a contested decision. Still red after that one retry → blocking question (AFK) or
|
|
82
|
+
blocking gate (HITL); `Next: /rite-plan unblock`.
|
|
83
|
+
An interactive element or user flow in the slice's test-plan interaction inventory left with
|
|
84
|
+
**no asserting test** has the same standing as red: an unverified-element gap blocks the
|
|
85
|
+
slice (don't mark it built). Continue the same wright to cover it, or record a blocker.
|
|
86
|
+
4. **Reconcile, then record.** First prove A1 held: write the wright's `Files changed` paths
|
|
87
|
+
(one per line) to `.devrites/work/<slug>/.reconcile-claimed` and run `reconcile.sh check`.
|
|
88
|
+
**Exit 5 → STOP** — a source file changed outside the wright's claimed set (A1 breach); revert
|
|
89
|
+
it and re-dispatch, don't mark the slice built. Then persist the wright's artifact to
|
|
90
|
+
`state.md`, `evidence.md`, `touched-files.md` (and `browser-evidence.md` for UI) per
|
|
91
|
+
[`evidence-standard.md`](evidence-standard.md). Evidence is the wright's real command output,
|
|
92
|
+
not its say-so. Then tick AFK if `.devrites/AFK` is present (`tick-afk.sh`; exit 3 → STOP).
|
|
93
|
+
|
|
94
|
+
## Fallback
|
|
95
|
+
If the `Task` tool / sub-agent dispatch is unavailable, `/rite-build` runs the wright's
|
|
96
|
+
discipline **inline** in its own context and flags it as a fallback (no clean-context benefit).
|
|
97
|
+
The slice still gets the full one-slice cycle — orient → RED → implement → verify — under the
|
|
98
|
+
same anti-slop charter; it just doesn't get the isolation. In this path the orchestrator is
|
|
99
|
+
legitimately the writer, so write `.devrites/work/<slug>/.reconcile-inline` before editing — the
|
|
100
|
+
reconcile gate (step 4) skips when that sentinel is present. Mirrors the reviewer-dispatch
|
|
101
|
+
fallback in
|
|
102
|
+
[`../../rite-seal/reference/parallel-dispatch.md`](../../rite-seal/reference/parallel-dispatch.md).
|
|
103
|
+
|
|
104
|
+
## Optional pre-block hook (defense in depth)
|
|
105
|
+
`reconcile.sh` is the **post-hoc** gate — it always runs and catches an A1 breach at record time.
|
|
106
|
+
A companion **pre-block** hook, `.claude/hooks/devrites-a1-guard.sh` (a `PreToolUse` matcher on
|
|
107
|
+
`Edit|Write|MultiEdit`), stops the breach *before* the write lands. It is armed only inside the
|
|
108
|
+
mid-build window (between `reconcile.sh snapshot` and a clean `check`, keyed on `.reconcile-base`),
|
|
109
|
+
allows the wright (subagent calls carry `agent_id`), the inline fallback (`.reconcile-inline`),
|
|
110
|
+
and any `.devrites/` write — so it never touches `/rite-polish`, `/rite-quick`, or ordinary
|
|
111
|
+
manual edits. It ships **observe-only** (logs would-be blocks to `.a1-guard.log`, never blocks);
|
|
112
|
+
flip to enforce with `DEVRITES_A1_HOOK=enforce` or a `.devrites/work/<slug>/.a1-enforce` file once
|
|
113
|
+
the log confirms it never flags the wright's own edits (older Claude Code builds may not populate
|
|
114
|
+
`agent_id` — the log is the proof before you enforce). The post-hoc gate stands on its own; the
|
|
115
|
+
hook is belt-and-suspenders.
|