wogiflow 1.4.2 → 1.4.4
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.
- package/.claude/commands/wogi-init.md +21 -0
- package/.claude/commands/wogi-start.md +111 -13
- package/.claude/docs/claude-code-compatibility.md +36 -1
- package/.claude/rules/README.md +60 -0
- package/.claude/rules/architecture/component-reuse.md +38 -0
- package/.claude/rules/architecture/document-structure.md +76 -0
- package/.claude/rules/architecture/feature-refactoring-cleanup.md +87 -0
- package/.claude/rules/architecture/model-management.md +35 -0
- package/.claude/rules/architecture/self-maintenance.md +87 -0
- package/.claude/rules/code-style/naming-conventions.md +55 -0
- package/.claude/rules/security/security-patterns.md +176 -0
- package/.claude/settings.json +120 -0
- package/.claude/skills/figma-analyzer/knowledge/learnings.md +11 -0
- package/.workflow/agents/performance.md +112 -0
- package/.workflow/specs/architecture.md.template +24 -0
- package/.workflow/specs/stack.md.template +33 -0
- package/.workflow/specs/testing.md.template +36 -0
- package/.workflow/templates/partials/auto-features.hbs +3 -1
- package/package.json +2 -1
- package/scripts/flow-model-caller.js +1 -1
- package/scripts/flow-worktree.js +34 -0
- package/scripts/hooks/adapters/claude-code.js +28 -2
- package/scripts/hooks/core/config-change.js +120 -0
- package/scripts/hooks/core/index.js +5 -0
- package/scripts/hooks/entry/claude-code/config-change.js +48 -0
- package/scripts/postinstall.js +34 -0
|
@@ -1053,6 +1053,27 @@ if (fs.existsSync(pendingPath)) {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
```
|
|
1055
1055
|
|
|
1056
|
+
#### 4.6 Register Hooks with Claude Code (CRITICAL)
|
|
1057
|
+
|
|
1058
|
+
**Run `flow hooks setup` to ensure hooks are registered with Claude Code.**
|
|
1059
|
+
|
|
1060
|
+
The postinstall script copies `.claude/settings.json` which contains hook definitions,
|
|
1061
|
+
but this step regenerates `settings.local.json` with absolute paths as a safety net.
|
|
1062
|
+
|
|
1063
|
+
```bash
|
|
1064
|
+
./scripts/flow hooks setup 2>&1
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
If this fails, hooks may not fire. Display a warning:
|
|
1068
|
+
```
|
|
1069
|
+
⚠️ Hook setup failed. Hooks may not work.
|
|
1070
|
+
Run manually: ./scripts/flow hooks setup
|
|
1071
|
+
```
|
|
1072
|
+
|
|
1073
|
+
**Why this matters**: Without hooks registered in `.claude/settings.json` or
|
|
1074
|
+
`.claude/settings.local.json`, Claude Code doesn't know WogiFlow's hook scripts
|
|
1075
|
+
exist. Task gating, scope validation, and loop enforcement all depend on hooks.
|
|
1076
|
+
|
|
1056
1077
|
### Step 5: Summary & Learning Explanation
|
|
1057
1078
|
|
|
1058
1079
|
Display the completion summary:
|
|
@@ -192,7 +192,9 @@ This command implements a **structured execution loop**:
|
|
|
192
192
|
│ │ → Agent 1: Codebase Analyzer (Glob/Grep/Read) │ │
|
|
193
193
|
│ │ → Agent 2: Best Practices (WebSearch) │ │
|
|
194
194
|
│ │ → Agent 3: Version Verifier (Read/WebSearch) │ │
|
|
195
|
-
│ │ →
|
|
195
|
+
│ │ → Agent 4: Risk & History (local reads) │ │
|
|
196
|
+
│ │ → Agent 5: Standards Preview (local reads) │ │
|
|
197
|
+
│ │ → All 5 run in parallel as Task agents │ │
|
|
196
198
|
│ │ → Consolidated research summary displayed │ │
|
|
197
199
|
│ └───────────────────────────────────────────────────┘ │
|
|
198
200
|
│ 1.5 SPEC PHASE: Generate specification │
|
|
@@ -398,8 +400,8 @@ This step invests more tokens up front to get things right. Three specialized ag
|
|
|
398
400
|
**Research Cache**: Before launching agents, check `.workflow/state/research-cache.json` for cached results from recent identical queries (TTL: 24 hours). If a cache hit exists and is still valid, use the cached result instead of re-running the research. Cache misses trigger fresh research which is then cached for future use.
|
|
399
401
|
|
|
400
402
|
**Research Depth** (controlled by `config.planMode.researchDepth`):
|
|
401
|
-
- `"thorough"` (default): All
|
|
402
|
-
- `"standard"`: Codebase Analyzer +
|
|
403
|
+
- `"thorough"` (default): All 5 agents run in parallel
|
|
404
|
+
- `"standard"`: Codebase Analyzer + Best Practices + Risk & History (3 agents, no web for version/standards)
|
|
403
405
|
- `"minimal"`: Codebase Analyzer only (legacy behavior)
|
|
404
406
|
|
|
405
407
|
**Skip conditions**: L3 (Subtask/trivial) tasks always skip this phase.
|
|
@@ -472,15 +474,88 @@ Return:
|
|
|
472
474
|
- Version-specific considerations
|
|
473
475
|
```
|
|
474
476
|
|
|
477
|
+
#### Agent 4: Risk & History Analyzer
|
|
478
|
+
|
|
479
|
+
Launch as `Task` with `subagent_type=Explore` (local only, no web searches):
|
|
480
|
+
|
|
481
|
+
```
|
|
482
|
+
Analyze risk and history for task: "[TASK_TITLE]"
|
|
483
|
+
Task type: [TASK_TYPE]
|
|
484
|
+
Planned files: [FILES_TO_CHANGE]
|
|
485
|
+
|
|
486
|
+
1. Read .workflow/state/feedback-patterns.md
|
|
487
|
+
- Search for entries matching this task type (feature, bugfix, refactor, etc.)
|
|
488
|
+
- Search for entries matching the planned file extensions (.js, .ts, .tsx, etc.)
|
|
489
|
+
- Extract the top 5 most relevant patterns with their occurrence counts
|
|
490
|
+
2. Search .workflow/corrections/ directory for correction reports
|
|
491
|
+
- Use Glob to find *.md files in corrections/
|
|
492
|
+
- Read any that relate to the same feature area or file paths
|
|
493
|
+
- Extract lessons learned
|
|
494
|
+
3. Search .workflow/state/decisions.md for rules tagged with the task type
|
|
495
|
+
- Focus on rules that were promoted from repeated violations (count >= 3)
|
|
496
|
+
- Extract the specific verification steps required
|
|
497
|
+
4. If a memory database exists (.workflow/memory/local.db or via MCP):
|
|
498
|
+
- Query for rejected approaches from past tasks touching the same files
|
|
499
|
+
- Query for observations tagged with the planned file paths
|
|
500
|
+
- Surface any "approach X was tried and failed" warnings
|
|
501
|
+
|
|
502
|
+
Return a structured summary:
|
|
503
|
+
- Known risks for this task type (from feedback-patterns)
|
|
504
|
+
- Past corrections in this area (from corrections/)
|
|
505
|
+
- Promoted rules that apply (from decisions.md, count >= 3)
|
|
506
|
+
- Rejected approaches from similar past work (from memory-db)
|
|
507
|
+
- Confidence: HIGH (many data points) / MEDIUM / LOW (no history)
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
#### Agent 5: Standards Preview
|
|
511
|
+
|
|
512
|
+
Launch as `Task` with `subagent_type=Explore` (local only, no web searches):
|
|
513
|
+
|
|
514
|
+
```
|
|
515
|
+
Preview applicable standards for task: "[TASK_TITLE]"
|
|
516
|
+
Task type: [TASK_TYPE]
|
|
517
|
+
Planned files: [FILES_TO_CHANGE]
|
|
518
|
+
|
|
519
|
+
1. Determine which standard checks apply based on planned file paths:
|
|
520
|
+
- If files include components (.tsx, .jsx) → check: naming, components, security
|
|
521
|
+
- If files include utilities (utils/, helpers/) → check: naming, functions, security
|
|
522
|
+
- If files include API routes (api/, routes/) → check: naming, api, security
|
|
523
|
+
- If task type is "bugfix" → check: naming, security (minimal)
|
|
524
|
+
- If task type is "feature" or "refactor" → check: all
|
|
525
|
+
2. Read .claude/rules/code-style/naming-conventions.md
|
|
526
|
+
- Extract rules that apply to the planned file types
|
|
527
|
+
3. Read .claude/rules/security/security-patterns.md
|
|
528
|
+
- Extract security patterns relevant to the planned operations
|
|
529
|
+
4. Read .workflow/state/app-map.md
|
|
530
|
+
- For each planned NEW component, check similarity against existing entries
|
|
531
|
+
- Flag any where name or purpose overlaps > 80% with an existing component
|
|
532
|
+
- This is the SAME check that flow-standards-gate.js will run post-implementation
|
|
533
|
+
5. Read .workflow/state/decisions.md
|
|
534
|
+
- Extract coding rules that will be enforced for this task type
|
|
535
|
+
|
|
536
|
+
Return a structured checklist:
|
|
537
|
+
- Task type classification: [type]
|
|
538
|
+
- Standards that WILL be enforced (these will block completion if violated):
|
|
539
|
+
* [rule name]: [what it checks] - [how to comply]
|
|
540
|
+
* [rule name]: [what it checks] - [how to comply]
|
|
541
|
+
- Component duplication warnings (if any new components planned):
|
|
542
|
+
* "[PlannedName]" is similar to existing "[ExistingName]" in app-map
|
|
543
|
+
* Recommendation: extend existing / create new
|
|
544
|
+
- Security patterns that apply:
|
|
545
|
+
* [pattern]: [when it triggers] - [correct approach]
|
|
546
|
+
```
|
|
547
|
+
|
|
475
548
|
#### Launching the Agents
|
|
476
549
|
|
|
477
|
-
**All
|
|
550
|
+
**All 5 agents are launched as parallel `Task` calls in a single message** (established pattern from `/wogi-review`):
|
|
478
551
|
|
|
479
552
|
```javascript
|
|
480
|
-
// Launch all
|
|
553
|
+
// Launch all 5 in parallel (single message, 5 Task tool calls)
|
|
481
554
|
Task(subagent_type=Explore, prompt="Codebase Analyzer: ...")
|
|
482
555
|
Task(subagent_type=Explore, prompt="Best Practices: ...")
|
|
483
556
|
Task(subagent_type=Explore, prompt="Version Verifier: ...")
|
|
557
|
+
Task(subagent_type=Explore, prompt="Risk & History Analyzer: ...")
|
|
558
|
+
Task(subagent_type=Explore, prompt="Standards Preview: ...")
|
|
484
559
|
```
|
|
485
560
|
|
|
486
561
|
**After all agents complete**, display a consolidated research summary:
|
|
@@ -519,6 +594,24 @@ Task(subagent_type=Explore, prompt="Version Verifier: ...")
|
|
|
519
594
|
- [package]@[version]: APIs confirmed compatible
|
|
520
595
|
- [package]@[version]: ⚠️ [deprecated API] - use [alternative]
|
|
521
596
|
|
|
597
|
+
⚠️ Risk & History:
|
|
598
|
+
Confidence: [HIGH/MEDIUM/LOW]
|
|
599
|
+
Known Risks:
|
|
600
|
+
- [pattern name] (occurred N times): [description]
|
|
601
|
+
Past Corrections:
|
|
602
|
+
- [correction]: [lesson learned]
|
|
603
|
+
Rejected Approaches:
|
|
604
|
+
- [approach]: tried in [task], failed because [reason]
|
|
605
|
+
|
|
606
|
+
📋 Standards Preview:
|
|
607
|
+
Task type: [type] → Checks: [list]
|
|
608
|
+
Rules to follow:
|
|
609
|
+
- [rule]: [how to comply]
|
|
610
|
+
Component Duplication:
|
|
611
|
+
- ⚠️ "[PlannedName]" similar to "[ExistingName]" → extend existing
|
|
612
|
+
Security Patterns:
|
|
613
|
+
- [pattern]: [correct approach]
|
|
614
|
+
|
|
522
615
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
523
616
|
```
|
|
524
617
|
|
|
@@ -541,13 +634,16 @@ If user chooses "Deepen":
|
|
|
541
634
|
|
|
542
635
|
#### Graceful Fallback
|
|
543
636
|
|
|
544
|
-
If
|
|
545
|
-
- Log a warning: `⚠️
|
|
546
|
-
-
|
|
547
|
-
-
|
|
548
|
-
- If
|
|
549
|
-
- If
|
|
550
|
-
-
|
|
637
|
+
If any agent fails (network issues, rate limits, timeouts, missing files):
|
|
638
|
+
- Log a warning: `⚠️ Research unavailable for [Agent Name]. Proceeding with remaining agents.`
|
|
639
|
+
- Agents 1, 4, 5 are **local-only** and should almost never fail (no network dependency)
|
|
640
|
+
- Agents 2, 3 use **web search** and may fail due to network issues
|
|
641
|
+
- If Best Practices agent fails: proceed without best practices
|
|
642
|
+
- If Version Verifier agent fails: proceed using local package.json versions only
|
|
643
|
+
- If Risk & History agent fails: proceed without history (no feedback-patterns data)
|
|
644
|
+
- If Standards Preview agent fails: standards will still be enforced post-implementation (Step 3.7)
|
|
645
|
+
- If ALL agents fail: proceed with codebase analysis only, equivalent to `researchDepth: "minimal"`
|
|
646
|
+
- Task proceeds normally without blocking — research is always best-effort
|
|
551
647
|
|
|
552
648
|
**IMPORTANT CONSTRAINTS:**
|
|
553
649
|
- **READ-ONLY**: Do NOT use Edit, Write, or NotebookEdit during this phase
|
|
@@ -562,7 +658,9 @@ If web search fails for any agent (network issues, rate limits, timeouts):
|
|
|
562
658
|
"researchAgents": {
|
|
563
659
|
"codebaseAnalyzer": { "enabled": true },
|
|
564
660
|
"bestPractices": { "enabled": true, "maxWebSearches": 3 },
|
|
565
|
-
"versionVerifier": { "enabled": true }
|
|
661
|
+
"versionVerifier": { "enabled": true },
|
|
662
|
+
"riskHistory": { "enabled": true },
|
|
663
|
+
"standardsPreview": { "enabled": true }
|
|
566
664
|
},
|
|
567
665
|
"researchDepth": "thorough",
|
|
568
666
|
"deepenPromptThreshold": "L1"
|
|
@@ -64,6 +64,7 @@ flow parallel check # See available parallel tasks
|
|
|
64
64
|
| 1.0.46+ | 2.1.20+ | Task deletion, improved compaction |
|
|
65
65
|
| 1.2.0+ | 2.1.33+ | TaskCompleted, TeammateIdle hooks, agent frontmatter |
|
|
66
66
|
| 1.3.0+ | 2.1.33+ | WebMCP integration, model registry (Opus 4.6/Sonnet 4.6) |
|
|
67
|
+
| 1.5.0+ | latest | ConfigChange hook, native worktree awareness, settings.json plugin, Sonnet 4.6 1M context |
|
|
67
68
|
|
|
68
69
|
### Environment Variables (2.1.19+)
|
|
69
70
|
|
|
@@ -158,6 +159,40 @@ await cancelTask('wf-123', 'superseded', false);
|
|
|
158
159
|
| SessionEnd | session-end.js | Request logging, progress update |
|
|
159
160
|
| TaskCompleted | task-completed.js | Move task to recentlyCompleted |
|
|
160
161
|
| TeammateIdle | teammate-idle.js | Suggest next task (disabled by default) |
|
|
162
|
+
| ConfigChange | config-change.js | Re-sync bridge on mid-session config changes |
|
|
163
|
+
|
|
164
|
+
### Features in Latest Release
|
|
165
|
+
|
|
166
|
+
- **ConfigChange hook event**: New hook event fired when configuration files change during a session. WogiFlow uses this to automatically re-sync the bridge (regenerate CLAUDE.md) when `.workflow/config.json` is modified mid-session. Always non-blocking.
|
|
167
|
+
- **Sonnet 4.6 with 1M context**: Sonnet 4.5 with 1M context has been removed from the Max plan in favor of Sonnet 4.6, which now has 1M context. WogiFlow's model registry updated with `contextWindowBeta: 1000000` for Sonnet 4.6.
|
|
168
|
+
- **Native `--worktree` flag**: Claude Code now supports `--worktree` (`-w`) to start sessions in an isolated git worktree (under `.claude/worktrees/`). WogiFlow's `createWorktree()` detects this and skips nested worktree creation.
|
|
169
|
+
- **Plugin `settings.json`**: Plugins can now ship `settings.json` for default configuration. WogiFlow now generates `.claude/settings.json` (committed, shared) with hook registrations using relative paths, while `.claude/settings.local.json` (gitignored) holds user-specific permissions.
|
|
170
|
+
- **Managed settings hierarchy**: `disableAllHooks` now respects managed settings hierarchy - non-managed settings cannot disable managed hooks set by policy. WogiFlow hooks in `settings.json` (shared) are protected from user disabling via this mechanism.
|
|
171
|
+
- **Background agent improvements**: Ctrl+F kills background agents (two-press confirmation). Ctrl+C/ESC no longer silently ignored when background agents are running.
|
|
172
|
+
- **MCP startup performance**: Auth failure caching and batched tool token counting improve startup when WogiFlow's MCP servers are configured.
|
|
173
|
+
|
|
174
|
+
### Simple Mode Naming Distinction
|
|
175
|
+
|
|
176
|
+
Claude Code's `CLAUDE_CODE_SIMPLE` environment variable (which enables a simplified tool set) is **unrelated** to WogiFlow's `loops.simpleMode` (a lightweight task completion loop using string detection). They are separate features that happen to share the word "simple":
|
|
177
|
+
|
|
178
|
+
| Feature | Scope | Purpose |
|
|
179
|
+
|---------|-------|---------|
|
|
180
|
+
| `CLAUDE_CODE_SIMPLE` | Claude Code | Restricts available tools to Bash + Edit |
|
|
181
|
+
| `loops.simpleMode` | WogiFlow | Completion-promise loop using `TASK_COMPLETE` string |
|
|
182
|
+
|
|
183
|
+
Both can be active simultaneously without conflict.
|
|
184
|
+
|
|
185
|
+
### Native Worktree vs WogiFlow Worktree
|
|
186
|
+
|
|
187
|
+
| Feature | Claude Code `--worktree` | WogiFlow `flow-worktree.js` |
|
|
188
|
+
|---------|-------------------------|----------------------------|
|
|
189
|
+
| Location | `.claude/worktrees/` | OS temp dir (`wogi-worktrees-{uid}`) |
|
|
190
|
+
| Branch naming | Auto-generated | `wogi-task-{taskId}-{timestamp}` |
|
|
191
|
+
| Squash merge | No (manual) | Yes (`squashOnMerge` config) |
|
|
192
|
+
| Task linking | No | Yes (links to task ID) |
|
|
193
|
+
| Cleanup | Prompted on session exit | Auto after 24h (`autoCleanupHours`) |
|
|
194
|
+
|
|
195
|
+
WogiFlow detects native worktrees and avoids nesting. When launched with `--worktree`, WogiFlow uses the native worktree as-is.
|
|
161
196
|
|
|
162
197
|
## Best Practices
|
|
163
198
|
|
|
@@ -269,4 +304,4 @@ Run `/keybindings` in Claude Code to customize your shortcuts.
|
|
|
269
304
|
|
|
270
305
|
---
|
|
271
306
|
|
|
272
|
-
*Last updated: 2026-02-
|
|
307
|
+
*Last updated: 2026-02-20*
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Project Rules
|
|
2
|
+
|
|
3
|
+
This directory contains coding rules and patterns for this project, organized by category.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.claude/rules/
|
|
9
|
+
├── code-style/ # Naming conventions, formatting
|
|
10
|
+
│ └── naming-conventions.md
|
|
11
|
+
├── security/ # Security patterns and practices
|
|
12
|
+
│ └── security-patterns.md
|
|
13
|
+
├── architecture/ # Design decisions and patterns
|
|
14
|
+
│ ├── component-reuse.md
|
|
15
|
+
│ └── model-management.md
|
|
16
|
+
└── README.md
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## How Rules Work
|
|
20
|
+
|
|
21
|
+
Rules are automatically loaded by Claude Code based on:
|
|
22
|
+
- **alwaysApply: true** - Rule is always loaded
|
|
23
|
+
- **alwaysApply: false** - Rule is loaded based on `globs` or `description` relevance
|
|
24
|
+
- **globs** - File patterns that trigger rule loading
|
|
25
|
+
|
|
26
|
+
## Adding New Rules
|
|
27
|
+
|
|
28
|
+
1. Choose the appropriate category subdirectory
|
|
29
|
+
2. Create a `.md` file with frontmatter:
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
---
|
|
33
|
+
alwaysApply: false
|
|
34
|
+
description: "Brief description for relevance matching"
|
|
35
|
+
globs: src/**/*.ts # Optional: only load for these files
|
|
36
|
+
---
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
3. Write the rule content in markdown
|
|
40
|
+
|
|
41
|
+
## Categories
|
|
42
|
+
|
|
43
|
+
| Category | Purpose |
|
|
44
|
+
|----------|---------|
|
|
45
|
+
| code-style | Naming conventions, formatting, file structure |
|
|
46
|
+
| security | Security patterns, input validation, safe practices |
|
|
47
|
+
| architecture | Design decisions, component patterns, system organization |
|
|
48
|
+
|
|
49
|
+
## Auto-Generation
|
|
50
|
+
|
|
51
|
+
Some rules can be auto-generated from `.workflow/state/decisions.md`:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
node scripts/flow-rules-sync.js
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The sync script will route rules to appropriate category subdirectories.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
Last updated: 2026-01-12
|
|
@@ -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,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: true
|
|
3
|
+
description: "All AI-context documents must use PIN markers for targeted context loading"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Document Structure for AI Context
|
|
7
|
+
|
|
8
|
+
All documents in `.workflow/` that are used as AI context MUST follow the PIN standard.
|
|
9
|
+
|
|
10
|
+
## Required Structure
|
|
11
|
+
|
|
12
|
+
### 1. Header with PIN List
|
|
13
|
+
Every document starts with a comment listing all pins in the document:
|
|
14
|
+
```markdown
|
|
15
|
+
<!-- PINS: pin1, pin2, pin3 -->
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 2. Section PIN Markers
|
|
19
|
+
Each major section has a PIN marker comment:
|
|
20
|
+
```markdown
|
|
21
|
+
### Section Title
|
|
22
|
+
<!-- PIN: section-specific-pin -->
|
|
23
|
+
[Content]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 3. PIN Naming Convention
|
|
27
|
+
- Use kebab-case: `user-authentication`, not `userAuthentication`
|
|
28
|
+
- Use semantic names: `error-handling`, not `eh`
|
|
29
|
+
- Use compound names for specificity: `json-parse-safety`
|
|
30
|
+
|
|
31
|
+
## Why PINs Matter
|
|
32
|
+
|
|
33
|
+
The PIN system enables:
|
|
34
|
+
1. **Targeted context loading**: Only load sections relevant to current task
|
|
35
|
+
2. **Cheaper model routing**: Haiku can fetch only relevant sections for Opus
|
|
36
|
+
3. **Change detection**: Hash sections independently for smart invalidation
|
|
37
|
+
4. **Cross-reference**: Link sections by PIN across documents
|
|
38
|
+
|
|
39
|
+
## Example Document
|
|
40
|
+
|
|
41
|
+
```markdown
|
|
42
|
+
# Config Reference
|
|
43
|
+
|
|
44
|
+
<!-- PINS: database, authentication, api-keys, environment -->
|
|
45
|
+
|
|
46
|
+
## Database Settings
|
|
47
|
+
<!-- PIN: database -->
|
|
48
|
+
| Setting | Default | Description |
|
|
49
|
+
|---------|---------|-------------|
|
|
50
|
+
|
|
51
|
+
## Authentication
|
|
52
|
+
<!-- PIN: authentication -->
|
|
53
|
+
| Setting | Default | Description |
|
|
54
|
+
|---------|---------|-------------|
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Parsing
|
|
58
|
+
|
|
59
|
+
The PIN system automatically parses documents with:
|
|
60
|
+
- `flow-section-index.js` - Generates section index with pins
|
|
61
|
+
- `flow-section-resolver.js` - Resolves sections by PIN lookup
|
|
62
|
+
- `getSectionsByPins(['auth', 'security'])` - Fetch only relevant sections
|
|
63
|
+
|
|
64
|
+
## Files That Must Have PINs
|
|
65
|
+
|
|
66
|
+
| File | Required PINs |
|
|
67
|
+
|------|---------------|
|
|
68
|
+
| `decisions.md` | Per coding rule/pattern |
|
|
69
|
+
| `app-map.md` | Per component/screen |
|
|
70
|
+
| `product.md` | Per product section |
|
|
71
|
+
| `stack.md` | Per technology |
|
|
72
|
+
|
|
73
|
+
## Validation
|
|
74
|
+
|
|
75
|
+
Run `node scripts/flow-section-index.js --force` to regenerate the index.
|
|
76
|
+
Check `.workflow/state/section-index.json` for indexed sections and their pins.
|
|
@@ -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,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
|