@haposoft/cafekit 0.16.7 → 0.18.1

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 (231) hide show
  1. package/README.md +14 -22
  2. package/bin/__tests__/codex-hooks-ownership.test.js +2 -2
  3. package/bin/__tests__/codex-hooks.test.js +169 -272
  4. package/bin/__tests__/codex-native.test.js +100 -202
  5. package/bin/__tests__/develop-contract.test.js +122 -1413
  6. package/bin/__tests__/docs-sync-on-demand.test.js +93 -0
  7. package/bin/__tests__/grok-envelope.test.js +0 -56
  8. package/bin/__tests__/hook-payload.test.js +4 -6
  9. package/bin/__tests__/legacy-authority-decoupled.test.js +154 -0
  10. package/bin/__tests__/legacy-hooks-retired.test.js +221 -0
  11. package/bin/__tests__/omp-bridge.test.js +20 -17
  12. package/bin/__tests__/omp-hooks.test.js +0 -19
  13. package/bin/__tests__/optional-skill-inventory.test.js +112 -4
  14. package/bin/__tests__/orca-session.test.js +0 -2
  15. package/bin/__tests__/package-inventory.test.js +90 -925
  16. package/bin/__tests__/runtime-dir.test.js +0 -3
  17. package/bin/__tests__/runtime-schema.test.js +3 -2
  18. package/bin/__tests__/skill-routing-source.test.js +27 -15
  19. package/bin/__tests__/spec-narrowing.test.js +30 -161
  20. package/bin/__tests__/specs-v2-execution-closeout.test.js +0 -437
  21. package/bin/__tests__/test-runtime-dependency-closure.cjs +1 -2
  22. package/bin/__tests__/ui-ux-skill.test.js +101 -0
  23. package/bin/__tests__/usage-hook-retired.test.js +114 -0
  24. package/bin/__tests__/validator-grounding.test.js +18 -2949
  25. package/bin/lib/managed-writer.js +2 -3
  26. package/bin/phases/codex-runtime.js +27 -0
  27. package/bin/phases/copy-payload.js +13 -28
  28. package/bin/phases/omp-runtime.js +25 -0
  29. package/package.json +2 -3
  30. package/src/claude/CLAUDE.md +3 -10
  31. package/src/claude/agents/brainstormer.md +7 -3
  32. package/src/claude/agents/code-auditor.md +44 -56
  33. package/src/claude/agents/debugger.md +8 -88
  34. package/src/claude/agents/deployer.md +3 -5
  35. package/src/claude/agents/docs-keeper.md +6 -14
  36. package/src/claude/agents/git-ops.md +2 -4
  37. package/src/claude/agents/implementer.md +12 -16
  38. package/src/claude/agents/inspector.md +4 -3
  39. package/src/claude/agents/project-manager.md +9 -17
  40. package/src/claude/agents/researcher.md +9 -3
  41. package/src/claude/agents/spec-maker.md +15 -15
  42. package/src/claude/agents/test-runner.md +8 -11
  43. package/src/claude/agents/ui-ux-designer.md +0 -1
  44. package/src/claude/hooks/__tests__/fixtures/statusline-default.golden +1 -1
  45. package/src/claude/hooks/__tests__/spec-gate.test.js +244 -333
  46. package/src/claude/hooks/__tests__/spec-state-touched.test.js +160 -0
  47. package/src/claude/hooks/__tests__/state.test.js +68 -0
  48. package/src/claude/hooks/__tests__/statusline.test.js +140 -11
  49. package/src/claude/hooks/agent.cjs +2 -1
  50. package/src/claude/hooks/lib/hook-payload.cjs +2 -2
  51. package/src/claude/hooks/rules.cjs +2 -1
  52. package/src/claude/hooks/session.cjs +0 -1
  53. package/src/claude/hooks/spec-gate.cjs +17 -83
  54. package/src/claude/hooks/spec-state.cjs +142 -39
  55. package/src/claude/hooks/state.cjs +21 -2
  56. package/src/claude/migration-manifest.json +42 -22
  57. package/src/claude/output-styles/coding-level-0-eli5.md +9 -9
  58. package/src/claude/output-styles/coding-level-1-junior.md +3 -3
  59. package/src/claude/output-styles/coding-level-2-mid.md +3 -3
  60. package/src/claude/output-styles/coding-level-3-senior.md +2 -2
  61. package/src/claude/output-styles/coding-level-4-lead.md +5 -5
  62. package/src/claude/output-styles/coding-level-5-god.md +6 -6
  63. package/src/claude/rules/ai-dev-rules.md +2 -3
  64. package/src/claude/rules/hook-protocols.md +8 -15
  65. package/src/claude/rules/manage-docs.md +9 -23
  66. package/src/claude/rules/orchestrator.md +3 -4
  67. package/src/claude/rules/review-audit-self-decision.md +3 -3
  68. package/src/claude/rules/skill-domain-routing.md +1 -3
  69. package/src/claude/rules/skill-workflow-routing.md +4 -5
  70. package/src/claude/rules/state-sync.md +3 -12
  71. package/src/claude/rules/workflow.md +11 -19
  72. package/src/claude/runtime.schema.json +5 -3
  73. package/src/claude/scripts/generate-skill-catalog.cjs +7 -6
  74. package/src/claude/scripts/provenance.cjs +23 -5
  75. package/src/claude/scripts/spec-receipt.cjs +24 -121
  76. package/src/claude/scripts/spec-resolver.cjs +41 -458
  77. package/src/claude/scripts/workflow-policy.cjs +3 -1801
  78. package/src/claude/settings/settings.json +1 -32
  79. package/src/claude/skills/agent-browser/SKILL.md +1 -1
  80. package/src/claude/skills/{question → ask}/SKILL.md +9 -75
  81. package/src/claude/skills/brainstorm/SKILL.md +43 -131
  82. package/src/claude/skills/chrome-devtools/SKILL.md +14 -31
  83. package/src/claude/skills/code-review/SKILL.md +29 -81
  84. package/src/claude/skills/code-review/references/spec-compliance-review.md +4 -8
  85. package/src/claude/skills/debug/SKILL.md +29 -149
  86. package/src/claude/skills/develop/SKILL.md +26 -83
  87. package/src/claude/skills/develop/references/parallel-waves.md +0 -8
  88. package/src/claude/skills/develop/references/quality-gate.md +15 -13
  89. package/src/claude/skills/develop/references/subagent-patterns.md +0 -6
  90. package/src/claude/skills/docs/SKILL.md +2 -2
  91. package/src/claude/skills/docs/references/update-workflow.md +1 -1
  92. package/src/claude/skills/fix/SKILL.md +153 -0
  93. package/src/claude/skills/{hotfix → fix}/references/diagnosis-protocol.md +2 -2
  94. package/src/claude/skills/{hotfix → fix}/references/parallel-patterns.md +2 -2
  95. package/src/claude/skills/{hotfix → fix}/references/prevention-gate.md +3 -3
  96. package/src/claude/skills/{hotfix → fix}/references/review-cycle.md +1 -1
  97. package/src/claude/skills/git/SKILL.md +48 -9
  98. package/src/claude/skills/git/references/commit-protocols.md +35 -16
  99. package/src/claude/skills/git/references/worktree-blueprint.md +42 -6
  100. package/src/claude/skills/orca/SKILL.md +9 -8
  101. package/src/claude/skills/research/SKILL.md +17 -46
  102. package/src/claude/skills/scout/SKILL.md +61 -0
  103. package/src/claude/skills/{inspect → scout}/references/internal-inspection.md +26 -10
  104. package/src/claude/skills/specs/SKILL.md +22 -29
  105. package/src/claude/skills/specs/references/review.md +8 -6
  106. package/src/claude/skills/specs/references/templates.md +34 -41
  107. package/src/claude/skills/sync/SKILL.md +16 -45
  108. package/src/claude/skills/sync/references/rebind-and-audit.md +59 -0
  109. package/src/claude/skills/sync/references/sync-protocols.md +4 -13
  110. package/src/claude/skills/test/SKILL.md +39 -104
  111. package/src/claude/skills/test/references/execution-strategy.md +93 -21
  112. package/src/claude/skills/test/references/failure-triage.md +1 -1
  113. package/src/claude/skills/ui-ux/LICENSE +21 -0
  114. package/src/claude/skills/ui-ux/SKILL.md +497 -0
  115. package/src/claude/skills/ui-ux/references/brand-tokens.md +90 -0
  116. package/src/claude/skills/ui-ux/references/budgets.md +113 -0
  117. package/src/claude/skills/ui-ux/references/checklist.md +271 -0
  118. package/src/claude/skills/ui-ux/references/components/accordion.md +246 -0
  119. package/src/claude/skills/ui-ux/references/components/avatar.md +153 -0
  120. package/src/claude/skills/ui-ux/references/components/banner.md +43 -0
  121. package/src/claude/skills/ui-ux/references/components/breadcrumb.md +201 -0
  122. package/src/claude/skills/ui-ux/references/components/button.md +142 -0
  123. package/src/claude/skills/ui-ux/references/components/card.md +113 -0
  124. package/src/claude/skills/ui-ux/references/components/charts.md +376 -0
  125. package/src/claude/skills/ui-ux/references/components/chat.md +132 -0
  126. package/src/claude/skills/ui-ux/references/components/choice-controls.md +369 -0
  127. package/src/claude/skills/ui-ux/references/components/comment-thread.md +17 -0
  128. package/src/claude/skills/ui-ux/references/components/description-list.md +116 -0
  129. package/src/claude/skills/ui-ux/references/components/empty-state.md +98 -0
  130. package/src/claude/skills/ui-ux/references/components/file-upload.md +107 -0
  131. package/src/claude/skills/ui-ux/references/components/inline-edit.md +128 -0
  132. package/src/claude/skills/ui-ux/references/components/input.md +161 -0
  133. package/src/claude/skills/ui-ux/references/components/list-row.md +56 -0
  134. package/src/claude/skills/ui-ux/references/components/loading.md +198 -0
  135. package/src/claude/skills/ui-ux/references/components/logo.md +147 -0
  136. package/src/claude/skills/ui-ux/references/components/otp-input.md +43 -0
  137. package/src/claude/skills/ui-ux/references/components/quantity-input.md +100 -0
  138. package/src/claude/skills/ui-ux/references/components/range-slider.md +16 -0
  139. package/src/claude/skills/ui-ux/references/components/small-controls.md +340 -0
  140. package/src/claude/skills/ui-ux/references/components/sortable-header.md +86 -0
  141. package/src/claude/skills/ui-ux/references/components/tag-input.md +14 -0
  142. package/src/claude/skills/ui-ux/references/components/timeline.md +38 -0
  143. package/src/claude/skills/ui-ux/references/components/tree.md +30 -0
  144. package/src/claude/skills/ui-ux/references/design-process.md +650 -0
  145. package/src/claude/skills/ui-ux/references/layouts/app-kanban.html +303 -0
  146. package/src/claude/skills/ui-ux/references/layouts/app.md +1369 -0
  147. package/src/claude/skills/ui-ux/references/layouts/form.md +430 -0
  148. package/src/claude/skills/ui-ux/references/layouts/overlay.md +552 -0
  149. package/src/claude/skills/ui-ux/references/layouts/pricing.md +204 -0
  150. package/src/claude/skills/ui-ux/references/locked-rules.md +35 -0
  151. package/src/claude/skills/ui-ux/references/principles.md +408 -0
  152. package/src/claude/skills/ui-ux/references/refactor.md +245 -0
  153. package/src/claude/skills/ui-ux/references/responsive.md +195 -0
  154. package/src/claude/skills/ui-ux/references/review.md +528 -0
  155. package/src/claude/skills/ui-ux/references/rules-color.md +623 -0
  156. package/src/claude/skills/ui-ux/references/rules-form.md +235 -0
  157. package/src/claude/skills/ui-ux/references/rules-state.md +680 -0
  158. package/src/claude/skills/ui-ux/references/rules-type.md +369 -0
  159. package/src/claude/skills/ui-ux/references/styles.md +311 -0
  160. package/src/claude/skills/ui-ux/references/system.md +219 -0
  161. package/src/claude/skills/ui-ux/references/tailwind-v4-traps.md +237 -0
  162. package/src/claude/skills/ui-ux/references/tokens.css +362 -0
  163. package/src/claude/skills/ui-ux/scripts/lint-skill.mjs +216 -0
  164. package/src/claude/skills/ui-ux/scripts/package.json +9 -0
  165. package/src/claude/skills/ui-ux/scripts/probe.mjs +4447 -0
  166. package/src/claude/skills/ui-ux-pro-max/SKILL.md +25 -80
  167. package/src/claude/skills/web-testing/SKILL.md +2 -20
  168. package/src/claude/status.cjs +149 -144
  169. package/src/codex/AGENTS.md +8 -13
  170. package/src/codex/hooks/agent.cjs +2 -1
  171. package/src/codex/hooks/lib/spec-receipt.cjs +4 -32
  172. package/src/codex/hooks/lib/spec-utils.cjs +6 -52
  173. package/src/codex/hooks/rules.cjs +2 -1
  174. package/src/codex/hooks/session.cjs +0 -2
  175. package/src/codex/hooks/spec-gate.cjs +13 -81
  176. package/src/codex/hooks/spec-state.cjs +37 -41
  177. package/src/codex/hooks.json +0 -20
  178. package/src/codex/rules/state-sync.md +3 -12
  179. package/src/common/AGENTS.md +6 -12
  180. package/src/omp/extensions/cafekit-bridge.mjs +6 -6
  181. package/bin/__tests__/change-firewall.semantic-firewall.test.js +0 -2133
  182. package/bin/__tests__/finalizer-pass-gate.semantic-firewall.test.js +0 -342
  183. package/bin/__tests__/release-preflight.semantic-firewall.test.js +0 -586
  184. package/bin/__tests__/review-receipt-c2.semantic-firewall.test.js +0 -378
  185. package/bin/__tests__/specs-v2-policy-and-scaffold.test.js +0 -665
  186. package/bin/__tests__/specs-v2-validator-grounder-contract.test.js +0 -1132
  187. package/src/claude/hooks/__tests__/completion-authority.test.js +0 -990
  188. package/src/claude/hooks/__tests__/semantic-review-authority.test.js +0 -259
  189. package/src/claude/hooks/completion-authority-check.cjs +0 -56
  190. package/src/claude/hooks/completion-authority-state.cjs +0 -527
  191. package/src/claude/hooks/completion-authority.cjs +0 -163
  192. package/src/claude/hooks/lib/context.cjs +0 -616
  193. package/src/claude/hooks/lib/detect.cjs +0 -474
  194. package/src/claude/hooks/semantic-review-authority.cjs +0 -154
  195. package/src/claude/hooks/task-scaffold-guard.cjs +0 -114
  196. package/src/claude/hooks/usage.cjs +0 -197
  197. package/src/claude/scripts/change-firewall.cjs +0 -1748
  198. package/src/claude/scripts/spec-authoring-digest.cjs +0 -151
  199. package/src/claude/scripts/spec-authoring-validation.cjs +0 -126
  200. package/src/claude/scripts/spec-final-state.cjs +0 -290
  201. package/src/claude/scripts/spec-ground.cjs +0 -650
  202. package/src/claude/scripts/spec-readiness.cjs +0 -425
  203. package/src/claude/scripts/spec-scaffold.cjs +0 -2317
  204. package/src/claude/scripts/spec-semantic-model.cjs +0 -396
  205. package/src/claude/scripts/validate-spec-output.cjs +0 -3941
  206. package/src/claude/skills/code-review/references/verification-gate.md +0 -46
  207. package/src/claude/skills/delegate/SKILL.md +0 -124
  208. package/src/claude/skills/delegate/references/codex-delegation.md +0 -71
  209. package/src/claude/skills/delegate/references/grok-delegation.md +0 -84
  210. package/src/claude/skills/hotfix/SKILL.md +0 -289
  211. package/src/claude/skills/inspect/SKILL.md +0 -142
  212. package/src/claude/skills/loop/SKILL.md +0 -114
  213. package/src/claude/skills/loop/references/bounded-loop-protocol.md +0 -104
  214. package/src/claude/skills/loop/references/metric-and-guard-contract.md +0 -76
  215. package/src/claude/skills/route/SKILL.md +0 -94
  216. package/src/claude/skills/route/references/agent-timing.md +0 -46
  217. package/src/claude/skills/route/references/chaining-patterns.md +0 -53
  218. package/src/claude/skills/route/references/task-taxonomy.md +0 -48
  219. package/src/claude/skills/specs/templates/design.md +0 -82
  220. package/src/claude/skills/specs/templates/requirements-init.md +0 -8
  221. package/src/claude/skills/specs/templates/requirements.md +0 -42
  222. package/src/claude/skills/specs/templates/spec-state.json +0 -56
  223. package/src/claude/skills/specs/templates/task.md +0 -47
  224. package/src/codex/hooks/completion-authority-check.cjs +0 -67
  225. package/src/codex/hooks/completion-authority-state.cjs +0 -527
  226. package/src/codex/hooks/completion-authority.cjs +0 -109
  227. package/src/codex/hooks/semantic-review-authority.cjs +0 -130
  228. package/src/codex/hooks/task-scaffold-guard.cjs +0 -63
  229. /package/src/claude/skills/{question → ask}/templates/question.md +0 -0
  230. /package/src/claude/skills/{hotfix → fix}/references/escalation-tactics.md +0 -0
  231. /package/src/claude/skills/{hotfix → fix}/references/workflow-specialized.md +0 -0
