wogiflow 1.5.9 → 1.5.11

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 (34) hide show
  1. package/.claude/commands/wogi-extract-review.md +4 -0
  2. package/.claude/commands/wogi-guided-edit.md +34 -0
  3. package/.claude/commands/wogi-hybrid-edit.md +79 -16
  4. package/.claude/commands/wogi-hybrid-off.md +23 -8
  5. package/.claude/commands/wogi-hybrid-setup.md +86 -43
  6. package/.claude/commands/wogi-hybrid-status.md +41 -11
  7. package/.claude/commands/wogi-hybrid.md +76 -89
  8. package/.claude/commands/wogi-start.md +73 -1
  9. package/.claude/commands/wogi-triage.md +22 -1
  10. package/.claude/docs/knowledge-base/02-task-execution/command-flowcharts.md +758 -0
  11. package/.workflow/templates/claude-md.hbs +44 -476
  12. package/.workflow/templates/partials/auto-features.hbs +12 -147
  13. package/.workflow/templates/partials/user-commands.hbs +2 -184
  14. package/package.json +1 -1
  15. package/scripts/flow-hybrid-detect.js +1 -1
  16. package/scripts/flow-phase.js +44 -0
  17. package/scripts/hooks/adapters/claude-code.js +20 -2
  18. package/scripts/hooks/core/phase-gate.js +369 -0
  19. package/scripts/hooks/core/task-completed.js +12 -0
  20. package/scripts/hooks/entry/claude-code/pre-tool-use.js +16 -0
  21. package/scripts/hooks/entry/claude-code/session-start.js +13 -0
  22. package/scripts/hooks/entry/claude-code/user-prompt-submit.js +23 -0
  23. package/.claude/rules/README.md +0 -60
  24. package/.claude/rules/architecture/component-reuse.md +0 -38
  25. package/.claude/rules/architecture/document-structure.md +0 -76
  26. package/.claude/rules/architecture/feature-refactoring-cleanup.md +0 -87
  27. package/.claude/rules/architecture/model-management.md +0 -35
  28. package/.claude/rules/architecture/self-maintenance.md +0 -87
  29. package/.claude/rules/code-style/naming-conventions.md +0 -55
  30. package/.claude/rules/security/security-patterns.md +0 -176
  31. package/.claude/skills/figma-analyzer/knowledge/learnings.md +0 -11
  32. package/.workflow/specs/architecture.md.template +0 -24
  33. package/.workflow/specs/stack.md.template +0 -33
  34. package/.workflow/specs/testing.md.template +0 -36
@@ -2,6 +2,8 @@
2
2
 
3
3
  Extract tasks from long input with 100% capture rate and mandatory human review.
4
4
 
5
+ **Scope**: This command does NOT modify source code files. It processes input text into structured tasks. All file modifications happen downstream via `/wogi-start`.
6
+
5
7
  ## Purpose
6
8
 
7
9
  When processing transcripts, meeting notes, or long prompts, this command ensures NOTHING is missed by:
@@ -105,6 +107,8 @@ After zero-loss extraction and review:
105
107
  1. Confirmed tasks become the input for topic extraction
106
108
  2. Topics are generated from the confirmed task list
107
109
  3. Standard 4-pass processing continues
110
+ 4. Final output creates stories in `ready.json` via `/wogi-story`
111
+ 5. Each story then executes through the full `/wogi-start` pipeline
108
112
 
109
113
  ```bash
110
114
  # Full flow
@@ -13,6 +13,26 @@ Usage:
13
13
  /wogi-guided-edit "update all imports from @old/lib to @new/lib"
14
14
  ```
15
15
 
16
+ ## Task Gating
17
+
18
+ This command modifies files. It MUST operate within one of these contexts:
19
+
20
+ 1. **Within `/wogi-start`** (preferred): When invoked as part of an active task, the task already exists in `ready.json` inProgress. Proceed directly — task lifecycle is managed by the parent command.
21
+ 2. **Standalone invocation**: Before editing files, check `ready.json` for an active inProgress task with `feature: "guided-edit"`. If no guided-edit task exists, create one:
22
+ ```json
23
+ {
24
+ "id": "[call generateTaskId('Guided edit: [description]')]",
25
+ "title": "Guided edit: [description]",
26
+ "type": "fix",
27
+ "feature": "guided-edit",
28
+ "status": "in_progress",
29
+ "priority": "P2",
30
+ "createdAt": "[ISO timestamp]",
31
+ "startedAt": "[ISO timestamp]"
32
+ }
33
+ ```
34
+ Add to `ready.json` inProgress before any file modifications. Store the task ID in the session file for cleanup.
35
+
16
36
  ## Workflow
