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,72 @@
1
+ # Optional tooling — code intelligence, docs, memory
2
+
3
+ Every external tool DevRites can use is **optional**. Detect what's present, use the best fit
4
+ for the job, and **degrade gracefully to `Read` / `Grep` / `Glob`** (always available) when
5
+ nothing is. Never assume a tool is installed, never require installing one to run a phase, and
6
+ never block on a missing tool — the fallback path is a first-class path, not a failure.
7
+
8
+ DevRites is stack-agnostic and installs into arbitrary projects; an index or MCP server that
9
+ exists in one repo is absent in the next. Treat the tools below as accelerators you reach for
10
+ *when available*, not dependencies.
11
+
12
+ ## Code intelligence — structure, placement, callers, impact, blast-radius, trace
13
+
14
+ For "where is X / what calls X / what would changing X break / how does X reach Y", reach for a
15
+ code-intelligence index when available. The three indexes below are **recommended, not
16
+ mandatory** — follow this order and skip any that isn't installed:
17
+
18
+ 1. **codebase-memory-mcp — primary.** When available, answer the structural question here
19
+ **first**: `search_graph`, `trace_path`, `detect_changes` (git-diff → affected symbols +
20
+ blast radius), `get_architecture`, `get_code_snippet`, `query_graph`.
21
+ 2. **Cross-verify with codegraph *and* graphify (both, when present).** Re-ask the same
22
+ structural question of `codegraph` (`.codegraph/`, `codegraph_*`) **and** `graphify`
23
+ (`graphify-out/`), and confirm they agree with the codebase-memory-mcp answer — especially
24
+ for load-bearing claims (blast radius, every caller of a thing you're about to change,
25
+ "nothing else uses this"). A disagreement between indexes is a signal, not noise: trust a
26
+ fresh read of the **live code** over any index, and investigate the gap before relying on it.
27
+ 3. **Standard methods — the always-available fallback.** When none of the three indexes is
28
+ present — or to pin an exact reference an index is unsure of — use **LSP** (Claude Code Code
29
+ Intelligence: go-to-definition, find-references, hover / signature, diagnostics, document &
30
+ workspace symbols) plus **`Read` / `Grep` / `Glob`**, reading comprehensively rather than
31
+ stopping at the first match (see `core.md` rule 1).
32
+
33
+ Use whatever subset is installed: codebase-memory-mcp alone is fine; codebase-memory-mcp plus
34
+ one of the others still cross-verifies; none present → standard methods. The fallback path is a
35
+ first-class path — never block a phase on a missing index.
36
+
37
+ ### Keeping the indexes fresh
38
+
39
+ An index only helps if it matches the live code; after edits, a stale graph manufactures the
40
+ very index-disagreement step 2 treats as a signal. DevRites keeps the three mechanical indexes
41
+ current automatically — the [`devrites-refresh-indexes`](../skills/devrites-refresh-indexes/SKILL.md)
42
+ Stop hook incrementally reindexes whichever of codebase-memory-mcp, codegraph, and graphify
43
+ track the repo, at end of turn, in a detached process. It self-guards on changes, no-ops when no
44
+ index is present, and is disabled by `DEVRITES_REFRESH_INDEXES=off`. Force a synchronous refresh
45
+ — or re-run graphify's semantic pass after **doc** changes (`/graphify --update`) — via that
46
+ skill. Still trust a fresh read of the live code over any index when they disagree.
47
+
48
+ ## Up-to-date library / framework docs — context7
49
+
50
+ When implementing against, choosing, or verifying an **external** library/framework whose
51
+ current API or version behaviour matters, use **context7 if available**: `resolve-library-id`
52
+ (library name + your question) → `query-docs` (the resolved id + the question).
53
+
54
+ context7 pairs with [`devrites-source-driven`](../skills/devrites-source-driven/SKILL.md), it
55
+ doesn't replace it: the project's **installed / pinned source still wins** for the version the
56
+ project actually runs. Reach for context7 when the local source/docs are missing, or when you
57
+ need the *current upstream* behaviour the installed copy may predate. Record the fact + its
58
+ source in `decisions.md` / `evidence.md` the same way — a context7 lookup is a cited source,
59
+ not a memory.
60
+
61
+ ## Architecture & decision memory — codebase-memory-mcp
62
+
63
+ Where a fast codebase map or a durable decision record helps, and codebase-memory-mcp is
64
+ available: `get_architecture` for an overview (languages, packages, routes, hotspots, clusters)
65
+ during `/rite-spec`, `/rite-define`, or `/rite-zoom-out`; `manage_adr` for an ADR-style record
66
+ at `/rite-define` / `/rite-seal`. This complements the workspace `decisions.md`; it never
67
+ replaces it — the workspace files remain the canonical source of truth.
68
+
69
+ ## Output hygiene
70
+
71
+ Per [`prose-style.md`](prose-style.md): don't name these tools to the user. Say what you
72
+ learned ("the change touches three call sites"), not which tool found it.
@@ -0,0 +1,53 @@
1
+ {
2
+ "$comment": "DevRites hooks — auto-approve the read-only orientation/gate scripts (no more per-run permission prompts), inject the active feature's orientation at session start + a live cursor each turn, arm the A1 pre-block guard on Edit/Write, drop a fail-on-red sentinel on test/build Bash output (devrites-redwatch.sh), and refuse to end a turn while the workspace is provably inconsistent (devrites-stop-gate.sh, Stop). All new gates are OBSERVE-only by default (they log but never block); enable enforcement per gate: DEVRITES_A1_HOOK=enforce (or a .a1-enforce file), DEVRITES_STOP_GATE=enforce — each only after its log confirms no false positives. The wright-scope and reviewer-readonly guards are wired from subagent frontmatter, not here. The bash installer SEEDS this file only when .claude/settings.json is absent; it is never overwritten on update, so your own settings are safe to add here. Plugin installs get the same hooks via pack/.claude/hooks/hooks.json instead.",
3
+ "hooks": {
4
+ "PreToolUse": [
5
+ {
6
+ "matcher": "Bash",
7
+ "hooks": [
8
+ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/devrites-allow.sh\"" }
9
+ ]
10
+ },
11
+ {
12
+ "matcher": "Edit|Write|MultiEdit|NotebookEdit",
13
+ "hooks": [
14
+ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/devrites-a1-guard.sh\"" }
15
+ ]
16
+ }
17
+ ],
18
+ "PostToolUse": [
19
+ {
20
+ "matcher": "Bash",
21
+ "hooks": [
22
+ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/devrites-redwatch.sh\"" }
23
+ ]
24
+ }
25
+ ],
26
+ "Stop": [
27
+ {
28
+ "hooks": [
29
+ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/devrites-stop-gate.sh\"" }
30
+ ]
31
+ },
32
+ {
33
+ "hooks": [
34
+ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/devrites-refresh-indexes.sh\"" }
35
+ ]
36
+ }
37
+ ],
38
+ "UserPromptSubmit": [
39
+ {
40
+ "hooks": [
41
+ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/devrites-cursor.sh\"" }
42
+ ]
43
+ }
44
+ ],
45
+ "SessionStart": [
46
+ {
47
+ "hooks": [
48
+ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/devrites-orient.sh\"" }
49
+ ]
50
+ }
51
+ ]
52
+ }
53
+ }
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: devrites-api-interface
3
+ description: Design stable APIs and interface contracts before implementation — REST/GraphQL endpoints, module boundaries, type contracts, FE/BE splits. Use when the user says "design the API", "contract this out", "split frontend and backend", or a slice crosses a boundary. Not for internal helpers or post-ship interfaces (use `/rite-review`).
4
+ user-invocable: false
5
+ ---
6
+
7
+ # devrites-api-interface — contract before implementation
8
+
9
+ When a slice crosses a boundary (FE/BE, service/service, module/module) or exposes a
10
+ public interface, define the contract first so both sides can proceed and the interface
11
+ stays stable.
12
+
13
+ ## Define the contract first
14
+ - **Shape** — request/response or function signature; field names, types, optionality,
15
+ units. Follow the project's existing naming and conventions.
16
+ - **Status & errors** — success codes, error codes, error body shape, validation
17
+ messages. Errors are part of the contract, not an afterthought.
18
+ - **Semantics** — idempotency, pagination, ordering, nullability, side effects.
19
+ - **Versioning/compat** — is this new or a change to an existing contract? A breaking
20
+ change to an existing consumer is a user decision (and a drift event if unplanned).
21
+
22
+ ## Stability principles
23
+ - Design for the caller. The interface should make the common case easy and the wrong
24
+ call hard.
25
+ - Be conservative in what you expose; you can add later, but removing/changing breaks
26
+ consumers.
27
+ - Match existing endpoints/modules in style — don't introduce a competing convention.
28
+ - Validate at the boundary (untrusted → trusted); don't trust caller-supplied trust
29
+ signals (IDs, roles). (See `rite-review/reference/security-review.md` three-tier.)
30
+
31
+ ## Enables the split
32
+ A clear contract lets `/rite-plan split` proceed: the backend slice can land against the
33
+ contract with a stub consumer; the frontend slice can build against a mock or the real
34
+ contract. Neither side blocks on the other.
35
+
36
+ ## Doubt the contract
37
+ Before standing the interface, run `devrites-doubt` — boundary decisions are exactly the
38
+ non-trivial kind worth an adversarial check. Record the contract + rationale in
39
+ `decisions.md`.
40
+
41
+ ## Gotchas
42
+ - Be conservative — you can add to a contract later, but removing or changing a field breaks every consumer.
43
+ - Validate at the boundary; never trust caller-supplied IDs, roles, or prices.
44
+ - A breaking change to an existing consumer is a user decision (and a `drift.md` event if unplanned), not a silent edit.
45
+ - Match the project's existing endpoint/module conventions; a competing convention is a tax, not a design.
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: devrites-audit
3
+ description: Read-only audit dispatch for the active feature on the requested axis — security (OWASP, trust boundary, secrets), perf (measure-first, N+1, CWV), or simplify (Chesterton's Fence, deletion test). Use when the user says "security review", "is this safe", "is this fast enough", "perf check", "N+1", "simplify this", "Chesterton's Fence". Not for write actions or whole-project audits.
4
+ argument-hint: "<security | perf | simplify>"
5
+ user-invocable: false
6
+ ---
7
+
8
+ # devrites-audit — read-only audit dispatch
9
+
10
+ Dispatch one read-only review subagent against the active feature's workspace + diff. The subagent runs in **fresh context** (no author anchoring) and returns labeled findings. The caller (`/rite-polish` Phase 1, `/rite-review`, or the user) acts on them — this skill returns the subagent's report verbatim.
11
+
12
+ This is the **inline single-axis pass** used during build / polish — one axis at a time, on demand, where a quick read keeps a slice honest. It is intentionally distinct from the seal/review **gate**, where the reviewer agents fan out in parallel across all relevant axes in their own fresh contexts (see `/rite-seal`). Same agents, different role: the audit is a cheap mid-flight check; the seal fan-out is the blocking gate. Both reading the same agent disciplines is the point, not a divergence.
13
+
14
+ Why a subagent rather than inline: an adversarial reviewer with no author context is more likely to find what's wrong. Anthropic bug [#49559](https://github.com/anthropics/claude-code/issues/49559) leaves `context: fork` silently inline under plugin install, so `Task` dispatch is the reliable path under both plugin and bash installs.
15
+
16
+ ## Axis selection
17
+
18
+ `$ARGUMENTS` picks the axis. If the caller did not pass one, infer from intent and confirm with the user before dispatch.
19
+
20
+ | Axis | Subagent (`.claude/agents/`) | Discipline |
21
+ |---|---|---|
22
+ | `security` | `devrites-security-auditor` | OWASP Top 10; three-tier trust boundary (untrusted → boundary → trusted); secrets handling; dependency risk. A real auth-bypass / data-exposure / injection is **Critical → NO-GO** at seal. |
23
+ | `perf` | `devrites-performance-reviewer` | Measure-first: no claim without a number or a specified measurement. N+1s, hot-path work, payload/bundle size, Core Web Vitals risks. Breach of a stated `spec.md` budget is **Important/Critical**. |
24
+ | `simplify` | `devrites-simplifier-reviewer` | Behavior-preserving simplification: guard clauses, Extract Method, simplify conditionals, the deletion-test heuristic, Chesterton's Fence; plus the AI-codegen over-engineering smells — single-use factory / needless indirection, defensive try-catch bloat + redundant logging, dependency creep where an in-repo option exists, a 100-line function where 20 would do. Findings are **Suggestion / Nit / FYI** — no behavior change. |
25
+
26
+ ## Gather
27
+
28
+ 1. Read `.devrites/ACTIVE` to resolve the active feature `<slug>`.
29
+ 2. Confirm `.devrites/work/<slug>/touched-files.md` and `spec.md` exist. If missing → **STOP** and tell the caller the feature has no recorded diff or spec yet.
30
+
31
+ ## Dispatch
32
+
33
+ Use the `Task` tool to launch the chosen subagent with this prompt shape (axis-specific reads in `Read:`):
34
+
35
+ ```
36
+ Audit the active DevRites feature on the <axis> axis.
37
+
38
+ Workspace: .devrites/work/<slug>/
39
+ Read:
40
+ - spec.md (acceptance criteria; for perf: any perf budget; for security: data model + affected areas)
41
+ - decisions.md (if present)
42
+ - evidence.md (existing measurements, for perf)
43
+ - touched-files.md
44
+ Run `git diff` and read the listed touched files. Apply your documented
45
+ discipline and return labeled findings (Critical / Important / Suggestion /
46
+ Nit / FYI) using your documented output format. ONE FINDING PER LINE,
47
+ cite file:line.
48
+
49
+ Feature scope only. No edits. Do not summarize or re-rank — the caller
50
+ reconciles.
51
+ ```
52
+
53
+ Rules for the dispatch:
54
+
55
+ - **One subagent per call.** This skill is not a fan-out; multi-axis fan-out is `/rite-seal`'s job (see `.claude/skills/rite-seal/reference/parallel-dispatch.md`).
56
+ - **No author context.** Do not pass the caller's analysis or framing of the change to the subagent — fresh, adversarial read is the point.
57
+ - **No cross-pollination.** If the caller wants more than one axis, dispatch each axis in its own `Task` call in a single message so the runtime parallelizes; each subagent gets only its own brief.
58
+
59
+ ## Return
60
+
61
+ Pass the subagent's findings report back to the caller **verbatim**. Do not re-label, re-rank, or summarize. The caller (`/rite-polish` for `simplify`, `/rite-review` for `security`/`perf`) decides what to act on within feature scope, and surfaces any **Critical** to `/rite-seal` as a NO-GO blocker.
62
+
63
+ ## Fallback
64
+
65
+ If the `Task` tool is unavailable in the current environment, fall back to a read-only inline audit using the discipline documented in the corresponding agent file (`.claude/agents/devrites-{security-auditor,performance-reviewer,simplifier-reviewer}.md`). **Flag clearly that this was an inline fallback**, not an independent review. The seal weighs the fallback differently — see [`rite-seal/reference/risk-and-rollback.md`](../rite-seal/reference/risk-and-rollback.md).
66
+
67
+ ## Scope reminders
68
+
69
+ - Active feature + touched files only. Out-of-scope risks become FYI follow-ups.
70
+ - Read-only. No edits.
71
+ - For `perf`: no number → no claim. Speculative micro-opts are Suggestion at most.
72
+ - For `simplify`: behavior-preserving only. Anything that needs new tests is out of scope here — route to `/rite-plan reslice`.
73
+ - Critical findings block the seal.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: devrites-browser-proof
3
+ description: Prove UI behavior via the browser-proof ladder — browser-harness → Chrome DevTools MCP → `/run`+`/verify` → project E2E → manual — recording routes, viewports, screenshots, console, network, interactions, design-reference match to `browser-evidence.md`. Use when the user says "check the UI in browser", "screenshot this", "prove it renders". Not for backend-only features.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # devrites-browser-proof — runtime evidence for UI
8
+
9
+ Screenshots and runtime observations beat "it should render fine." Use the highest rung
10
+ of the ladder that's available; record which one.
11
+
12
+ ## Ladder (top-down)
13
+ 1. **browser-harness** — detect `command -v browser-harness`. Connects to the user's
14
+ Chrome over CDP. Pattern: `new_tab(url)` → `wait_for_load()` → `capture_screenshot()`
15
+ → read the pixel → `click_at_xy(x,y)` → re-screenshot. Coordinate clicks pass through
16
+ iframes/shadow/cross-origin. `print(page_info())` for liveness. Don't launch a new
17
+ browser; don't auto-install.
18
+ 2. **Chrome DevTools MCP** (if configured) — screenshots, DOM, console, network,
19
+ performance, accessibility tree.
20
+ 3. **Claude Code `/run` + `/verify`** (if available) — launch + observe the app.
21
+ 4. **Project-native E2E** (only if present) — Playwright/Cypress/Capybara/Selenium via
22
+ the project's existing commands. Don't add a new framework.
23
+ 5. **Manual fallback** — none available: record the limitation + exact manual steps.
24
+
25
+ ## Evidence schema → `browser-evidence.md`
26
+ Tooling used · route(s) · viewports (375/768/1280) · screenshot paths **opened and
27
+ described** · console errors/warnings · network failures · interaction path tested ·
28
+ accessibility basics · responsive checks · **design-reference match** (if the spec saved
29
+ references in `references/`, compare the built UI to them and note match/diffs) ·
30
+ limitations.
31
+
32
+ ## Hard rules
33
+ - A screenshot **path is not proof** — open it and describe what's visible.
34
+ - Check ≥1 small and ≥1 large viewport for layout work.
35
+ - **Auth wall → stop and ask the user**; never type credentials from a screenshot.
36
+ - Confirm destructive actions before performing them to "prove" a flow.
37
+ - Detect, don't install. Tooling setup is the user's decision.
38
+ - No browser available → mark proof **pending (manual)** with steps; don't fake a pass.
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: devrites-debug-recovery
3
+ description: Debug systematically when tests, builds, or runtime/browser checks fail — deterministic feedback loop, reproduce, 3-5 ranked hypotheses, instrument, fix root cause, regression-test. Use when the user says "debug this", "why is it failing", "it broke", "the build is red", "the tests fail". Not for code review or flaky tests (fix the flake first).
4
+ user-invocable: false
5
+ ---
6
+
7
+ # devrites-debug-recovery — fix the root cause, not the symptom
8
+
9
+ Disciplined recovery from failures. **NO shotgun edits, NO blanket retries.**
10
+
11
+ ## When to invoke
12
+
13
+ Loaded by `/rite-prove` (and during `/rite-build`) when something fails. Use
14
+ when tests, builds, typecheck, runtime, or browser checks are red and the next
15
+ move is unclear.
16
+
17
+ ## The six-phase cycle
18
+
19
+ 1. **Build the feedback loop** — fast, deterministic, agent-runnable pass/fail
20
+ signal. **This is the skill** — be aggressive here.
21
+ See [build-the-loop.md](reference/build-the-loop.md).
22
+ 2. **Reproduce** — run the loop. Confirm the failure matches the user's report
23
+ (not a nearby failure); capture the **exact error text**; confirm
24
+ reproducibility (or a high enough repro rate for flaky bugs). Do not proceed
25
+ without reproduction.
26
+ 3. **Ranked hypotheses (3-5, falsifiable)** — generate the list before testing
27
+ any of them. Each must state a prediction.
28
+ See [hypotheses.md](reference/hypotheses.md).
29
+ 4. **Instrument** — debugger > logs > "log everything and grep". One variable
30
+ at a time. Tagged debug-log prefixes.
31
+ See [instrumentation.md](reference/instrumentation.md).
32
+ 5. **Fix + regression test** — write the regression test before the fix, but
33
+ only if a correct seam exists. If no correct seam: that IS the finding;
34
+ record it.
35
+ See [regression-test.md](reference/regression-test.md).
36
+ 6. **Cleanup + classify** — repro gone, debug logs gone, throwaway harnesses
37
+ gone, hypothesis recorded. Classify the failure.
38
+ See [cleanup-and-classify.md](reference/cleanup-and-classify.md).
39
+
40
+ ## Hard rules
41
+
42
+ - **Quote real error text;** never paraphrase it away.
43
+ - **Change one thing at a time** so you know what fixed it.
44
+ - **Do NOT loosen / delete a failing assertion** to get green — check whether
45
+ it's drift first (route via `/rite-plan repair`).
46
+ - **Do NOT hide flakiness** with sleeps / retries — characterize it.
47
+ - **3 failed attempts on the same root cause → escalate**: record the wrong idea and *why it
48
+ failed* under `## Dead ends` in `decisions.md` (so a retry or the next agent doesn't repeat it),
49
+ then re-hypothesize from **scratch** — fresh context, carrying those dead-ends as ruled-out —
50
+ invoke `devrites-doubt`, or ask the user. Don't keep trying variations of a wrong idea.
@@ -0,0 +1,47 @@
1
+ # Build the feedback loop
2
+
3
+ **This is the skill.** Everything else is mechanical. If you have a fast,
4
+ deterministic, agent-runnable pass/fail signal for the failure, you will find
5
+ the cause — bisection, hypothesis-testing, and instrumentation all just consume
6
+ that signal. If you don't have one, no amount of staring at code will save you.
7
+
8
+ **Spend disproportionate effort here. Be aggressive. Refuse to give up.**
9
+
10
+ ## Build the loop — try these in roughly this order
11
+
12
+ 1. **Failing test** at whatever seam reaches the failure (unit / integration / e2e).
13
+ 2. **Direct CLI / curl invocation** against the running dev server or process.
14
+ 3. **Replay a captured trace** — save the offending request/payload/event to disk, replay it through the code path in isolation.
15
+ 4. **Throwaway harness** — spin up a minimal subset (one service, mocked deps) that triggers the failure with a single function call.
16
+ 5. **Headless browser script** (Chrome DevTools MCP / Playwright) — drives the UI, asserts on DOM/console/network.
17
+ 6. **Bisection harness** — if the failure appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so `git bisect run` can find it.
18
+ 7. **Differential harness** — same input through old-version vs new-version (or two configs), diff outputs.
19
+ 8. **Property / fuzz loop** — if the failure is "sometimes wrong", run 1000 random inputs and look for the failure shape.
20
+ 9. **Human-in-the-loop, structured** — last resort. If a human must click, drive *them* with a checklist so the loop stays structured. Captured output feeds back.
21
+
22
+ ## Iterate on the loop itself
23
+
24
+ The loop is a product. Once you have *a* loop, ask:
25
+
26
+ - Can I make it faster? (cache setup, skip unrelated init, narrow scope.)
27
+ - Can I make the signal sharper? (assert on the specific symptom, not "didn't crash".)
28
+ - Can I make it more deterministic? (pin time, seed RNG, isolate filesystem, freeze network.)
29
+
30
+ A 30-second flaky loop is barely better than no loop. A 2-second deterministic
31
+ loop is a debugging superpower.
32
+
33
+ ## Non-deterministic failures
34
+
35
+ Goal is **higher reproduction rate**, not a clean repro. Loop the trigger 100×,
36
+ parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug
37
+ is debuggable; 1% is not — raise the rate until it's debuggable.
38
+
39
+ ## When you genuinely cannot build a loop
40
+
41
+ **STOP and say so explicitly.** List what you tried. Ask the user for:
42
+
43
+ - access to whatever environment reproduces it,
44
+ - a captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or
45
+ - permission to add temporary production instrumentation.
46
+
47
+ **Do NOT proceed without a loop you believe in.**
@@ -0,0 +1,17 @@
1
+ # Cleanup + classify
2
+
3
+ ## Classify the failure (for the report)
4
+
5
+ - `test-right / code-wrong` (fix code)
6
+ - `test-wrong` (possible **spec drift** → `/rite-plan repair`)
7
+ - `environment / setup`
8
+ - `flaky / ordering`
9
+ - `external-dependency-down` (blocker)
10
+
11
+ ## Cleanup checklist — required before declaring done
12
+
13
+ - [ ] Original repro no longer reproduces (re-run the Phase 1 loop).
14
+ - [ ] Regression test passes (or absence of seam is documented).
15
+ - [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix).
16
+ - [ ] Throwaway harnesses deleted (or moved to a clearly marked debug location).
17
+ - [ ] The correct hypothesis is stated in `evidence.md` + the commit/PR message — next debugger learns.
@@ -0,0 +1,17 @@
1
+ # Ranked hypotheses (3-5, falsifiable)
2
+
3
+ Generate **3-5 ranked hypotheses** *before* testing any of them.
4
+ Single-hypothesis generation anchors on the first plausible idea.
5
+
6
+ Each hypothesis must be **falsifiable**: state the prediction it makes.
7
+
8
+ > Format: *"If <X> is the cause, then <changing Y> will make the failure
9
+ > disappear / <changing Z> will make it worse."*
10
+
11
+ If you cannot state the prediction, the hypothesis is a vibe — discard or
12
+ sharpen it.
13
+
14
+ **Show the ranked list to the user before testing.** Domain knowledge re-ranks
15
+ instantly ("we just deployed a change to #3"), or they've already ruled out
16
+ hypotheses. Cheap checkpoint, big time saver. Don't block on it — proceed with
17
+ your ranking if the user is AFK.
@@ -0,0 +1,21 @@
1
+ # Instrumentation
2
+
3
+ Each probe maps to a specific prediction from the hypothesis phase.
4
+ **Change one variable at a time.**
5
+
6
+ ## Tool preference
7
+
8
+ 1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
9
+ 2. **Targeted logs** at the boundaries that distinguish hypotheses.
10
+ 3. **NEVER** "log everything and grep".
11
+
12
+ ## Tagged prefixes
13
+
14
+ **Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at
15
+ the end is a single grep. Untagged logs survive; tagged logs die.
16
+
17
+ ## Perf branch
18
+
19
+ For performance regressions, logs are usually wrong. Establish a baseline
20
+ measurement (timing harness, `performance.now()`, profiler, query plan), then
21
+ bisect. **Measure first, fix second.**
@@ -0,0 +1,31 @@
1
+ # Fix + regression test
2
+
3
+ Write the regression test **before the fix** — *but only if there is a correct
4
+ seam for it*.
5
+
6
+ A correct seam exercises the **real failure pattern** as it occurs at the call
7
+ site. If the only available seam is too shallow (unit test that can't replicate
8
+ the chain that triggered the failure), a regression test there gives false
9
+ confidence.
10
+
11
+ ## No correct seam? That itself is the finding
12
+
13
+ Note it in `evidence.md` and append a follow-up in the active feature's
14
+ `decisions.md` (or open a `/rite-plan` repair item if the spec is affected): the
15
+ codebase architecture is preventing this class of failure from being locked
16
+ down. Frame it as a *deepening opportunity* — "this module needs a seam at <X>
17
+ so failures here can be regression-tested" — so the next refactor (or an
18
+ `improve-codebase-architecture` pass at the project level) has a concrete
19
+ target.
20
+
21
+ Do **not** invent an artificial seam just to host a test: a shallow seam that
22
+ doesn't exercise the real call chain gives false confidence and is worse than
23
+ no test at all.
24
+
25
+ ## When a correct seam exists
26
+
27
+ 1. Turn the minimised repro into a failing test at that seam.
28
+ 2. Watch it fail.
29
+ 3. Apply the fix.
30
+ 4. Watch it pass.
31
+ 5. Re-run the Phase 1 loop against the original (un-minimised) scenario.
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: devrites-doubt
3
+ description: Stress-test a single non-trivial decision via CLAIM → EXTRACT → DOUBT → RECONCILE → STOP with `devrites-doubt-reviewer` for an independent take. Use when the user says "are we sure", "double-check this", "what could go wrong", or a boundary / data-model / auth / public-API / migration change is about to commit. Not for post-merge review or trivial choices.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # devrites-doubt — CLAIM → EXTRACT → DOUBT → RECONCILE → STOP
8
+
9
+ A pre-mortem on a single decision, not a final review. Find what's wrong before it's
10
+ load-bearing.
11
+
12
+ ## When to use
13
+ Introducing branching logic · crossing a module/service boundary · changing the data
14
+ model · modifying auth/authz · changing a public API · touching migrations · changing a
15
+ browser/user flow · relying on an assumption tests can't prove · working in unfamiliar
16
+ code · claiming "this is safe", "this scales", or "this matches the spec".
17
+
18
+ ## The cycle (copy this checklist)
19
+
20
+ - [ ] **1. CLAIM** — state the claim in 1–3 sentences + why it matters.
21
+ - [ ] **2. EXTRACT** — isolate the smallest reviewable artifact + its contract; strip your reasoning so the reviewer sees only the code/decision.
22
+ - [ ] **3. DOUBT** — invoke a fresh-context reviewer with an ADVERSARIAL prompt: *"find what's wrong; do not validate."* Prefer a real subagent (`.claude/agents/devrites-doubt-reviewer`) so it has no anchoring context.
23
+ - [ ] **4. RECONCILE** — classify EVERY finding: contract misread | valid & actionable | valid trade-off | noise.
24
+ - [ ] **5. STOP** — met a stop condition (only trivial findings, 3 cycles done, or user override). Emit a **binary gate verdict** the orchestrator must clear: **accept** (no valid-&-actionable findings remain) or **reject + the specific required changes**. On reject, the orchestrator loops the wright on those changes before the slice is accepted; still reject after the 3-cycle cap → escalate to the user.
25
+
26
+ ## Deletion-test lens (for "is this abstraction load-bearing?" doubts)
27
+
28
+ When the claim is "this new module / boundary / wrapper is worth it", apply the
29
+ **deletion test** before standing it: *imagine the abstraction never existed — does
30
+ its complexity vanish (it was a pass-through, the abstraction was added on speculation)
31
+ or does the same complexity re-appear distributed across N callers (it concentrates real
32
+ complexity, deletion would smear it)?* Pass-throughs that fail the test get downgraded
33
+ to "not yet" — wait for the second real caller before standing the seam.
34
+
35
+ ## Rules
36
+ - For "where does this claim reach / what would change with it" questions, prefer a
37
+ code-intelligence index if available — codebase-memory-mcp (`detect_changes` / `trace_path`)
38
+ first, cross-checked with codegraph (`codegraph_impact` / `codegraph_callers`) + graphify,
39
+ else standard methods (LSP / Read/Grep/Glob); see `.claude/rules/tooling.md` — over file
40
+ reads; they answer impact in one call without polluting context.
41
+ - The reviewer prompt must be adversarial — its job is to break the claim, not to agree.
42
+ - Strip your own justification before review; reasoning anchors the reviewer toward
43
+ agreement.
44
+ - Loop **max 3 times**. If material uncertainty remains after 3, **ask the user**.
45
+ - Act on "valid & actionable" findings (fix or re-plan). Accept "valid trade-off"
46
+ explicitly in `decisions.md`. Discard "noise" with a one-line reason. Re-check
47
+ "contract misread" against the actual contract text.
48
+ - In interactive sessions, a **cross-model second opinion** is allowed **only with
49
+ explicit user authorization**. Never run external CLIs without authorization.
50
+
51
+ ## AFK exception
52
+
53
+ When `.devrites/AFK` exists and the user is away, `escalated to user` is unavailable in
54
+ real time. Map the verdict to a `questions.md` entry instead of a synchronous prompt:
55
+
56
+ - **Finding severity ≤ slice's gate ceiling** (the slice's `Gate:` plus `.devrites/AFK`
57
+ `allow_gates`, default `[advisory]`): append a `questions.md` entry with
58
+ `gate: advisory`, record the trade-off in `decisions.md`, and proceed with the best
59
+ inference. The advisory is surfaced by `/rite-status` so the user sees it on return.
60
+ - **Finding severity > gate ceiling, OR the claim touches destructive migration,
61
+ auth/authz boundaries, public APIs, irreversible data writes**: append a
62
+ `questions.md` entry with `gate: blocking`, set `state.md` `Status: awaiting_human`,
63
+ fire the `notify:` hook, and STOP. AFK never silently accepts irreversible risk.
64
+
65
+ The 3-loop limit still applies — after 3 cycles, the verdict is `escalated to user` and
66
+ the unresolved doubt becomes a blocking question regardless of AFK config.
67
+
68
+ ## Output
69
+ ```
70
+ Claim: ...
71
+ Gate: accept | reject — <the specific required changes, if reject>
72
+ Verdict: holds | revised | escalated to user
73
+ Actionable findings handled: ...
74
+ Trade-offs accepted (→ decisions.md): ...
75
+ ```