wogiflow 1.6.0 → 1.6.2

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 (94) hide show
  1. package/.claude/commands/wogi-audit.md +359 -0
  2. package/.claude/commands/wogi-export.md +1 -1
  3. package/.claude/commands/wogi-onboard.md +33 -0
  4. package/.claude/commands/wogi-review.md +64 -0
  5. package/.claude/docs/commands.md +1 -1
  6. package/.claude/docs/knowledge-base/01-setup-onboarding/README.md +4 -2
  7. package/.claude/docs/knowledge-base/01-setup-onboarding/installation.md +40 -3
  8. package/.claude/docs/knowledge-base/README.md +3 -1
  9. package/.claude/settings.json +1 -1
  10. package/.workflow/templates/claude-md.hbs +11 -5
  11. package/.workflow/templates/partials/user-commands.hbs +1 -0
  12. package/README.md +4 -1
  13. package/package.json +1 -1
  14. package/scripts/flow-aggregate.js +0 -0
  15. package/scripts/flow-api-index.js +0 -0
  16. package/scripts/flow-archive +0 -0
  17. package/scripts/flow-audit.js +341 -0
  18. package/scripts/flow-bug.js +0 -0
  19. package/scripts/flow-cascade.js +2 -1
  20. package/scripts/flow-changelog +0 -0
  21. package/scripts/flow-config-set.js +0 -0
  22. package/scripts/flow-context +0 -0
  23. package/scripts/flow-correct.js +0 -0
  24. package/scripts/flow-deps +0 -0
  25. package/scripts/flow-done +0 -0
  26. package/scripts/flow-durable-session.js +7 -8
  27. package/scripts/flow-entropy-monitor.js +0 -0
  28. package/scripts/flow-epics.js +18 -1
  29. package/scripts/flow-export-profile +0 -0
  30. package/scripts/flow-function-index.js +0 -0
  31. package/scripts/flow-guided-edit.js +0 -0
  32. package/scripts/flow-health +0 -0
  33. package/scripts/flow-health.js +1 -1
  34. package/scripts/flow-hooks.js +7 -1
  35. package/scripts/flow-hybrid-detect.js +0 -0
  36. package/scripts/flow-hybrid-interactive.js +0 -0
  37. package/scripts/flow-hybrid-test.js +0 -0
  38. package/scripts/flow-import-profile +0 -0
  39. package/scripts/flow-init +0 -0
  40. package/scripts/flow-knowledge-sync.js +0 -0
  41. package/scripts/flow-long-input.js +5 -2
  42. package/scripts/flow-lsp.js +0 -0
  43. package/scripts/flow-map-index +0 -0
  44. package/scripts/flow-map-sync +0 -0
  45. package/scripts/flow-memory-blocks.js +6 -6
  46. package/scripts/flow-memory-compactor.js +0 -0
  47. package/scripts/flow-memory-sync.js +11 -2
  48. package/scripts/flow-migrate.js +0 -0
  49. package/scripts/flow-model-router.js +0 -0
  50. package/scripts/flow-models.js +0 -0
  51. package/scripts/flow-onboard +0 -0
  52. package/scripts/flow-orchestrate.js +0 -0
  53. package/scripts/flow-parallel.js +1 -1
  54. package/scripts/flow-prd-manager.js +0 -0
  55. package/scripts/flow-progress.js +0 -0
  56. package/scripts/flow-prompt-composer.js +0 -0
  57. package/scripts/flow-queue.js +0 -0
  58. package/scripts/flow-ready +0 -0
  59. package/scripts/flow-regression.js +0 -0
  60. package/scripts/flow-resume.js +0 -0
  61. package/scripts/flow-review.js +170 -5
  62. package/scripts/flow-search +0 -0
  63. package/scripts/flow-session-end +0 -0
  64. package/scripts/flow-session-end.js +51 -0
  65. package/scripts/flow-session-state.js +15 -8
  66. package/scripts/flow-setup-hooks +0 -0
  67. package/scripts/flow-setup-hooks.js +0 -0
  68. package/scripts/flow-skill-create.js +0 -0
  69. package/scripts/flow-skill-learn.js +0 -0
  70. package/scripts/flow-standup +0 -0
  71. package/scripts/flow-start +0 -0
  72. package/scripts/flow-start.js +1 -1
  73. package/scripts/flow-status +0 -0
  74. package/scripts/flow-statusline-setup.js +0 -0
  75. package/scripts/flow-story +0 -0
  76. package/scripts/flow-suspend.js +0 -0
  77. package/scripts/flow-task-analyzer.js +0 -0
  78. package/scripts/flow-templates.js +0 -0
  79. package/scripts/flow-trace +0 -0
  80. package/scripts/flow-update-map +0 -0
  81. package/scripts/flow-utils.js +100 -80
  82. package/scripts/flow-watch +0 -0
  83. package/scripts/hooks/adapters/base-adapter.js +3 -1
  84. package/scripts/hooks/adapters/claude-code.js +95 -43
  85. package/scripts/hooks/core/loop-check.js +11 -0
  86. package/scripts/hooks/core/observation-capture.js +11 -1
  87. package/scripts/hooks/core/routing-gate.js +78 -25
  88. package/scripts/hooks/core/scope-gate.js +24 -20
  89. package/scripts/hooks/core/task-completed.js +4 -2
  90. package/scripts/hooks/core/task-gate.js +2 -0
  91. package/scripts/hooks/entry/claude-code/pre-tool-use.js +19 -5
  92. package/scripts/hooks/entry/claude-code/session-start.js +18 -0
  93. package/scripts/hooks/entry/claude-code/stop.js +52 -24
  94. package/scripts/postinstall.js +95 -0