17
37
 
18
38
  1. **Analyze**: Find all files affected by the change
@@ -22,7 +42,21 @@ Usage:
22
42
  - Show proposed diff (if replace operation)
23
43
  - User: approve / reject / skip
24
44
  4. **Apply**: Make approved changes
45
+ - **After each file edit**, validate by file type:
46
+ - `.js` files: `node --check <file>` + ESLint
47
+ - `.ts`/`.tsx` files: `npx tsc --noEmit` + ESLint
48
+ - `.json` files: JSON parse check
49
+ - Other types: skip validation
50
+ - Do NOT proceed to next file until current file passes validation
25
51
  5. **Summary**: Show completion stats
52
+ 6. **Complete task** (standalone invocation only): If a guided-edit task was created in step 2, move it from inProgress to recentlyCompleted in `ready.json`. If running within `/wogi-start` (case 1), skip — the parent command manages task lifecycle.
53
+
54
+ ## Abort Handling
55
+
56
+ When the user issues `abort`/`q`, or the session is abandoned mid-edit:
57
+ 1. Move the guided-edit task from inProgress to recentlyCompleted with a note: "Aborted after N/M files"
58
+ 2. The session file (`.workflow/state/guided-edit-session.json`) retains progress for potential resume
59
+ 3. Do NOT leave tasks stuck in inProgress — always clean up on exit
26
60
 
27
61
  ## Commands During Session
28
62
 
@@ -1,36 +1,99 @@
1
1
  ---
2
- description: Edit the current execution plan before running
2
+ description: View and edit the current hybrid execution plan
3
3
  ---
4
4
 
5
- # Edit Hybrid Plan
5
+ # Edit Hybrid Execution Plan
6
6
 
7
- Show me the current plan and what you'd like to change.
7
+ View the current execution plan and modify steps before running.
8
8
 
9
- ## Current Plan
9
+ ## Step 1: Load Current Plan
10
10
 
11
11
  ```bash
12
12
  if [ -f ".workflow/state/current-plan.json" ]; then
13
- jq '.' .workflow/state/current-plan.json
13
+ echo "═══════════════════════════════════════════════════════════"
14
+ echo " CURRENT EXECUTION PLAN"
15
+ echo "═══════════════════════════════════════════════════════════"
16
+ echo ""
17
+ jq -r '
18
+ "Task: \(.taskId // "unknown")",
19
+ "Executor: \(.executor // "not set")",
20
+ "Steps: \(.steps | length)",
21
+ "",
22
+ (.steps | to_entries[] | " Step \(.key + 1): [\(.value.status // "pending")] \(.value.description // "unnamed")\n Model: \(.value.model // "default")\n Files: \(.value.files // [] | join(", "))\n")
23
+ ' .workflow/state/current-plan.json
24
+ echo "═══════════════════════════════════════════════════════════"
14
25
  else
15
- echo "No plan currently loaded"
26
+ echo ""
27
+ echo "No active execution plan."
28
+ echo ""
29
+ echo "A plan is created when you start a task with hybrid mode enabled."
30
+ echo "Use /wogi-hybrid to enable hybrid mode first, then /wogi-start a task."
31
+ echo ""
16
32
  fi
17
33
  ```
18
34
 
19
35
  ## Edit Options
20
36
 
21
- Tell me what you'd like to change:
37
+ If a plan exists, tell me what you'd like to change:
22
38
 
