wogiflow 2.34.1 → 2.34.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 (36) hide show
  1. package/.workflow/templates/partials/methodology-rules.hbs +3 -1
  2. package/lib/workspace-channel-server.js +10 -0
  3. package/package.json +1 -1
  4. package/scripts/flow-io.js +17 -0
  5. package/scripts/flow-paths.js +81 -0
  6. package/scripts/flow-utils.js +2 -0
  7. package/scripts/hooks/core/long-input-enforcement.js +49 -39
  8. package/scripts/hooks/core/phase-gate.js +34 -5
  9. package/scripts/hooks/core/phase-read-gate.js +62 -10
  10. package/scripts/hooks/core/worker-continuation-gate.js +169 -8
  11. package/.claude/rules/README.md +0 -36
  12. package/.claude/rules/_internal/README.md +0 -64
  13. package/.claude/rules/_internal/document-structure.md +0 -77
  14. package/.claude/rules/_internal/dual-repo-management.md +0 -174
  15. package/.claude/rules/_internal/feature-refactoring-cleanup.md +0 -87
  16. package/.claude/rules/_internal/github-releases.md +0 -71
  17. package/.claude/rules/_internal/model-management.md +0 -35
  18. package/.claude/rules/_internal/self-maintenance.md +0 -87
  19. package/.claude/rules/_internal/worker-tool-first-turn.md +0 -82
  20. package/.claude/rules/alternative-execpolicy-toml-command-policy.md +0 -11
  21. package/.claude/rules/alternative-hand-edit-ready-json-to-register-orpha.md +0 -11
  22. package/.claude/rules/alternative-hook-args-exec-form.md +0 -6
  23. package/.claude/rules/alternative-permission-ruleset-per-phase.md +0 -11
  24. package/.claude/rules/alternative-short-name.md +0 -12
  25. package/.claude/rules/alternative-wogi-flow-as-mcp-client-oauth-manager.md +0 -11
  26. package/.claude/rules/architecture/component-reuse.md +0 -38
  27. package/.claude/rules/architecture/hook-three-layer.md +0 -68
  28. package/.claude/rules/code-style/naming-conventions.md +0 -107
  29. package/.claude/rules/dual-repo-architecture-2026-02-28.md +0 -18
  30. package/.claude/rules/github-release-workflow-2026-01-30.md +0 -16
  31. package/.claude/rules/operations/git-workflows.md +0 -92
  32. package/.claude/rules/operations/scratch-directory.md +0 -54
  33. package/.claude/skills/figma-analyzer/knowledge/learnings.md +0 -11
  34. package/.workflow/specs/architecture.md.template +0 -24
  35. package/.workflow/specs/stack.md.template +0 -33
  36. package/.workflow/specs/testing.md.template +0 -36
@@ -185,6 +185,138 @@ function escalateBlocked({ workspaceRoot, repoName, taskId, reason, managerPort
185
185
  } catch (_err) { /* best effort */ }
186
186
  }
187
187
 
