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.
Files changed (232) hide show
  1. package/.claude-plugin/marketplace.json +24 -0
  2. package/.claude-plugin/plugin.json +43 -0
  3. package/CHANGELOG.md +391 -0
  4. package/LICENSE +56 -0
  5. package/NOTICE.md +18 -0
  6. package/README.md +582 -0
  7. package/SECURITY.md +193 -0
  8. package/bin/devrites.mjs +100 -0
  9. package/docs/architecture.md +272 -0
  10. package/docs/cli-mcp.md +57 -0
  11. package/docs/command-map.md +143 -0
  12. package/docs/flow.md +360 -0
  13. package/docs/release.md +29 -0
  14. package/docs/skills.md +214 -0
  15. package/docs/usage.md +325 -0
  16. package/install.sh +359 -0
  17. package/mcp/devrites-mcp.mjs +103 -0
  18. package/pack/.claude/agents/devrites-code-reviewer.md +50 -0
  19. package/pack/.claude/agents/devrites-doubt-reviewer.md +55 -0
  20. package/pack/.claude/agents/devrites-frontend-reviewer.md +52 -0
  21. package/pack/.claude/agents/devrites-performance-reviewer.md +47 -0
  22. package/pack/.claude/agents/devrites-plan-reviewer.md +79 -0
  23. package/pack/.claude/agents/devrites-security-auditor.md +53 -0
  24. package/pack/.claude/agents/devrites-simplifier-reviewer.md +75 -0
  25. package/pack/.claude/agents/devrites-slice-wright.md +181 -0
  26. package/pack/.claude/agents/devrites-spec-reviewer.md +72 -0
  27. package/pack/.claude/agents/devrites-strategy-reviewer.md +62 -0
  28. package/pack/.claude/agents/devrites-test-analyst.md +47 -0
  29. package/pack/.claude/hooks/devrites-a1-guard.sh +81 -0
  30. package/pack/.claude/hooks/devrites-allow.sh +44 -0
  31. package/pack/.claude/hooks/devrites-cursor.sh +28 -0
  32. package/pack/.claude/hooks/devrites-orient.sh +53 -0
  33. package/pack/.claude/hooks/devrites-redwatch.sh +39 -0
  34. package/pack/.claude/hooks/devrites-refresh-indexes.sh +127 -0
  35. package/pack/.claude/hooks/devrites-reviewer-readonly.sh +28 -0
  36. package/pack/.claude/hooks/devrites-statusline.sh +18 -0
  37. package/pack/.claude/hooks/devrites-stop-gate.sh +45 -0
  38. package/pack/.claude/hooks/devrites-wright-scope.sh +35 -0
  39. package/pack/.claude/hooks/hooks.json +52 -0
  40. package/pack/.claude/rules/README.md +48 -0
  41. package/pack/.claude/rules/afk-hitl.md +245 -0
  42. package/pack/.claude/rules/agents.md +98 -0
  43. package/pack/.claude/rules/anti-patterns.md +48 -0
  44. package/pack/.claude/rules/code-review.md +38 -0
  45. package/pack/.claude/rules/coding-style.md +55 -0
  46. package/pack/.claude/rules/context-hygiene.md +97 -0
  47. package/pack/.claude/rules/core.md +119 -0
  48. package/pack/.claude/rules/development-workflow.md +40 -0
  49. package/pack/.claude/rules/documentation.md +27 -0
  50. package/pack/.claude/rules/error-handling.md +33 -0
  51. package/pack/.claude/rules/git-workflow.md +35 -0
  52. package/pack/.claude/rules/hooks.md +38 -0
  53. package/pack/.claude/rules/patterns.md +45 -0
  54. package/pack/.claude/rules/performance.md +27 -0
  55. package/pack/.claude/rules/prose-style.md +101 -0
  56. package/pack/.claude/rules/security.md +63 -0
  57. package/pack/.claude/rules/testing.md +88 -0
  58. package/pack/.claude/rules/tooling.md +72 -0
  59. package/pack/.claude/settings.json +53 -0
  60. package/pack/.claude/skills/devrites-api-interface/SKILL.md +45 -0
  61. package/pack/.claude/skills/devrites-audit/SKILL.md +73 -0
  62. package/pack/.claude/skills/devrites-browser-proof/SKILL.md +38 -0
  63. package/pack/.claude/skills/devrites-debug-recovery/SKILL.md +50 -0
  64. package/pack/.claude/skills/devrites-debug-recovery/reference/build-the-loop.md +47 -0
  65. package/pack/.claude/skills/devrites-debug-recovery/reference/cleanup-and-classify.md +17 -0
  66. package/pack/.claude/skills/devrites-debug-recovery/reference/hypotheses.md +17 -0
  67. package/pack/.claude/skills/devrites-debug-recovery/reference/instrumentation.md +21 -0
  68. package/pack/.claude/skills/devrites-debug-recovery/reference/regression-test.md +31 -0
  69. package/pack/.claude/skills/devrites-doubt/SKILL.md +75 -0
  70. package/pack/.claude/skills/devrites-frontend-craft/SKILL.md +96 -0
  71. package/pack/.claude/skills/devrites-frontend-craft/reference/craft.md +59 -0
  72. package/pack/.claude/skills/devrites-frontend-craft/reference/design-references.md +116 -0
  73. package/pack/.claude/skills/devrites-frontend-craft/reference/fullstack.md +45 -0
  74. package/pack/.claude/skills/devrites-frontend-craft/reference/quality-standards.md +215 -0
  75. package/pack/.claude/skills/devrites-frontend-craft/reference/reuse-first.md +59 -0
  76. package/pack/.claude/skills/devrites-frontend-craft/reference/shape.md +60 -0
  77. package/pack/.claude/skills/devrites-interview/SKILL.md +81 -0
  78. package/pack/.claude/skills/devrites-lib/SKILL.md +76 -0
  79. package/pack/.claude/skills/devrites-lib/scripts/analyze.sh +78 -0
  80. package/pack/.claude/skills/devrites-lib/scripts/check-acceptance.sh +75 -0
  81. package/pack/.claude/skills/devrites-lib/scripts/close-out.sh +47 -0
  82. package/pack/.claude/skills/devrites-lib/scripts/conventions.py +273 -0
  83. package/pack/.claude/skills/devrites-lib/scripts/coverage.sh +51 -0
  84. package/pack/.claude/skills/devrites-lib/scripts/devrites.sh +69 -0
  85. package/pack/.claude/skills/devrites-lib/scripts/doctor.sh +92 -0
  86. package/pack/.claude/skills/devrites-lib/scripts/evidence-fresh.sh +63 -0
  87. package/pack/.claude/skills/devrites-lib/scripts/footprint.sh +45 -0
  88. package/pack/.claude/skills/devrites-lib/scripts/learnings.sh +74 -0
  89. package/pack/.claude/skills/devrites-lib/scripts/mutation-gate.sh +52 -0
  90. package/pack/.claude/skills/devrites-lib/scripts/package-existence.sh +68 -0
  91. package/pack/.claude/skills/devrites-lib/scripts/preamble.sh +76 -0
  92. package/pack/.claude/skills/devrites-lib/scripts/progress.sh +103 -0
  93. package/pack/.claude/skills/devrites-lib/scripts/readiness.sh +62 -0
  94. package/pack/.claude/skills/devrites-lib/scripts/reconcile.sh +123 -0
  95. package/pack/.claude/skills/devrites-lib/scripts/resolve.sh +279 -0
  96. package/pack/.claude/skills/devrites-lib/scripts/stuck.sh +67 -0
  97. package/pack/.claude/skills/devrites-lib/scripts/test-integrity.sh +87 -0
  98. package/pack/.claude/skills/devrites-lib/scripts/tick-afk.sh +52 -0
  99. package/pack/.claude/skills/devrites-prose-craft/SKILL.md +105 -0
  100. package/pack/.claude/skills/devrites-prose-craft/reference/banned-phrases.md +95 -0
  101. package/pack/.claude/skills/devrites-prose-craft/reference/examples.md +88 -0
  102. package/pack/.claude/skills/devrites-prose-craft/reference/structures.md +134 -0
  103. package/pack/.claude/skills/devrites-refresh-indexes/SKILL.md +54 -0
  104. package/pack/.claude/skills/devrites-source-driven/SKILL.md +36 -0
  105. package/pack/.claude/skills/devrites-ux-shape/SKILL.md +121 -0
  106. package/pack/.claude/skills/devrites-ux-shape/reference/brief-template.md +93 -0
  107. package/pack/.claude/skills/devrites-ux-shape/reference/visual-direction-probe.md +48 -0
  108. package/pack/.claude/skills/rite/SKILL.md +135 -0
  109. package/pack/.claude/skills/rite/reference/menu.md +32 -0
  110. package/pack/.claude/skills/rite-adopt/SKILL.md +83 -0
  111. package/pack/.claude/skills/rite-adopt/reference/adoption.md +58 -0
  112. package/pack/.claude/skills/rite-adopt/reference/anti-patterns.md +19 -0
  113. package/pack/.claude/skills/rite-autocomplete/SKILL.md +96 -0
  114. package/pack/.claude/skills/rite-autocomplete/reference/decision-policy.md +35 -0
  115. package/pack/.claude/skills/rite-autocomplete/reference/loop.md +54 -0
  116. package/pack/.claude/skills/rite-autocomplete/reference/stop-conditions.md +59 -0
  117. package/pack/.claude/skills/rite-build/SKILL.md +261 -0
  118. package/pack/.claude/skills/rite-build/reference/afk-discipline.md +145 -0
  119. package/pack/.claude/skills/rite-build/reference/anti-patterns.md +25 -0
  120. package/pack/.claude/skills/rite-build/reference/checkpoint-protocol.md +149 -0
  121. package/pack/.claude/skills/rite-build/reference/evidence-standard.md +32 -0
  122. package/pack/.claude/skills/rite-build/reference/frontend-trigger.md +39 -0
  123. package/pack/.claude/skills/rite-build/reference/one-slice-cycle.md +38 -0
  124. package/pack/.claude/skills/rite-build/reference/spec-drift-guard.md +43 -0
  125. package/pack/.claude/skills/rite-build/reference/tdd.md +26 -0
  126. package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +115 -0
  127. package/pack/.claude/skills/rite-define/SKILL.md +157 -0
  128. package/pack/.claude/skills/rite-define/reference/anti-patterns.md +25 -0
  129. package/pack/.claude/skills/rite-define/reference/gates.md +152 -0
  130. package/pack/.claude/skills/rite-define/reference/plan-template.md +65 -0
  131. package/pack/.claude/skills/rite-doctor/SKILL.md +50 -0
  132. package/pack/.claude/skills/rite-frame/SKILL.md +116 -0
  133. package/pack/.claude/skills/rite-frame/reference/failure-modes.md +68 -0
  134. package/pack/.claude/skills/rite-handoff/SKILL.md +95 -0
  135. package/pack/.claude/skills/rite-handoff/reference/handoff-template.md +34 -0
  136. package/pack/.claude/skills/rite-learn/SKILL.md +82 -0
  137. package/pack/.claude/skills/rite-plan/SKILL.md +82 -0
  138. package/pack/.claude/skills/rite-plan/reference/anti-patterns.md +24 -0
  139. package/pack/.claude/skills/rite-plan/reference/dependency-graph.md +33 -0
  140. package/pack/.claude/skills/rite-plan/reference/replan-and-repair.md +42 -0
  141. package/pack/.claude/skills/rite-plan/reference/slicing.md +52 -0
  142. package/pack/.claude/skills/rite-plan/reference/task-breakdown.md +34 -0
  143. package/pack/.claude/skills/rite-polish/SKILL.md +90 -0
  144. package/pack/.claude/skills/rite-polish/reference/anti-ai-slop.md +177 -0
  145. package/pack/.claude/skills/rite-polish/reference/anti-patterns.md +27 -0
  146. package/pack/.claude/skills/rite-polish/reference/backend-polish.md +80 -0
  147. package/pack/.claude/skills/rite-polish/reference/browser-polish-evidence.md +31 -0
  148. package/pack/.claude/skills/rite-polish/reference/code.md +85 -0
  149. package/pack/.claude/skills/rite-polish/reference/design-system-discovery.md +35 -0
  150. package/pack/.claude/skills/rite-polish/reference/harden-checklist.md +109 -0
  151. package/pack/.claude/skills/rite-polish/reference/ui.md +136 -0
  152. package/pack/.claude/skills/rite-pressure-test/SKILL.md +43 -0
  153. package/pack/.claude/skills/rite-prototype/SKILL.md +87 -0
  154. package/pack/.claude/skills/rite-prove/SKILL.md +120 -0
  155. package/pack/.claude/skills/rite-prove/reference/anti-patterns.md +25 -0
  156. package/pack/.claude/skills/rite-prove/reference/browser-proof.md +26 -0
  157. package/pack/.claude/skills/rite-prove/reference/failure-triage.md +25 -0
  158. package/pack/.claude/skills/rite-prove/reference/proof-ladder.md +26 -0
  159. package/pack/.claude/skills/rite-prove/reference/test-command-discovery.md +30 -0
  160. package/pack/.claude/skills/rite-quick/SKILL.md +81 -0
  161. package/pack/.claude/skills/rite-resolve/SKILL.md +113 -0
  162. package/pack/.claude/skills/rite-resolve/reference/answer-protocol.md +114 -0
  163. package/pack/.claude/skills/rite-review/SKILL.md +170 -0
  164. package/pack/.claude/skills/rite-review/reference/anti-patterns.md +32 -0
  165. package/pack/.claude/skills/rite-review/reference/cognitive-load.md +90 -0
  166. package/pack/.claude/skills/rite-review/reference/feature-scoped-review.md +26 -0
  167. package/pack/.claude/skills/rite-review/reference/five-axis-review.md +46 -0
  168. package/pack/.claude/skills/rite-review/reference/nielsen-heuristics.md +130 -0
  169. package/pack/.claude/skills/rite-review/reference/parallel-dispatch.md +62 -0
  170. package/pack/.claude/skills/rite-review/reference/performance-review.md +28 -0
  171. package/pack/.claude/skills/rite-review/reference/security-review.md +32 -0
  172. package/pack/.claude/skills/rite-seal/SKILL.md +183 -0
  173. package/pack/.claude/skills/rite-seal/reference/anti-patterns.md +27 -0
  174. package/pack/.claude/skills/rite-seal/reference/conventions-ledger.md +63 -0
  175. package/pack/.claude/skills/rite-seal/reference/final-evidence.md +72 -0
  176. package/pack/.claude/skills/rite-seal/reference/go-no-go.md +37 -0
  177. package/pack/.claude/skills/rite-seal/reference/parallel-dispatch.md +69 -0
  178. package/pack/.claude/skills/rite-seal/reference/risk-and-rollback.md +30 -0
  179. package/pack/.claude/skills/rite-seal/reference/seal-template.md +36 -0
  180. package/pack/.claude/skills/rite-ship/SKILL.md +120 -0
  181. package/pack/.claude/skills/rite-ship/reference/anti-patterns.md +25 -0
  182. package/pack/.claude/skills/rite-ship/reference/close-out.md +31 -0
  183. package/pack/.claude/skills/rite-ship/reference/design-memory.md +120 -0
  184. package/pack/.claude/skills/rite-ship/reference/git-ship.md +42 -0
  185. package/pack/.claude/skills/rite-ship/reference/ship-template.md +33 -0
  186. package/pack/.claude/skills/rite-spec/SKILL.md +126 -0
  187. package/pack/.claude/skills/rite-spec/reference/acceptance-criteria.md +31 -0
  188. package/pack/.claude/skills/rite-spec/reference/anti-patterns.md +25 -0
  189. package/pack/.claude/skills/rite-spec/reference/interview-patterns.md +56 -0
  190. package/pack/.claude/skills/rite-spec/reference/investigation.md +64 -0
  191. package/pack/.claude/skills/rite-spec/reference/question-protocol.md +61 -0
  192. package/pack/.claude/skills/rite-spec/reference/references-intake.md +57 -0
  193. package/pack/.claude/skills/rite-spec/reference/spec-checklists.md +73 -0
  194. package/pack/.claude/skills/rite-spec/reference/spec-template.md +124 -0
  195. package/pack/.claude/skills/rite-spec/reference/state-workspace.md +159 -0
  196. package/pack/.claude/skills/rite-status/SKILL.md +101 -0
  197. package/pack/.claude/skills/rite-temper/SKILL.md +119 -0
  198. package/pack/.claude/skills/rite-temper/reference/anti-patterns.md +29 -0
  199. package/pack/.claude/skills/rite-temper/reference/review-dimensions.md +65 -0
  200. package/pack/.claude/skills/rite-temper/reference/scope-modes.md +53 -0
  201. package/pack/.claude/skills/rite-temper/reference/significance.md +46 -0
  202. package/pack/.claude/skills/rite-temper/reference/strategy-template.md +90 -0
  203. package/pack/.claude/skills/rite-vet/SKILL.md +155 -0
  204. package/pack/.claude/skills/rite-vet/reference/anti-patterns.md +29 -0
  205. package/pack/.claude/skills/rite-vet/reference/artifacts.md +135 -0
  206. package/pack/.claude/skills/rite-vet/reference/cross-model.md +41 -0
  207. package/pack/.claude/skills/rite-vet/reference/depth.md +53 -0
  208. package/pack/.claude/skills/rite-vet/reference/eng-lenses.md +48 -0
  209. package/pack/.claude/skills/rite-vet/reference/review-axes.md +167 -0
  210. package/pack/.claude/skills/rite-zoom-out/SKILL.md +75 -0
  211. package/package.json +68 -0
  212. package/scripts/build-release-tarball.sh +74 -0
  213. package/scripts/check-cross-refs.py +121 -0
  214. package/scripts/check-no-global-writes.sh +44 -0
  215. package/scripts/check-rule-uniqueness.sh +73 -0
  216. package/scripts/devrites-detect.sh +175 -0
  217. package/scripts/eval-runner.py +273 -0
  218. package/scripts/grade-feature.sh +104 -0
  219. package/scripts/install-lib.sh +83 -0
  220. package/scripts/pin.sh +166 -0
  221. package/scripts/render-eval-summary.py +48 -0
  222. package/scripts/run-evals.sh +149 -0
  223. package/scripts/run-outcome-evals.sh +49 -0
  224. package/scripts/scan-pack-security.py +209 -0
  225. package/scripts/scan-supply-chain-iocs.py +127 -0
  226. package/scripts/supply-chain-iocs.json +11 -0
  227. package/scripts/sync-version.sh +56 -0
  228. package/scripts/validate-frontmatter.py +149 -0
  229. package/scripts/validate-workflow-security.py +86 -0
  230. package/scripts/validate.sh +234 -0
  231. package/uninstall.sh +137 -0
  232. package/update.sh +196 -0
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: rite-handoff
3
+ description: Compact the current chat into a handoff doc a fresh agent can pick up cold — syncs chat-only context into the canonical `.devrites/` files, references artifacts by path. Use when the user says "handoff", "prep for tomorrow", "I'm leaving for a while", "summarize for the next agent". Not for routine `/clear` between phases.
4
+ user-invocable: true
5
+ argument-hint: "[what the next session will focus on]"
6
+ ---
7
+
8
+ # /rite-handoff — chat-only context, into a fresh-agent doc
9
+
10
+ DevRites' workspace `.devrites/work/<slug>/` already captures everything that *should*
11
+ persist (spec, plan, tasks, decisions, evidence, drift, review). This skill captures
12
+ what the **chat** is holding that is **not** in the workspace, so a fresh agent — or
13
+ the same user after `/clear` — can pick the work up without re-reading the transcript.
14
+
15
+ Read `.claude/rules/core.md` first — its "Persistence before stopping" discipline is
16
+ exactly what this skill executes. The other rule files load on demand.
17
+
18
+ Then **run the shared orientation preamble** — it prints `state.md`, the artifacts present,
19
+ the run mode (HITL/AFK), and the open-question tally by gate, so you orient deterministically
20
+ instead of re-deriving state from raw Markdown:
21
+ ```bash
22
+ P=.claude/skills/devrites-lib/scripts/preamble.sh
23
+ [ -f "$P" ] || P="${CLAUDE_SKILL_DIR:-}/../devrites-lib/scripts/preamble.sh"
24
+ [ -f "$P" ] || P=pack/.claude/skills/devrites-lib/scripts/preamble.sh
25
+ [ -f "$P" ] && bash "$P" || echo "(orientation preamble unavailable on this install — read state.md directly to orient)"
26
+ ```
27
+
28
+ ## Where to write
29
+
30
+ - **Active feature exists** → `.devrites/work/<slug>/handoff.md` (overwrites the previous
31
+ handoff; the workspace is the canonical home for this slug).
32
+ - **No active feature** → OS temp dir (`$TMPDIR` / `/tmp` / `%TEMP%`) as
33
+ `rite-handoff-<ISO-timestamp>.md`. Print the absolute path after writing.
34
+
35
+ ## Before you write — sync, don't duplicate
36
+
37
+ For each of these, write the content into its **canonical home** first, then merely
38
+ *note* in the handoff that the sync happened:
39
+
40
+ - **Open mid-flight question** → append to `questions.md` (with best-guess attached if
41
+ possible).
42
+ - **Decision discussed but not yet recorded** → append to `decisions.md` with the *why*,
43
+ not just the *what*.
44
+ - **Assumption** about behaviour / API / user intent → append to `assumptions.md`.
45
+ - **Drift event raised but not fully resolved** → update `drift.md` with the current
46
+ resolution status (open / asked-user / repaired).
47
+ - **Files modified in chat not yet in `touched-files.md`** → append to
48
+ `touched-files.md`.
49
+
50
+ The handoff doc itself then says "synced N entries into decisions.md", not the entries
51
+ themselves. The workspace is the canonical store; the handoff is the chat-only delta.
52
+
53
+ ## What to include in the handoff
54
+
55
+ 1. **Suggested next action.** ONE command, not three options. If the active feature is
56
+ mid-phase, name the next `rite-*` command. If a question blocks progress, point at
57
+ it. If the user passed `[what the next session will focus on]`, tailor this section
58
+ to the named focus. Where you were mid-thought, **quote the most recent next-step
59
+ verbatim** from the chat (the exact sentence describing what to do next) so no nuance
60
+ is lost to paraphrase.
61
+ 2. **What just happened in this chat** (3–5 bullets). Distil — do not transcribe.
62
+ 3. **External references** that exist only in chat: URLs, Figma links, screenshot paths,
63
+ video timestamps the user pasted. List as references; do not embed.
64
+ 4. **Live assumptions the agent is acting on** that the workspace doesn't reflect yet
65
+ (after the sync above, this section should be near-empty — flag anything that
66
+ remains).
67
+ 5. **How to resume** — fixed boilerplate (see template below).
68
+
69
+ ## What NOT to include
70
+
71
+ - Anything already in `spec.md`, `plan.md`, `tasks.md`, `state.md`, `decisions.md`,
72
+ `evidence.md`, `review.md` — link by path instead.
73
+ - `git diff` output — the next agent runs `git diff` themselves.
74
+ - The full conversation transcript — distil.
75
+ - Secrets (API keys, tokens, PII, credentials). Redact aggressively.
76
+ - **New ideas the user didn't confirm.** A handoff records what *happened* and what's *next* —
77
+ not fresh suggestions, scope the user didn't agree to, or a redesign you thought of. Capture the
78
+ state, not your opinions about it.
79
+
80
+ ## Output template
81
+
82
+ Loaded on demand from [`reference/handoff-template.md`](reference/handoff-template.md).
83
+ Fill in each section + write to `.devrites/work/<slug>/handoff.md` (or to a temp file
84
+ when no active feature).
85
+
86
+ After writing, **print the absolute path** of the handoff file so the user (or the next
87
+ agent) can open it without searching.
88
+
89
+ ## Session hygiene
90
+ Close with the one-line hygiene advisory + the single resume command — this skill *is* the
91
+ pre-`/clear` bridge, so it's where the advisory matters most (`context-hygiene.md`):
92
+ ```
93
+ ↻ Hygiene: /clear — handoff written; all chat-only context is now on disk, safe to /clear
94
+ or close the session. Resume next session with: <the single next command from state.md>
95
+ ```
@@ -0,0 +1,34 @@
1
+ # Handoff doc template
2
+
3
+ Loaded on demand by `/rite-handoff`. Write the filled-in template to
4
+ `.devrites/work/<slug>/handoff.md` (or to a `$TMPDIR` file when no active feature).
5
+
6
+ ```
7
+ # Handoff — <feature slug | "no active feature"> — <ISO date>
8
+
9
+ ## Suggested next action
10
+ <one command, no options>
11
+
12
+ ## What just happened (this chat)
13
+ - ...
14
+ - ...
15
+
16
+ ## External references (chat-only)
17
+ - <URL / Figma / screenshot path / video timestamp>
18
+
19
+ ## Live assumptions (not yet in assumptions.md)
20
+ - ... (this section should be near-empty after the sync step)
21
+
22
+ ## Synced this turn
23
+ - decisions.md: <N entries appended>
24
+ - questions.md: <N appended>
25
+ - assumptions.md: <N appended>
26
+ - drift.md: <updated? yes/no>
27
+ - touched-files.md: <N appended>
28
+
29
+ ## How to resume
30
+ 1. Read this file.
31
+ 2. Read `.devrites/work/<slug>/state.md` for the workspace cursor.
32
+ 3. Run `/rite-status` for the current phase / next action / open drift.
33
+ 4. Continue with the suggested next action above.
34
+ ```
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: rite-learn
3
+ description: Review the auto-captured learning ledger and promote recurring lessons to project rules — the human-gated half of the cross-feature learning loop. Capture is automatic (`/rite-seal` appends dismissed-finding classes + dead-ends to `.devrites/learnings.md` on every GO; the review skills load it before a fan-out), so the system learns without a command; this skill mines that ledger across features and decides which recurring lessons graduate into a rule (propose, don't impose). Use when the user says "what have we learned", "rite learn", "harvest lessons", "promote our learnings", or after several features ship. Not for the install (`/rite-doctor`), feature status (`/rite-status`), onboarding (`/rite-adopt`), or a diff review (`/rite-review`).
4
+ argument-hint: "[--mine | \"<lesson to record>\"]"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # /rite-learn — the cross-feature learning loop
10
+
11
+ Recurring corrections, dismissed review findings, and dead-ends are durable signal. **Capture is
12
+ automatic** — `/rite-seal` appends them to `.devrites/learnings.md` on every GO (step 9a), and the
13
+ review skills load that ledger **before** a fan-out, so a dismissed-finding class stops being
14
+ re-flagged without anyone running a command. The system learns as it ships.
15
+
16
+ `/rite-learn` is the periodic **review + promote** pass on that auto-populated ledger: cluster the
17
+ signal across features and decide which recurring lessons graduate into a project rule. **Propose,
18
+ never impose** — promotion is the human's call, which is why it stays a deliberate command rather
19
+ than firing on its own.
20
+
21
+ Read-mostly. It reads the auto-populated ledger + the archive; it writes only `.devrites/learnings.md`
22
+ (consolidation, via `learnings.sh`) and drafts proposed rule/ledger edits for the user to confirm —
23
+ it never edits source or rule files on its own.
24
+
25
+ ## Modes
26
+
27
+ - `/rite-learn` or `/rite-learn --mine` — **mine + propose** (the default).
28
+ - `/rite-learn "<lesson>"` — **record one lesson** directly to the ledger and stop.
29
+
30
+ ## Workflow (mine + propose)
31
+
32
+ 1. **Gather the signal.** Start from the **auto-populated ledger** `.devrites/learnings.md` (seal
33
+ appends to it on every GO — step 9a), then run `learnings.sh mine` over the archive (resolve via
34
+ the standard 3-path snippet; it clusters repeated finding / decision / drift phrases across shipped
35
+ features) to surface cross-feature patterns the per-feature entries don't show on their own:
36
+ ```bash
37
+ L=.claude/skills/devrites-lib/scripts/learnings.sh
38
+ [ -f "$L" ] || L="${CLAUDE_SKILL_DIR:-}/../devrites-lib/scripts/learnings.sh"
39
+ [ -f "$L" ] || L=pack/.claude/skills/devrites-lib/scripts/learnings.sh
40
+ [ -f "$L" ] && bash "$L" mine || echo "(learnings.sh unavailable — scan .devrites/archive/*/{decisions,drift,review}.md by hand)"
41
+ ```
42
+ 2. **Cluster + name.** Group the recurring corrections into candidate lessons. A candidate needs
43
+ **≥2 occurrences across distinct features** — one-offs are noise, not a pattern. Name the
44
+ pattern in one specific sentence (the specificity rule from `prose-style.md` applies: a lesson
45
+ you could swap onto any project says nothing).
46
+ 3. **Classify each candidate** into its durable home:
47
+ - **project rule** — a craft/standard that belongs in a `.claude/rules/*` file or `CLAUDE.md`.
48
+ - **conventions-ledger entry** — a proven project idiom for `.devrites/conventions.md`.
49
+ - **dismissed-finding class** — a pattern reviewers keep flagging that is *intentional here*;
50
+ recording it stops the recurring false positive (`learnings.md`, loaded pre-fan-out).
51
+ - **drop** — not durable; let it go.
52
+ 4. **Propose, don't impose.** Present the candidates with their evidence (which features, how many
53
+ times, the proposed home) via `AskUserQuestion` — the human picks which to promote. Never
54
+ promote a lesson to a rule silently; an unproven "lesson" hardened into a rule is its own slop.
55
+ 5. **Record the accepted.** For each the user accepts, append it with `learnings.sh add <slug>
56
+ "<lesson>" <tag>` (`tag` ∈ `rule | convention | dismiss`). If the user approves a **rule** or
57
+ **ledger** promotion, draft the exact edit and let the user confirm it through the normal flow
58
+ — `/rite-learn` writes the ledger, not the rule files. Then `touch .devrites/.learnings-reviewed`
59
+ so the SessionStart learnings nudge snoozes until new signal accumulates.
60
+
61
+ ## How the ledger is used
62
+
63
+ The review skills (`/rite-review`, `/rite-seal`) read `.devrites/learnings.md` before they fan
64
+ out: a **dismissed-finding class** suppresses the recurring false positive; a **proven
65
+ convention** raises the bar. The ledger is an **untrusted prior** — a fresh observation of the
66
+ live code always overrides a ledger entry (see `.claude/rules/security.md`). Confidence in a
67
+ recorded lesson never raises its authority.
68
+
69
+ ## Gotchas
70
+ - Evidence first: a lesson without ≥2 real occurrences is speculation. Cite the features.
71
+ - Don't pad the ledger. Five real lessons that change behaviour beat thirty rubber-stamped rows.
72
+ - The ledger records *what was learned*; it does not re-open shipped features or edit their archives.
73
+
74
+ ## Output
75
+ ```
76
+ Mined: <n> features · <n> recurring patterns
77
+ Candidates: <n> (rule: a · convention: b · dismiss: c · dropped: d)
78
+ Promoted: <n> → .devrites/learnings.md (+ <n> rule/ledger edits drafted for your confirm)
79
+
80
+ Session hygiene: /clear (recommended) — the ledger is on disk; the proposals are listed above.
81
+ Resume next session with: <the single next command, e.g. the drafted rule edit, or /rite-status>
82
+ ```
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: rite-plan
3
+ description: Reshape an active plan — decompose / reslice / repair / reorder / split FE-BE / unblock / course-correct — without changing product behavior unless asked. Use when the user says "replan", "reslice", "repair the plan", "drift", "unblock", "change of plan", "we're pivoting", or `/rite-build` flags Spec Drift. Not for the initial plan (use `/rite-define`).
4
+ argument-hint: "[mode: decompose|reslice|repair|reorder|split|unblock|course-correct]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # /rite-plan — (re)plan an active feature
9
+
10
+ Reshape the plan when reality and the plan disagree. **Read the active workspace
11
+ first.** If `.devrites/ACTIVE` is empty or its workspace is missing, stop and tell the
12
+ user to run `/rite-spec <feature>`.
13
+
14
+ ## Rules consulted (read on demand from `.claude/rules/`)
15
+ Read `.claude/rules/core.md` first. Pull `development-workflow.md` via `Read` when
16
+ reshaping slice cadence or DoD criteria.
17
+
18
+ ## Operating rules
19
+ - Spec is living, not sacred — but never plan around a known-wrong assumption silently.
20
+ - If a change alters product behavior, scope, architecture, data model, UX, security,
21
+ or migration risk → **ask the user first** (use the Spec Drift Guard question format).
22
+ - Keep each slice small enough for one focused build → prove cycle.
23
+ - **Slice count is derived, never dictated** — reslice when a slice fails the sizing rule
24
+ (multiple "and"s, can't build+prove in one cycle), not to hit a user-named tally. A
25
+ requested count is a hint at most; slice logically and explain if it differs. See
26
+ [`reference/slicing.md`](reference/slicing.md) ("How many slices?").
27
+ - **Size by complexity, order by dependency.** A slice carries a `Complexity: N/5` score (from
28
+ `/rite-define`); a slice scoring **>3** is a reslice trigger unless its inline reason justifies
29
+ the irreducible complexity. Honor each slice's `depends_on:` — the next *buildable* slice is the
30
+ lowest pending one whose dependencies are all built (keeps one-slice-at-a-time correct, not parallel).
31
+
32
+ ## Workflow
33
+ 0. Read `.claude/rules/core.md` (operating rules) before reshaping anything.
34
+ Then **run the shared orientation preamble** — it prints `state.md`, the artifacts present,
35
+ the run mode (HITL/AFK), and the open-question tally by gate, so you orient deterministically
36
+ instead of re-deriving state from raw Markdown:
37
+ ```bash
38
+ P=.claude/skills/devrites-lib/scripts/preamble.sh
39
+ [ -f "$P" ] || P="${CLAUDE_SKILL_DIR:-}/../devrites-lib/scripts/preamble.sh"
40
+ [ -f "$P" ] || P=pack/.claude/skills/devrites-lib/scripts/preamble.sh
41
+ [ -f "$P" ] && bash "$P" || echo "(orientation preamble unavailable on this install — read state.md directly to orient)"
42
+ ```
43
+ 1. Read `spec.md`, `plan.md`, `tasks.md`, `state.md`, `drift.md`, and the current
44
+ `git diff` (if a repo). Read `decisions.md` and `assumptions.md`. If a code-intelligence
45
+ index is available — `codebase-memory-mcp` first, cross-checked with `codegraph`
46
+ (`.codegraph/` / `codegraph_*` tools) + `graphify` (`graphify-out/`), else standard methods
47
+ (LSP / `Read`/`Grep`/`Glob`); see `.claude/rules/tooling.md` —
48
+ prefer it for structural questions (what calls X, what would
49
+ changing Y break) over reading whole files, to keep planning context lean. For an external
50
+ dependency's current API surface, consult context7 if available.
51
+ 2. **Pick the mode** (`$ARGUMENTS` or infer):
52
+ - **decompose** — first/again break the feature into vertical slices.
53
+ - **reslice** — a slice is too large; split into thinner end-to-end slices.
54
+ - **repair** — a Spec Drift Guard event; fold the resolution into plan + tasks.
55
+ - **reorder** — fix the dependency order.
56
+ - **split** — separate backend/frontend contracts (see `devrites-api-interface`).
57
+ - **unblock** — a verification failed; re-route around the blocker.
58
+ - **course-correct** — a deliberate mid-build *pivot* (the user changed their mind), distinct
59
+ from accidental drift: classify the change, assess its impact across the remaining slices,
60
+ decide rollback vs forward-fix, and update `spec.md` + `plan.md` + `tasks.md` + `decisions.md`
61
+ atomically. An acceptance/behavior change still goes through the user first.
62
+ See [replan-and-repair](reference/replan-and-repair.md) for each mode's steps.
63
+ 3. Reason about dependencies — [dependency-graph](reference/dependency-graph.md).
64
+ 4. Re-slice using vertical-slice rules — [slicing](reference/slicing.md) and
65
+ [task-breakdown](reference/task-breakdown.md). Prefer thin, shippable, verifiable.
66
+ 5. Update `plan.md`, `tasks.md`, `state.md`, and append rationale to `decisions.md`.
67
+ If you stopped for drift, mark the `drift.md` entry resolved.
68
+ 6. If product behavior/acceptance criteria change, confirm with the user before writing.
69
+
70
+ > **Mid-flight discipline.** When tempted to change product behavior without asking, absorb drift silently, or skip the user — see [`anti-patterns`](reference/anti-patterns.md). Load it the moment you reach for the excuse.
71
+
72
+ ## Output
73
+
74
+ **Footer first** — render the slice meter + flow ribbon by running the progress footer (`progress.sh`, resolved like the step-0 preamble — canonical snippet in `devrites-lib/SKILL.md`); keep the fact lines below it terse (`key value · key value`). Then:
75
+ ```
76
+ Re-planned <slug> — mode: <mode>
77
+ Changes: <what moved/split/repaired>
78
+ Slices now: N (next: slice <N — name>)
79
+ Behavior change? <no | asked + answer>
80
+ Next: /rite-build (or /rite-prove if a built slice needs re-verification)
81
+ ↻ Hygiene: /clear if reshape was big or unwound a drift; keep session for small reorders. See rules/context-hygiene.md.
82
+ ```
@@ -0,0 +1,24 @@
1
+ # rite-plan — anti-patterns
2
+
3
+ Load this when standing a non-trivial re-plan decision, or when the agent
4
+ feels reluctance toward asking the user before a behavior change.
5
+
6
+ Pack-wide rationalizations + red flags: see [rules/anti-patterns.md](../../../rules/anti-patterns.md).
7
+
8
+ ## Phase-specific rationalizations
9
+
10
+ | Excuse | Rebuttal |
11
+ |---|---|
12
+ | "User didn't ask for a re-plan." | A Spec Drift Guard event *is* a re-plan trigger — ask is courtesy, the route is automatic. |
13
+ | "I can fix the slice mid-build, no need to update tasks." | `tasks.md` is the contract `/rite-build` reads. A fix that isn't there isn't visible to the next phase. |
14
+ | "Reordering slices is cosmetic." | Dependency order controls risk discovery; risk-first wins because it surfaces blockers early. |
15
+ | "This drift is small enough to absorb silently." | Silent drift = unrecorded decision = future "why does this work?" debugging session. |
16
+ | "I can change product behavior to make the plan fit." | Behavior change always asks the user first, no exceptions. |
17
+
18
+ ## Red Flags
19
+
20
+ - About to change product behavior, acceptance, or scope without asking the user.
21
+ - `drift.md` entry unresolved while planning the next slice.
22
+ - A "mode" invented that isn't one of `decompose / reslice / repair / reorder / split / unblock`.
23
+ - Slices reordered without updating dependency notes — order changed, rationale didn't.
24
+ - Repairing a drift event by silently widening the spec rather than narrowing the plan.
@@ -0,0 +1,33 @@
1
+ # Dependency graph
2
+
3
+ Order slices by what must exist before what. Keep it in `plan.md` as plain text.
4
+
5
+ ## Build the graph
6
+ 1. For each slice, list its hard prerequisites (a model it queries, an endpoint it
7
+ calls, a component it composes).
8
+ 2. Draw edges prerequisite → dependent.
9
+ 3. Topologically sort. Independent slices can be built in any order (or noted as
10
+ parallelizable for the user).
11
+
12
+ ```
13
+ Slice 1 (schema) ──► Slice 2 (write API) ──► Slice 3 (UI form)
14
+ └─► Slice 4 (read API) ──► Slice 5 (UI list)
15
+ Slice 6 (config) ── independent ──
16
+ ```
17
+
18
+ ## Within a tier: risk-first
19
+ Among slices that are equally unblocked, do the **riskiest** first — the one most
20
+ likely to invalidate the plan (new integration, uncertain library behavior, migration).
21
+ Finding drift early is cheap; finding it at seal time is not.
22
+
23
+ ## Smells
24
+ - A slice with many prerequisites → probably too big; reslice for a thinner cut that
25
+ stands alone.
26
+ - A cycle (A needs B needs A) → the boundary is wrong; split the contract
27
+ (`devrites-api-interface`) so one side can land with a stub.
28
+ - Everything depends on slice 1 → slice 1 is doing too much.
29
+
30
+ ## Cross-boundary edges
31
+ Mark edges that cross a frontend/backend or service boundary. Those slices should
32
+ define the contract first (so both sides can proceed) and trigger `devrites-doubt`
33
+ before standing the interface.
@@ -0,0 +1,42 @@
1
+ # Re-plan & repair modes
2
+
3
+ `/rite-plan` runs in one of these modes. Pick from `$ARGUMENTS` or infer from state.
4
+
5
+ ## decompose
6
+ First (or fresh) breakdown into vertical slices. Use `task-breakdown.md` +
7
+ `slicing.md`. Output: a populated `tasks.md` and an ordered `plan.md` graph.
8
+
9
+ ## reslice
10
+ A slice proved too large (couldn't build+prove in one cycle, or its goal has multiple
11
+ "and"s). Split into thinner end-to-end slices, preserving acceptance coverage — split
12
+ **by the sizing rule, not to a target count**. Update `tasks.md`; renumber; fix
13
+ dependency edges.
14
+
15
+ ## repair (after Spec Drift Guard)
16
+ A drift event stopped the build. Steps:
17
+ 1. Read the `drift.md` entry and its classification.
18
+ 2. If the user answered a drift question, encode that decision in `decisions.md`.
19
+ 3. Update `spec.md` (only the affected sections) and `plan.md`/`tasks.md` to match
20
+ reality. Adjust acceptance criteria if they were wrong.
21
+ 4. Mark the `drift.md` entry **resolved** with the resolution + date.
22
+ 5. Resume at the corrected slice.
23
+ Never repair by quietly deleting the inconvenient requirement — if behavior changes,
24
+ that was a user question.
25
+
26
+ ## reorder
27
+ Dependency order is wrong or suboptimal. Recompute the graph (`dependency-graph.md`),
28
+ re-sort risk-first within tiers, update `plan.md`'s implementation order.
29
+
30
+ ## split (backend/frontend contract)
31
+ A slice couples two sides too tightly. Define the contract first (shape, status codes,
32
+ errors — `devrites-api-interface`), then split into a backend slice (can land with a
33
+ stub consumer) and a frontend slice (can land against a mock/real contract).
34
+
35
+ ## unblock
36
+ A `/rite-prove` failure can't be fixed inside the current slice. Capture the blocker in
37
+ `state.md`, decide: route around it (reorder), shrink the slice (reslice), or escalate
38
+ to the user (if it changes scope). Don't loop on the same failing approach.
39
+
40
+ ## Always
41
+ Update `state.md` (phase, next step) and append a dated line to `decisions.md`
42
+ explaining *why* the plan changed. Ask the user before any product-behavior change.
@@ -0,0 +1,52 @@
1
+ # Slicing
2
+
3
+ DevRites builds in **thin vertical slices**: each slice cuts through every layer it
4
+ needs (data → logic → API → UI) and leaves the system in a working, testable state.
5
+
6
+ ## Vertical, not horizontal
7
+ Horizontal ("build all models, then all controllers, then all views") delays working
8
+ software and hides integration risk until the end. Vertical delivers a usable path each
9
+ slice:
10
+ ```
11
+ Slice 1: Create a task (DB + API + minimal UI) → user can create + test passes
12
+ Slice 2: List tasks (query + API + UI) → user can see them
13
+ Slice 3: Edit a task (update + API + UI) → user can modify
14
+ Slice 4: Delete a task (delete + API + UI + confirm) → full CRUD
15
+ ```
16
+
17
+ ## Sizing a slice
18
+ A slice is the right size when it:
19
+ - delivers one observable capability end-to-end;
20
+ - can be built and proven in a single `/rite-build` → `/rite-prove` cycle;
21
+ - has acceptance criteria you can verify with evidence;
22
+ - can be rolled back on its own.
23
+
24
+ Too big if: it touches many unrelated files, has multiple "and"s in its goal, or you
25
+ can't name its single observable outcome. → reslice.
26
+
27
+ ## How many slices? — derive, don't dictate
28
+ The slice **count is an output, not an input.** It falls out of the work: one slice per
29
+ independently-shippable vertical increment that satisfies one (or a tight group of)
30
+ acceptance criteria and passes the sizing test above. A 2-criterion feature is 1–2 slices;
31
+ a 12-criterion feature is however many thin end-to-end cuts those 12 need.
32
+
33
+ - **Never slice to a target number.** Don't pad a small feature into "5 slices" or
34
+ compress a large one into "3" because a figure was named.
35
+ - **A user-supplied count is a hint at most.** If the user says "do it in 4", slice the
36
+ work logically first; if your honest decomposition differs, present the logical count
37
+ and *why*, then let them redirect — don't silently force their number.
38
+ - **Re-size by the rule, not the tally** (`/rite-plan reslice`): split a slice because it
39
+ failed the sizing test, not to hit a count.
40
+
41
+ Not to be confused with `.devrites/AFK` `max_slices` — that's an AFK *iteration budget*
42
+ capping how many slices the unattended loop builds before it stops, **not** the plan's
43
+ decomposition. The plan always holds exactly the slices the work needs; `max_slices` only
44
+ limits how many run unattended.
45
+
46
+ ## First slice
47
+ Make slice 1 the **thinnest useful end-to-end path** — it flushes out integration and
48
+ convention surprises early, while changes are cheap.
49
+
50
+ ## Slice independence
51
+ Order by dependency, but minimize coupling. A slice that needs three other slices first
52
+ is a smell — look for a thinner cut that stands alone.
@@ -0,0 +1,34 @@
1
+ # Task breakdown
2
+
3
+ How to turn a spec into ordered, vertical slices in `tasks.md`.
4
+
5
+ ## Each slice is one task, in this format
6
+ ```markdown
7
+ ## Slice N: <name>
8
+ Goal: # single observable capability
9
+ Acceptance criteria: # binary, evidence-backed (see ../../rite-spec/reference/acceptance-criteria.md)
10
+ Files likely touched: # real paths from codebase inspection
11
+ Tests to write/run: # the command(s) that prove it
12
+ Browser proof required: # yes/no (yes if UI — see ../../rite-build/reference/frontend-trigger.md)
13
+ Frontend craft required: # yes/no
14
+ Dependencies: # slice numbers that must land first
15
+ Rollback notes: # how to back this slice out
16
+ Evidence required: # what /rite-prove must capture
17
+ ```
18
+
19
+ ## Process
20
+ 1. List the capabilities the spec promises.
21
+ 2. Map each to a vertical slice (thinnest end-to-end cut).
22
+ 3. Order by dependency; risk-first within a tier (do the scary slice early while it's
23
+ cheap to change).
24
+ 4. Mark which slices touch UI (→ frontend craft + browser proof) and which cross a
25
+ module/service boundary (→ `devrites-api-interface`, `devrites-doubt`).
26
+ 5. Sanity check: every acceptance criterion in `spec.md` maps to ≥1 slice; no slice has
27
+ an unowned criterion.
28
+
29
+ ## Keep it honest
30
+ - Don't pre-write code in the task — describe the outcome, not the implementation.
31
+ - Don't bundle "while we're here" work into a slice. That's scope creep; log it as a
32
+ follow-up instead.
33
+ - Don't slice to a target number — the count comes from the capabilities + the sizing
34
+ rule (`slicing.md`), not a figure anyone named.
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: rite-polish
3
+ description: Polish the active feature before review — code polish always; UI normalize + ship-quality pass when UI is touched. Use when the user says "polish this", "finish before review", "ship-quality", "normalize the UI", "bolder", "quieter", "distill", "harden". Not for repo-wide refactors or pre-`/rite-prove` polish.
4
+ argument-hint: "[target | bolder | quieter | distill | harden | normalize-only]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # /rite-polish — finish before review
9
+
10
+ The "finish" phase. **Always** code-polishes; **and** runs UI normalize +
11
+ design polish when the feature touches UI. Self-review the work to ship
12
+ quality *before* handing it to `/rite-review`. The two-phase split (code,
13
+ UI) lives in `reference/code.md` and `reference/ui.md` — read each on demand,
14
+ don't load both up front.
15
+
16
+ ## Operating rules
17
+
18
+ - **Functionality complete first.** Polish runs after `/rite-prove` (full
19
+ feature proven).
20
+ - Feature scope only.
21
+ - For UI: **NEVER polish without normalizing first** — decoration on drift is
22
+ banned.
23
+
24
+ ## Orchestration
25
+
26
+ 0. **Read** `.claude/rules/core.md` first (the always-on operating rules). The
27
+ per-phase rule files (`coding-style.md`, `error-handling.md`, …) load on demand
28
+ from `reference/code.md` / `reference/ui.md` when their phase runs.
29
+ Then **run the shared orientation preamble** — it prints `state.md`, the artifacts present,
30
+ the run mode (HITL/AFK), and the open-question tally by gate, so you orient deterministically
31
+ instead of re-deriving state from raw Markdown:
32
+ ```bash
33
+ P=.claude/skills/devrites-lib/scripts/preamble.sh
34
+ [ -f "$P" ] || P="${CLAUDE_SKILL_DIR:-}/../devrites-lib/scripts/preamble.sh"
35
+ [ -f "$P" ] || P=pack/.claude/skills/devrites-lib/scripts/preamble.sh
36
+ [ -f "$P" ] && bash "$P" || echo "(orientation preamble unavailable on this install — read state.md directly to orient)"
37
+ ```
38
+ 1. **Read** `state.md`, `touched-files.md`, and the `git diff` for the active
39
+ workspace (or `$ARGUMENTS` if a target was given).
40
+ 2. **Detect UI scope** — UI is touched if the diff or `touched-files.md`
41
+ contains any of: `.tsx`, `.jsx`, `.vue`, `.svelte`, `.html`, `.css`,
42
+ `.scss`, `.sass`, `.less`, `.styl`, component dirs (`components/`,
43
+ `pages/`, `routes/`, `app/`, `views/`, `screens/`), Storybook stories,
44
+ or design-token files. When in doubt, look for visual changes that need
45
+ verification.
46
+ 3. **Always** read [`reference/code.md`](reference/code.md) and run **Phase 1
47
+ (code polish)**; if backend was touched, continue into **Phase 2 (backend
48
+ polish)** from the same file.
49
+ 4. **If UI scope detected** read [`reference/ui.md`](reference/ui.md), and read
50
+ `design-brief.md` if present (the UX/UI contract `devrites-ux-shape` shaped at spec and
51
+ `devrites-frontend-craft` refined while building) so the polish honors the agreed
52
+ direction + states. Then run
53
+ **Phase 3 (normalize)** → **Phase 4 (UI polish)**. Honor argument modes:
54
+ - `bolder | quieter | distill | harden` — passed to Phase 4 as the
55
+ emphasis dial.
56
+ - `normalize-only` — run Phase 3 and stop (no Phase 4).
57
+ 5. **Re-verify after any code edit** — polish edits code, so the proof from
58
+ `/rite-prove` no longer post-dates it. Run the relevant fast checks (the
59
+ targeted tests for the touched files + typecheck/lint; browser re-check if UI
60
+ changed) and record a **`Re-verification:`** line in `polish-report.md`. A
61
+ polish that changed code without a green re-verification isn't finished.
62
+ 6. **Aggregate output** — both phases append to the single `polish-report.md`.
63
+
64
+ ## Refinement modes
65
+
66
+ When the user (or your own assessment) names a direction the UI should move,
67
+ pass it through to Phase 4. Modes don't bypass normalize + quality-bar work —
68
+ they shape the polish *after* the system is aligned. See `reference/ui.md` for
69
+ the mode table.
70
+
71
+ > **Mid-flight discipline.** When tempted to polish UI without normalize, cite
72
+ > clean lint as proof of quality, skip Phase 2 on a backend diff, or delete a
73
+ > Chesterton's Fence — see [anti-patterns](reference/anti-patterns.md).
74
+
75
+ ## Output → `polish-report.md`
76
+
77
+ **Footer first (to chat, not into the report file)** — render the slice meter + flow ribbon by running the progress footer (`progress.sh`, resolved like the step-0 preamble — canonical snippet in `devrites-lib/SKILL.md`). Then write the report:
78
+ ```
79
+ Target: <slug | path/route/component>
80
+ Phase 1 (code polish): findings → fixes (technique + why behavior preserved)
81
+ Phase 2 (backend polish): error/log/data/API/cleanup fixes | n/a (no backend)
82
+ Phase 3 (normalize): drift found → root-cause fixes | n/a (no UI)
83
+ Phase 4 (UI polish): quality-bar deltas | n/a (no UI)
84
+ Browser evidence: <summary | n/a>
85
+ Re-verification: <fast checks run after the edits → pass/fail | n/a (no code changed)>
86
+ Open design questions asked: <none | list>
87
+ Re-prove: <if polish changed code, run a scoped `/rite-prove` so evidence post-dates the change before /rite-review → /rite-seal | n/a — no code changed>
88
+ Next: /rite-review
89
+ ↻ Hygiene: /clear between polish targets and before /rite-review (polish-report.md + browser-evidence.md captured). See rules/context-hygiene.md.
90
+ ```