23
- 1. **Add a step** - Describe what you want to add
24
- 2. **Remove a step** - Tell me which step number to remove
25
- 3. **Modify a step** - Tell me which step and what to change
26
- 4. **Reorder steps** - Specify the new order
27
- 5. **Change execution mode** - Mark steps as parallel/sequential
39
+ ### Modify Steps
40
+ 1. **Add a step** "Add a step to create unit tests after step 3"
41
+ 2. **Remove a step** "Remove step 4, I'll handle that manually"
42
+ 3. **Modify a step** "Change step 2 to use React Hook Form instead"
43
+ 4. **Reorder steps** "Move step 5 before step 3"
44
+
45
+ ### Change Execution
46
+ 5. **Change model for a step** — "Use Sonnet for step 3 instead of Haiku"
47
+ 6. **Change model for all** — "Use GPT-4o-mini for all remaining steps"
48
+ 7. **Mark step as manual** — "I'll do step 4 myself, skip it"
49
+ 8. **Change to parallel** — "Run steps 2 and 3 in parallel"
50
+
51
+ ### Plan Management
52
+ 9. **Save plan** — Save current plan to reuse later
53
+ 10. **Discard plan** — Cancel execution and discard plan
54
+ 11. **Reset plan** — Regenerate plan from task spec
55
+
56
+ ## How Plan Editing Works
57
+
58
+ When you request a change:
59
+ 1. I read the current plan from `.workflow/state/current-plan.json`
60
+ 2. Apply your modifications
61
+ 3. Show the updated plan for confirmation
62
+ 4. Save the updated plan
63
+ 5. Execution continues from where it left off
64
+
65
+ ## Plan File Format
66
+
67
+ Plans are stored at `.workflow/state/current-plan.json`:
68
+
69
+ ```json
70
+ {
71
+ "taskId": "wf-XXXXXXXX",
72
+ "executor": "claude-3-5-haiku-latest",
73
+ "routing": "smart",
74
+ "createdAt": "ISO timestamp",
75
+ "steps": [
76
+ {
77
+ "id": 1,
78
+ "description": "Create UserCard component",
79
+ "model": "claude-3-5-sonnet-latest",
80
+ "status": "pending",
81
+ "files": ["src/components/UserCard.tsx"],
82
+ "context": "Template + patterns from app-map",
83
+ "verification": ["lint", "typecheck"]
84
+ }
85
+ ]
86
+ }
87
+ ```
28
88
 
29
89
  ## Example Requests
30
90
 
31
- - "Add a step to create unit tests after the service"
32
- - "Remove step 3, I'll handle that manually"
33
- - "Change step 2 to use React Hook Form instead"
34
- - "Make steps 1-3 run in parallel"
91
+ ```
92
+ "Add a step to create unit tests after the service"
93
+ "Remove step 3, I'll handle that manually"
94
+ "Change step 2 to use Sonnet instead of Haiku"
95
+ "Make steps 1-3 run in parallel"
96
+ "Use GPT-4o-mini for all documentation steps"
97
+ ```
35
98
 
36
99
  What would you like to change?
@@ -1,24 +1,39 @@
1
1
  ---
2
- description: Disable hybrid mode and return to normal operation
2
+ description: Disable hybrid mode and return to direct Opus execution
3
3
  ---
4
4
 
5
5
  # Disable Hybrid Mode
6
6
 
7
- Turning off hybrid mode. I'll go back to executing everything directly.
7
+ Turning off multi-model hybrid execution. All tasks will be executed directly by Opus.
8
8
 
9
9
  ```bash
10
10
  # Update config
11
- cd "$(pwd)" && cat .workflow/config.json | jq '.hybrid.enabled = false' > /tmp/config.tmp && mv /tmp/config.tmp .workflow/config.json
11
+ cd "$(pwd)" && jq '.hybrid.enabled = false' .workflow/config.json > /tmp/wogi-config-tmp.json && mv /tmp/wogi-config-tmp.json .workflow/config.json
12
12
 
13
- echo "✅ Hybrid mode disabled"
13
+ # Clean up session state
14
+ if [ -f ".workflow/state/current-plan.json" ]; then
15
+ rm .workflow/state/current-plan.json
16
+ echo "Removed active execution plan"
17
+ fi
18
+
19
+ echo "Hybrid mode disabled"
14
20
  ```
15
21
 
16
22
  ## What Changes
17
23
 