188
+ /**
189
+ * Is autonomous walk-away mode active for this worker? Read from the canonical
190
+ * session-state.json. Tailors the stall directive (pre-approved → proceed) but
191
+ * does NOT change the never-idle guarantee — that holds in all worker mode.
192
+ */
193
+ function isAutonomousActive(stateDir) {
194
+ try {
195
+ const { safeJsonParse } = require('../../flow-utils');
196
+ const ss = safeJsonParse(path.join(stateDir, 'session-state.json'), null);
197
+ return Boolean(ss && ss.autonomousMode && ss.autonomousMode.active);
198
+ } catch (_err) {
199
+ return false;
200
+ }
201
+ }
202
+
203
+ /**
204
+ * Directive injected when an in-progress worker is parked at a gate. Tells it to
205
+ * make real progress by SATISFYING the gate legitimately (read the phase doc,
206
+ * decompose, provide evidence) — or to channel-escalate — and EXPLICITLY forbids
207
+ * gate circumvention. This is the integrity half of RC2: never give the worker a
208
+ * reason to reach for a worktree / marker-write.
209
+ */
210
+ function buildStallDirective({ taskId, phase, remaining, total, attempt, k, autonomous, env }) {
211
+ const port = (env && env.WOGI_MANAGER_PORT) || '8800';
212
+ const repo = (env && env.WOGI_REPO_NAME) || 'worker';
213
+ const isParked = phase === 'exploring' || phase === 'spec_review';
214
+ const lines = [
215
+ `SUSTAINED EXECUTION — task ${taskId} is in progress but appears PARKED (phase=${phase}, ${remaining}/${total || 0} sub-tasks).`,
216
+ `You are a workspace worker. A dispatched task runs to COMPLETION across turns. Idling silently while a task is in-progress is NOT a valid end-of-turn state.`,
217
+ '',
218
+ 'Make REAL progress THIS turn by SATISFYING the gate legitimately:'
219
+ ];
220
+ if (isParked) {
221
+ lines.push(
222
+ ` • You are in the ${phase} phase. Read the required phase instruction file (.claude/docs/phases/), finish the ${phase === 'spec_review' ? 'spec' : 'exploration'}, and advance the pipeline.`,
223
+ autonomous
224
+ ? ` • Autonomous mode is ACTIVE → you are PRE-APPROVED. Do NOT wait for spec/architect approval — proceed.`
225
+ : ` • If this needs manager/user approval, channel-escalate (below) instead of waiting silently.`
226
+ );
227
+ } else {
228
+ lines.push(
229
+ ` • The task is in an active phase but has no decomposed sub-task ledger yet. Decompose it (TodoWrite) and START the first sub-task, OR if a gate is blocking you, satisfy it (read the required phase doc / provide the required evidence).`
230
+ );
231
+ }
232
+ lines.push(
233
+ '',
234
+ 'PROHIBITED — gate circumvention is forbidden and pointless (gates resolve phase from the canonical main-repo state, not your cwd):',
235
+ ' ✗ Do NOT create a git worktree to reach an "ungated" context.',
236
+ ' ✗ Do NOT hand-write gate-satisfying markers or edit .workflow/state files to fake gate satisfaction.',
237
+ ' ✗ Do NOT change working directory to dodge a gate.',
238
+ '',
239
+ 'If you genuinely cannot proceed (blocked on the manager/user, or the next step is destructive / needs credentials), ESCALATE then end the turn:',
240
+ ` curl -s -X POST http://127.0.0.1:${port} \\`,
241
+ ` -H "X-Wogi-From: ${repo}" \\`,
242
+ ` --data-binary "## QUESTION: <your blocker>"`,
243
+ '',
244
+ `(stall continuation ${attempt}/${k} — make real progress or escalate; ${k} idle turns in a row will auto-escalate to the manager and stop.)`
245
+ );
246
+ return lines.join('\n');
247
+ }
248
+
249
+ /**
250
+ * Stall handler (RC1). Drives a proceed-or-escalate continuation for an
251
+ * in-progress worker task the happy path won't cover, then escalates to the
252
+ * manager after `noProgressK` consecutive no-progress turns. Shares the per-task
253
+ * counter file but tracks stall progress in dedicated fields so it never
254
+ * conflates with the happy-path continuation count. Never returns a silent stop
255
+ * without having escalated.
256
+ */
257
+ function handleStall({ stateDir, root, env, taskId, phase, remaining, total, fingerprintFn, cfg }) {
258
+ let counter = readCounter(stateDir);
259
+ if (!counter || counter.taskId !== taskId) {
260
+ counter = { taskId, count: 0, noProgressStreak: 0, fingerprint: null, escalated: false };
261
+ }
262
+
263
+ const fp = fingerprintFn(root, remaining);
264
+
265
+ // Use the SAME progress fields as the happy path (fingerprint /
266
+ // noProgressStreak / escalated). The stall and happy paths are mutually
267
+ // exclusive per turn but share one task counter; keeping separate fingerprint
268
+ // fields would break the escalated-resume check when a task transitions
269
+ // between modes after an escalation (the other mode's fingerprint is null →
270
+ // resume never fires → worker stuck "already-escalated"). Only `stallCount`
271
+ // is stall-specific (the attempt display).
272
+
273
+ // Respect an existing escalation — only resume if work moved since.
274
+ if (counter.escalated) {
275
+ if (counter.fingerprint && fp !== counter.fingerprint) {
276
+ counter.escalated = false;
277
+ counter.noProgressStreak = 0;
278
+ } else {
279
+ counter.fingerprint = fp;
280
+ writeCounter(stateDir, counter);
281
+ return { fired: false, decision: 'allow', reason: 'stall-already-escalated', escalated: true };
282
+ }
283
+ }
284
+
285
+ // No-progress streak (shared with happy path — no-progress is no-progress
286
+ // regardless of which mode produced the turn).
287
+ if (counter.fingerprint != null && fp === counter.fingerprint) {
288
+ counter.noProgressStreak = (counter.noProgressStreak || 0) + 1;
289
+ } else {
290
+ counter.noProgressStreak = 0;
291
+ }
292
+ counter.fingerprint = fp;
293
+
294
+ // Escalate after K consecutive no-progress turns, then stop.
295
+ if (counter.noProgressStreak >= cfg.noProgressK) {
296
+ counter.escalated = true;
297
+ writeCounter(stateDir, counter);
298
+ escalateBlocked({
299
+ workspaceRoot: env.WOGI_WORKSPACE_ROOT, repoName: env.WOGI_REPO_NAME,
300
+ taskId, reason: `parked at "${phase}" gate with no progress across ${counter.noProgressStreak} turns`,
301
+ managerPort: env.WOGI_MANAGER_PORT
302
+ });
303
+ return { fired: false, decision: 'allow', reason: 'stall-escalated', escalated: true, phase };
304
+ }
305
+
306
+ // Fire a proceed-or-escalate continuation.
307
+ counter.stallCount = (counter.stallCount || 0) + 1;
308
+ writeCounter(stateDir, counter);
309
+ const directive = buildStallDirective({
310
+ taskId, phase, remaining, total,
311
+ attempt: counter.noProgressStreak + 1, k: cfg.noProgressK,
312
+ autonomous: isAutonomousActive(stateDir), env
313
+ });
314
+ return {
315
+ fired: true, decision: 'continue', reason: 'in-progress-stall',
316
+ taskId, phase, remaining, total, attempt: counter.stallCount, stopReason: directive
317
+ };
318
+ }
319
+
188
320
  /**
189
321
  * Main gate. Returns one of:
190
322
  * { continue: true, stopReason } — force continuation
@@ -220,20 +352,47 @@ function checkWorkerContinuation(opts = {}) {
220
352
  return { fired: false, decision: 'allow', reason: 'no-in-progress' };
221
353
  }
222
354
 
223
- // Active-work phase only (respect spec-approval / exploration waits).
224
355
  const phase = readPhase(stateDir);
225
- if (!cfg.activePhases.includes(phase)) {
226
- return { fired: false, decision: 'allow', reason: `phase-not-active:${phase || 'none'}` };
227
- }
356
+ const fingerprintFn = opts.fingerprintFn || defaultProgressFingerprint;
228
357
 
229
- // Remaining decomposed work?
358
+ // Remaining decomposed work (needed by both happy-path and stall fallback).
230
359
  const subtaskState = opts.subtaskState || require('../../../lib/workspace-subtask-state');
231
360
  const summary = subtaskState.summary(taskId);
232
361
  const remaining = summary.remaining;
233
- if (remaining <= 0) {
234
- return { fired: false, decision: 'allow', reason: 'no-remaining-subtasks' };
362
+ const total = summary.total;
363
+
364
+ const PARKED_PHASES = ['exploring', 'spec_review'];
365
+ const inActivePhase = cfg.activePhases.includes(phase);
366
+
367
+ // Decomposed ledger exists and ALL sub-tasks are complete (total>0,
368
+ // remaining<=0): the task is wrapping up. Allow a clean stop so the worker
369
+ // can run `flow done` and task-complete can fire (preserves S2/S6
370
+ // termination — this is the completion boundary, not a parked stall).
371
+ if (inActivePhase && remaining <= 0 && total > 0) {
372
+ return { fired: false, decision: 'allow', reason: 'subtasks-complete' };
235
373
  }
236
374
 
375
+ // Stall fallback (RC1, wf-e5e57361): an in-progress worker task that the
376
+ // happy path won't cover MUST NOT idle silently. Two shapes:
377
+ // (a) active phase but NO decomposed ledger ever (total<=0) — e.g. parked
378
+ // at an architect / phase-read gate before TodoWrite decomposition.
379
+ // (b) parked in an approval / explore phase (exploring / spec_review).
380
+ // Drive a proceed-or-escalate continuation; escalate to the manager after
381
+ // noProgressK no-progress turns. Never a silent allow-stop.
382
+ if ((inActivePhase && total <= 0) || PARKED_PHASES.includes(phase)) {
383
+ return handleStall({
384
+ stateDir, root, env, taskId, phase,
385
+ remaining, total, fingerprintFn, cfg
386
+ });
387
+ }
388
+
389
+ // Not actionable (idle / routing / completing / unknown) — genuinely allow a
390
+ // normal stop; there is no in-progress work to sustain here.
391
+ if (!inActivePhase) {
392
+ return { fired: false, decision: 'allow', reason: `phase-not-actionable:${phase || 'none'}` };
393
+ }
394
+
395
+ // ── Happy path: active phase + remaining > 0 (unchanged S2 logic) ──
237
396
  // Per-task counter (reset when the task changes).
238
397
  let counter = readCounter(stateDir);
239
398
  if (!counter || counter.taskId !== taskId) {
@@ -243,7 +402,6 @@ function checkWorkerContinuation(opts = {}) {
243
402
  // Already escalated for this task ⇒ allow stop (don't re-fire). Manager
244
403
  // re-dispatch / restart resets the counter (taskId match but escalated flag);
245
404
  // we clear the escalation only when progress resumes (fingerprint changes).
246
- const fingerprintFn = opts.fingerprintFn || defaultProgressFingerprint;
247
405
  const fingerprint = fingerprintFn(root, remaining);
248
406
 
249
407
  if (counter.escalated) {
@@ -313,6 +471,9 @@ function checkWorkerContinuation(opts = {}) {
313
471
 
314
472
  module.exports = {
315
473
  checkWorkerContinuation,
474
+ handleStall,
475
+ buildStallDirective,
476
+ isAutonomousActive,
316
477
  isWorkerMode,
317
478
  getCfg,
318
479
  derivedCap,
@@ -1,36 +0,0 @@
1
- # Auto-Generated Rules
2
-
3
- This directory is auto-generated from `.workflow/state/decisions.md`.
4
-
5
- **DO NOT EDIT THESE FILES DIRECTLY.**
6
-
7
- Edit `decisions.md` instead, then run:
8
- ```bash
9
- node scripts/flow-rules-sync.js
10
- ```
11
-
12
- Or rules will auto-sync when decisions.md is updated.
13
-
14
- ## How It Works
15
-
16
- - Each section in decisions.md becomes a separate rule file
17
- - Rules are path-scoped based on section keywords (e.g., "component" rules only load for component files)
18
- - Claude Code automatically loads these rules for context-aware guidance
19
-
20
- ## Rule Types
21
-
22
- Rules have `alwaysApply` frontmatter that determines loading behavior:
23
-
24
- - **`alwaysApply: true`** - Always loaded (rules with: general, always, project, naming, coding, standard, convention, must, never, critical, security in title)
25
- - **`alwaysApply: false`** - Agent-requested: Claude decides whether to load based on description relevance to current task
26
-
27
- This saves tokens by not loading React rules when working on backend code, etc.
28
-
29
- ## Files
30
-
31
- - dual-repo-architecture-2026-02-28.md
32
- - github-release-workflow-2026-01-30.md
33
- - alternative-short-name.md
34
- - alternative-hand-edit-ready-json-to-register-orpha.md
35
-
36
- Last synced: 2026-04-24T06:42:44.238Z
@@ -1,64 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- description: "Meta-documentation about how project rules are organized"
4
- ---
5
- # Project Rules
6
-
7
- This directory contains coding rules and patterns for this project, organized by category.
8
-
9
- ## Structure
10
-
11
- ```
12
- .claude/rules/
13
- ├── code-style/ # Naming conventions, formatting
14
- │ └── naming-conventions.md
15
- ├── security/ # Security patterns and practices
16
- │ └── security-patterns.md
17
- ├── architecture/ # Design decisions and patterns
18
- │ ├── component-reuse.md
19
- │ └── model-management.md
20
- └── README.md
21
- ```
22
-
23
- ## How Rules Work
24
-
25
- Rules are automatically loaded by Claude Code based on:
26
- - **alwaysApply: true** - Rule is always loaded
27
- - **alwaysApply: false** - Rule is loaded based on `globs` or `description` relevance
28
- - **globs** - File patterns that trigger rule loading
29
-
30
- ## Adding New Rules
31
-
32
- 1. Choose the appropriate category subdirectory
33
- 2. Create a `.md` file with frontmatter:
34
-
35
- ```yaml
36
- ---
37
- alwaysApply: false
38
- description: "Brief description for relevance matching"
39
- globs: src/**/*.ts # Optional: only load for these files
40
- ---
41
- ```
42
-
43
- 3. Write the rule content in markdown
44
-
45
- ## Categories
46
-
47
- | Category | Purpose |
48
- |----------|---------|
49
- | code-style | Naming conventions, formatting, file structure |
50
- | security | Security patterns, input validation, safe practices |
51
- | architecture | Design decisions, component patterns, system organization |
52
-
53
- ## Auto-Generation
54
-
55
- Some rules can be auto-generated from `.workflow/state/decisions.md`:
56
-
57
- ```bash
58
- node scripts/flow-rules-sync.js
59
- ```
60
-
61
- The sync script will route rules to appropriate category subdirectories.
62
-
63
- ---
64
- Last updated: 2026-01-12
@@ -1,77 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- description: "All AI-context documents must use PIN markers for targeted context loading"
4
- globs: ".workflow/**/*.md"
5
- ---
6
-
7
- # Document Structure for AI Context
8
-
9
- All documents in `.workflow/` that are used as AI context MUST follow the PIN standard.
10
-
11
- ## Required Structure
12
-
13
- ### 1. Header with PIN List
14
- Every document starts with a comment listing all pins in the document:
15
- ```markdown
16
- <!-- PINS: pin1, pin2, pin3 -->
17
- ```
18
-
19
- ### 2. Section PIN Markers
20
- Each major section has a PIN marker comment:
21
- ```markdown
22
- ### Section Title
23
- <!-- PIN: section-specific-pin -->
24
- [Content]
25
- ```
26
-
27
- ### 3. PIN Naming Convention
28
- - Use kebab-case: `user-authentication`, not `userAuthentication`
29
- - Use semantic names: `error-handling`, not `eh`
30
- - Use compound names for specificity: `json-parse-safety`
31
-
32
- ## Why PINs Matter
33
-
34
- The PIN system enables:
35
- 1. **Targeted context loading**: Only load sections relevant to current task
36
- 2. **Cheaper model routing**: Haiku can fetch only relevant sections for Opus
37
- 3. **Change detection**: Hash sections independently for smart invalidation
38
- 4. **Cross-reference**: Link sections by PIN across documents
39
-
40
- ## Example Document
41
-
42
- ```markdown
43
- # Config Reference
44
-
45
- <!-- PINS: database, authentication, api-keys, environment -->
46
-
47
- ## Database Settings
48
- <!-- PIN: database -->
49
- | Setting | Default | Description |
50
- |---------|---------|-------------|
51
-
52
- ## Authentication
53
- <!-- PIN: authentication -->
54
- | Setting | Default | Description |
55
- |---------|---------|-------------|
56
- ```
57
-
58
- ## Parsing
59
-
60
- The PIN system automatically parses documents with:
61
- - `flow-section-index.js` - Generates section index with pins
62
- - `flow-section-resolver.js` - Resolves sections by PIN lookup
63
- - `getSectionsByPins(['auth', 'security'])` - Fetch only relevant sections
64
-
65
- ## Files That Must Have PINs
66
-
67
- | File | Required PINs |
68
- |------|---------------|
69
- | `decisions.md` | Per coding rule/pattern |
70
- | `app-map.md` | Per component/screen |
71
- | `product.md` | Per product section |
72
- | `stack.md` | Per technology |
73
-
74
- ## Validation
75
-
76
- Run `node scripts/flow-section-index.js --force` to regenerate the index.
77
- Check `.workflow/state/section-index.json` for indexed sections and their pins.
@@ -1,174 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- description: "Dual-repo management rules for wogi-flow and wogiflow-cloud"
4
- globs: "package.json,lib/installer.js,lib/extension-points.js"
5
- ---
6
- # Dual-Repo Management: wogi-flow + wogiflow-cloud
7
-
8
- **Added**: 2026-02-28
9
- **Source**: User directive — formalize dual-repo architecture decisions
10
-
11
- ## Repository Ownership
12
-
13
- | Repo | Package | Visibility | Purpose |
14
- |------|---------|-----------|---------|
15
- | `wogi-flow` | `wogiflow` (npm) | Public (AGPL-3.0) | Free CLI, workflow engine, all local-only features |
16
- | `wogiflow-cloud` | `@wogiflow/teams` (client), `wogiflow-cloud-server` (server) | Private | Teams backend, client hooks, dashboard, portal logic |
17
- | `wogiflow-portal` | N/A (static site) | Public | wogi.ai — landing page, login, signup, knowledge base |
18
-
19
- ## Hard Rule: No Teams Code in the Free Repo
20
-
21
- Team-specific logic MUST NEVER appear in `wogi-flow`. This includes:
22
- - Auth/login UI beyond the thin `wogi login`/`wogi logout` adapter
23
- - Sync engines, presence, real-time features
24
- - Team CRUD, roles, permissions
25
- - Dashboard pages
26
- - Server-side API routes
27
-
28
- The free repo provides **extension points** (hooks in `lib/extension-points.js`) that the cloud client plugs into. The adapter pattern is:
29
- - `wogi-flow` exports hook interfaces and config schema
30
- - `@wogiflow/teams` imports those interfaces and adds team behavior
31
- - All team logic executes from `@wogiflow/teams`, never from `wogiflow` core
32
-
33
- ## Version Management
34
-
35
- ### Independent Versions, Mutual Awareness
36
-
37
- Each repo has its own semver version. They are NOT locked together.
38
-
39
- - `wogi-flow` → `package.json` version (currently 1.6.0)
40
- - `wogiflow-cloud` server → `packages/server/package.json` version (currently 0.1.0)
41
- - `@wogiflow/teams` client → `packages/client/package.json` version (currently 0.1.0)
42
-
43
- ### Cross-Repo Version File
44
-
45
- Each repo maintains a `.workflow/state/partner-versions.json` that records the last-known version of the other repo:
46
-
47
- ```json
48
- // In wogi-flow:
49
- {
50
- "self": { "package": "wogiflow", "version": "1.6.0" },
51
- "partners": {
52
- "wogiflow-cloud-server": { "version": "0.1.0", "checkedAt": "2026-02-28" },
53
- "wogiflow-teams-client": { "version": "0.1.0", "minCompatible": "1.5.0", "checkedAt": "2026-02-28" }
54
- }
55
- }
56
-
57
- // In wogiflow-cloud:
58
- {
59
- "self": { "package": "wogiflow-cloud", "version": "0.1.0" },
60
- "partners": {
61
- "wogiflow": { "version": "1.6.0", "checkedAt": "2026-02-28" }
62
- }
63
- }
64
- ```
65
-
66
- **Update rule**: When releasing either repo, update `partner-versions.json` in BOTH repos.
67
-
68
- ### Compatibility Contract
69
-
70
- The `@wogiflow/teams` client declares its minimum compatible `wogiflow` version via peerDependencies:
71
-
72
- ```json
73
- "peerDependencies": {
74
- "wogiflow": ">=1.5.0"
75
- }
76
- ```
77
-
78
- **When to bump the minimum**:
79
- - When the free repo removes or renames an exported function that the client uses
80
- - When the free repo changes the shape of config.json, ready.json, or other state files
81
- - When the free repo changes hook interfaces (entry point signatures, event payloads)
82
-
83
- **When NOT to bump**:
84
- - New features added to the free repo (additive changes are always compatible)
85
- - Internal refactoring that doesn't change exports
86
-
87
- ## Interface Contract (Public API Surface)
88
-
89
- The cloud client depends on these interfaces from `wogi-flow`. Changes to any of these require updating the client:
90
-
91
- ### Exported Functions (from scripts/)
92
- - `flow-utils.js`: `getConfig()`, `safeJsonParse()`, `writeJson()`, `generateTaskId()`, `validateTaskId()`, `PATHS`, `getReadyData()`, `saveReadyData()`
93
- - `flow-session-state.js`: `trackTaskStart()`, `trackBypassAttempt()`
94
- - `flow-memory-blocks.js`: `setCurrentTask()`
95
-
96
- ### Hook Interfaces (entry point contracts)
97
- - `PreToolUse` hooks receive: `{ tool, toolInput }` via stdin JSON
98
- - `PostToolUse` hooks receive: `{ tool, toolInput, toolResult }` via stdin JSON
99
- - `TaskCompleted` hooks receive: `{ taskId }` via stdin JSON
100
- - `SessionStart`/`SessionEnd` hooks receive: `{}` via stdin JSON
101
-
102
- ### State File Formats
103
- - `ready.json`: `{ inProgress: [], ready: [], blocked: [], recentlyCompleted: [], backlog: [] }`
104
- - `config.json`: Schema documented in `config.schema.json`
105
- - `decisions.md`: Markdown with `## Section` / `### Rule` structure
106
- - `session-state.json`: `{ taskId, status, lastBriefingAt, ... }`
107
-
108
- ### Config Keys Used by Cloud
109
- - `hooks.rules.*` — all hook toggle keys
110
- - `enforcement.*` — strict mode, task gating
111
- - `semanticMatching.*` — reuse detection thresholds
112
-
113
- **When modifying any of the above**: Check wogiflow-cloud for consumers BEFORE releasing.
114
-
115
- ## Change Propagation Rules
116
-
117
- ### OSS Change → Does Cloud Need Updating?
118
-
119
- | Change Type | Cloud Impact | Action Required |
120
- |-------------|-------------|-----------------|
121
- | New feature (additive) | None | No action needed |
122
- | Bug fix (internal) | None | No action needed |
123
- | Exported function renamed/removed | BREAKING | Update client, bump peerDep minimum |
124
- | State file format changed | BREAKING | Update client parsers |
125
- | Hook interface changed | BREAKING | Update client hooks |
126
- | Config key renamed/removed | BREAKING | Update client config readers |
127
- | New config key added | None (additive) | Client can optionally use it |
128
-
129
- ### Cloud Change → Does OSS Need Updating?
130
-
131
- | Change Type | OSS Impact | Action Required |
132
- |-------------|-----------|-----------------|
133
- | New server feature | None | No action needed |
134
- | New client hook | None | No action needed |
135
- | Client needs new OSS export | REQUIRES | Add export to OSS, release OSS first |
136
- | Dashboard changes | None | Entirely separate |
137
-
138
- ### Release Order
139
-
140
- 1. **OSS first**: If the cloud needs a new OSS feature, release OSS first
141
- 2. **Cloud follows**: Cloud releases independently, referencing the OSS version in peerDeps
142
- 3. **Never**: Release cloud with a dependency on an unreleased OSS version
143
-
144
- ```
145
- OSS v1.7.0 (adds new export)
146
-
147
- Cloud client v0.2.0 (uses new export, peerDep bumped to >=1.7.0)
148
-
149
- Cloud server v0.2.0 (may or may not change)
150
- ```
151
-
152
- ## Web Properties
153
-
154
- | Property | Repo | Purpose |
155
- |----------|------|---------|
156
- | wogi.ai (main site) | `wogiflow-portal` | Landing, login, signup, knowledge base |
157
- | Dashboard (admin UI) | `wogiflow-cloud/packages/dashboard/` | Team admin — served by cloud server |
158
-
159
- The portal is a separate deployment from the dashboard. The portal is public-facing (marketing + auth). The dashboard is authenticated (team management).
160
-
161
- ## Verification Checklist (Before Any Release)
162
-
163
- ### Releasing wogi-flow (OSS):
164
- 1. Check `partner-versions.json` — is cloud version current?
165
- 2. If any exported function/interface changed: grep wogiflow-cloud for consumers
166
- 3. Run `node --check` on all modified scripts
167
- 4. Follow GitHub Release Workflow (decisions.md)
168
- 5. After release: update `partner-versions.json` in wogiflow-cloud
169
-
170
- ### Releasing wogiflow-cloud:
171
- 1. Check `partner-versions.json` — is OSS version current?
172
- 2. Verify `peerDependencies.wogiflow` range includes current OSS version
173
- 3. If client needs new OSS export: release OSS first
174
- 4. After release: update `partner-versions.json` in wogi-flow
@@ -1,87 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- description: "Cleanup checklist when refactoring or renaming features"
4
- globs:
5
- - "scripts/*.js"
6
- - ".claude/skills/**/*"
7
- ---
8
-
9
- # Feature Refactoring Cleanup
10
-
11
- When refactoring, renaming, or replacing a feature, ensure complete cleanup of the old implementation.
12
-
13
- ## Mandatory Cleanup Checklist
14
-
15
- When a feature is refactored or renamed, you MUST:
16
-
17
- ### 1. Remove Old Code
18
- - [ ] Delete old script files (e.g., `flow-old-feature.js`)
19
- - [ ] Remove old skill directories (e.g., `.claude/skills/old-feature/`)
20
- - [ ] Remove old hook files if applicable
21
-
22
- ### 2. Update Configuration
23
- - [ ] Rename config keys (e.g., `oldFeature` → `newFeature`)
24
- - [ ] Remove from `skills.installed` array if skill was removed
25
- - [ ] Update any feature flags
26
-
27
- ### 3. Update Documentation
28
- - [ ] Rename/update doc files in `.claude/docs/`
29
- - [ ] Update command references in `commands.md`
30
- - [ ] Update skill-matching.md if skill changed
31
- - [ ] Search for old name in all `.md` files
32
-
33
- ### 4. Clean References
34
- - [ ] Search codebase: `grep -r "old-feature-name" .`
35
- - [ ] Update imports in dependent scripts
36
- - [ ] Update any hardcoded references
37
-
38
- ### 5. Update State Files
39
- - [ ] Clean `.workflow/state/` of old state files
40
- - [ ] Update `ready.json` if tasks reference old feature
41
- - [ ] Archive old change specs
42
-
43
- ## Search Commands
44
-
45
- Run these to find lingering references:
46
-
47
- ```bash
48
- # Find all references to old feature
49
- grep -r "old-feature-name" --include="*.js" --include="*.md" --include="*.json" .
50
-
51
- # Find in config
52
- grep "oldFeatureName" .workflow/config.json
53
-
54
- # Find skill references
55
- grep -r "old-feature" .claude/
56
- ```
57
-
58
- ## Why This Matters
59
-
60
- Incomplete cleanup causes:
61
- - **Confusion**: Old commands/skills appear to work but don't
62
- - **Bloat**: Dead code accumulates
63
- - **Errors**: Old references cause runtime failures
64
- - **Documentation drift**: Docs describe non-existent features
65
-
66
- ## Example: transcript-digestion → long-input-gate
67
-
68
- When this refactoring happened without proper cleanup:
69
-
70
- | Artifact | Status | Should Have Been |
71
- |----------|--------|------------------|
72
- | `.claude/skills/transcript-digestion/` | Left behind | Deleted |
73
- | `config.transcriptDigestion` | Left as-is | Renamed to `longInputGate` |
74
- | `skills.installed` array | Still listed | Removed |
75
- | `skill-matching.md` | Old references | Updated |
76
- | `transcript-digestion.md` doc | Still existed | Renamed/rewritten |
77
-
78
- ## Automation Opportunity
79
-
80
- Consider adding a `flow refactor-cleanup <old-name> <new-name>` command that:
81
- 1. Searches for all references
82
- 2. Shows what needs updating
83
- 3. Optionally auto-updates simple cases
84
-
85
- ---
86
-
87
- Last updated: 2026-01-14