@@ -0,0 +1,359 @@
1
+ Comprehensive project-wide deep analysis that goes far beyond code review. While `/wogi-review` asks "did I introduce problems?", `/wogi-audit` asks "how can we make this project better?"
2
+
3
+ **Triggers**: `/wogi-audit`, "audit project", "project audit", "full project analysis", "full analysis"
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ /wogi-audit # Full 7-dimension audit
9
+ /wogi-audit --skip-deps # Skip dependency analysis
10
+ /wogi-audit --skip-web # Skip web searches (faster, offline)
11
+ /wogi-audit --focus arch # Focus on architecture only
12
+ /wogi-audit --focus perf,debt # Focus on specific dimensions
13
+ ```
14
+
15
+ ## Comparison
16
+
17
+ | Dimension | /wogi-health | /wogi-review | /wogi-audit |
18
+ |-----------|-------------|-------------|-------------|
19
+ | Checks | WogiFlow files/config | Code quality in specific files | Entire project holistically |
20
+ | Finds | Missing files, broken JSON | Bugs, security, standards violations | Architecture, opportunities, modernization |
21
+ | Scope | WogiFlow infrastructure | Git diff (or NL-scoped files) | All project code |
22
+ | When | After install/config changes | After coding, before commit | Periodically, or when onboarding |
23
+ | Output | Health status (pass/fail) | Findings with fix recommendations | Strategic report with prioritized opportunities |
24
+
25
+ ## Architecture Note
26
+
27
+ The audit system has **two layers**:
28
+ 1. **Runtime script** (`flow-audit.js`) — provides helper functions for file scanning, TODO finding, dependency checking, and score calculation.
29
+ 2. **AI instructions** (this document) — describe the 7-agent parallel analysis, scoring, and post-audit workflow. You (the AI) orchestrate the full audit.
30
+
31
+ ## How It Works
32
+
33
+ ### Step 1: Gather Project Files
34
+
35
+ ```bash
36
+ node scripts/flow-audit.js files
37
+ ```
38
+
39
+ This returns all tracked project files (excluding node_modules, dist, .workflow/state/, etc.). Use this as the base file set for all agents.
40
+
41
+ ### Step 2: Launch 7 Parallel Agents
42
+
43
+ Launch ALL enabled agents as parallel `Task` calls in a single message. Each agent uses `subagent_type=Explore` and `model="sonnet"` (per decisions.md: use Sonnet for routine exploration).
44
+
45
+ **Agent configuration** is in `config.audit.agents` — skip any agent set to `false`.
46
+
47
+ ---
48
+
49
+ #### Agent 1: Architecture Analyzer
50
+
51
+ ```
52
+ Analyze the architecture of this project.
53
+
54
+ 1. Read the project's main entry points and directory structure
55
+ 2. Check separation of concerns:
56
+ - Are controllers/routes separate from business logic?
57
+ - Are utilities separate from domain code?
58
+ - Is configuration separate from implementation?
59
+ 3. Find layer violations:
60
+ - UI code calling database directly
61
+ - Route handlers containing business logic (>50 LOC)
62
+ - Utility files importing domain-specific modules
63
+ 4. Find god files (files with >300 LOC or >10 exported functions)
64
+ 5. Check for circular dependencies between modules
65
+ 6. Identify missing abstractions (repeated patterns that could be extracted)
66
+
67
+ Return a structured report with:
68
+ - Strengths (good patterns found)
69
+ - Opportunities (improvements), each tagged [HIGH/MED/LOW]
70
+ - Score: A (excellent) through F (critical issues)
71
+ ```
72
+
73
+ #### Agent 2: Dependency Auditor
74
+
75
+ ```
76
+ Audit the project's dependencies.
77
+
78
+ 1. Read package.json for all dependencies and devDependencies
79
+ 2. Run: node scripts/flow-audit.js outdated
80
+ → This runs npm outdated and returns structured results
81
+ 3. Check for:
82
+ - Major version updates available (HIGH priority)
83
+ - Deprecated packages (check npm registry via web search if --skip-web not set)
84
+ - Lighter alternatives (e.g., moment.js → date-fns, lodash → native)
85
+ - Unused dependencies (in package.json but never imported)
86
+ - Missing peer dependencies
87
+ 4. Check for known security vulnerabilities:
88
+ - Run: node scripts/flow-audit.js audit
89
+ → This runs npm audit and returns structured results
90
+
91
+ Return:
92
+ - Dependencies summary (total, outdated, vulnerable)
93
+ - Each finding tagged [HIGH/MED/LOW]
94
+ - Score: A through F
95
+ ```
96
+
97
+ #### Agent 3: Duplication & Consolidation Scanner
98
+
99
+ ```
100
+ Scan for code duplication and consolidation opportunities.
101
+
102
+ 1. Read ALL registry maps:
103
+ - .workflow/state/app-map.md (components)
104
+ - .workflow/state/function-map.md (functions)
105
+ - .workflow/state/api-map.md (APIs)
106
+ - Any other *-map.md files in .workflow/state/
107
+ 2. Find similar entries that could be merged:
108
+ - Functions with similar names and purposes
109
+ - Components with overlapping functionality
110
+ - API endpoints that share 80%+ logic
111
+ 3. Search for copy-paste code patterns:
112
+ - Similar function bodies across different files
113
+ - Repeated error handling patterns (>3 occurrences)
114
+ - Utility functions that duplicate native language features
115
+ 4. Find consolidation opportunities:
116
+ - Similar utility functions in different directories
117
+ - Multiple implementations of the same pattern
118
+
119
+ Return:
120
+ - Duplication findings, each tagged [HIGH/MED/LOW]
121
+ - Consolidation recommendations
122
+ - Score: A through F
123
+ ```
124
+
125
+ #### Agent 4: Performance & Optimization Analyzer
126
+
127
+ ```
128
+ Analyze the project for performance issues and optimization opportunities.
129
+
130
+ 1. Search for common performance anti-patterns:
131
+ - Sequential awaits that could be Promise.all (look for: await X; await Y;)
132
+ - N+1 query patterns (loops containing DB/API calls)
133
+ - Large synchronous file operations in request handlers
134
+ - Missing caching on frequently-accessed data
135
+ 2. Check for bundle size concerns:
136
+ - Large library imports (lodash, moment, etc.)
137
+ - Importing entire libraries when only one function is needed
138
+ 3. Check for memory leak patterns:
139
+ - Event listeners not cleaned up
140
+ - Growing arrays/maps without bounds
141
+ - Closures holding references to large objects
142
+ 4. Framework-specific checks:
143
+ - React: unnecessary re-renders, missing useMemo/useCallback
144
+ - Express/Fastify: missing compression, no request timeouts
145
+ - Node.js: sync file operations in async contexts
146
+
147
+ Return:
148
+ - Performance findings, each tagged [HIGH/MED/LOW]
149
+ - Score: A through F
150
+ ```
151
+
152
+ #### Agent 5: Consistency & Patterns Auditor
153
+
154
+ ```
155
+ Audit consistency of patterns across the project.
156
+
157
+ 1. Error handling consistency:
158
+ - How many different error handling patterns exist? (try/catch, .catch(), middleware, etc.)
159
+ - Are errors logged consistently?
160
+ - Is there a standard error format?
161
+ 2. Logging patterns:
162
+ - Mix of console.log and structured logging?
163
+ - Consistent log levels?
164
+ 3. Naming convention adherence:
165
+ - File naming: kebab-case throughout?
166
+ - Variable naming: camelCase consistently?
167
+ - Catch block variables: always 'err'?
168
+ 4. API response format consistency:
169
+ - Do all endpoints return the same shape ({ data } vs { result } vs raw)?
170
+ - Consistent HTTP status codes?
171
+ 5. Configuration patterns:
172
+ - Are config values accessed consistently?
173
+ - Any hardcoded values that should be configurable?
174
+
175
+ Return:
176
+ - Consistency findings, each tagged [HIGH/MED/LOW]
177
+ - Dominant patterns vs outliers
178
+ - Score: A through F
179
+ ```
180
+
181
+ #### Agent 6: Modernization & Alternatives Scout
182
+
183
+ ```
184
+ Scout for modernization opportunities in this project.
185
+
186
+ 1. Check for outdated patterns:
187
+ - var usage (should be const/let)
188
+ - Callback-based code (could be async/await)
189
+ - Manual null checks (could use optional chaining ?.)
190
+ - Verbose conditionals (could use nullish coalescing ??)
191
+ 2. Check framework best practices (if --skip-web not set):
192
+ - Web search for "[framework] best practices 2026"
193
+ - Compare current patterns against recommended approaches
194
+ 3. Check for newer library alternatives:
195
+ - Web search for lightweight alternatives to heavy dependencies
196
+ 4. Look for simplification opportunities:
197
+ - Complex logic that could use modern language features
198
+ - Manual implementations of things available in the standard library
199
+ - Overly defensive code that could trust framework guarantees
200
+
201
+ Return:
202
+ - Modernization opportunities, each tagged [HIGH/MED/LOW]
203
+ - Score: A through F
204
+ ```
205
+
206
+ #### Agent 7: Tech Debt Cataloger
207
+
208
+ ```
209
+ Catalog technical debt in this project.
210
+
211
+ 1. Find all TODO, FIXME, HACK, WORKAROUND, TEMPORARY comments:
212
+ - Run: node scripts/flow-audit.js todos
213
+ → Returns structured list of all TODO/FIXME/HACK comments with file:line
214
+ 2. Find commented-out code blocks (>3 consecutive commented lines)
215
+ 3. Find functions with high complexity:
216
+ - Deep nesting (>4 levels)
217
+ - Many branches (>8 if/else chains)
218
+ - Long functions (>100 LOC)
219
+ 4. Find dead code:
220
+ - Unused exports (exported but never imported elsewhere)
221
+ - Unreachable branches
222
+ 5. Cross-reference with existing tech debt:
223
+ - Read .workflow/state/tech-debt.json if it exists
224
+ - Identify new debt vs already-tracked debt
225
+
226
+ Return:
227
+ - Tech debt items, each tagged [HIGH/MED/LOW]
228
+ - Summary: TODOs count, FIXMEs count, HACKs count
229
+ - Commented-out code blocks count
230
+ - Score: A through F
231
+ ```
232
+
233
+ ### Step 3: Consolidate Results
234
+
235
+ After all agents complete, consolidate into a single report.
236
+
237
+ **Use `node scripts/flow-audit.js score` with the agent scores to calculate a weighted overall score.**
238
+
239
+ ### Step 4: Display Report
240
+
241
+ ```
242
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
243
+ PROJECT AUDIT REPORT
244
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
245
+
246
+ Project: [name] | Files scanned: N | Date: YYYY-MM-DD
247
+
248
+ HEALTH SCORE: [A/B/C/D/F] (weighted across all dimensions)
249
+
250
+ ━━━ ARCHITECTURE (score: X) ━━━
251
+ Strengths:
252
+ - [good patterns found]
253
+
254
+ Opportunities:
255
+ [HIGH] [description]
256
+ [MED] [description]
257
+ [LOW] [description]
258
+
259
+ ━━━ DEPENDENCIES (score: X) ━━━
260
+ [findings...]
261
+
262
+ ━━━ DUPLICATION (score: X) ━━━
263
+ [findings...]
264
+
265
+ ━━━ PERFORMANCE (score: X) ━━━
266
+ [findings...]
267
+
268
+ ━━━ CONSISTENCY (score: X) ━━━
269
+ [findings...]
270
+
271
+ ━━━ MODERNIZATION (score: X) ━━━
272
+ [findings...]
273
+
274
+ ━━━ TECH DEBT (score: X) ━━━
275
+ TODOs: N | FIXMEs: N | HACKs: N
276
+ [findings...]
277
+
278
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
279
+ SUMMARY: N opportunities found
280
+ High: N | Medium: N | Low: N
281
+
282
+ Top 5 Quick Wins (highest impact, lowest effort):
283
+ 1. [description]
284
+ 2. [description]
285
+ 3. [description]
286
+ 4. [description]
287
+ 5. [description]
288
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
289
+ ```
290
+
291
+ ### Step 5: Post-Audit Actions
292
+
293
+ After displaying the report, offer these options using AskUserQuestion:
294
+
295
+ 1. **Create tasks** — Convert high-priority findings to stories/tasks in ready.json
296
+ 2. **Add to tech debt** — Add findings to `.workflow/state/tech-debt.json` via `/wogi-debt`
297
+ 3. **Save report** — Persist to `.workflow/audits/YYYY-MM-DD-audit.md`
298
+ 4. **Create rules** — Promote recurring patterns to decisions.md via `/wogi-decide`
299
+
300
+ ### Step 6: Persist Report
301
+
302
+ Regardless of user choice, always save the audit results to `.workflow/state/last-audit.json`:
303
+
304
+ ```json
305
+ {
306
+ "date": "YYYY-MM-DD",
307
+ "overallScore": "B+",
308
+ "scores": {
309
+ "architecture": "B+",
310
+ "dependencies": "A-",
311
+ "duplication": "C+",
312
+ "performance": "B",
313
+ "consistency": "B-",
314
+ "modernization": "B+",
315
+ "techDebt": "B"
316
+ },
317
+ "findings": {
318
+ "total": 45,
319
+ "high": 8,
320
+ "medium": 18,
321
+ "low": 19
322
+ },
323
+ "topFindings": [...]
324
+ }
325
+ ```
326
+
327
+ ## Configuration
328
+
329
+ Controlled by `config.audit`:
330
+
331
+ ```json
332
+ {
333
+ "audit": {
334
+ "agents": {
335
+ "architecture": true,
336
+ "dependencies": true,
337
+ "duplication": true,
338
+ "performance": true,
339
+ "consistency": true,
340
+ "modernization": true,
341
+ "techDebt": true
342
+ },
343
+ "scoring": {
344
+ "enabled": true,
345
+ "weights": {
346
+ "architecture": 0.25,
347
+ "dependencies": 0.15,
348
+ "duplication": 0.15,
349
+ "performance": 0.15,
350
+ "consistency": 0.10,
351
+ "modernization": 0.10,
352
+ "techDebt": 0.10
353
+ }
354
+ },
355
+ "exclude": ["node_modules", ".workflow/state", "dist", "build"],
356
+ "maxFilesPerAgent": 100
357
+ }
358
+ }
359
+ ```
@@ -81,7 +81,7 @@ Run the export script directly:
81
81
  After installing WogiFlow, import a team profile:
82
82
 
83
83
  ```bash