18
- - I'll write code directly instead of creating plans
19
- - All execution happens via Claude (no local LLM)
20
- - No token savings, but simpler workflow
24
+ - All tasks are executed directly by Opus (no delegation to cheaper models)
25
+ - No execution plans are created code is written directly
26
+ - No token savings from multi-model routing
27
+ - Simpler workflow, but higher token usage
28
+
29
+ ## Your Configuration Is Preserved
30
+
31
+ - Cloud provider API keys remain configured
32
+ - Local LLM connections remain saved
33
+ - Smart routing rules remain in config
34
+ - Project templates remain generated
21
35
 
22
36
  ## Re-enabling
23
37
 
24
- Run `/wogi-hybrid` to enable again with your previous settings.
38
+ Run `/wogi-hybrid` to re-enable with your previous settings.
39
+ Run `/wogi-hybrid-setup` to reconfigure from scratch.
@@ -1,79 +1,122 @@
1
1
  ---
2
- description: Set up hybrid mode - generates templates and configures local LLM
2
+ description: Set up hybrid mode - configure executor models for multi-model execution
3
3
  ---
4
4
 
5
5
  # Hybrid Mode Setup
6
6
 
7
- This command sets up everything needed for hybrid mode in your project.
7
+ This command sets up everything needed for multi-model hybrid execution in your project.
8
8
 
9
- ## Step 1: Generate Project Templates
9
+ ## Step 1: Choose Executor Type
10
10
 
11
- Analyzing your codebase and generating customized templates:
11
+ ### Cloud Models (Recommended Easiest Setup)
12
+
13
+ If you have API keys for any of these providers, hybrid mode works immediately:
14
+
15
+ | Provider | Cheapest Model | Mid-tier Model | Env Variable |
16
+ |----------|---------------|----------------|--------------|
17
+ | Anthropic | Claude 3.5 Haiku | Claude 3.5 Sonnet | `ANTHROPIC_API_KEY` |
18
+ | OpenAI | GPT-4o-mini | GPT-4o | `OPENAI_API_KEY` |
19
+ | Google | Gemini 2.0 Flash | Gemini 1.5 Pro | `GOOGLE_API_KEY` |
20
+
21
+ **Quick setup**: If you already have `ANTHROPIC_API_KEY` set (which you do if you use Claude Code), Haiku and Sonnet are ready to use as executors.
12
22
 
23
+ ### Local Models (Free Tokens)
24
+
25
+ For local LLM execution, you need Ollama or LM Studio running:
26
+
27
+ **Ollama:**
13
28
  ```bash
14
- node scripts/flow-templates.js generate
29
+ ollama serve
30
+ ollama pull qwen3-coder # or your preferred model
15
31
  ```
16
32
 
17
- ## Step 2: Enable Hybrid Mode
33
+ **LM Studio:**
34
+ - Open the app → Download a model → Start the local server
35
+
36
+ ### Mixed Setup (Best of Both)
18
37
 
19
- Running the interactive setup wizard to configure your local LLM:
38
+ Configure both local and cloud models. Hybrid mode will select the best executor based on task type:
39
+ - Simple edits → Local LLM (free) or Haiku (cheapest cloud)
40
+ - Code generation → Sonnet or GPT-4o (mid-tier cloud)
41
+ - Complex work → Keep on Opus (no delegation)
42
+
43
+ ## Step 2: Generate Project Templates
44
+
45
+ Analyzing your codebase and generating customized templates:
20
46
 
21
47
  ```bash
22
- node scripts/flow-hybrid-interactive.js
48
+ node scripts/flow-templates.js generate
23
49
  ```
24
50
 
25
- ## What This Does
51
+ This creates templates in `templates/hybrid/` that teach executor models your project's patterns.
26
52
 
27
- 1. **Analyzes your project**
28
- - Detects framework (React, Next.js, Vue, Angular, etc.)
29
- - Detects state management (Zustand, Redux, MobX, etc.)
30
- - Detects styling (Tailwind, Styled Components, etc.)
31
- - Finds code examples from your components, hooks, services
53
+ ## Step 3: Configure Hybrid Mode
32
54
 
