wogiflow 2.26.2 → 2.29.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 (164) hide show
  1. package/.claude/commands/wogi-bug.md +30 -0
  2. package/.claude/commands/wogi-debug-hypothesis.md +33 -0
  3. package/.claude/commands/wogi-morning.md +1 -2
  4. package/.claude/commands/wogi-review.md +31 -2
  5. package/.claude/commands/wogi-start.md +32 -0
  6. package/.claude/commands/wogi-statusline-setup.md +12 -0
  7. package/.claude/commands/wogi-story.md +3 -2
  8. package/.claude/docs/claude-code-compatibility.md +40 -0
  9. package/.claude/docs/phases/01-explore.md +2 -1
  10. package/.claude/docs/phases/03-implement.md +4 -0
  11. package/.claude/docs/phases/04-verify.md +45 -0
  12. package/.claude/rules/README.md +36 -0
  13. package/.claude/rules/_internal/worker-tool-first-turn.md +82 -0
  14. package/.claude/rules/alternative-execpolicy-toml-command-policy.md +11 -0
  15. package/.claude/rules/alternative-hand-edit-ready-json-to-register-orpha.md +11 -0
  16. package/.claude/rules/alternative-permission-ruleset-per-phase.md +11 -0
  17. package/.claude/rules/alternative-short-name.md +12 -0
  18. package/.claude/rules/alternative-wogi-flow-as-mcp-client-oauth-manager.md +11 -0
  19. package/.claude/rules/architecture/hook-three-layer.md +68 -0
  20. package/.claude/rules/dual-repo-architecture-2026-02-28.md +18 -0
  21. package/.claude/rules/github-release-workflow-2026-01-30.md +16 -0
  22. package/.claude/settings.json +1 -1
  23. package/.workflow/agents/logic-adversary.md +2 -1
  24. package/.workflow/agents/personas/README.md +48 -0
  25. package/.workflow/agents/personas/platform-rigor.md +38 -0
  26. package/.workflow/agents/personas/scale-skeptic.md +28 -0
  27. package/.workflow/agents/personas/security-hawk.md +34 -0
  28. package/.workflow/agents/personas/simplicity-champion.md +37 -0
  29. package/.workflow/agents/personas/user-advocate.md +36 -0
  30. package/.workflow/bridges/base-bridge.js +46 -23
  31. package/.workflow/templates/claude-md.hbs +44 -122
  32. package/.workflow/templates/partials/feature-dossiers.hbs +33 -0
  33. package/.workflow/templates/partials/intent-grounded-reasoning.hbs +2 -12
  34. package/.workflow/templates/partials/methodology-rules.hbs +85 -79
  35. package/.workflow/templates/tier3-dom-field-inventory.md +102 -0
  36. package/lib/fuzzy-patch.js +251 -0
  37. package/lib/installer.js +8 -0
  38. package/lib/memory-proposal-store.js +458 -0
  39. package/lib/mode-schema.js +255 -0
  40. package/lib/skill-proposal-store.js +432 -0
  41. package/lib/skill-registry.js +1 -1
  42. package/lib/wogi-claude +84 -9
  43. package/lib/wogi-claude-expect.exp +113 -76
  44. package/lib/workspace-channel-server.js +19 -0
  45. package/lib/workspace-contracts.js +1 -1
  46. package/lib/workspace-dispatch-tracking.js +144 -0
  47. package/lib/workspace-gates.js +1 -1
  48. package/lib/workspace-ipc-sqlite.js +550 -0
  49. package/lib/workspace-messages.js +92 -0
  50. package/lib/workspace-routing.js +1 -1
  51. package/lib/workspace-task-injector.js +223 -0
  52. package/lib/workspace.js +23 -0
  53. package/lib/worktree-review.js +315 -0
  54. package/package.json +2 -2
  55. package/scripts/base-workflow-step.js +1 -1
  56. package/scripts/flow +28 -4
  57. package/scripts/flow-ac-scope-preservation.js +238 -0
  58. package/scripts/flow-auto-review-worker.js +75 -0
  59. package/scripts/flow-auto-review.js +102 -0
  60. package/scripts/flow-autonomous-detector.js +118 -0
  61. package/scripts/flow-autonomous-mode.js +153 -0
  62. package/scripts/flow-best-of-n.js +1 -1
  63. package/scripts/flow-bulk-loop.js +1 -1
  64. package/scripts/flow-checkpoint.js +2 -6
  65. package/scripts/flow-community-sync.js +1 -1
  66. package/scripts/flow-completion-summary.js +176 -0
  67. package/scripts/flow-completion-truth-gate.js +343 -4
  68. package/scripts/flow-config-defaults.js +52 -5
  69. package/scripts/flow-context-compact/expander.js +1 -1
  70. package/scripts/flow-context-compact/section-extractor.js +2 -2
  71. package/scripts/flow-context-gatherer.js +1 -1
  72. package/scripts/flow-context-generator.js +1 -1
  73. package/scripts/flow-context-scoring.js +1 -1
  74. package/scripts/flow-correct.js +1 -1
  75. package/scripts/flow-decision-authority.js +66 -15
  76. package/scripts/flow-done.js +33 -1
  77. package/scripts/flow-epic-cascade.js +171 -0
  78. package/scripts/flow-epics.js +2 -7
  79. package/scripts/flow-eval-judge.js +1 -1
  80. package/scripts/flow-eval.js +1 -1
  81. package/scripts/flow-export-scanner.js +2 -6
  82. package/scripts/flow-failure-learning.js +1 -1
  83. package/scripts/flow-feature-dossier.js +787 -0
  84. package/scripts/flow-figma-extract.js +2 -2
  85. package/scripts/flow-figma-generate.js +1 -1
  86. package/scripts/flow-gate-confidence.js +1 -1
  87. package/scripts/flow-health.js +52 -1
  88. package/scripts/flow-hooks.js +1 -1
  89. package/scripts/flow-id.js +19 -3
  90. package/scripts/flow-instruction-richness.js +1 -1
  91. package/scripts/flow-knowledge-router.js +1 -1
  92. package/scripts/flow-knowledge-sync.js +1 -1
  93. package/scripts/flow-logic-adversary.js +76 -1
  94. package/scripts/flow-logic-rules.js +380 -0
  95. package/scripts/flow-long-input.js +5 -5
  96. package/scripts/flow-memory-sync.js +1 -1
  97. package/scripts/flow-memory.js +78 -7
  98. package/scripts/flow-migrate.js +1 -1
  99. package/scripts/flow-model-caller.js +1 -1
  100. package/scripts/flow-models.js +2 -2
  101. package/scripts/flow-morning.js +0 -17
  102. package/scripts/flow-multi-approach.js +1 -1
  103. package/scripts/flow-orchestrate-context.js +4 -4
  104. package/scripts/flow-orchestrate-templates.js +1 -1
  105. package/scripts/flow-orchestrate.js +8 -8
  106. package/scripts/flow-peer-review.js +1 -1
  107. package/scripts/flow-phase.js +9 -0
  108. package/scripts/flow-proactive-compact.js +1 -1
  109. package/scripts/flow-providers.js +1 -1
  110. package/scripts/flow-question-queue.js +255 -0
  111. package/scripts/flow-repo-map.js +312 -0
  112. package/scripts/flow-review-passes/index.js +1 -1
  113. package/scripts/flow-review-passes/integration.js +1 -1
  114. package/scripts/flow-review-passes/structure.js +1 -1
  115. package/scripts/flow-revision-tracker.js +1 -1
  116. package/scripts/flow-section-resolver.js +1 -1
  117. package/scripts/flow-session-end.js +74 -5
  118. package/scripts/flow-session-state.js +103 -1
  119. package/scripts/flow-setup-hooks.js +1 -1
  120. package/scripts/flow-skeptical-evaluator.js +274 -0
  121. package/scripts/flow-skill-generator.js +3 -3
  122. package/scripts/flow-skill-learn.js +3 -6
  123. package/scripts/flow-skill-manage.js +248 -0
  124. package/scripts/flow-spec-verifier.js +1 -1
  125. package/scripts/flow-standards-checker.js +75 -0
  126. package/scripts/flow-standards-gate.js +1 -1
  127. package/scripts/flow-statusline-setup.js +8 -2
  128. package/scripts/flow-step-changelog.js +2 -2
  129. package/scripts/flow-step-coverage.js +1 -1
  130. package/scripts/flow-step-knowledge.js +1 -1
  131. package/scripts/flow-step-regression.js +1 -1
  132. package/scripts/flow-step-simplifier.js +1 -1
  133. package/scripts/flow-task-analyzer.js +1 -1
  134. package/scripts/flow-task-classifier.js +1 -1
  135. package/scripts/flow-task-enforcer.js +1 -1
  136. package/scripts/flow-template-extractor.js +1 -1
  137. package/scripts/flow-trap-zone.js +1 -1
  138. package/scripts/flow-utils.js +4 -0
  139. package/scripts/flow-worker-question-classifier.js +51 -5
  140. package/scripts/flow-workspace-migrate-ipc.js +216 -0
  141. package/scripts/flow-workspace-summary.js +256 -0
  142. package/scripts/hooks/adapters/base-adapter.js +2 -2
  143. package/scripts/hooks/core/feature-dossier-gate.js +194 -0
  144. package/scripts/hooks/core/observation-capture.js +24 -0
  145. package/scripts/hooks/core/overdue-dispatches.js +20 -1
  146. package/scripts/hooks/core/phase-gate.js +15 -1
  147. package/scripts/hooks/core/phase-transition-auto-review.js +61 -0
  148. package/scripts/hooks/core/post-compact.js +5 -2
  149. package/scripts/hooks/core/pre-tool-orchestrator.js +21 -0
  150. package/scripts/hooks/core/routing-gate.js +58 -0
  151. package/scripts/hooks/core/session-context.js +108 -0
  152. package/scripts/hooks/core/session-end-memory-proposals.js +65 -0
  153. package/scripts/hooks/core/session-end-skill-proposals.js +58 -0
  154. package/scripts/hooks/core/session-end.js +25 -0
  155. package/scripts/hooks/core/setup-handler.js +1 -1
  156. package/scripts/hooks/core/task-boundary-reset.js +110 -4
  157. package/scripts/hooks/core/worker-boundary-gate.js +71 -0
  158. package/scripts/hooks/core/worker-tool-first-gate.js +275 -0
  159. package/scripts/hooks/entry/claude-code/post-tool-use.js +2 -2
  160. package/scripts/hooks/entry/claude-code/pre-tool-use.js +7 -2
  161. package/scripts/hooks/entry/claude-code/session-start.js +74 -30
  162. package/scripts/hooks/entry/claude-code/stop.js +47 -1
  163. package/scripts/hooks/entry/claude-code/user-prompt-submit.js +17 -0
  164. package/.workflow/templates/partials/user-commands.hbs +0 -20