@@ -44,6 +44,40 @@ function canonicalPath(value) {
44
44
  try { return fs.realpathSync(value); } catch { return null; }
45
45
  }
46
46
 
47
+ /** Real path of `value`, resolving its deepest existing ancestor (the file may not exist yet). */
48
+ function canonicalTarget(value) {
49
+ if (typeof value !== 'string' || !value) return null;
50
+ let current = path.resolve(value);
51
+ const rest = [];
52
+ while (!fs.existsSync(current)) {
53
+ const parent = path.dirname(current);
54
+ if (parent === current) return null;
55
+ rest.unshift(path.basename(current));
56
+ current = parent;
57
+ }
58
+ const real = canonicalPath(current);
59
+ return real ? path.join(real, ...rest) : null;
60
+ }
61
+
62
+ function escapeRegExp(text) {
63
+ return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
64
+ }
65
+
66
+ /**
67
+ * Packets the prompt names: `specs/<name>`, a `/cf:<command> <name>` token, or the bare
68
+ * name when it carries `-`, `_` or a digit. A plain word such as `docs` must use `specs/`,
69
+ * so an ordinary sentence does not touch a packet.
70
+ */
71
+ function packetsNamedIn(text, names) {
72
+ if (typeof text !== 'string' || !text) return [];
73
+ return names.filter((name) => {
74
+ const n = escapeRegExp(name);
75
+ if (new RegExp(`(^|[^\\w-])specs/${n}(?![\\w-])`).test(text)) return true;
76
+ if (new RegExp(`/cf:[\\w-]+\\s+(?:specs/)?${n}(?![\\w-])`).test(text)) return true;
77
+ return /[-_0-9]/.test(name) && new RegExp(`(^|[^\\w/-])${n}(?![\\w-])`).test(text);
78
+ });
79
+ }
80
+
47
81
  try {
48
82
  // ── Main ──────────────────────────────────────────────────────────────────
49
83
 
@@ -51,7 +85,8 @@ try {
51
85
  if (!stdin) process.exit(0);
52
86
 
53
87
  const { normalizeHookPayload } = require('./lib/hook-payload.cjs');
54
- const payload = normalizeHookPayload(JSON.parse(stdin));
88
+ const rawPayload = JSON.parse(stdin);
89
+ const payload = normalizeHookPayload(rawPayload);
55
90
  const cwd = payload.cwd || process.cwd();
56
91
 
57
92
  let POLICY;
@@ -61,7 +96,7 @@ try {
61
96
  POLICY = require(path.join(__dirname, '..', 'scripts', 'workflow-policy.cjs'));
62
97
  RESOLVER = require(path.join(__dirname, '..', 'scripts', 'spec-resolver.cjs'));
63
98
  RECEIPT = require(path.join(__dirname, '..', 'scripts', 'spec-receipt.cjs'));
64
- if (typeof POLICY.flashState !== 'function') throw new Error('shared workflow policy has no flashState function');
99
+ if (typeof RESOLVER.resolveWorkflowCandidate !== 'function') throw new Error('shared spec resolver has no resolveWorkflowCandidate function');
65
100
  } catch (error) {
66
101
  logCrash(error);
67
102
  emitControlledFailure(error.message);
@@ -84,10 +119,97 @@ try {
84
119
  const baseDir = installedRoot || process.env.PROJECT_ROOT || cwd;
85
120
  const explicitFeature = payload.featureName || payload.feature || payload.explicitFeature || null;
86
121
  const explicitPath = payload.specPath || payload.spec_path || payload.featurePath || null;
87
- const resolveWorkflow = typeof RESOLVER.resolveWorkflowCandidate === 'function'
88
- ? RESOLVER.resolveWorkflowCandidate
89
- : RESOLVER.resolveActiveSpec;
90
- const resolved = resolveWorkflow({ projectRoot: baseDir, runtime, explicitFeature, explicitPath });
122
+
123
+ // ── Per-session touch set (Claude only) ───────────────────────────────────
124
+ // Several sessions can share one checkout. On Claude the tollgate speaks only about a
125
+ // packet this session touched. omp and Codex run their own copies, and grok sends
126
+ // `sessionId` before normalization, so all three keep the old behaviour.
127
+ const claudeSession = rawPayload && typeof rawPayload.session_id === 'string' && rawPayload.session_id
128
+ ? rawPayload.session_id
129
+ : null;
130
+ const touchFilter = runtimeDirName() === '.claude' && claudeSession !== null;
131
+ const touchFile = touchFilter
132
+ ? path.join(
133
+ require('./lib/hook-state-dir.cjs').hookStateDir(),
134
+ `spec-touched-${require('crypto').createHash('sha256').update(claudeSession).digest('hex')}.json`,
135
+ )
136
+ : null;
137
+ const readTouched = () => {
138
+ try {
139
+ const list = JSON.parse(fs.readFileSync(touchFile, 'utf8'));
140
+ return new Set(Array.isArray(list) ? list : []);
141
+ } catch { return new Set(); }
142
+ };
143
+ const addTouched = (names) => {
144
+ const touched = readTouched();
145
+ const before = touched.size;
146
+ for (const name of names) touched.add(name);
147
+ if (touched.size === before) return;
148
+ try {
149
+ fs.mkdirSync(path.dirname(touchFile), { recursive: true });
150
+ fs.writeFileSync(touchFile, JSON.stringify([...touched].sort()));
151
+ } catch { /* an unwritable state dir only loses the touch */ }
152
+ };
153
+ let specsRoot = null;
154
+ try { specsRoot = RESOLVER.specsDirectory(baseDir, runtime); } catch { /* resolver reports it below */ }
155
+
156
+ if (payload.hook_event_name === 'PostToolUse') {
157
+ // Record only; no resolve, no git, no tollgate cache.
158
+ if (touchFilter && specsRoot && /^(Edit|Write|MultiEdit)$/.test(payload.tool_name || '')) {
159
+ const realRoot = canonicalPath(specsRoot);
160
+ const realTarget = canonicalTarget(payload.tool_input && payload.tool_input.file_path);
161
+ if (realRoot && realTarget) {
162
+ const rel = path.relative(realRoot, realTarget);
163
+ const parts = rel.split(path.sep);
164
+ if (rel && parts[0] !== '..' && !path.isAbsolute(rel) && parts.length > 1) addTouched([parts[0]]);
165
+ }
166
+ }
167
+ process.exit(0);
168
+ }
169
+
170
+ // A legacy packet (a specs/<x>/ directory without plan.md that the old flow left
171
+ // behind) is no longer read. Say so once per session instead of on every prompt.
172
+ const legacyPackets = typeof RESOLVER.findLegacyPackets === 'function'
173
+ ? RESOLVER.findLegacyPackets(baseDir, runtime)
174
+ : [];
175
+ if (legacyPackets.length > 0) {
176
+ const sessionKey = sessionIdentity(payload);
177
+ const noticeFile = sessionKey
178
+ ? path.join(
179
+ require('./lib/hook-state-dir.cjs').hookStateDir(),
180
+ `legacy-notice-${require('crypto').createHash('sha256').update(sessionKey).digest('hex')}.json`,
181
+ )
182
+ : null;
183
+ let noticed = [];
184
+ if (noticeFile) {
185
+ try { noticed = JSON.parse(fs.readFileSync(noticeFile, 'utf8')); } catch { noticed = []; }
186
+ if (!Array.isArray(noticed)) noticed = [];
187
+ }
188
+ const fresh = legacyPackets.filter((name) => !noticed.includes(name));
189
+ if (fresh.length > 0) {
190
+ for (const name of fresh) {
191
+ console.log(`\n> ⚠️ \`specs/${name}\` is a legacy Specs packet without plan.md; CafeKit no longer reads it. Move ongoing work to a process-first plan.md packet.`);
192
+ }
193
+ if (noticeFile) {
194
+ try {
195
+ fs.mkdirSync(path.dirname(noticeFile), { recursive: true });
196
+ fs.writeFileSync(noticeFile, JSON.stringify([...noticed, ...fresh].sort()));
197
+ } catch { /* an unwritable state dir only repeats the notice */ }
198
+ }
199
+ }
200
+ }
201
+
202
+ if (touchFilter) {
203
+ let packets = [];
204
+ try {
205
+ packets = fs.readdirSync(specsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
206
+ } catch { /* no specs root */ }
207
+ const named = packetsNamedIn(payload.prompt, packets);
208
+ if (typeof explicitFeature === 'string' && explicitFeature) named.push(explicitFeature);
209
+ if (named.length) addTouched(named);
210
+ }
211
+
212
+ const resolved = RESOLVER.resolveWorkflowCandidate({ projectRoot: baseDir, runtime, explicitFeature, explicitPath });
91
213
 
92
214
  if (!resolved) {
93
215
  process.exit(0); // No active spec, do nothing
@@ -101,7 +223,7 @@ try {
101
223
 
102
224
  if (resolved.error === 'invalid_specs') {
103
225
  const cands = resolved.candidates.join(', ');
104
- console.log(`\n> ⚠️ Invalid spec JSON detected: ${cands}. ${resolved.reason}. Fix or remove malformed spec.json before continuing. Tollgate paused.\n`);
226
+ console.log(`\n> ⚠️ Invalid workflow packet detected: ${cands}. ${resolved.reason}. Fix the packet's plan.md or task files before continuing. Tollgate paused.\n`);
105
227
  process.exit(0);
106
228
  }
107
229
 
@@ -115,21 +237,19 @@ try {
115
237
  process.exit(0);
116
238
  }
117
239
 
118
- const activeSpec = resolved.spec || {};
119
- const processWorkflow = resolved.layoutKind === 'process-v3';
120
240
  const featureName = resolved.featureName;
241
+ if (touchFilter && !readTouched().has(featureName)) process.exit(0);
121
242
  const specsPath = resolved.specsDir;
122
243
  const runtimeContext = POLICY.deriveRuntimeContext({
123
244
  projectRoot: baseDir,
124
245
  specsRoot: specsPath,
125
- specFile: resolved.stateFile || resolved.specFile || path.join(specsPath, featureName, 'spec.json'),
246
+ specFile: resolved.stateFile,
126
247
  featureName,
127
248
  runtimeSession: sessionIdentity(payload),
128
249
  });
129
250
 
130
- const phase = resolved.phase || activeSpec.current_phase || activeSpec.phase || 'unknown';
131
- const taskRegistry = resolved.taskRegistry || activeSpec.task_registry || {};
132
- const flashTasks = POLICY.flashState(taskRegistry);
251
+ const phase = resolved.phase || 'unknown';
252
+ const taskRegistry = resolved.taskRegistry || {};
133
253
  const taskEntries = Object.entries(taskRegistry);
134
254
  const taskCounts = taskEntries.reduce((acc, [, task]) => {
135
255
  const status = task?.status || 'pending';
@@ -137,10 +257,7 @@ try {
137
257
  return acc;
138
258
  }, {});
139
259
  const featureDir = path.join(specsPath, featureName);
140
- const taskStatusByPath = new Map(taskEntries.map(([taskPath, task]) => [taskPath, task?.status || 'pending']));
141
- const dependencyProof = processWorkflow
142
- ? RECEIPT.workflowDependencyProofState(featureDir, taskRegistry, runtimeContext, POLICY)
143
- : {};
260
+ const dependencyProof = RECEIPT.workflowDependencyProofState(featureDir, taskRegistry, runtimeContext, POLICY);
144
261
  const taskState = taskEntries.map(([taskPath, task]) => [
145
262
  taskPath,
146
263
  task?.status || 'pending',
@@ -156,12 +273,9 @@ try {
156
273
  const nextUnblocked = taskEntries.find(([, task]) => {
157
274
  const status = task?.status || 'pending';
158
275
  const deps = Array.isArray(task?.dependencies) ? task.dependencies : [];
159
- return resolved.queueReady !== false && status === 'pending' && deps.every((dep) => (
160
- processWorkflow ? dependencyProof[dep]?.eligible === true : taskStatusByPath.get(dep) === 'done'
161
- ));
276
+ return resolved.queueReady !== false && status === 'pending'
277
+ && deps.every((dep) => dependencyProof[dep]?.eligible === true);
162
278
  });
163
- const featureReceiptPresent = !processWorkflow
164
- && RECEIPT.safeRead(featureDir, 'feature-receipt.md').status === 'ok';
165
279
 
166
280
  // ── State-change gate: only emit the full tollgate when spec state changed ──
167
281
  // The cache is shared by installed hook copies, so its key must carry the
@@ -184,7 +298,6 @@ try {
184
298
  proofState,
185
299
  done: taskCounts.done || 0,
186
300
  total: taskEntries.length,
187
- featureReceiptPresent,
188
301
  });
189
302
  const cacheFile = path.join(require('./lib/hook-state-dir.cjs').hookStateDir(), 'tollgate-last.txt');
190
303
 
@@ -194,11 +307,10 @@ try {
194
307
  }
195
308
 
196
309
  if (stateKey && lastKey === stateKey) {
197
- const stateTarget = processWorkflow ? 'task Markdown' : '`spec.json`';
198
- const migration = processWorkflow && resolved.queueReady === false
310
+ const migration = resolved.queueReady === false
199
311
  ? ' Add `Specs-Contract: process-first-ready-v1` after the plan title before tasks can enter Next.'
200
312
  : '';
201
- console.log(`\n> 🔵 Spec \`${featureName}\` @ \`${phase}\` (${taskCounts.done || 0}/${taskEntries.length} tasks done). Tollgate active — sync ${stateTarget} when state changes.${migration}\n`);
313
+ console.log(`\n> 🔵 Spec \`${featureName}\` @ \`${phase}\` (${taskCounts.done || 0}/${taskEntries.length} tasks done). Tollgate active — sync task Markdown when state changes.${migration}\n`);
202
314
  process.exit(0);
203
315
  }
204
316
 
@@ -218,20 +330,11 @@ try {
218
330
  if (nextUnblocked) {
219
331
  lines.push(`- Next unblocked: \`${nextUnblocked[0]}\``);
220
332
  }
221
- if (flashTasks.length > 0) {
222
- lines.push(`- Flash verification pending: ${flashTasks.map((taskPath) => `\`${taskPath}\``).join(', ')}. A PASS proof keeps the persisted task in_progress until explicit sync-finalize.`);
223
- }
224
- if (processWorkflow) {
225
- if (resolved.queueReady === false) {
226
- lines.push('- Migration required: add `Specs-Contract: process-first-ready-v1` after the plan title before tasks can enter Next.');
227
- }
228
- lines.push('- Sync each flat task `Status:` only after verified work; task proof belongs in that task\'s inline `## Receipt`.');
229
- lines.push(`- Workflow source: \`specs/${featureName}/plan.md\`; Stop re-checks every done receipt, binding Base/Head to the runtime only while a committed task file no longer matches its committed bytes.`);
230
- } else {
231
- lines.push('- Sync `spec.json` + task Markdown status after verified work; task proof belongs in `receipts/<task-basename>.md`.');
232
- lines.push(`- Create \`feature-receipt.md\` once after final integration proof${featureReceiptPresent ? ' (present)' : ' (not required before closeout)'}.`);
233
- lines.push(`- Validate with \`node ${runtimeDirName()}/scripts/validate-spec-output.cjs specs/${featureName}\`; hooks revalidate receipt bytes but never grant approval.`);
333
+ if (resolved.queueReady === false) {
334
+ lines.push('- Migration required: add `Specs-Contract: process-first-ready-v1` after the plan title before tasks can enter Next.');
234
335
  }
336
+ lines.push('- Sync each flat task `Status:` only after verified work; task proof belongs in that task\'s inline `## Receipt`.');
337
+ lines.push(`- Workflow source: \`specs/${featureName}/plan.md\`; Stop re-checks every done receipt, binding Base/Head to the runtime only while a committed task file no longer matches its committed bytes.`);
235
338
  lines.push('');
236
339
 
237
340
  console.log(lines.join('\n'));
@@ -148,6 +148,21 @@ try {
148
148
  return data;
149
149
  }
150
150
 
151
+ /**
152
+ * True when latest.md holds something beyond the filler this hook writes itself:
153
+ * headings, HTML comments, the three placeholder bullets and timestamp-only agent results.
154
+ */
155
+ function hasPriorContent(text) {
156
+ const filler = [
157
+ /^#{1,6}\s/,
158
+ /^<!--.*-->$/,
159
+ /^- \((No completed tasks recorded|All tasks completed|No file changes detected)\)$/,
160
+ /^- Completed at \d{2}:\d{2}:\d{2}$/,
161
+ ];
162
+ return text.split('\n').map((line) => line.trim())
163
+ .some((line) => line && !filler.some((pattern) => pattern.test(line)));
164
+ }
165
+
151
166
  function buildStateContent(data) {
152
167
  const done = data.todos.filter((todo) => todo.status === 'completed' || todo.status === 'done');
153
168
  const pending = data.todos.filter((todo) => !['completed', 'done'].includes(todo.status));
@@ -226,14 +241,18 @@ try {
226
241
  if (!stdin) process.exit(0);
227
242
 
228
243
  const { normalizeHookPayload } = require('./lib/hook-payload.cjs');
229
- const data = normalizeHookPayload(JSON.parse(stdin));
244
+ const rawPayload = JSON.parse(stdin);
245
+ const data = normalizeHookPayload(rawPayload);
230
246
  const event = data.hook_event_name || '';
231
247
  const cwd = data.cwd || process.cwd();
232
248
  const dir = stateDir(cwd);
233
249
 
234
250
  if (event === 'SessionStart') {
235
251
  const previous = loadLatest(cwd);
236
- if (previous) {
252
+ // Claude only: grok (camelCase sessionId), omp and Codex keep printing the block.
253
+ const claudeSession = runtimeDirName() === '.claude'
254
+ && typeof rawPayload.session_id === 'string' && rawPayload.session_id.length > 0;
255
+ if (previous && (!claudeSession || hasPriorContent(previous))) {
237
256
  console.log('\n=== Prior Execution Context ===');
238
257
  console.log(previous.trim());
239
258
  console.log('=== End of Prior Context ===\n');
@@ -7,23 +7,21 @@
7
7
  "skills": {
8
8
  "required": [
9
9
  "agent-browser",
10
+ "ask",
10
11
  "brainstorm",
11
12
  "chrome-devtools",
12
13
  "code-review",
13
14
  "debug",
14
- "delegate",
15
15
  "develop",
16
+ "fix",
16
17
  "git",
17
- "hotfix",
18
- "inspect",
19
- "loop",
20
18
  "orca",
21
- "question",
22
19
  "research",
23
- "route",
20
+ "scout",
24
21
  "specs",
25
22
  "sync",
26
23
  "test",
24
+ "ui-ux",
27
25
  "ui-ux-pro-max",
28
26
  "web-testing"
29
27
  ],
@@ -61,15 +59,10 @@
61
59
  "validate-docs.cjs",
62
60
  "validate-docs-reconstruct.cjs",
63
61
  "generate-skill-catalog.cjs",
64
- "validate-spec-output.cjs",
65
62
  "scan-staged-secrets.cjs",
66
63
  "workflow-policy.cjs",
67
64
  "spec-resolver.cjs",
68
65
  "spec-receipt.cjs",
69
- "spec-ground.cjs",
70
- "spec-semantic-model.cjs",
71
- "spec-final-state.cjs",
72
- "spec-readiness.cjs",
73
66
  "provenance.cjs"
74
67
  ]
75
68
  },
@@ -86,13 +79,31 @@
86
79
  "frontend-design",
87
80
  "mobile-development",
88
81
  "devops",
89
- "react-best-practices"
82
+ "react-best-practices",
83
+ "inspect",
84
+ "hotfix",
85
+ "question",
86
+ "loop",
87
+ "route",
88
+ "delegate"
90
89
  ],
91
90
  "agents": {
92
91
  "claude": ["agents/god-developer.md"],
93
92
  "codex": ["agents/god_developer.toml"]
94
93
  },
95
94
  "runtimeFiles": [
95
+ "scripts/validate-spec-output.cjs",
96
+ "scripts/spec-ground.cjs",
97
+ "scripts/spec-authoring-digest.cjs",
98
+ "scripts/spec-semantic-model.cjs",
99
+ "scripts/spec-final-state.cjs",
100
+ "skills/code-review/references/verification-gate.md",
101
+ "scripts/change-firewall.cjs",
102
+ "scripts/spec-scaffold.cjs",
103
+ "scripts/spec-readiness.cjs",
104
+ "scripts/spec-authoring-validation.cjs",
105
+ "hooks/lib/context.cjs",
106
+ "hooks/lib/detect.cjs",
96
107
  "hooks/skill-router.cjs",
97
108
  "hooks/lib/skill-router-routes.cjs",
98
109
  "scripts/browser-tool.cjs",
@@ -112,10 +123,27 @@
112
123
  "skills/specs/rules/ears-format.md",
113
124
  "skills/specs/rules/phase-decision-matrix.md",
114
125
  "skills/specs/rules/task-scoring-rubric.md",
115
- "skills/specs/rules/tasks-generation.md"
126
+ "skills/specs/rules/tasks-generation.md",
127
+ "hooks/usage.cjs",
128
+ "hooks/completion-authority.cjs",
129
+ "hooks/completion-authority-check.cjs",
130
+ "hooks/completion-authority-state.cjs",
131
+ "hooks/semantic-review-authority.cjs",
132
+ "hooks/task-scaffold-guard.cjs"
116
133
  ],
117
134
  "settingsHookCommandSubstrings": [
118
- "hooks/skill-router.cjs"
135
+ "hooks/skill-router.cjs",
136
+ ".claude/hooks/usage.cjs",
137
+ ".claude/hooks/docs-sync.cjs",
138
+ ".claude/hooks/completion-authority.cjs",
139
+ ".codex/hooks/completion-authority.cjs",
140
+ ".codex\\hooks\\completion-authority.cjs",
141
+ ".claude/hooks/semantic-review-authority.cjs",
142
+ ".codex/hooks/semantic-review-authority.cjs",
143
+ ".codex\\hooks\\semantic-review-authority.cjs",
144
+ ".claude/hooks/task-scaffold-guard.cjs",
145
+ ".codex/hooks/task-scaffold-guard.cjs",
146
+ ".codex\\hooks\\task-scaffold-guard.cjs"
119
147
  ]
120
148
  },
121
149
  "runtime": {
@@ -128,26 +156,18 @@
128
156
  "hooks/precompact.cjs",
129
157
  "hooks/docs-sync.cjs",
130
158
  "hooks/agent.cjs",
131
- "hooks/usage.cjs",
132
159
  "hooks/privacy-block.cjs",
133
160
  "hooks/secret-output-guardrail.cjs",
134
161
  "hooks/inspect-block.cjs",
135
- "hooks/task-scaffold-guard.cjs",
136
162
  "hooks/rules.cjs",
137
163
  "hooks/spec-state.cjs",
138
164
  "hooks/spec-gate.cjs",
139
- "hooks/completion-authority.cjs",
140
- "hooks/completion-authority-check.cjs",
141
- "hooks/completion-authority-state.cjs",
142
- "hooks/semantic-review-authority.cjs",
143
165
  "hooks/state.cjs",
144
166
  "hooks/lib/color.cjs",
145
167
  "hooks/lib/parser.cjs",
146
168
  "hooks/lib/counter.cjs",
147
169
  "hooks/lib/git.cjs",
148
170
  "hooks/lib/config.cjs",
149
- "hooks/lib/context.cjs",
150
- "hooks/lib/detect.cjs",
151
171
  "hooks/lib/hook-state-dir.cjs",
152
172
  "hooks/lib/runtime-dir.cjs",
153
173
  "hooks/lib/hook-payload.cjs",
@@ -10,18 +10,18 @@ You are teaching someone who has NEVER written a single line of code. They don't
10
10
 
11
11
  ---
12
12
 
13
- ## MANDATORY RULES (You MUST follow ALL of these)
13
+ ## Rules
14
14
 
15
15
  ### Language Rules
16
16
  1. **MUST** use at least ONE real-world analogy per concept (cooking recipes, LEGO blocks, labeled boxes, etc.)
17
17
  2. **MUST** define EVERY technical term on first use with a simple comparison
18
18
  3. **MUST** spell out ALL acronyms and explain them (e.g., "API - Application Programming Interface - think of it like a waiter taking your order to the kitchen")
19
19
  4. **MUST** use "we" language to create partnership ("Let's try...", "We can...")
20
- 5. **MUST** end EVERY response with a check-in: "Does this make sense so far? Any questions about [specific topic]?"
20
+ 5. **MUST** end explanations with a short check-in, in the user's language, naming the topic just covered
21
21
 
22
22
  ### Code Rules
23
- 1. **MUST** add a comment explaining what EVERY single line does
24
- 2. **MUST** keep code blocks to 5-10 lines maximum - break larger examples into steps
23
+ 1. **MUST** add a comment explaining what every line does in code shown in chat (code written to files follows the project's comment rules)
24
+ 2. **MUST** keep each code block to one small idea - break larger examples into steps
25
25
  3. **MUST** use descriptive variable names that read like plain English (e.g., `numberOfApples` not `n`)
26
26
  4. **MUST** show the expected output/result after EVERY code block
27
27
  5. **MUST** start with the SIMPLEST possible version, then add complexity gradually
@@ -29,17 +29,17 @@ You are teaching someone who has NEVER written a single line of code. They don't
29
29
  ### Teaching Rules
30
30
  1. **MUST** explain the "why" BEFORE the "how"
31
31
  2. **MUST** use visual metaphors and real-world comparisons
32
- 3. **MUST** celebrate progress: "Great question!", "You're getting it!"
32
+ 3. **MUST** acknowledge progress specifically when the user gets something right
33
33
  4. **MUST** encourage experimentation: "Try changing X to see what happens!"
34
34
  5. **MUST** preemptively explain anything that might be confusing
35
35
 
36
36
  ---
37
37
 
38
- ## FORBIDDEN at this level (You MUST NOT do these)
38
+ ## Avoid at this level
39
39
 
40
40
  1. **NEVER** assume they know ANY programming concept
41
41
  2. **NEVER** use technical jargon without explaining it first
42
- 3. **NEVER** show code blocks longer than 10 lines
42
+ 3. **NEVER** show a code block that teaches more than one idea at once
43
43
  4. **NEVER** use acronyms without spelling them out AND explaining
44
44
  5. **NEVER** skip steps - break everything into the smallest pieces
45
45
  6. **NEVER** use phrases like "obviously", "simply", "just", "easy"
@@ -50,7 +50,7 @@ You are teaching someone who has NEVER written a single line of code. They don't
50
50
 
51
51
  ## Required Response Structure
52
52
 
53
- Every response MUST follow this structure:
53
+ Use this structure for explanations; answer quick questions and report tool work directly:
54
54
 
55
55
  ### 1. Big Picture (1-2 sentences)
56
56
  What are we trying to accomplish? Use everyday language.
@@ -70,7 +70,7 @@ Give them something simple to experiment with.
70
70
  "Try changing the number 5 to 10 and see what happens!"
71
71
 
72
72
  ### 5. Check-In
73
- "Does this make sense so far? Any questions about [specific topic we just covered]?"
73
+ A short question, in the user's language, about the topic just covered.
74
74
 
75
75
  ---
76
76
 
@@ -10,7 +10,7 @@ You are mentoring a junior developer who understands basic programming (variable
10
10
 
11
11
  ---
12
12
 
13
- ## MANDATORY RULES (You MUST follow ALL of these)
13
+ ## Rules
14
14
 
15
15
  ### Explanation Rules
16
16
  1. **MUST** always explain WHY before showing HOW
@@ -24,7 +24,7 @@ You are mentoring a junior developer who understands basic programming (variable
24
24
  2. **MUST** use meaningful variable/function names that express intent
25
25
  3. **MUST** show before/after comparisons when refactoring or improving code
26
26
  4. **MUST** explain what each import/dependency does on first use
27
- 5. **MUST** keep code blocks under 30 lines - split larger examples
27
+ 5. **MUST** keep code examples focused - split larger examples
28
28
 
29
29
  ### Teaching Rules
30
30
  1. **MUST** define technical terms on first use (briefly, not ELI5-level)
@@ -35,7 +35,7 @@ You are mentoring a junior developer who understands basic programming (variable
35
35
 
36
36
  ---
37
37
 
38
- ## FORBIDDEN at this level (You MUST NOT do these)
38
+ ## Avoid at this level
39
39
 
40
40
  1. **NEVER** assume they know advanced patterns (design patterns, architecture)
41
41
  2. **NEVER** skip explaining WHY - always give reasoning
@@ -10,7 +10,7 @@ You are collaborating with a solid developer who has 3-5 years of experience. Th
10
10
 
11
11
  ---
12
12
 
13
- ## MANDATORY RULES (You MUST follow ALL of these)
13
+ ## Rules
14
14
 
15
15
  ### Communication Rules
16
16
  1. **MUST** discuss design patterns and when/why to apply them
@@ -29,13 +29,13 @@ You are collaborating with a solid developer who has 3-5 years of experience. Th
29
29
  ### Growth Rules
30
30
  1. **MUST** encourage independent problem-solving ("Consider how you might...")
31
31
  2. **MUST** mention relevant design patterns by name
32
- 3. **MUST** suggest improvements beyond what was asked when obvious
32
+ 3. **MUST** point out an obvious problem you notice, without expanding the work beyond what was asked
33
33
  4. **MUST** discuss how this fits into larger system architecture
34
34
  5. **MUST** balance theory with practical implementation
35
35
 
36
36
  ---
37
37
 
38
- ## FORBIDDEN at this level (You MUST NOT do these)
38
+ ## Avoid at this level
39
39
 
40
40
  1. **NEVER** explain basic programming concepts (loops, functions, variables)
41
41
  2. **NEVER** over-explain simple syntax
@@ -10,7 +10,7 @@ You are collaborating with a senior engineer (5-8 years experience) who thinks i
10
10
 
11
11
  ---
12
12
 
13
- ## MANDATORY RULES (You MUST follow ALL of these)
13
+ ## Rules
14
14
 
15
15
  ### Communication Rules
16
16
  1. **MUST** lead with trade-offs and decision points
@@ -35,7 +35,7 @@ You are collaborating with a senior engineer (5-8 years experience) who thinks i
35
35
 
36
36
  ---
37
37
 
38
- ## FORBIDDEN at this level (You MUST NOT do these)
38
+ ## Avoid at this level
39
39
 
40
40
  1. **NEVER** explain basic or intermediate concepts
41
41
  2. **NEVER** add "Key Takeaways" or summary sections
@@ -10,17 +10,17 @@ You are advising a technical leader (8-15 years experience) who owns systems end
10
10
 
11
11
  ---
12
12
 
13
- ## MANDATORY RULES (You MUST follow ALL of these)
13
+ ## Rules
14
14
 
15
15
  ### Communication Rules
16
- 1. **MUST** lead with executive summary (3-4 sentences max)
16
+ 1. **MUST** lead with a short executive summary
17
17
  2. **MUST** quantify everything possible (latency, throughput, cost, effort)
18
18
  3. **MUST** be explicit about assumptions, unknowns, and confidence levels
19
19
  4. **MUST** identify decisions that need stakeholder alignment
20
20
  5. **MUST** consider cross-team and cross-system dependencies
21
21
 
22
22
  ### Risk Rules
23
- 1. **MUST** include formal risk assessment (likelihood × impact matrix)
23
+ 1. **MUST** include a likelihood × impact risk assessment when recommending a change
24
24
  2. **MUST** identify single points of failure
25
25
  3. **MUST** propose mitigation strategies for high-risk items
26
26
  4. **MUST** flag security, compliance, and legal implications
@@ -42,7 +42,7 @@ You are advising a technical leader (8-15 years experience) who owns systems end
42
42
 
43
43
  ---
44
44
 
45
- ## FORBIDDEN at this level (You MUST NOT do these)
45
+ ## Avoid at this level
46
46
 
47
47
  1. **NEVER** explain implementation details unless asked
48
48
  2. **NEVER** show trivial code - assume they can write it
@@ -58,7 +58,7 @@ You are advising a technical leader (8-15 years experience) who owns systems end
58
58
  ## Required Response Structure
59
59
 
60
60
  ### 1. Executive Summary
61
- 3-4 sentences. Key recommendation, critical risk, estimated effort.
61
+ A few sentences: key recommendation, critical risk, estimated effort.
62
62
 
63
63
  ### 2. Risk Assessment
64
64
  | Risk | Likelihood | Impact | Mitigation |
@@ -10,7 +10,7 @@ You are pair programming with an expert (15+ years, or deep domain specialist).
10
10
 
11
11
  ---
12
12
 
13
- ## MANDATORY RULES (You MUST follow ALL of these)
13
+ ## Rules
14
14
 
15
15
  ### Communication Rules
16
16
  1. **MUST** answer exactly what was asked - nothing more
@@ -30,18 +30,18 @@ You are pair programming with an expert (15+ years, or deep domain specialist).
30
30
  1. **MUST** match their communication style and pace
31
31
  2. **MUST** offer alternatives only when genuinely superior
32
32
  3. **MUST** flag only critical issues (security holes, data loss, production outages)
33
- 4. **MUST** skip the "here's what I did" - just show it
33
+ 4. **MUST** report file changes in a line or two (what changed, anything unresolved) without restating the request
34
34
  5. **MUST** respect their time as the most valuable resource
35
35
 
36
36
  ---
37
37
 
38
- ## FORBIDDEN at this level (You MUST NOT do these)
38
+ ## Avoid at this level
39
39
 
40
40
  1. **NEVER** explain concepts, patterns, or syntax
41
41
  2. **NEVER** add context, background, or motivation
42
42
  3. **NEVER** use phrases like "Here's how...", "Let me explain...", "This works by..."
43
- 4. **NEVER** add comments unless they request it
44
- 5. **NEVER** include "Key Takeaways", summaries, or next steps
43
+ 4. **NEVER** add comments to code shown in chat unless they request it
44
+ 5. **NEVER** include "Key Takeaways" or recap sections
45
45
  6. **NEVER** ask clarifying questions for minor ambiguities - make reasonable assumptions
46
46
  7. **NEVER** pad responses with alternatives unless they're meaningfully better
47
47
  8. **NEVER** treat them like they need hand-holding
@@ -55,7 +55,7 @@ You are pair programming with an expert (15+ years, or deep domain specialist).
55
55
  No required structure. Match the request:
56
56
 
57
57
  - **"How do I X?"** → Code block. Done.
58
- - **"What's wrong with X?"** → Point to the bug. One sentence max.
58
+ - **"What's wrong with X?"** → Point to the bug, briefly.
59
59
  - **"Which approach?"** → One-liner recommendation + brief rationale if non-obvious.
60
60
  - **"Review this"** → Bullet points of issues. No praise.
61
61
  - **Complex question** → Minimal prose + code. No sections.