33
- 2. **Generates templates** in `templates/hybrid/`
34
- - `_base.md` - Universal rules for your stack
35
- - `_patterns.md` - Your actual coding patterns
36
- - Task-specific templates (create-component, create-hook, etc.)
55
+ ### Option A: Use Unified Model Setup (Recommended)
37
56
 
38
- 3. **Configures local LLM**
39
- - Detects Ollama and/or LM Studio
40
- - Lists available models
41
- - Tests the connection
42
- - Saves configuration to `config.json`
57
+ Configures all your models in one place:
43
58
 
44
- 4. **Uses durable session system**
45
- - Session state tracked in `durable-history.json`
59
+ ```
60
+ /wogi-models-setup
61
+ ```
46
62
 
47
- ## Requirements
63
+ ### Option B: Interactive Setup
48
64
 
49
- Before running, ensure you have a local LLM running:
65
+ Runs the hybrid-specific setup wizard:
50
66
 
51
- **Ollama:**
52
67
  ```bash
53
- ollama serve
54
- ollama pull nemotron-3-nano # or your preferred model
68
+ node scripts/flow-hybrid-interactive.js
55
69
  ```
56
70
 
57
- **LM Studio:**
58
- - Open the app
59
- - Download a model
60
- - Start the local server
71
+ ## Step 4: Configure Smart Routing (Optional)
72
+
73
+ Edit `config.json hybrid.routing` to customize which models handle which task types:
74
+
75
+ ```json
76
+ {
77
+ "hybrid": {
78
+ "routing": {
79
+ "enabled": true,
80
+ "rules": [
81
+ { "taskType": "simple-edit", "model": "cheapest" },
82
+ { "taskType": "code-generation", "model": "mid-tier" },
83
+ { "taskType": "refactoring", "model": "planner" },
84
+ { "taskType": "documentation", "model": "cheapest" }
85
+ ],
86
+ "tiers": {
87
+ "cheapest": ["claude-3-5-haiku-latest", "gpt-4o-mini", "gemini-2.0-flash-exp"],
88
+ "mid-tier": ["claude-3-5-sonnet-latest", "gpt-4o", "gemini-1.5-pro"],
89
+ "planner": "current"
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ ## What This Does
97
+
98
+ 1. **Analyzes your project** — Detects framework, state management, styling
99
+ 2. **Generates templates** — Customized task templates in `templates/hybrid/`
100
+ 3. **Configures executor(s)** — Sets up cloud and/or local model connections
101
+ 4. **Tests connections** — Verifies executor models respond correctly
102
+ 5. **Enables routing** — Configures smart model selection based on task type
61
103
 
62
104
  ## After Setup
63
105
 
64
106
  Use these commands:
65
- - `/wogi-hybrid-status` - Check configuration
66
- - `/wogi-hybrid-off` - Disable hybrid mode
67
- - `/wogi-hybrid-edit` - Edit plans before execution
107
+ - `/wogi-hybrid` Enable hybrid mode and start using it
108
+ - `/wogi-hybrid-status` Check configuration and routing table
109
+ - `/wogi-hybrid-off` Disable hybrid mode
110
+ - `/wogi-hybrid-edit` — Edit plans before execution
68
111
 
69
112
  ## Token Savings
70
113
 
71
- | Task Size | Normal | Hybrid | Savings |
72
- |-----------|--------|--------|---------|
73
- | Small | ~8K | ~5K | 35% |
74
- | Medium | ~20K | ~10K | 50% |
75
- | Large | ~45K | ~20K | 55% |
114
+ | Task Size | Normal (Opus) | Hybrid (mixed) | Savings |
115
+ |-----------|--------------|----------------|---------|
116
+ | Small | ~8K | ~2K | 75% |
117
+ | Medium | ~20K | ~8K | 60% |
118
+ | Large | ~45K | ~15K | 65% |
76
119
 
77
- *Note: Actual savings vary based on instruction detail needed for quality.*
120
+ *Savings vary based on executor model selection and task complexity.*
78
121
 
79
122
  Let me set up hybrid mode for your project now...
@@ -1,10 +1,10 @@
1
1
  ---
2
- description: Show current hybrid mode configuration
2
+ description: Show current hybrid mode configuration and routing table
3
3
  ---
4
4
 
5
5
  # Hybrid Mode Status
6
6
 
7
- Let me check the current configuration:
7
+ Let me check the current multi-model execution configuration:
8
8
 
9
9
  ```bash