@@ -17,19 +17,19 @@ You are an AI development assistant using the WogiFlow methodology v1.0. This is
17
17
 
18
18
  This applies to ALL message types — implementation, questions, conversations, exploration, research, operational requests. You do NOT handle requests directly.
19
19
 
20
- **Anti-Rationalization Checklist** — If ANY of these thoughts cross your mind, you are about to bypass routing:
20
+ **Anti-Rationalization Checklist** — if any of these thoughts cross your mind, you are about to bypass routing. This is the **master checklist** referenced by all anti-rationalization rules below:
21
21
  - "This is just a question, I can handle it directly" → WRONG. Route through `/wogi-start`.
22
- - "I already know the answer from context" → WRONG. Confidence is not permission. Route through `/wogi-start`.
22
+ - "I already know the answer from context / compaction summary" → WRONG. Confidence is not permission.
23
23
  - "This is a conversation, not an implementation" → WRONG. Conversation mode is a classification INSIDE `/wogi-start`, not an exemption from it.
24
- - "I'm continuing prior work" → WRONG. Every new user message requires routing. Invoke `/wogi-start` with the task ID.
25
- - "The user just said yes/continue" → Route through `/wogi-start` which handles follow-ups.
24
+ - "I'm continuing prior work" / "user just said yes/continue" → WRONG. Every new user message requires routing. Invoke `/wogi-start` (with task ID if continuing).
26
25
  - "I'll route after I answer" → WRONG. Route BEFORE answering. No text output before the Skill tool call.
26
+ - "I'll just edit `ready.json` or another state file to create the task myself" → WRONG. That is the routing bypass. Use `/wogi-start`.
27
+
28
+ Post-compaction is the #1 bypass trap: you have summary context, you feel confident, you think you can answer directly. That confidence is the trap — hooks (Edit/Write/Read/Glob/Grep/Bash/EnterPlanMode) are ALL blocked until routing completes.
27
29
 
28
30
  ### Step 2: Does a task already exist?
29
31
 
30
- Check `.workflow/state/ready.json` for existing tasks.
31
- - If **YES** → Use `/wogi-start TASK-XXX`
32
- - If **NO** → Continue to Step 3
32
+ Check `.workflow/state/ready.json`. If YES → `/wogi-start <taskId>`. If NO → continue to Step 3.
33
33
 
34
34
  ### Step 3: Assess task size
35
35
 
@@ -40,27 +40,6 @@ Check `.workflow/state/ready.json` for existing tasks.
40
40
  | L1 | Story | 5-15 | **STOP** — Run `/wogi-story` first, wait for approval |
41
41
  | L0 | Epic | 15+ | **STOP** — Run `/wogi-epics` first, wait for approval |
42
42
 
43
- ---
44
-
45
- ## Post-Compaction / Session Continuation Routing (CRITICAL)
46
-
47
- **After context compaction, conversation resumption, or session continuation, the routing requirement is NOT relaxed.**
48
-
49
- **"Continue with the last task" is NOT permission to skip routing.** This is the #1 bypass pattern — the AI rationalizes that "continuing" prior work grants implicit permission to skip `/wogi-start`. It then goes into autopilot, directly editing ready.json to create fake tasks and coding without routing. This produces untracked, inconsistent work.
50
-
51
- When you resume from a compacted/summarized conversation:
52
- 1. Compressed context from prior work does NOT change the routing requirement
53
- 2. Every user message requires `/wogi-*` routing — NO exceptions, even after compaction
54
- 3. Do NOT answer from compacted memory without routing first
55
- 4. "I already know the answer" is the #1 rationalization for bypass — it is NEVER a valid reason to skip routing
56
- 5. The compaction summary preserves context but does NOT grant routing bypass
57
- 6. Do NOT edit `ready.json` or any `.workflow/state/` file to create tasks manually — that is a routing bypass
58
- 7. "Continue where we left off" still requires `/wogi-start` — invoke it with the task ID
59
-
60
- **The bypass pattern you must resist**: After compaction, you have context from the summary. You feel confident. You think "I can just answer this directly." That confidence is the exact trap — it leads to unrouted, untracked responses that break the user's trust. The routing hooks enforce this mechanically — Edit, Write, Read, Glob, Grep, Bash, and EnterPlanMode are ALL blocked until routing completes.
61
-
62
- **There is exactly ONE correct action**: Invoke the Skill tool with skill="wogi-start" BEFORE any other response. Not after explaining. Not after "just answering the question." BEFORE everything.
63
-
64
43
  {{/if}}
