wogiflow 2.1.2 → 2.2.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 (49) hide show
  1. package/.claude/commands/wogi-audit.md +189 -3
  2. package/.claude/commands/wogi-bulk.md +1 -1
  3. package/.claude/commands/wogi-help.md +1 -1
  4. package/.claude/commands/{wogi-compact.md → wogi-pre-compact.md} +6 -2
  5. package/.claude/commands/wogi-review.md +86 -13
  6. package/.claude/commands/wogi-setup-stack.md +1 -1
  7. package/.claude/commands/wogi-skill-learn.md +1 -1
  8. package/.claude/commands/wogi-start.md +65 -20
  9. package/.claude/docs/claude-code-compatibility.md +28 -0
  10. package/.claude/docs/commands.md +1 -1
  11. package/.claude/docs/knowledge-base/02-task-execution/04-completion.md +1 -1
  12. package/.claude/docs/knowledge-base/04-memory-context/README.md +2 -2
  13. package/.claude/docs/knowledge-base/04-memory-context/context-management.md +1 -1
  14. package/.claude/rules/_internal/README.md +64 -0
  15. package/.claude/rules/_internal/document-structure.md +77 -0
  16. package/.claude/rules/_internal/dual-repo-management.md +174 -0
  17. package/.claude/rules/_internal/feature-refactoring-cleanup.md +87 -0
  18. package/.claude/rules/_internal/github-releases.md +71 -0
  19. package/.claude/rules/_internal/model-management.md +35 -0
  20. package/.claude/rules/_internal/self-maintenance.md +87 -0
  21. package/.claude/rules/architecture/component-reuse.md +38 -0
  22. package/.claude/rules/code-style/naming-conventions.md +52 -0
  23. package/.claude/rules/operations/git-workflows.md +92 -0
  24. package/.claude/rules/operations/scratch-directory.md +54 -0
  25. package/.claude/rules/security/security-patterns.md +176 -0
  26. package/.claude/skills/figma-analyzer/knowledge/learnings.md +11 -0
  27. package/.workflow/bridges/claude-bridge.js +1 -1
  28. package/.workflow/models/registry.json +1 -1
  29. package/.workflow/specs/architecture.md.template +24 -0
  30. package/.workflow/specs/stack.md.template +33 -0
  31. package/.workflow/specs/testing.md.template +36 -0
  32. package/.workflow/templates/claude-md.hbs +33 -3
  33. package/README.md +1 -1
  34. package/package.json +1 -1
  35. package/scripts/flow-audit.js +158 -1
  36. package/scripts/flow-context-compact/index.js +1 -1
  37. package/scripts/flow-context-monitor.js +2 -2
  38. package/scripts/flow-loop-retry-learning.js +1 -1
  39. package/scripts/flow-proactive-compact.js +3 -3
  40. package/scripts/flow-progress-tracker.js +289 -0
  41. package/scripts/flow-prompt-capture.js +263 -170
  42. package/scripts/flow-standards-learner.js +167 -3
  43. package/scripts/flow-task-checkpoint.js +2 -0
  44. package/scripts/flow-version-check.js +1 -0
  45. package/scripts/hooks/core/commit-log-gate.js +146 -0
  46. package/scripts/hooks/core/post-compact.js +109 -4
  47. package/scripts/hooks/core/task-completed.js +19 -0
  48. package/scripts/hooks/entry/claude-code/post-tool-use.js +60 -0
  49. package/scripts/hooks/entry/claude-code/pre-tool-use.js +27 -0