10
10
  echo "═══════════════════════════════════════════════════════════"
@@ -18,28 +18,58 @@ echo "Status: $ENABLED"
18
18
 
19
19
  if [ "$ENABLED" = "true" ]; then
20
20
  echo ""
21
- echo "Configuration:"
22
- jq '.hybrid' .workflow/config.json
21
+ echo "── Executor Configuration ──"
22
+ EXEC_TYPE=$(jq -r '.hybrid.executor.type // "not set"' .workflow/config.json)
23
+ EXEC_MODEL=$(jq -r '.hybrid.executor.model // "not set"' .workflow/config.json)
24
+ echo " Type: $EXEC_TYPE"
25
+ echo " Model: $EXEC_MODEL"
23
26
 
24
27
  echo ""
25
- echo "Testing connection..."
26
- node scripts/flow-hybrid-detect.js providers
28
+ echo "── Smart Routing ──"
29
+ ROUTING_ENABLED=$(jq -r '.hybrid.routing.enabled // false' .workflow/config.json)
30
+ echo " Routing enabled: $ROUTING_ENABLED"
31
+ if [ "$ROUTING_ENABLED" = "true" ]; then
32
+ echo ""
33
+ echo " Task Type Routing:"
34
+ jq -r '.hybrid.routing.rules[]? | " \(.taskType) → \(.model) (\(.description // ""))"' .workflow/config.json
35
+ echo ""
36
+ echo " Model Tiers:"
37
+ echo " Cheapest: $(jq -r '.hybrid.routing.tiers.cheapest // [] | join(", ")' .workflow/config.json)"
38
+ echo " Mid-tier: $(jq -r '.hybrid.routing.tiers["mid-tier"] // [] | join(", ")' .workflow/config.json)"
39
+ echo " Planner: $(jq -r '.hybrid.routing.tiers.planner // "current"' .workflow/config.json)"
40
+ fi
41
+
42
+ echo ""
43
+ echo "── Cloud Providers ──"
44
+ jq -r '.hybrid.cloudProviders | to_entries[] | " \(.key): \(.value.models | join(", ")) [env: \(.value.envKey)]"' .workflow/config.json
27
45
 
28
46
  echo ""
29
- echo "Session state:"
30
- # Use durable session (v2.0) - check durable-history.json for active sessions
47
+ echo "── Local Providers ──"
48
+ echo " Checking..."
49
+ node scripts/flow-hybrid-detect.js providers 2>/dev/null | jq -r '.[] | " \(.name): \(if .available then "✓ available (\(.models | length) models)" else "✗ not running" end)"' 2>/dev/null || echo " Detection unavailable"
50
+
51
+ echo ""
52
+ echo "── Session State ──"
31
53
  if [ -f ".workflow/state/durable-history.json" ]; then
32
- ACTIVE=$(jq -r '.activeSession // empty' .workflow/state/durable-history.json)
54
+ ACTIVE=$(jq -r '.activeSession // empty' .workflow/state/durable-history.json 2>/dev/null)
33
55
  if [ -n "$ACTIVE" ] && [ "$ACTIVE" != "null" ]; then
34
56
  jq '.activeSession' .workflow/state/durable-history.json
35
57
  else
36
- echo "No active session"
58
+ echo " No active session"
37
59
  fi
38
60
  else
39
- echo "No durable session history"
61
+ echo " No durable session history"
40
62
  fi
41
63
  fi
42
64
 
43
65
  echo ""
44
66
  echo "═══════════════════════════════════════════════════════════"
45
67
  ```
68
+
69
+ ## Quick Actions
70
+
71
+ - `/wogi-hybrid` — Enable hybrid mode
72
+ - `/wogi-hybrid-setup` — Run setup wizard
73
+ - `/wogi-hybrid-edit` — Edit current execution plan
74
+ - `/wogi-hybrid-off` — Disable hybrid mode
75
+ - `/wogi-hybrid --select-model` — Change executor model