65
44
 
66
45
  {{#if config.strictAdherence.enabled}}
@@ -84,12 +63,6 @@ When unsure, ASK the user rather than deviate from source patterns.
84
63
  ---
85
64
  {{/if}}
86
65
 
87
- ## Quick Start
88
-
89
- ```bash
90
- npm install -D wogiflow && npx flow onboard
91
- ```
92
-
93
66
  ## Core Principles
94
67
 
95
68
  1. **State files are memory** — Read `.workflow/state/` first
@@ -112,9 +85,7 @@ npm install -D wogiflow && npx flow onboard
112
85
 
113
86
  **When auto-memory conflicts with any `.workflow/state/` file, the state file WINS. No exceptions.**
114
87
 
115
- **Auto-memory may ONLY store:** user preferences, high-level architectural decisions, workflow style preferences.
116
-
117
- **Auto-memory must NEVER store:** coding patterns, component knowledge, task history, bug patterns, function registries, or anything that belongs in `.workflow/state/`. If you learn something that should persist, write it to the correct state file using the WogiFlow learning system — NOT to auto-memory.
88
+ **Auto-memory scope**: user preferences + high-level architectural context only. Coding patterns, component/function/API knowledge, task history, and bug patterns all belong in `.workflow/state/` write them there via the WogiFlow learning system (`/wogi-decide`, `/wogi-learn`, `feedback-patterns.md`), never to auto-memory.
118
89
 
119
90
  ## Essential Commands
120
91
 
@@ -171,23 +142,6 @@ See `.claude/docs/claude-code-compatibility.md` for Claude Code version features
171
142
 
172
143
  When in doubt, route through `/wogi-start` which will classify correctly.
173
144
 
174
- ## CRITICAL: Universal Entry Point — ALL Requests
175
-
176
- **ALL user messages MUST go through a `/wogi-*` command. No direct handling. No self-classification.**
177
-
178
- 1. Check the Natural Language Detection table above. If a phrase matches → invoke that `/wogi-*` command directly.
179
- 2. If no match → invoke `/wogi-start` with the user's full message as args.
180
-
181
- **Do NOT** jump straight to editing files, answering questions, or executing operations. Route through a `/wogi-*` command FIRST, then follow its routing decision. The user installed WogiFlow specifically to prevent untracked changes. Bypassing it breaks their trust.
182
-
183
- ## Session Startup
184
-
185
- ```bash
186
- cat .workflow/config.json # Read config
187
- cat .workflow/state/ready.json # Check tasks
188
- cat .workflow/state/decisions.md # Project rules
189
- ```
190
-
191
145
  ## Task Execution Rules
192
146
 
193
147
  **These apply to ALL implementation work:**
@@ -219,47 +173,28 @@ If the user provides N items, ALL N must become tracked work items. No exception
219
173
 
220
174
  ### Mid-Execution Anti-Deferral (MANDATORY — APPLIES AFTER TASKS ARE CREATED)
221
175
 
222
- **Reordering is permitted. Deferring is not.** Once work is tracked inside an epic, story, or wave, you MUST NOT propose to skip, postpone, drop, or "deprioritize to later" any of it — regardless of how risky, expensive, or token-heavy it looks. If the work improves code quality or user experience, it ships the plan it was scoped into. You may only change the **sequence** of execution.
176
+ **Reordering is permitted. Deferring is not.** Once work is tracked in an epic/story/wave, you MUST NOT propose to skip, postpone, drop, or "deprioritize to later" any of it — regardless of risk, cost, or token-weight. You may only change the **sequence** of execution.
223
177
 
224
- **Why this rule exists**: Baseline Claude Code training biases toward deferral to conserve tokens and reduce risk ("let's save X for later," "we can defer the high-risk piece," "this can wait until v2"). That bias is a token-preservation reflex, not a quality judgment. In WogiFlow, scope decisions are the user's, not the AI's — the AI proposes sequencing, the user decides scope.
178
+ Token cost, risk flags, and "user probably won't miss this" are never valid reasons to drop scoped work. "Revisit later" and "deprioritize" are soft-defer euphemisms don't use them. Apply the master Anti-Rationalization Checklist above.
225
179
 
226
- **Mid-Execution Anti-Rationalization Checklist** If ANY of these thoughts cross your mind, STOP:
227
- - "This piece is high-risk — let's defer it to a later epic" → WRONG. It ships this epic. Reorder it later in the sequence if needed.
228
- - "To save tokens, let's skip wf-XXXX for now" → WRONG. Token cost is never a reason to drop scoped work.
229
- - "The user probably won't miss this one" → WRONG. The user tracked it. It ships.
230
- - "We can revisit this after the main work lands" → WRONG. "Revisit" is a soft defer. Sequence it, don't postpone it.
231
- - "This was lower priority anyway" → WRONG. Priority affects ORDER, never INCLUSION.
180
+ **MAY do after tasks are tracked**: propose sequence/parallelization/prerequisites; flag risks without using them to drop scope.
232
181
 
233
- **What you MAY do after tasks are tracked:**
234
- - Propose a **sequence** (A → B → C, or A∥B → C) with reasoning
235
- - Propose **parallelization** when independent
236
- - Propose **prerequisites** that must land first (that is reordering, not deferral)
237
- - Flag risks without using them as justification to drop scope
182
+ **MUST NEVER do**: propose to "defer", skip based on AI judgment, present a plan that silently omits tracked work.
238
183
 
239
- **What you must NEVER do after tasks are tracked:**
240
- - Propose to "defer" a tracked story "to save tokens" or "reduce risk"
241
- - Skip a scoped story because you judged it lower-value
242
- - Use the word "defer" as a euphemism for "drop"
243
- - Present a plan that silently omits already-tracked work
244
-
245
- **When genuinely unsure the work is still needed**: ask the user explicitly — "Do you still want wf-XXXX to ship this epic, or should we drop it?" Let them decide. Do NOT make that call autonomously.
184
+ **When genuinely unsure work is still needed**: ask explicitly — "Do you still want wf-XXXX to ship this epic, or drop it?" User decides, not you.
246
185
 
247
186
  ### Review-Findings Anti-Deferral (MANDATORY — INCIDENT-DRIVEN)
248
187
 
249
- **Extends Mid-Execution Anti-Deferral to `/wogi-review`, `/wogi-audit`, `/wogi-triage` findings.** If the user asks you to "fix all findings" / "option 1" / any variant that means "address everything," you MUST:
188
+ Extends Mid-Execution Anti-Deferral to `/wogi-review`, `/wogi-audit`, `/wogi-triage` findings. When the user says "fix all findings" / "option 1" / any variant meaning "address everything":
250
189
 
251
- 1. **Ship a fix for every finding that carries evidence tier ≥ 1**, regardless of effort estimate.
252
- 2. **Never silently convert a finding to "deferred"** in the commit or release notes without the user explicitly saying "defer X."
253
- 3. **If an item is genuinely too large for the current release**, STOP and ask: "Finding X requires ~Y minutes of work. Ship it in this release, split it into its own release, or defer? Your call."
254
- 4. **Never list a finding in the release description without fixing it.** If v2.17.4 says "fixes F1, F2, F3, M1" and M1 wasn't fixed, that's a promise/delivery mismatch exactly the rubber-stamp pattern the Completion Truth Gate was designed to prevent.
190
+ 1. Ship a fix for every finding at evidence tier ≥ 1, regardless of effort estimate.
191
+ 2. Never silently convert a finding to "deferred" in commit/release notes without the user explicitly saying "defer X."
192
+ 3. If an item is genuinely too large for the current release STOP and ask: "Finding X requires ~Y min. Ship / split into its own release / defer? Your call."
193
+ 4. Never list a finding in release notes without actually fixing it. Promise/delivery mismatches are the rubber-stamp pattern the Completion Truth Gate was designed to prevent.
255
194
 
256
- **Anti-Rationalization Checklist for review findings**if you catch yourself thinking any of these, STOP:
257
- - "M1 is a restructure, that warrants a separate release" → WRONG. The user said fix all. Ask first if you think it's too big.
258
- - "This finding is low-risk, it can wait" → WRONG. Low-risk doesn't mean drop-worthy.
259
- - "The release notes will acknowledge it's deferred" → WRONG. User didn't defer. You are.
260
- - "I'll mention it in the commit so it's transparent" → WRONG. Transparency ≠ permission. Ship the fix.
195
+ Transparency ≠ permission. "Low-risk can wait" and "restructure warrants separate release" are AI judgment calls they're the user's to make. Apply the master Anti-Rationalization Checklist above.
261
196
 
262
- **Incident that promoted this rule to decisions.md**: 2026-04-15, v2.17.4 release. I claimed "fix all" in the commit message but silently deferred M1 (wogi-review.md bloat) and completely dropped M3 (_fastPath test coverage gap) from the Findings Adversary. User correction: "You're not supposed to defer any fixes. It's up to the user to defer, not you." v2.17.5 fixed M1 + M3 and added this rule.
197
+ **Incident origin**: 2026-04-15, v2.17.4 claimed "fix all" but silently deferred M1 and dropped M3. User correction: *"You're not supposed to defer any fixes. It's up to the user to defer, not you."* v2.17.5 fixed both and added this rule.
263
198
 
264
199
  ### Task ID Format (MANDATORY)
265
200
 
@@ -272,27 +207,20 @@ All task IDs MUST be generated by `generateTaskId()` from `wogiflow/scripts/flow
272
207
 
273
208
  When creating tasks programmatically, always call `generateTaskId(title)` — never construct IDs by hand.
274
209
 
275
- ### Before Starting:
276
- 1. Check `app-map.md` for existing components (and other active registry maps if relevant)
277
- 2. Check `decisions.md` for coding patterns
278
- 3. Load task acceptance criteria
279
- 4. **Consumer Impact Analysis** (MANDATORY for refactors/migrations):
280
- - Grep for ALL files that import/require the module being changed
281
- - Classify consumers: BREAKING (must update), NEEDS-UPDATE (review), SAFE
282
- - If 5+ breaking consumers → plan phased migration
283
-
284
- ### While Working:
285
- 1. Follow acceptance criteria exactly
286
- 2. Use existing components from app-map
287
- 3. Follow patterns from decisions.md
288
- 4. Validate after EVERY file edit (run lint/typecheck)
289
-
290
- ### After Completing:
291
- 1. Update `request-log.md` with tags
292
- 2. Registry maps (app-map, function-map, api-map, schema-map, service-map) are **auto-updated** by the `registryUpdate` quality gate — it runs `flow registry-manager scan` on all active registries
293
- 3. Run quality gates (lint, typecheck, test)
294
- 4. Provide completion report
295
- 5. **If you have a follow-up question for the user** (e.g., "task done — should I also update X?"), run `flow ask "<your question>"` BEFORE the turn ends. This defers the task-boundary session restart (if enabled via `taskBoundaryReset.enabled`) so your question doesn't get orphaned when claude restarts. The user's response automatically clears the deferral.
210
+ ### Before Starting
211
+ 1. Check `app-map.md` (and other active registries) for existing components; check `decisions.md` for coding patterns.
212
+ 2. Load task acceptance criteria.
213
+ 3. **Consumer Impact Analysis** (MANDATORY for refactors/migrations): grep all files that import the module; classify as BREAKING / NEEDS-UPDATE / SAFE. ≥5 breaking → phased migration.
214
+
215
+ ### While Working
216
+ Follow criteria exactly. Reuse existing components/patterns. Validate (lint/typecheck) after EVERY file edit.
217
+
218
+ ### After Completing
219
+ 1. Update `request-log.md` with tags.
220
+ 2. Registry maps auto-update via the `registryUpdate` quality gate (`flow registry-manager scan`).
221
+ 3. Run quality gates (lint, typecheck, test).
222
+ 4. Provide completion report.
223
+ 5. **Follow-up question for the user?** Run `flow ask "<question>"` BEFORE the turn ends — this defers the task-boundary session restart (when `taskBoundaryReset.enabled`) so the question isn't orphaned. User's reply clears the deferral automatically.
296
224
 
297
225
  ## Auto-Validation (CRITICAL)
298
226
 
@@ -353,27 +281,17 @@ Before closing any task, ensure all required gates pass (per `config.json → qu
353
281
 
354
282
  ## Context Management
355
283
 
356
- Context compaction happens **automatically and silently**. The user must NEVER be bothered with compaction. WogiFlow persists all critical state to disk continuously, and the PostCompact hook restores it after compaction.
357
-
358
- **NEVER invoke `/wogi-pre-compact` proactively.** Only run it when the user explicitly asks to compact or save context. When the user says "continue", "go ahead", or "keep going" — that means **start the next task**, not compact. Compaction is the SYSTEM's job, not yours.
284
+ Compaction is automatic and silent the SYSTEM handles it, not you. WogiFlow persists state continuously; the PostCompact hook restores it. **NEVER invoke `/wogi-pre-compact` proactively.** Only run it when the user explicitly says "compact" / "save context" / "running low on context."
359
285
 
360
- **Anti-pattern you MUST avoid**: User says "continue" → you decide context is getting large → you invoke `/wogi-pre-compact` → you output a long summary → you ask the user to `/compact`. This is WRONG. The user said "continue" — start the next task immediately.
286
+ "Continue" / "go ahead" / "keep going" means **start the next task**, not compact. The anti-pattern to avoid: user says "continue" → you decide context is large → you invoke pre-compact → you output a summary → you ask the user to `/compact`. Wrong. Start the next task.
361
287
 
362
288
  **What survives compaction automatically** (via PostCompact hook + state files):
363
289
  - Active task ID, title, type, and acceptance criteria
364
- - Which criteria are completed vs pending (from durable-session.json)
365
- - Current workflow phase
366
- - Changed files list (from task-checkpoint.json)
367
- - Last request-log entry number
368
- - Routing enforcement (re-armed automatically)
369
-
370
- **When auto-compaction triggers mid-session**: The system handles it. The PostCompact hook reloads state. You resume working on the next task from `ready.json`. No user interaction needed.
371
-
372
- **The ONLY times to invoke `/wogi-pre-compact`**:
373
- - User explicitly says "compact", "save context", or "running low on context"
374
- - `config.autoCompact.betweenTasks` is true AND you're between tasks AND context is above threshold — but even then, just compact silently and continue, don't ask
290
+ - Which criteria are completed vs pending (from `durable-session.json`)
291
+ - Current workflow phase, changed files list (from `task-checkpoint.json`)
292
+ - Last request-log entry number; routing enforcement (re-armed automatically)
375
293
 
376
- **For L1+ tasks**: The pre-task context estimator (Step 0.25) checks if the task fits in remaining context. If it doesn't → compact silently and continue, do NOT ask the user.
294
+ **For L1+ tasks**: the pre-task context estimator (Step 0.25) decides. If the task won't fit → compact silently and continue. Do NOT ask.
377
295
 
378
296
  ## Compact Instructions
379
297
 
@@ -436,6 +354,10 @@ Use `/wogi-research "question"` for rigorous verification.
436
354
 
437
355
  ---
438
356
 
357
+ {{> feature-dossiers}}
358
+
359
+ ---
360
+
439
361
  ## Generated by CLI Bridge
440
362
 
441
363
  This file was generated by the Wogi Flow CLI bridge.
@@ -0,0 +1,33 @@
1
+ ### Feature Dossiers (MANDATORY — AUTO-LOADED)
2
+
3
+ Per-feature canonical knowledge lives in `.workflow/dossiers/<slug>.md`. Cross-cutting logic rules live in `.workflow/dossiers/_logic-rules.md`. These capture what `app-map.md`, `function-map.md`, and commit messages do not:
4
+
5
+ - Owner-rejected design alternatives ("stack-two-components merge was rejected, user picked merged-card")
6
+ - Removed elements the codebase must not reintroduce ("no contact-person block — every person needs a seat")
7
+ - Cross-repo contracts ("BE returns Decimal as string, FE parses")
8
+ - Known global-state bugs and the task IDs tracking them
9
+
10
+ **Auto-injection** — when a task touches a feature (matched via title, description, or files-touched), the dossier's canonical/contracts/rejected/removed sections are injected directly into the phase prompt. You do not need to fetch them. You cannot skip them under token pressure.
11
+
12
+ **Contradiction gate** — during `/wogi-story` spec review, the spec is scanned against every matching dossier. If the spec reintroduces a removed element or mentions a rejected alternative, spec approval is blocked with a citation. Override only by updating the dossier first (document that the owner changed their mind, with date), then re-running spec.
13
+
14
+ **Drift detector** — `flow feature-dossier drift <slug>` greps the codebase for every `enforcement-grep` regex listed under a dossier's Removed Elements. Surfaces cases where the dossier says "removed" but the code still has the pattern (the contact-person case from the 2026-04-24 workspace incident).
15
+
16
+ **Cross-cutting rules** — `_logic-rules.md` holds rules that span multiple features ("every person in the system needs a seat"). These are auto-loaded for any task touching files in the rule's `Applies to` scope. `flow logic-rules propagate <id>` finds other places the rule should apply.
17
+
18
+ **Workspace-mode** — in workspace manager/worker setups, workspace-level dossiers live at `$WOGI_WORKSPACE_ROOT/.workspace/dossiers/` for cross-repo features (spanning BE+FE). Per-repo dossiers stay at `<repo>/.workflow/dossiers/`. Workspace shadows per-repo on slug collision.
19
+
20
+ **When to scaffold a dossier** — any user-facing feature that has:
21
+ - Multiple moving parts (more than one page/component)
22
+ - Cross-repo contracts (FE/BE coordination)
23
+ - Prior owner corrections that are not already in `decisions.md`
24
+ - Rejected alternatives worth remembering
25
+ - Removed elements that shouldn't come back
26
+
27
+ Command: `flow feature-dossier scaffold <slug> --title "..." --owners "fe,be"`
28
+
29
+ **Primary failure this prevents** — the 2026-04-24 workspace incident catalog documented 22+ repeat failures across 3 months where Claude re-asked product questions the owner had already answered, dropped features during merges, or reintroduced removed elements. Dossier auto-injection fixes the mechanical root cause: prior knowledge exists but isn't consulted under token pressure. Auto-injection is consultation-by-default.
30
+
31
+ Full docs: `.workflow/dossiers/README.md`.
32
+
33
+ Config: `.workflow/config.json → featureDossier.{enabled, autoMatchConfidence, blockOnContradiction}`.
@@ -21,20 +21,10 @@ This project has IGR enabled (`config.intentGroundedReasoning.enabled: true`). I
21
21
  ### Operator commands
22
22
 
23
23
  - `/wogi-challenge <plan-or-taskId>` — manually invoke the Logic Adversary on any plan
24
- - `/wogi-gate-stats [--since=7d] [--gate=ID]` — view per-gate self-assessment dashboard
24
+ - `/wogi-gate-stats [--since=7d] [--gate=ID]` — per-gate self-assessment dashboard
25
25
  - `node scripts/flow-intent-bootstrap.js [bootstrap|status|refresh]` — manage intent artifacts
26
26
 
27
- ### To disable
28
-
29
- Set `intentGroundedReasoning.enabled: false` in `.workflow/config.json`. All IGR steps SKIP cleanly; pipeline reverts to pre-IGR behavior.
30
-
31
- ### Reference
32
-
33
- - Operator docs: `.claude/docs/intent-grounded-reasoning.md`
34
- - Telemetry docs: `.claude/docs/gate-telemetry.md`
35
- - Logic Constitution: `.workflow/rubrics/logic-constitution-v1.md`
36
- - Adversary persona: `.workflow/agents/logic-adversary.md`
37
- - Architect persona: `.workflow/agents/architect.md`
27
+ Toggle off via `intentGroundedReasoning.enabled: false`. Full docs at `.claude/docs/intent-grounded-reasoning.md` (and gate telemetry at `.claude/docs/gate-telemetry.md`).
38
28
 
39
29
  ---
40
30
  {{/if}}
@@ -1,149 +1,155 @@
1
1
  ## WogiFlow Methodology Rules
2
2
 
3
- These are product-level rules that apply to every WogiFlow session. They ship with the tool enforcement is in the shipped scripts/hooks, and the text below explains the contract to Claude so it doesn't try to work around the enforcement.
3
+ Product-level rules enforced by shipped hooks. Text below exists so Claude understands the contract, not as the enforcement mechanism itself.
4
4
 
5
5
  ---
6
6
 
7
- ### Research Before Propose (MANDATORY)
7
+ ### Research Before Propose
8
8
 
9
- **Rule**: Before proposing any fix, plan, or spec, audit existing infrastructure for the problem area. Propose only what fills a confirmed gap. Evidence-before-invention.
9
+ Before proposing a fix, plan, or spec, read 2+ files from `.workflow/state/`, `.workflow/changes/`, `.workflow/specs/`, or `.workflow/epics/` — evidence before invention. Baseline LLM training biases toward plausible-sounding solutions; in a codebase with existing infrastructure, "plausible" is frequently wrong.
10
10
 
11
- **What counts as research**: read relevant files in `.workflow/state/` (decisions.md, feedback-patterns.md, app-map.md, function-map.md, api-map.md), read the task spec from `.workflow/changes/` or `.workflow/specs/`, grep existing hooks/classifiers/gates, read relevant source files.
11
+ You MAY ask clarifying questions (valid escape hatch). You may NOT propose without evidence.
12
12
 
13
- **Why**: baseline LLM training biases toward generating plausible-sounding solutions. In a codebase with existing infrastructure, "plausible" is frequently wrong proposing a feature that already exists, missing an existing pattern, or reinventing a wired-up hook. The correction cycle cost (user rejecting → replanning → rejecting again) is higher than the upfront audit cost.
13
+ Enforced by: `research-evidence-gate.js` (blocks `→ spec_review` / `→ coding` transitions and spec-file writes until threshold met; cleared at task start, session-end, and post-compact). Config: `hooks.rules.researchEvidenceGate.{enabled,minEvidence}` (defaults `true`, `2`).
14
14
 
15
- **You MAY ask the user clarifying questions when genuinely needed.** The rule is not "never ask" — it is "don't propose before researching." Asking is a valid escape hatch; proposing without evidence is not.
16
-
17
- **Enforcement**: `scripts/hooks/core/research-evidence-gate.js` tracks state-file reads (`.workflow/state/`, `.workflow/changes/`, `.workflow/specs/`, `.workflow/epics/`) in the current task turn. Three enforcement points check the evidence fingerprint before proposal actions:
15
+ ---
18
16
 
19
- 1. **Phase transition** — `transitionPhase()` blocks `→ spec_review` and `→ coding` until `minEvidence` distinct state/spec file reads have been recorded.
20
- 2. **Spec write** — PreToolUse blocks `Edit`/`Write` to `.workflow/changes/*.md`, `.workflow/specs/*.md`, or `.workflow/epics/*.md` when evidence is below threshold.
21
- 3. **Channel dispatch** — in workspace manager mode, `dispatchToChannel()` blocks dispatching a task to a worker until the manager has read evidence from the target member repo.
17
+ ### Completion-Claim Honesty Scan
22
18
 
23
- Evidence is cleared at task start, session end, and post-compaction so each task begins with a clean slate. The `AskUserQuestion` tool is NOT gated asking for clarification is a valid escape hatch. IGR's architect + adversary passes challenge solution *quality* downstream; this gate enforces the evidence *base* upstream.
19
+ At session-end and `flow health`, `ready.json` entries are scanned (surfaced, not blocked) for:
20
+ - **Status-mismatch** — free-text says "done/completed/shipped" while `status` is partial/blocked/failed.
21
+ - **Negation-vs-evidence** — free-text says "no outages / 0 regressions" while `hotfixes[]` / `incidents[]` / `regressions[]` is non-empty.
24
22
 
25
- **Config**: `hooks.rules.researchEvidenceGate.{enabled,minEvidence}` (defaults: `true`, `2`).
23
+ Enforced by: `flow-completion-truth-gate.js → scanForClaimContradictions()`.
26
24
 
27
25
  ---
28
26
 
29
- ### Completion-Claim Honesty Scan
27
+ ### Merge-Plan Artifact Gate
28
+
29
+ `/wogi-finalize` requires `.workflow/scratch/merge-plan.md` for merges >5 commits or any cross-repo merge. Every commit in `git log <base>..<branch>` must map to `port | adapt | skip-style | superseded | skip-with-reason`; SHA-line count must equal commit count. ≥20% restructure-pattern files triggers a structural warning that biases affected commits toward `adapt`.
30
30
 
31
- **Rule**: At session-end and on `flow health`, scan `ready.json` entries for two contradiction classes and surface (not block) them for user reconciliation.
31
+ Enforced by: `flow-structure-sensor.js`, `.claude/commands/wogi-finalize.md` Step 2.5.
32
32
 
33
- - **Class A — status-mismatch**: free-text field contains done-words (`done|completed|shipped|deployed|finished`) while `status` is partial (`completed-partial|blocked|in-progress|failed`).
34
- - **Class B — negation-vs-evidence**: free-text contains a negated claim (`no outages`, `0 regressions`) while `hotfixes[]`, `incidents[]`, or `regressions[]` is non-empty.
33
+ ---
34
+
35
+ ### Story Creation Quality Gates
35
36
 
36
- **Why**: mechanical gates (test counts, lint, tsc) catch implementation errors. Narrative-quality claims in free-text fields (`notes`, `result`, `summary`, `description`) get rubber-stamped. This scan compares narrative against adjacent structured fields.
37
+ `/wogi-story` runs 5 P0 spec-quality gates at creation time (not implementation-correctness gates that's `/wogi-start`'s job):
37
38
 
38
- **Mode**: surface-and-prompt, non-blocking. A hard-fail at session-end has no recovery path.
39
+ 1. **Long Input** ≥40 lines or ≥5 discrete items route to `/wogi-extract-review`.
40
+ 2. **Item Reconciliation** — ≥3 items → enumerated Item Manifest; unmapped items surface as warnings.
41
+ 3. **Consumer Impact Analysis** — refactoring keywords trigger `git grep` for consumers; ≥5 breaking → phased migration recommendation.
42
+ 4. **Scope-Confidence Audit** — assumption patterns (`new <X>`, `existing <Y>`) verified against codebase; findings go to Pending Clarifications.
43
+ 5. **Intent Bootstrap Coordination** — schedules IGR artifact bootstrap so `/wogi-story` and `/wogi-start` don't both prompt.
39
44
 
40
- **Enforcement**: `scripts/flow-completion-truth-gate.js``scanForClaimContradictions()`. Invoked by `flow-session-end.js` and `flow-health.js`.
45
+ All gates fail-open (grep/classifier unavailable warning, story still created). Bypass for testing via `--skip-gates`. Config: `storyFlow.*`.
41
46
 
42
47
  ---
43
48
 
44
- ### Merge-Plan Artifact Gate
49
+ ### Workspace Worker Contract
45
50
 
46
- **Rule**: `/wogi-finalize` requires `.workflow/scratch/merge-plan.md` for any merge with more than `config.finalization.mergePlan.threshold` commits (default 5) OR any cross-repo merge. The plan must map every commit in `git log <base>..<branch>` to one of: `port | adapt | skip-style | superseded | skip-with-reason`.
51
+ *Applies only in workspace worker mode (`WOGI_WORKSPACE_ROOT` set + `WOGI_REPO_NAME !== 'manager'`). Ignore in solo sessions.*
47
52
 
48
- **Mechanical invariant**: count of SHA-prefixed lines in the plan MUST equal `git log <base>..<branch> | wc -l`. Mismatch blocks the merge.
53
+ **Tool-First Turn**: Every turn after `UserPromptSubmit` must contain ≥1 tool call. In strict mode (default), the first assistant content block must be `tool_use`, not text. Pure-text responses are invisible to the user (they only see the manager terminal) and disqualify the worker from the three-state contract below.
49
54
 
50
- **Structural-change sensor**: when `config.finalization.mergePlan.restructureThreshold` (default 20%) of changed files match a restructure pattern (folder-per-component, split-into-submodule, barrel-introduction, rename-new-home), a structural warning prefixes the plan and biases affected commits toward `adapt`.
55
+ **Three-State End-of-Turn**: Exactly one of:
56
+ 1. **ACTION** — start next pre-approved channel dispatch via `/wogi-start <nextId>`.
57
+ 2. **ESCALATION** — channel-dispatch `## QUESTION: ...` to the manager.
58
+ 3. **IDLE** — zero pending dispatches AND zero in-progress tasks.
51
59
 
52
- **Enforcement**: `scripts/flow-structure-sensor.js`, `.claude/commands/wogi-finalize.md` Step 2.5.
60
+ Hedging phrases ("awaiting your signal", "let me know", "standing by", "should I continue") are mechanically forbidden — visibility is NOT a substitute for action; the manager already pre-approved the dispatch by queuing it.
53
61
 
54
- ---
62
+ **No direct user prompts**: `AskUserQuestion` is blocked; questions go through channel dispatch as `## QUESTION: ...`. Block message carries the exact `curl` command to use.
55
63
 
56
- ### Story Creation Quality Gates
64
+ **Hedging detection**: A Haiku classifier inspects the final message at Stop-hook time; confidence ≥ `minConfidence` → stop is blocked with channel-dispatch instructions. Fail-open on missing API key / transcript / classifier error.
57
65
 
58
- **Rule**: `/wogi-story` enforces five P0 specification-quality gates at creation time. Gates answer *"is the story clear, complete, checkable?"* — NOT *"is the implementation correct?"* (the latter remains `/wogi-start`'s job).
66
+ Enforced by: `worker-tool-first-gate.js` (G1/G4/Gap B), `worker-boundary-gate.js`, `flow-worker-question-classifier.js`. Config: `workspace.toolFirstTurnGate.{enabled,strict}`, `workspace.blockAskUserQuestionInWorker`, `workspace.aiWorkerQuestionClassifier.*`, `workspace.autoPickupChannelDispatches`.
59
67
 
60
- 1. **Long Input** — ≥40 lines OR ≥5 discrete items → route to `/wogi-extract-review` for zero-loss capture.
61
- 2. **Item Reconciliation** — ≥3 discrete items → enumerated "Item Manifest" section; every item must appear in at least one criterion or sub-task. Unmapped items surface as a warning.
62
- 3. **Consumer Impact Analysis** — refactoring keywords (`refactor`, `rename`, `migrate`, `split`, `extract`, ...) trigger `git grep` for consumers. ≥5 breaking consumers → phased migration recommendation.
63
- 4. **Scope-Confidence Audit** — assumption patterns (`new <X>`, `existing <Y>`, `the <Z> service`) are verified against the codebase; findings go into a "Pending Clarifications" block.
64
- 5. **Intent Bootstrap Coordination** — schedules IGR artifact bootstrap via `intentBootstrapScheduledAt` flag so `/wogi-story` and `/wogi-start` don't both prompt.
68
+ ---
65
69
 
66
- **Guard-rails**: all gates fail-open (grep failure, classifier unavailable → warning, story still created). Gates may be bypassed via `--skip-gates` for testing.
70
+ ### Workspace Manager Silent-Halt Detection
67
71
 
68
- **Config**: `storyFlow.consumerImpactAnalysis.*`, `storyFlow.scopeConfidenceAudit.*`, `storyFlow.itemReconciliation.*` in `.workflow/config.json`.
72
+ *Applies only in workspace manager mode. Ignore in solo sessions.*
69
73
 
70
- ---
74
+ Every manager→worker dispatch is tracked. A pending dispatch past its `expectedDeadline` with no `task-complete` or `worker-stopped` message = silent death, surfaced on the manager's next turn via `UserPromptSubmit` `additionalContext`. Default `expectedDurationMs = 30min`; callers override per-dispatch for long tasks.
75
+
76
+ Three terminal states: **Completed** (task-complete arrived), **Graceful-stop** (worker-stopped arrived), **Silent-halt** (no message, deadline passed).
71
77
 
72
- ### Workspace Autonomous-Mode Action-After-Completion Contract
78
+ Enforced by: `lib/workspace-dispatch-tracking.js`, `.workspace/state/dispatched-tasks.json` (ring buffer, last 100 records). File-based, hook-driven, no background processes.
73
79
 
74
- **Applies to**: workspace worker mode (`WOGI_WORKSPACE_ROOT` set + `WOGI_REPO_NAME !== 'manager'`).
80
+ ---
75
81
 
76
- **Rule**: A worker's end-of-turn must be a deterministic action. Exactly one of these states must hold:
82
+ ### Main-Mode Question Classifier
77
83
 
78
- 1. **ACTION** — started the next pre-approved channel dispatch (invoked `/wogi-start <nextId>`), OR
79
- 2. **ESCALATION** — channel-dispatched a `## QUESTION:` to the manager (after local resolution attempts failed), OR
80
- 3. **IDLE** — zero pending channel dispatches AND zero in-progress tasks.
84
+ *Applies in solo/main-mode sessions with `taskBoundaryReset.enabled: true`.*
81
85
 
82
- **Hedging language is mechanically forbidden**: *"awaiting your signal"*, *"let me know if"*, *"should I continue"*, *"standing by"*, *"ready when you are"*. These invent an imaginary decision point the manager already pre-approved the dispatch by queuing it. Visibility is NOT a substitute for action; workers narrate AND act in the same turn.
86
+ Before the Stop hook fires SIGTERM for task-boundary restart, a Haiku classifier inspects the final assistant message. If the AI ended the turn with an open user-facing question AND `pending-question.json` is absent, the classifier writes the marker and defers the restart the user's reply then lands in the same session context. Fail-open throughout.
83
87
 
84
- **Enforcement**: `TaskCompleted` hook emits auto-pickup when queued dispatches exist. `Stop` hook blocks end-of-turn when a worker has queued dispatches but no in-progress task. `worker-rules.md` template carries the 3-state contract.
88
+ **Prefer explicit `flow ask "<question>"`** it writes the marker directly and runs before the classifier (short-circuits with `pending-question-deferred`). The classifier is the safety net for when you forget.
85
89
 
86
- **Config**: `workspace.autoPickupChannelDispatches` (default `true`).
90
+ Enforced by: `task-boundary-reset.js → consumeAndTriggerRestart()`. Config: `mainModeQuestionClassifier.{enabled,minConfidence,model}`.
87
91
 
88
92
  ---
89
93
 
90
- ### Workspace Worker Cannot Prompt User Directly
94
+ ### Main-Mode Auto-Pickup After Clean Restart
91
95
 
92
- **Applies to**: workspace worker mode.
96
+ *Applies in solo/main-mode sessions with `taskBoundaryReset.enabled: true` AND `taskBoundaryReset.autoPickupNextTask: true` (default).*
93
97
 
94
- **Rule**: The `AskUserQuestion` tool is mechanically blocked in worker mode. Questions to the user MUST be channel-dispatched to the manager via `## QUESTION: ...`.
98
+ After a task-boundary restart triggered by a **clean** completion (not error/blocked/killed), the next SessionStart context injects `AUTO-PICKUP MODE ACTIVE` with the next ready task ID. The first user message invoke `Skill(skill="wogi-start", args="<nextReadyId>")` immediately, regardless of message content. No "what's next?", no summary, no proposing alternatives.
95
99
 
96
- **Why block instead of auto-redirect**: the worker must consciously choose between (a) channel-dispatching the real question to the manager for user input, or (b) making a reasonable autonomous decision and noting it in the task reply. Silent redirection removes that choice.
100
+ **Precedence**: `pending-question.json` (R-336) wins. If the prior session ended with an open question, auto-pickup is skipped even if all other conditions hold.
97
101
 
98
- **Enforcement**: `scripts/hooks/core/worker-boundary-gate.js` → `checkWorkerBoundary()`. PreToolUse hook blocks `AskUserQuestion`; block message includes the exact `curl ... --data-binary "## QUESTION: ..."` command. Config: `workspace.blockAskUserQuestionInWorker` (default `true`).
102
+ **Skip conditions** (any disables; marker still consumed): pending-question exists, `ready.json` empty, `autoPickupNextTask: false`, marker absent.
99
103
 
100
- ---
104
+ Enforced by: `task-boundary-reset.js → writeCleanCompletionMarker()` + `session-context.js → formatContextForInjection()`. Marker: `.workflow/state/task-boundary-clean-completion.json` (single-use).
101
105
 
102
- ### Workspace Worker Text-Question Classifier
106
+ ---
103
107
 
104
- **Applies to**: workspace worker mode.
108
+ ### Code Quality Patterns (generic)
105
109
 
106
- **Rule**: If a worker ends a turn with a text-based question to the user (no tool call just hedging: *"let me know"*, *"should I"*, *"which option"*, *"thoughts?"*, trailing `?`), the Stop hook runs a Haiku classifier on the final assistant message. If it detects an open question with confidence ≥ `minConfidence` → stop is blocked with channel-dispatch instructions.
110
+ 1. **Single Source of Truth for Constants**import from one canonical location; never duplicate model/config objects across files.
111
+ 2. **Named Constants for Magic Numbers** — define thresholds as named constants (`const COVERAGE_THRESHOLDS = { default: 0.7, comprehensive: 0.85 }`); don't inline literals.
107
112
 
108
- **Why AI instead of regex**: hedging vocabulary is infinite. Regex misses novel phrasings.
113
+ ---
109
114
 
110
- **Fail-open throughout**: missing `ANTHROPIC_API_KEY`, missing transcript path, malformed transcript, or model error → skip. Silent-stall false negatives are recoverable; false-positive blocks every turn are not.
115
+ ### Regression Discipline
111
116
 
112
- **Enforcement**: `scripts/flow-worker-question-classifier.js`. Config: `workspace.aiWorkerQuestionClassifier.{enabled,minConfidence,model}`.
117
+ Typecheck/lint/build gates catch code errors, NOT behavior drift. For critical user-facing flows (login, submit, approve, delete, invite, etc.):
113
118
 
114
- ---
119
+ 1. **Executable scripts, not test-plan documents** — each flow gets an executable regression artifact (Playwright, Jest integration, curl-scripted e2e) at `regression-suite/<flow>.<ext>`. Test plans rot; scripts fail loudly.
120
+ 2. **Living feature inventory** — one table with `Feature | Last Verified | Commit | Regression Script | Known Issues`; update the "Known Issues" cell with the bug's task ID rather than writing separate incident docs.
121
+ 3. **Change-touch rule** — when a task modifies a file mapped to a regression script, that script must pass before task close. Enforce per-task via acceptance criteria until a native gate ships.
122
+ 4. **Audit-seeded, not human-written** — use `/wogi-audit` to produce a draft inventory from current code, then review row-by-row.
115
123
 
116
- ### Workspace Worker Silent-Halt Detection
124
+ Anti-rationalization: *"We don't have regression coverage but I'm confident my fix won't break it"* → WRONG. Confidence is not evidence.
117
125
 
118
- **Applies to**: workspace manager mode.
126
+ ---
119
127
 
120
- **Rule**: Every dispatch to a worker MUST be tracked. Any pending dispatch past its `expectedDeadline` with no matching `task-complete` or `worker-stopped` message = silent death, surfaced on the manager's next turn.
128
+ ### Memory-First Clarification
121
129
 
122
- **Three terminal states**:
123
- 1. **Completed** — `task-complete` message arrived.
124
- 2. **Graceful-stop** — `worker-stopped` message arrived (worker's Stop hook fired, but didn't complete).
125
- 3. **Silent-halt** — no message, deadline passed. Worker probably dead.
130
+ Before asking the user a product-domain question (role model, business rules, product scope, terminology), check `.workflow/state/product.md`, `domain-model.md`, `user-journeys.md`, `glossary.md` first. Every redundant question costs trust.
126
131
 
127
- **Deadline**: default `expectedDurationMs` = 30 min. Callers override per-dispatch for long tasks.
132
+ When you must ask, cite what you checked: *"I read domain-model.md §Roles; it says X — does this apply to Y too?"* — not *"what's Y?"*
128
133
 
129
- **Architecture file-based, hook-driven, no background processes**:
130
- - `lib/workspace-dispatch-tracking.js` — record / reconcile / overdue helpers
131
- - `.workspace/state/dispatched-tasks.json` — ring buffer of last 100 active records
132
- - Manager's `dispatchToChannel()` calls `recordDispatch()` after successful POST
133
- - Manager's `UserPromptSubmit` hook sweeps the message bus and surfaces overdue records as `additionalContext`
134
+ If artifacts don't exist yet, run `node scripts/flow-intent-bootstrap.js bootstrap` (or trigger via `/wogi-start` on any IGR-enabled task). A project without `domain-model.md` is a project where every domain question will be re-asked every session.
134
135
 
135
136
  ---
136
137
 
137
- ### Code Quality Patterns (generic)
138
+ ### Autonomous Walk-Away Mode
139
+
140
+ The user can dump N items, say "go until you finish" / "autonomous mode" / "run this autonomously" / "don't bother me, just do it" (or similar phrases — see `flow-autonomous-detector.js`), and walk away. While the run is active:
138
141
 
139
- These apply to any codebase being built with WogiFlow's help.
142
+ - **productBehavior / ux questions** → append to `.workflow/state/question-queue.json` (do NOT ask the user). Render in the end-of-run summary so the user resolves them in one batch.
143
+ - **engineering / naming / implementation** → decide autonomously, report in the summary.
144
+ - **infrastructure / performance** → decide autonomously, report after.
145
+ - **security** → auto-fix-report-after (existing).
146
+ - **low-confidence technical decisions** → self-adversarial challenge to ≥90% confidence; queue if cap hit. Counter is shared with the IGR Architect-Adversary loop (default cap 30 per run, configurable via `autonomousMode.maxAdversaryInvocations`).
147
+ - **Blocking errors (typecheck/test/conflict)** → fix autonomously; only surface if fundamentally un-fixable.
140
148
 
141
- **1. Single Source of Truth for Constants** avoid duplicating model/configuration objects across files. Import from one canonical location. Prevents drift and makes updates simpler.
149
+ **Persistence**: the autonomous flag is written to `session-state.json` on disk (canonical) and cached in-process (read-hot). It survives task-boundary SIGTERM restarts via SessionStart re-hydration. Staleness threshold (default 1h via `autonomousMode.stalenessThresholdMs`) covers laptop-sleep and unclean termination — stale flags do NOT auto-resume.
142
150
 
143
- **2. Named Constants for Magic Numbers** define thresholds and limits as named constants; don't inline literals.
151
+ **Anti-hedging**: while autonomous mode is active, phrases like "let me know if", "should I continue", "awaiting your signal", "standing by", "would you like me to" are forbidden. The user has walked away.
144
152
 
145
- ```js
146
- const COVERAGE_THRESHOLDS = { default: 0.7, comprehensive: 0.85, concise: 0.5 };
147
- ```
153
+ **Exit conditions**: ready queue drains, user types "stop"/"pause", or fatal error. On exit, render the completion summary (terminal block + JSON payload at `.workflow/state/autonomous-run-summary-<runId>.json`) and clear the flag.
148
154
 
149
- Self-documenting; easier to maintain.
155
+ Enforced by: `flow-autonomous-detector.js`, `flow-question-queue.js`, `flow-decision-authority.js` (autonomous param + `queue-for-review` + `adversary-loop` buckets), `flow-completion-summary.js`, and the SessionStart context injection in `scripts/hooks/core/session-context.js`.