@@ -0,0 +1,64 @@
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
@@ -0,0 +1,77 @@
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.
@@ -0,0 +1,174 @@
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
@@ -0,0 +1,87 @@
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
@@ -0,0 +1,71 @@
1
+ ---
2
+ description: "GitHub release workflow - prevents race conditions in npm publish"
3
+ alwaysApply: false
4
+ globs: package.json
5
+ ---
6
+
7
+ # GitHub Release Workflow
8
+
9
+ **Source**: Repeated failures (10+ times) in npm publish automation
10
+ **Priority**: Critical - prevents wasted releases and broken npm versions
11
+
12
+ ## Problem
13
+
14
+ Running `git push` followed immediately by `gh release create` causes a race condition. The release tag gets created on the remote's HEAD before the push fully propagates, pointing to an old commit.
15
+
16
+ ## Pre-Release Quality Gate (MANDATORY)
17
+
18
+ Before ANY release, verify the codebase is in a releasable state:
19
+
20
+ 1. **Check outstanding findings**: Read `.workflow/state/last-review.json` — if unresolved critical/high findings exist, STOP and fix them first
21
+ 2. **Run lint** (if configured): `npm run lint`
22
+ 3. **Run typecheck** (if configured): `npm run typecheck`
23
+ 4. **Verify no uncommitted changes**: `git status` should be clean
24
+
25
+ The `preRelease` and `outstandingFindings` quality gates in `flow-done.js` enforce this automatically for `release` type tasks. For manual releases, check these yourself.
26
+
27
+ ## Correct Procedure
28
+
29
+ ```bash
30
+ # 0. Verify codebase is releasable (pre-release gate)
31
+ # (automated by flow-done.js for release-type tasks)
32
+
33
+ # 1. Push commits first
34
+ git push origin master
35
+
36
+ # 2. Create tag LOCALLY on the correct commit
37
+ git tag vX.Y.Z HEAD
38
+
39
+ # 3. Push the tag explicitly
40
+ git push origin vX.Y.Z
41
+
42
+ # 4. THEN create the release (it will use the existing tag)
43
+ gh release create vX.Y.Z --title "vX.Y.Z" --notes "..."
44
+ ```
45
+
46
+ ## Never Do This
47
+
48
+ ```bash
49
+ # BAD - race condition, tag may point to wrong commit
50
+ git push origin master && gh release create vX.Y.Z ...
51
+ ```
52
+
53
+ ## Recovery Procedure
54
+
55
+ If a release fails with wrong version:
56
+
57
+ 1. Delete the bad release: `gh release delete vX.Y.Z --yes`
58
+ 2. Delete the bad remote tag: `git push origin --delete vX.Y.Z`
59
+ 3. Delete local tag if exists: `git tag -d vX.Y.Z`
60
+ 4. Follow the correct procedure above
61
+
62
+ ## Verification
63
+
64
+ Before creating the release, verify:
65
+ ```bash
66
+ git show vX.Y.Z --quiet --format="%H" # Should match HEAD
67
+ git show vX.Y.Z:package.json | grep version # Should show X.Y.Z
68
+ ```
69
+
70
+ ---
71
+ Last updated: 2026-01-30
@@ -0,0 +1,35 @@
1
+ ---
2
+ globs: scripts/flow-model*.js
3
+ alwaysApply: false
4
+ description: "Model management architecture - two separate systems for different purposes"
5
+ ---
6
+
7
+ # Model Management Architecture
8
+
9
+ **Context**: Phase 1 introduced model registry and stats system alongside existing model-adapter.
10
+
11
+ ## Two Model Systems
12
+
13
+ ### 1. flow-model-adapter.js - Prompt Adaptation
14
+
15
+ - `getCurrentModel()` returns normalized model name (string)
16
+ - Focus: Per-model prompt adjustments, learning, and corrections
17
+ - Imports: Used by flow-knowledge-router.js
18
+
19
+ ### 2. flow-models.js - Registry and Stats
20
+
21
+ - `getCurrentModel()` returns `{name, info, source}` object
22
+ - Focus: Model listing, routing recommendations, cost tracking
23
+ - Standalone CLI commands: `flow models [subcommand]`
24
+
25
+ ## Design Decision
26
+
27
+ **Keep them separate** because:
28
+ - Different return types serve different consumers
29
+ - Adapter system needs just the name for pattern matching
30
+ - Registry system needs full model metadata for display/routing
31
+ - Merging would create unnecessary coupling
32
+
33
+ ## Future Consideration
34
+
35
+ Could extract shared model detection logic into a common utility if they drift apart, but avoid premature abstraction.
@@ -0,0 +1,87 @@
1
+ ---
2
+ description: "Patterns for modifying WogiFlow itself (scripts, templates, config)"
3
+ alwaysApply: false
4
+ globs: "scripts/**,*.workflow/**,.claude/**,templates/**,agents/**,lib/**"
5
+ ---
6
+
7
+ # WogiFlow Self-Maintenance Patterns
8
+
9
+ When modifying WogiFlow's own code (scripts/, templates/, config, hooks), follow these patterns.
10
+
11
+ ## 1. Template-First Changes
12
+
13
+ CLAUDE.md is **generated**, not hand-edited. Changes must go through the template system:
14
+
15
+ ```
16
+ .workflow/templates/claude-md.hbs # Main template
17
+ .workflow/templates/partials/*.hbs # Partial templates
18
+ ```
19
+
20
+ After editing templates, regenerate:
21
+ ```bash
22
+ node scripts/flow-bridge.js sync claude-code
23
+ ```
24
+
25
+ **Never edit CLAUDE.md directly** - changes will be overwritten on next sync.
26
+
27
+ ## 2. Three-Layer Hook Architecture
28
+
29
+ All hooks follow: Entry → Core → Adapter
30
+
31
+ ```
32
+ scripts/hooks/entry/claude-code/<name>.js # CLI-specific entry point
33
+ scripts/hooks/core/<name>.js # CLI-agnostic logic
34
+ scripts/hooks/adapters/claude-code.js # Transform results
35
+ ```
36
+
37
+ When adding/modifying hooks:
38
+ - Logic goes in `core/` (not entry)
39
+ - Entry files only parse input and call core
40
+ - Register hook in `.claude/settings.local.json`
41
+ - Add config toggle in `.workflow/config.json` under `hooks.rules`
42
+
43
+ ## 3. Config Changes Need Documentation
44
+
45
+ When adding config keys:
46
+ - Use `_comment_<keyName>` for inline documentation of non-obvious settings
47
+ - Update config.schema.json if it exists
48
+ - Ensure `lib/installer.js` handles the new key for fresh installs
49
+
50
+ ## 4. State File Templates
51
+
52
+ For files in `.workflow/state/` that target projects need:
53
+ - Create both the file AND a `.template` version
54
+ - Templates go in `.workflow/state/<name>.template` (for init/onboard)
55
+ - Also add to `templates/` directory (for npm distribution)
56
+
57
+ ## 5. Slash Commands Are Flat Files
58
+
59
+ Slash commands in `.claude/commands/` must be flat `.md` files:
60
+ ```
61
+ .claude/commands/wogi-start.md ← Correct (flat file)
62
+ .claude/commands/wogi-start/ ← Wrong (directory)
63
+ ```
64
+
65
+ ## 6. Two Agent Directories
66
+
67
+ | Directory | Purpose | Used By |
68
+ |-----------|---------|---------|
69
+ | `agents/` | 11 persona files | Health checks, CLI |
70
+ | `.workflow/agents/` | Review checklists | wogi-review |
71
+
72
+ Don't confuse them. `agents/security.md` (persona) is different from `.workflow/agents/security.md` (OWASP checklist).
73
+
74
+ ## 7. Regression Prevention
75
+
76
+ When modifying flow-*.js scripts:
77
+ - Run `node --check scripts/<file>.js` after edits
78
+ - WogiFlow has no test suite - syntax checking is the safety net
79
+ - Check for circular dependencies when moving shared functions
80
+
81
+ ## 8. Feature Refactoring Cleanup
82
+
83
+ When renaming/replacing a feature, follow the full checklist in `.claude/rules/architecture/feature-refactoring-cleanup.md`. Key steps:
84
+ - Remove old script files
85
+ - Update config keys
86
+ - Update documentation references
87
+ - Search all `.md` files for old name
@@ -0,0 +1,38 @@
1
+ ---
2
+ globs: src/components/**/*
3
+ alwaysApply: false
4
+ description: "Component reuse policy - always check app-map.md before creating components"
5
+ ---
6
+
7
+ # Component Reuse Policy
8
+
9
+ **Rule**: Always check `app-map.md` before creating any component.
10
+
11
+ ## Priority Order
12
+
13
+ 1. **Use existing** - Check if component already exists in app-map
14
+ 2. **Add variant** - Extend existing component with a new variant
15
+ 3. **Extend** - Create a wrapper/HOC around existing component
16
+ 4. **Create new** - Only as last resort
17
+
18
+ ## Before Creating Components
19
+
20
+ ```bash
21
+ # Check app-map first
22
+ cat .workflow/state/app-map.md | grep -i "button"
23
+
24
+ # Or search codebase
25
+ grep -r "Button" src/components/
26
+ ```
27
+
28
+ ## Variant vs New Component
29
+
30
+ Prefer variants when:
31
+ - Same base functionality, different appearance
32
+ - Same HTML structure, different styling
33
+ - Same component, different size/color/state
34
+
35
+ Create new component when:
36
+ - Fundamentally different functionality
37
+ - Different DOM structure
38
+ - Different state management
@@ -0,0 +1,52 @@
1
+ ---
2
+ alwaysApply: true
3
+ description: "Naming conventions for files and code variants"
4
+ globs: "**/*.{js,ts,jsx,tsx,mjs,cjs}"
5
+ ---
6
+
7
+ # Naming Conventions
8
+
9
+ ## File Names
10
+
11
+ Use **kebab-case** for all file names in this project.
12
+
13
+ Examples:
14
+ - `flow-health.js` (correct)
15
+ - `flowHealth.js` (incorrect)
16
+ - `flow_health.js` (incorrect)
17
+
18
+ ## Variant Names (UI Projects Only)
19
+
20
+ When working on projects with UI components, use consistent variant names:
21
+
22
+ | Category | Values |
23
+ |----------|--------|
24
+ | Size | `sm`, `md`, `lg`, `xl` |
25
+ | Intent | `primary`, `secondary`, `danger`, `success`, `warning` |
26
+ | State | `default`, `hover`, `active`, `disabled` |
27
+
28
+ Skip this section for backend-only or library projects (no UI components).
29
+
30
+ ## Catch Block Variables
31
+
32
+ Use `err` for all catch blocks in this codebase.
33
+
34
+ **Avoid**: `e`, `error`, `ex`, `exception` - these cause confusion with loop variables.
35
+
36
+ ```javascript
37
+ // Good
38
+ try {
39
+ doSomething();
40
+ } catch (err) {
41
+ console.error(err.message);
42
+ }
43
+
44
+ // Bad - 'e' conflicts with common iterator variables
45
+ try {
46
+ items.map(e => e.value); // 'e' used as iterator
47
+ } catch (e) {
48
+ console.error(e.message); // Easy to confuse with iterator 'e'
49
+ }
50
+ ```
51
+
52
+ **Reason**: Standardizing on `err` prevents mix-ups when `.map(e => ...)` is used nearby.