84
- npm install wogiflow
84
+ npm install -D wogiflow
85
85
  npx flow import-profile ~/my-team.zip
86
86
  ```
87
87
 
@@ -691,6 +691,36 @@ Display:
691
691
 
692
692
  ---
693
693
 
694
+ ### Phase 6.5: Generate CLAUDE.md (CRITICAL)
695
+
696
+ **Now that config.json exists, generate the full CLAUDE.md from templates.**
697
+
698
+ This replaces the bootstrap CLAUDE.md (created by postinstall) with the complete version rendered from Handlebars templates using the project's actual config values.
699
+
700
+ ```bash
701
+ npx flow bridge sync
702
+ ```
703
+
704
+ This runs the bridge which:
705
+ 1. Reads `.workflow/config.json` (just created in Phase 6)
706
+ 2. Renders `.workflow/templates/claude-md.hbs` with config values
707
+ 3. Writes the full `CLAUDE.md` with all enforcement rules, file locations, and commands
708
+
709
+ Display:
710
+ ```
711
+ CLAUDE.md... ✓ Generated from templates (full version)
712
+ ```
713
+
714
+ **If bridge sync fails:**
715
+ - Log warning: `⚠️ CLAUDE.md generation failed: [error]. Bootstrap version remains.`
716
+ - The bootstrap CLAUDE.md from postinstall still provides basic task gating
717
+ - User can manually run `npx flow bridge sync` later
718
+
719
+ **Why this step matters:**
720
+ Without it, the user completes onboarding but CLAUDE.md is either missing or still the bootstrap version. The full CLAUDE.md contains file locations, quality gate configs, commit behavior rules, and natural language command detection — all essential for the full WogiFlow experience.
721
+
722
+ ---
723
+
694
724
  ### Phase 7: Summary
695
725
 
696
726
  Display:
@@ -719,6 +749,8 @@ Template extraction... ✓ Found 4 templates (component, service, test, hook)
719
749
 
720
750
  ━━━ Generated Files ━━━
721
751
 
752
+ CLAUDE.md # Full project instructions (from templates)
753
+
722
754
  .workflow/
723
755
  config.json # Project configuration
724
756
  context/
@@ -778,6 +810,7 @@ You can:
778
810
 
779
811
  | File | Purpose |
780
812
  |------|---------|
813
+ | `CLAUDE.md` | Full project instructions for Claude Code (generated from templates) |
781
814
  | `.workflow/config.json` | Project configuration (quality gates, temporal thresholds) |
782
815
  | `.workflow/context/stack.md` | Detected tech stack |
783
816
  | `.workflow/context/product.md` | Product description and features |
@@ -87,6 +87,70 @@ The review system has **two layers**:
87
87
 
88
88
  **The runtime script does NOT execute all 5 phases.** It handles pre-flight only. You (the AI) are responsible for orchestrating the complete review.
89
89
 
90
+ ## Step 0: Scope Resolution (Natural Language Scoping)
91
+
92
+ **Before Phase 1, resolve what files to review.** When the user provides a description instead of (or in addition to) flags, the AI interprets it and resolves a file list.
93
+
94
+ **Default behavior (no args)**: Standard git diff — unchanged from previous behavior. Skip this step.
95
+
96
+ **When args are provided**, interpret the natural language and resolve scope:
97
+
98
+ ```
99
+ Step 0: Scope Resolution
100
+ ├── No args (just /wogi-review)? → Default git diff, skip this step
101
+ ├── Has --commits, --staged flags? → Use those flags directly, skip NL
102
+ └── Has natural language args? → AI interprets:
103
+ ├── Session-based ("last 3 sessions", "since yesterday's session")
104
+ │ → Use getSessionBoundaryCommits(n) from flow-review.js
105
+ │ → git diff between session boundary commits
106
+ ├── Feature-based ("auth feature", "payment flow")
107
+ │ → Grep codebase for related files
108
+ │ → Check app-map.md, function-map.md for feature groupings
109
+ │ → Read request-log.md for tagged entries (#screen:X, #component:Y)
110
+ ├── Branch-based ("this branch", "feature/xyz", "everything on this branch")
111
+ │ → Use getBranchFiles() from flow-review.js
112
+ │ → git diff main...HEAD (or specified branch)
113
+ ├── Time-based ("last week", "since Monday", "past 2 days")
114
+ │ → Use getFilesSinceDate() from flow-review.js
115
+ │ → git log --since to find commit range
116
+ ├── Path-based ("the API layer", "all services", "just the hooks")
117
+ │ → Glob for matching file patterns (e.g., scripts/hooks/**)
118
+ └── Full project ("everything", "the whole project", "all files")
119
+ → Use getAllProjectFiles() from flow-review.js
120
+ → Auto-enable multi-pass mode for large file sets
121
+ ```
122
+
123
+ **After resolving scope, display it before proceeding:**
124
+ ```
125
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
126
+ SCOPE RESOLUTION
127
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
128
+ Request: "check the last 3 sessions"
129
+ Resolved: 23 files from last 3 sessions (commits abc1234..xyz5678)
130
+
131
+ Files:
132
+ scripts/flow-review.js
133
+ scripts/hooks/core/routing-gate.js
134
+ ... (list first 10, summarize rest)
135
+
136
+ Mode: multi-pass (auto-enabled: 23 files)
137
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
138
+ ```
139
+
140
+ **Helper functions available** (exported from `scripts/flow-review.js`):
141
+ - `getSessionBoundaryCommits(n)` — finds last N "End session" commits
142
+ - `getFilesBetweenCommits(fromSha, toSha)` — git diff between two commits
143
+ - `getFilesSinceDate(dateStr)` — git log --since to find commit range
144
+ - `getBranchFiles(baseBranch)` — git diff against merge-base
145
+ - `getAllProjectFiles()` — all tracked files excluding node_modules, dist, etc.
146
+
147
+ **When scope resolves to 20+ files**: Auto-suggest multi-pass mode.
148
+ **When scope is "full project"**: Cap to relevant code files, always use multi-pass.
149
+
150
+ The resolved file list replaces the default git diff in Phase 1. All subsequent phases operate on the resolved scope.
151
+
152
+ ---
153
+
90
154
  ## How It Works (MANDATORY 5-PHASE SEQUENTIAL EXECUTION)
91
155
 
92
156
  **CRITICAL: You MUST execute ALL 5 phases sequentially. Do NOT stop after Phase 2.**
@@ -169,7 +169,7 @@ When user types these commands, execute the corresponding action immediately.
169
169
 
170
170
  ```bash
171
171
  # Setup
172
- npm install wogiflow # Install WogiFlow in your project
172
+ npm install -D wogiflow # Install WogiFlow as dev dependency
173
173
  npx flow onboard # Analyze existing project & set up context
174
174
 
175
175
  # Task Management
@@ -21,7 +21,9 @@ The setup and onboarding process gathers this context automatically and stores i
21
21
  ### Install
22
22
 
23
23
  ```bash
24
- npm install wogiflow
24
+ npm install -D wogiflow
25
+ # or
26
+ bun add -d --trust wogiflow # --trust is required for bun to run postinstall
25
27
  ```
26
28
 
27
29
  The postinstall script automatically creates the `.workflow/` directory structure.
@@ -150,7 +152,7 @@ This analyzes your codebase and populates:
150
152
 
151
153
  | Command | Purpose |
152
154
  |---------|---------|
153
- | `npm install wogiflow` | Install WogiFlow and create .workflow structure |
155
+ | `npm install -D wogiflow` (or `bun add -d --trust wogiflow`) | Install WogiFlow and create .workflow structure |
154
156
  | `npx flow onboard` | Analyze existing project |
155
157
  | `/wogi-map-index` | Show/regenerate component index |
156
158
  | `/wogi-map-scan` | Scan for unmapped components |
@@ -7,13 +7,29 @@ Set up WogiFlow for your project.
7
7
  ## Quick Install
8
8
 
9
9
  ```bash
10
- npm install wogiflow
10
+ npm install -D wogiflow
11
+ # or
12
+ bun add -d --trust wogiflow
11
13
  ```
12
14
 
13
15
  This automatically:
14
16
  1. Creates the `.workflow/` directory structure
15
17
  2. Copies template files to `.workflow/state/`
16
- 3. Sets up necessary subdirectories
18
+ 3. Generates a bootstrap `CLAUDE.md` for immediate use
19
+ 4. Sets up necessary subdirectories
20
+
21
+ ### Bun Users
22
+
23
+ Bun does not run lifecycle scripts (postinstall) from third-party packages by default — this is a security measure. The `--trust` flag is **required** for WogiFlow to set up properly.
24
+
25
+ Without `--trust`, the postinstall script never runs, so no `.workflow/` directory, no `.claude/commands/`, no scripts — nothing gets set up.
26
+
27
+ To persist trust so future updates also run lifecycle scripts, add to `bunfig.toml`:
28
+
29
+ ```toml
30
+ [install]
31
+ trustedDependencies = ["wogiflow"]
32
+ ```
17
33
 
18
34
  ---
19
35
 
@@ -96,6 +112,8 @@ Or in Claude:
96
112
 
97
113
  ```bash
98
114
  npm update wogiflow
115
+ # or
116
+ bun update wogiflow # requires trustedDependencies in bunfig.toml (see above)
99
117
  ```
100
118
 
101
119
  ---
@@ -117,6 +135,24 @@ The installer creates a balanced config:
117
135
 
118
136
  ## Troubleshooting
119
137
 
138
+ ### Bun: Nothing Got Set Up
139
+
140
+ If `.workflow/` and `.claude/` directories don't exist after install, you likely forgot `--trust`:
141
+
142
+ ```bash
143
+ # Remove and reinstall with --trust
144
+ bun remove wogiflow
145
+ bun add -d --trust wogiflow
146
+ ```
147
+
148
+ Or add to `bunfig.toml` for persistent trust:
149
+ ```toml
150
+ [install]
151
+ trustedDependencies = ["wogiflow"]
152
+ ```
153
+
154
+ Then reinstall: `bun install`
155
+
120
156
  ### Permission Denied
121
157
 
122
158
  ```bash
@@ -125,9 +161,10 @@ chmod +x ./node_modules/wogiflow/scripts/flow*
125
161
 
126
162
  ### Missing Dependencies
127
163
 
128
- Ensure Node.js 18+ is installed:
164
+ Ensure Node.js 18+ or Bun 1.0+ is installed:
129
165
  ```bash
130
166
  node --version # Should be 18+
167
+ bun --version # Should be 1.0+
131
168
  ```
132
169
 
133
170
  ### Config Validation Errors
@@ -21,7 +21,9 @@ Welcome to the comprehensive knowledge base for WogiFlow, an AI workflow framewo
21
21
 
22
22
  ### Install
23
23
  ```bash
24
- npm install wogiflow
24
+ npm install -D wogiflow
25
+ # or
26
+ bun add -d --trust wogiflow # --trust is required for bun to run postinstall
25
27
  ```
26
28
 
27
29
  ### Analyze Existing Project
@@ -104,4 +104,4 @@
104
104
  "_wogiFlowManaged": true,
105
105
  "_wogiFlowVersion": "1.5.9",
106
106
  "_comment": "Shared WogiFlow hook configuration. Committed to repo for team use. User-specific overrides go in settings.local.json."
107
- }
107
+ }
@@ -34,9 +34,11 @@ Check `.workflow/state/ready.json` for existing tasks.
34
34
 
35
35
  ---
36
36
 
37
- ## Post-Compaction Routing (CRITICAL)
37
+ ## Post-Compaction / Session Continuation Routing (CRITICAL)
38
38
 
39
- **After context compaction or conversation resumption, the routing requirement is NOT relaxed.**
39
+ **After context compaction, conversation resumption, or session continuation, the routing requirement is NOT relaxed.**
40
+
41
+ **"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.
40
42
 
41
43
  When you resume from a compacted/summarized conversation:
42
44
  1. You may have compressed context from prior work — that is fine
@@ -44,10 +46,12 @@ When you resume from a compacted/summarized conversation:
44
46
  3. Do NOT answer from compacted memory without routing first
45
47
  4. Do NOT assume "I already know the answer" justifies skipping routing
46
48
  5. The compaction summary preserves context but does NOT grant routing bypass
49
+ 6. Do NOT edit `ready.json` or any `.workflow/state/` file to create tasks manually — that is a routing bypass
50
+ 7. "Continue where we left off" still requires `/wogi-start` — invoke it with the task ID
47
51
 
48
- **Why this matters**: After compaction, CLAUDE.md rules may be compressed. The AI may "feel" confident answering directly because it has context from the summary. This is the exact scenario that causes routing bypass. The routing hooks (UserPromptSubmit, PreToolUse, Stop) enforce this mechanically, but this instruction ensures you comply proactively.
52
+ **Why this matters**: After compaction, CLAUDE.md rules may be compressed. The AI may "feel" confident answering directly because it has context from the summary. This is the exact scenario that causes routing bypass. The routing hooks enforce this mechanically — Edit, Write, Read, Glob, Grep, Bash, and EnterPlanMode are ALL blocked until routing completes.
49
53
 
50
- **If you catch yourself about to respond without routing**: STOP. Invoke the Skill tool with skill="wogi-start" first. The Stop hook will block you from completing a response that bypassed routing.
54
+ **If you catch yourself about to respond without routing**: STOP. Invoke the Skill tool with skill="wogi-start" first. The PreToolUse hook will block ANY tool call (including Edit/Write) before routing.
51
55
 
52
56
  {{/if}}
53
57
 
@@ -75,7 +79,7 @@ When unsure, ASK the user rather than deviate from source patterns.
75
79
  ## Quick Start
76
80
 
77
81
  ```bash
78
- npm install wogiflow && npx flow onboard
82
+ npm install -D wogiflow && npx flow onboard
79
83
  ```
80
84
 
81
85
  ## Core Principles
@@ -115,6 +119,7 @@ npm install wogiflow && npx flow onboard
115
119
  | `/wogi-health` | Check workflow health |
116
120
  | `/wogi-roadmap` | View/manage deferred work |
117
121
  | `/wogi-suggest "text"` | Submit suggestion for WogiFlow |
122
+ | `/wogi-audit` | Comprehensive project-wide analysis (7 dimensions) |
118
123
 
119
124
  See `.claude/docs/commands.md` for complete command reference.
120
125
 
@@ -141,6 +146,7 @@ See `.claude/docs/commands.md` for complete command reference.
141
146
  | "finalize branch", "merge to master", "create a PR", "discard this branch", "what to do with this branch" | `/wogi-finalize` |
142
147
  | "rescan project", "re-evaluate project", "project changed", "others made changes", "sync wogi", "things changed", "out of sync" | `/wogi-rescan` |
143
148
  | "suggest improvement", "feature request for wogi", "wogi suggestion", "submit feedback" | `/wogi-suggest` |
149
+ | "audit project", "project audit", "full project analysis", "full analysis" | `/wogi-audit` |
144
150
 
145
151
  **IMPORTANT**: When a user's message matches one of these patterns, immediately invoke the Skill tool with the corresponding command. Do not ask for confirmation. These `/wogi-*` commands satisfy the mandatory routing requirement — you do NOT also need to invoke `/wogi-start` when a detection match exists. `/wogi-start` is the fallback for messages that don't match this table.
146
152
 
@@ -14,5 +14,6 @@
14
14
  | Learn from patterns | "let's learn from this" or "promote pattern" |
15
15
  | Session retro | "retro" or "what went well" |
16
16
  | Rescan project | "rescan project" or "things changed" or "out of sync" |
17
+ | Project audit | "audit project" or "full analysis" |
17
18
 
18
19
  `/wogi-start` is the universal fallback router — it classifies any request and routes to the right action. Detailed per-command docs live in each skill's `.md` file under `.claude/commands/`.