wogiflow 1.0.25 → 1.0.31

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.
@@ -15,6 +15,21 @@ Root (overview)
15
15
  └── File changes (expandable)
16
16
  ```
17
17
 
18
+ ## CRITICAL: Task Queue Check
19
+
20
+ **Before ANY compaction**, you MUST:
21
+
22
+ 1. Read `.workflow/state/ready.json`
23
+ 2. Note pending tasks in your summary
24
+ 3. **NEVER claim "nothing pending" without checking ready.json**
25
+
26
+ If tasks exist:
27
+ - **In Progress** (`inProgress` in ready.json): List task IDs currently being worked on
28
+ - **Ready** (`ready` in ready.json): Count + list task IDs awaiting work
29
+ - **Blocked** (`blocked` in ready.json): Count blocked tasks
30
+
31
+ This ensures task awareness survives context compaction.
32
+
18
33
  ## Before Compacting
19
34
 
20
35
  1. **Update progress.md** with:
@@ -48,7 +63,12 @@ Provide this information for the compaction system:
48
63
  - [Task/change 1]
49
64
  - [Task/change 2]
50
65
 
51
- **In Progress**:
66
+ **Pending Tasks** (REQUIRED - from ready.json):
67
+ - In Progress: [task IDs or "none"]
68
+ - Ready: [count] tasks - [first 5 task IDs]
69
+ - Blocked: [count] tasks
70
+
71
+ **In Progress (Current)**:
52
72
  - TASK-XXX: [description] - [current state, what's left]
53
73
 
54
74
  **Key Decisions**:
@@ -65,11 +85,25 @@ Provide this information for the compaction system:
65
85
 
66
86
  **Context to Preserve**:
67
87
  - [Important context that should survive compaction]
88
+
89
+ **ON RESUME**: Check `.workflow/state/ready.json` for pending work.
68
90
  ```
69
91
 
70
92
  ## Context Pressure Monitoring
71
93
 
72
- Check context pressure status:
94
+ ### Smart Compaction (v2.2)
95
+
96
+ With smart compaction enabled (`config.smartCompaction.enabled`), context is managed intelligently:
97
+
98
+ - **Before task start**: `/wogi-start` estimates task's context needs
99
+ - **Proactive compaction**: Only compacts if `current + estimated > 95%`
100
+ - **Emergency threshold**: Always compacts if context exceeds 95%
101
+
102
+ This means fixed thresholds are less relevant - compaction happens when actually needed based on the specific task.
103
+
104
+ ### Legacy Fixed Thresholds
105
+
106
+ If smart compaction is disabled, check context pressure status:
73
107
  - **Normal**: Under 50k tokens - no action needed
74
108
  - **Warning**: 50k-80k tokens - consider compacting soon
75
109
  - **Critical**: Over 80k tokens - compact immediately
@@ -509,9 +509,6 @@ This file tracks all changes made to the project.
509
509
  **Files**: .workflow/*, .claude/*
510
510
  ```
511
511
 
512
- **roadmap.md** (future work):
513
- Copy from `templates/roadmap.md` to `.workflow/roadmap.md`
514
-
515
512
  #### 4.4 Create Spec Files
516
513
 
517
514
  **stack.md** in `.workflow/specs/`:
@@ -154,6 +154,48 @@ Respond with:
154
154
  - For learning different perspectives
155
155
  - When stuck on architecture decisions
156
156
 
157
+ ## Phase: Post-Review Actions
158
+
159
+ After peer review completes, optionally create tasks from actionable improvements.
160
+
161
+ ### Store & Create Tasks
162
+
163
+ Unlike `/wogi-review` (which finds bugs), peer review finds **improvement opportunities**. These are optional enhancements, not required fixes.
164
+
165
+ **Task creation rules:**
166
+ - Strong agreements (2+ models) → Create task if user approves
167
+ - Single-model suggestions → Note in tech-debt.json for future
168
+ - Disagreements → Document in review report, no task
169
+
170
+ **Present options:**
171
+ ```
172
+ ═══════════════════════════════════════
173
+ ACTIONABLE IMPROVEMENTS
174
+ ═══════════════════════════════════════
175
+ 3 improvements with strong agreement:
176
+ • Extract repeated logic to helper (readability)
177
+ • Add memoization for expensive computation (performance)
178
+ • Use early return pattern (readability)
179
+
180
+ Options:
181
+ [1] Create tasks - Add as improvement tasks (P3)
182
+ [2] Add to tech-debt - Track for future
183
+ [3] Skip - Just log the review
184
+ ```
185
+
186
+ ### Learning Loop
187
+
188
+ For recurring suggestions across reviews:
189
+
190
+ 1. If same improvement suggested 3+ times → Consider adding to decisions.md
191
+ 2. If pattern disagreement resolved consistently → Document the resolution
192
+
193
+ Example:
194
+ ```
195
+ Pattern "prefer-early-return" suggested 4 times across reviews.
196
+ Add to coding standards? [Y/n]
197
+ ```
198
+
157
199
  ## Options
158
200
 
159
201
  - `--provider <name>` - Override configured provider
@@ -162,3 +204,4 @@ Respond with:
162
204
  - `--task <id>` - Review task changes
163
205
  - `--json` - Output JSON for automation
164
206
  - `--verbose` - Show full model responses
207
+ - `--create-tasks` - Auto-create tasks for strong agreements
@@ -608,6 +608,159 @@ The review is not complete until the user confirms. This ensures:
608
608
  - User can request additional fixes
609
609
  - User can reject fixes that change behavior unexpectedly
610
610
 
611
+ ## Phase 4: Store Findings & Create Tasks
612
+
613
+ After review completes, store findings and create actionable tasks.
614
+
615
+ ### Step 1: Store Each Finding as Bug
616
+
617
+ Save each finding to `.workflow/bugs/` using the bug template:
618
+
619
+ ```bash
620
+ # For each finding, create a bug file
621
+ # wf-XXXXXXXX.md (8-char hash of finding description)
622
+ ```
623
+
624
+ Bug file format:
625
+ ```markdown
626
+ # Bug: [Issue title]
627
+
628
+ **ID**: wf-XXXXXXXX
629
+ **Severity**: Critical | High | Medium | Low
630
+ **Discovered**: review-YYYYMMDD-HHMMSS
631
+ **File**: path/to/file.ts:line
632
+ **Status**: open
633
+
634
+ ## Description
635
+ [Issue description from review]
636
+
637
+ ## Reproduction
638
+ Found during code review of [files reviewed]
639
+
640
+ ## Fix
641
+ [Recommendation from review]
642
+ ```
643
+
644
+ ### Step 2: Create Tasks (Severity-Based Aggregation)
645
+
646
+ Apply smart aggregation based on severity and regression risk:
647
+
648
+ | Severity | Regression Risk | Action |
649
+ |----------|-----------------|--------|
650
+ | Critical | Any | Individual task (P0) |
651
+ | High | High risk | Individual task (P1) |
652
+ | High | Low risk | Aggregate with medium (P1) |
653
+ | Medium | Any | Aggregate together (P2) |
654
+ | Low | Any | Aggregate together (P3) |
655
+
656
+ **Regression risk indicators** (treat as High risk):
657
+ - Changes to shared utilities/helpers
658
+ - Changes to API contracts or types
659
+ - Changes to authentication/authorization
660
+ - Changes to data persistence
661
+ - Changes affecting multiple consumers
662
+
663
+ **Result**:
664
+ - Critical/high-risk issues → Individual tasks per issue
665
+ - Low-risk issues → One aggregated "Fix N low-risk review findings" task
666
+
667
+ ### Step 3: Present Options to User
668
+
669
+ ```
670
+ ═══════════════════════════════════════
671
+ TASKS CREATED FROM REVIEW
672
+ ═══════════════════════════════════════
673
+ Found 8 issues:
674
+ • 2 critical/high-risk → 2 separate tasks created
675
+ - wf-abc12345: Fix SQL injection in user query (P0)
676
+ - wf-def67890: Fix missing auth check in API (P1)
677
+ • 6 low-risk → 1 aggregated task created
678
+ - wf-ghi11111: Fix 6 low-risk review findings (P2)
679
+
680
+ Options:
681
+ [1] Fix all - Start all tasks (/wogi-bulk)
682
+ [2] Fix critical first - Start critical/high tasks only
683
+ [3] Review tasks - Show in /wogi-ready, start manually
684
+ ```
685
+
686
+ Use AskUserQuestion to present these options.
687
+
688
+ ## Phase 5: Learning Loop
689
+
690
+ After presenting findings, trigger self-reflection to prevent future issues.
691
+
692
+ ### Step 1: Self-Reflection Prompt
693
+
694
+ For each category of findings, ask:
695
+
696
+ ```
697
+ ═══════════════════════════════════════
698
+ LEARNING OPPORTUNITY
699
+ ═══════════════════════════════════════
700
+ Review found patterns that could be prevented.
701
+
702
+ Analyzing what can be updated to prevent these in future...
703
+ ```
704
+
705
+ ### Step 2: Check Each Finding Against Knowledge Base
706
+
707
+ For each finding, evaluate:
708
+
709
+ | Finding Type | Check Against | Potential Update |
710
+ |--------------|---------------|------------------|
711
+ | Code pattern issue | `decisions.md` | Add new coding rule |
712
+ | Security issue | `.claude/rules/security/` | Add security pattern |
713
+ | Missing validation | skill patterns | Add anti-pattern |
714
+ | Component misuse | `app-map.md` | Add usage notes |
715
+ | Repeated mistake | `feedback-patterns.md` | Track for promotion |
716
+
717
+ ### Step 3: Create Corrections
718
+
719
+ For preventable patterns, create correction records:
720
+
721
+ ```bash
722
+ # Automatically create correction in .workflow/corrections/
723
+ # This feeds into feedback-patterns.md
724
+ ```
725
+
726
+ Example correction:
727
+ ```markdown
728
+ ### CORR-XXX | 2026-01-21
729
+
730
+ **Pattern**: Missing try-catch around file reads
731
+ **Frequency**: Found in 3 places this review
732
+ **Prevention**: Add to security-patterns.md rule
733
+
734
+ **Action taken**: Updated .claude/rules/security/security-patterns.md
735
+ ```
736
+
737
+ ### Step 4: Check for Promotion Opportunities
738
+
739
+ If a pattern has occurred 3+ times in feedback-patterns.md:
740
+
741
+ ```
742
+ ═══════════════════════════════════════
743
+ PATTERN PROMOTION AVAILABLE
744
+ ═══════════════════════════════════════
745
+ Pattern "missing-try-catch-file-reads" has occurred 4 times.
746
+
747
+ Promote to decisions.md as permanent coding rule? [Y/n]
748
+ ```
749
+
750
+ ### Step 5: Learning Summary
751
+
752
+ ```
753
+ ═══════════════════════════════════════
754
+ LEARNING CAPTURED
755
+ ═══════════════════════════════════════
756
+ • Created correction: CORR-047 (missing null checks)
757
+ • Updated: .claude/rules/security/security-patterns.md
758
+ • Pattern "null-check-before-access" at 3 occurrences
759
+ → Promoted to decisions.md ✓
760
+
761
+ Future reviews will check for these patterns.
762
+ ```
763
+
611
764
  ## Auto-Fix Suggestions
612
765
 
613
766
  For certain issue types, offer automated fixes:
@@ -1,6 +1,101 @@
1
1
  Start working on a task. Provide the task ID as argument: `/wogi-start wf-XXXXXXXX`
2
2
 
3
- ## Structured Execution (v2.1)
3
+ ## Request Triage (NEW)
4
+
5
+ When invoked with a **quoted request** instead of a task ID (e.g., `/wogi-start "update github and npm"`), first determine what type of request this is:
6
+
7
+ ### Step 0: Detect Request Type
8
+
9
+ **Is this a task ID or a quoted request?**
10
+ - Task ID format: `wf-XXXXXXXX` (letters, numbers, hyphens) → Skip triage, go to Structured Execution
11
+ - Quoted request: `"anything in quotes"` → Continue with triage below
12
+
13
+ ### Operational Commands (Execute Directly)
14
+
15
+ These are release/deploy/maintenance actions that don't require task tracking:
16
+
17
+ | Category | Examples | Action |
18
+ |----------|----------|--------|
19
+ | **Version Control** | push, pull, fetch, merge, sync, commit | Execute git command |
20
+ | **Publishing** | publish to npm/pypi, deploy to prod/staging | Run publish/deploy |
21
+ | **Build/CI** | run tests, build, lint, format, typecheck | Run the command |
22
+ | **Maintenance** | update dependencies, bump version | Run maintenance |
23
+
24
+ **Examples that execute directly:**
25
+ - `"update github and npm"` → `git push && npm publish`
26
+ - `"push to origin"` → `git push origin`
27
+ - `"push to bitbucket"` → `git push`
28
+ - `"deploy to production"` → Run deploy script
29
+ - `"bump version"` → `npm version patch`
30
+ - `"run tests"` → `npm test`
31
+ - `"sync with remote"` → `git pull && git push`
32
+
33
+ **Action**: Execute the commands directly. No task/story needed.
34
+
35
+ ### Implementation Requests (Create Task First)
36
+
37
+ These involve changing application code/behavior and need planning:
38
+
39
+ | Category | Examples | Action |
40
+ |----------|----------|--------|
41
+ | **Features** | add, create, build, implement new functionality | Create story |
42
+ | **Bug fixes** | fix, repair, resolve issues | Create story |
43
+ | **Refactoring** | refactor, restructure, reorganize code | Create story |
44
+ | **Code Changes** | modify, update, change existing behavior | Create story |
45
+
46
+ **Examples that need a task:**
47
+ - `"add dark mode toggle"` → Run `/wogi-story "add dark mode toggle"` first
48
+ - `"fix the login bug"` → Run `/wogi-story "fix the login bug"` first
49
+ - `"refactor auth system"` → Run `/wogi-story "refactor auth system"` first
50
+ - `"update the login form"` → Run `/wogi-story "update the login form"` first
51
+
52
+ **Action**: Run `/wogi-story "[request]"` to create story with acceptance criteria, wait for approval, then start implementation.
53
+
54
+ ### Decision Logic
55
+
56
+ Use Claude's understanding (not regex) to decide:
57
+
58
+ 1. **Does request mention git/npm/docker/deploy/build operations without code changes?**
59
+ - YES → **Operational** → Execute directly
60
+ - NO → Continue to step 2
61
+
62
+ 2. **Does request involve changing application code/behavior?**
63
+ - YES → **Implementation** → Create story first
64
+ - NO → Continue to step 3
65
+
66
+ 3. **Is it a simple, isolated command (run X, check Y)?**
67
+ - YES → **Operational** → Execute directly
68
+ - NO → **Implementation** → Create story first
69
+
70
+ **Key question**: "Does this request require writing/modifying application code?"
71
+ - YES → Create story first (track acceptance criteria, quality gates)
72
+ - NO → Just execute it (git, npm, deploy are infrastructure, not code)
73
+
74
+ ### Triage Output
75
+
76
+ **Operational:**
77
+ ```
78
+ Request: "update github and npm"
79
+ Category: OPERATIONAL (version control + publishing)
80
+ Action: Executing directly...
81
+
82
+ → git push origin master
83
+ → npm publish
84
+ ✓ Done
85
+ ```
86
+
87
+ **Implementation:**
88
+ ```
89
+ Request: "add dark mode toggle"
90
+ Category: IMPLEMENTATION (new feature)
91
+ Action: Creating story first...
92
+
93
+ → Running /wogi-story "add dark mode toggle"
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Structured Execution (v2.2)
4
99
 
5
100
  This command implements a **structured execution loop**:
6
101
  - **Model-invoked skills**: Auto-loads relevant skills based on task context
@@ -15,6 +110,9 @@ This command implements a **structured execution loop**:
15
110
  ┌─────────────────────────────────────────────────────────┐
16
111
  │ /wogi-start wf-XXXXXXXX │
17
112
  ├─────────────────────────────────────────────────────────┤
113
+ │ 0.25 CONTEXT CHECK: Will this task fit in context? │
114
+ │ → Estimate task's context needs │
115
+ │ → If current + estimated > 95% → Compact first │
18
116
  │ 0.5 PARALLEL CHECK: Are other tasks parallelizable? │
19
117
  │ → If yes: Show parallel option before proceeding │
20
118
  │ 1. Load context + Match skills (auto-invoke) │
@@ -51,6 +149,70 @@ This command implements a **structured execution loop**:
51
149
  └─────────────────────────────────────────────────────────┘
52
150
  ```
53
151
 
152
+ ### Step 0.25: Pre-Task Context Check (Automatic)
153
+
154
+ **Before loading full task context, estimate if the task will fit:**
155
+
156
+ 1. Get current context usage percentage (from status line or estimate)
157
+ 2. Load task metadata from ready.json (just ID, title, type - not full spec yet)
158
+ 3. Estimate task's context needs using `flow-context-estimator.js`:
159
+ - Count acceptance criteria → ~3% each
160
+ - Count expected files → ~2% each
161
+ - Check for refactor/migration keywords → +10% buffer
162
+ - If parent task with subtasks → multiply by (1 + subtasks × 0.3)
163
+ - Fallback to defaults: small=10%, medium=25%, large=40%
164
+
165
+ 4. Calculate: `projected_total = current + estimated`
166
+
167
+ 5. **Decision:**
168
+ - If `projected_total > 95%` → **Compact first**, then resume
169
+ - If `current >= 95%` → **Emergency compact** (always, regardless of task)
170
+ - Otherwise → **Proceed** without compaction
171
+
172
+ **Example outputs:**
173
+
174
+ ```
175
+ 📊 Context Check: Proceeding without compaction
176
+ Current: 60%
177
+ Task estimate: +25%
178
+ Projected: 85%
179
+ Safe threshold: 95%
180
+ Factors: 4 criteria, 3 files
181
+ ```
182
+
183
+ ```
184
+ 📊 Context Check: Compaction needed before task
185
+ Current: 75%
186
+ Task estimate: +30%
187
+ Projected: 105%
188
+ Safe threshold: 95%
189
+ Factors: 8 criteria, 6 files, +refactor buffer
190
+
191
+ → Running /wogi-compact before starting task...
192
+ ```
193
+
194
+ **Why this approach?**
195
+ - Traditional fixed thresholds (compact at 80%) are arbitrary
196
+ - A task needing 15% context shouldn't trigger compaction at 70%
197
+ - This approach compacts only when actually necessary
198
+ - Large tasks at low context proceed; small tasks at high context compact
199
+
200
+ **Config**: Controlled by `config.smartCompaction`:
201
+ ```json
202
+ {
203
+ "enabled": true,
204
+ "safeThreshold": 0.95,
205
+ "emergencyThreshold": 0.95,
206
+ "estimation": {
207
+ "perFile": 0.02,
208
+ "perCriterion": 0.03,
209
+ "refactorBuffer": 0.10
210
+ }
211
+ }
212
+ ```
213
+
214
+ ---
215
+
54
216
  ### Step 0.5: Parallel Execution Check (Automatic)
55
217
 
56
218
  **Before starting, automatically check if parallel execution is available:**
@@ -492,8 +654,9 @@ Phase commands:
492
654
  - If can't fix after 3 attempts, stop and report
493
655
 
494
656
  ### Context getting too large
495
- - After 3+ scenarios, check context size
496
- - If getting large, commit current progress and suggest `/wogi-compact`
657
+ - **Pre-task check** estimates context needs and compacts proactively if needed
658
+ - After 3+ scenarios, re-check context size
659
+ - If getting large mid-task, commit current progress and suggest `/wogi-compact`
497
660
  - Progress is preserved in files and ready.json
498
661
 
499
662
  ## Important
@@ -114,3 +114,30 @@ const tempPath = path.join(os.tmpdir(), 'myfile.txt');
114
114
  // Bad - manual concatenation can break on Windows
115
115
  const tempPath = os.tmpdir() + '/myfile.txt';
116
116
  ```
117
+
118
+ ## 8. Shell Command Parameter Validation
119
+
120
+ When executing shell commands with dynamic parameters, always validate inputs.
121
+
122
+ **Risk**: Command injection via unvalidated parameters passed to execSync/spawn.
123
+
124
+ ```javascript
125
+ // DANGEROUS - lang parameter not validated
126
+ execSync(`sg --pattern "${pattern}" --lang ${lang} --json "${path}"`);
127
+
128
+ // SAFER - validate against whitelist
129
+ const ALLOWED_LANGUAGES = new Set(['typescript', 'javascript', 'python', 'go']);
130
+ if (!ALLOWED_LANGUAGES.has(lang)) {
131
+ throw new Error(`Unsupported language: ${lang}`);
132
+ }
133
+
134
+ // BEST - use execFile with array arguments (no shell interpretation)
135
+ const { execFileSync } = require('child_process');
136
+ execFileSync('sg', ['--pattern', pattern, '--lang', lang, '--json', path]);
137
+ ```
138
+
139
+ **Best practices:**
140
+ - Validate all dynamic parameters against allowlists
141
+ - Prefer `execFile`/`execFileSync` with array arguments over `exec`/`execSync` with template strings
142
+ - When using template strings, escape all user-controlled values
143
+ - Never interpolate user input directly into shell commands
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wogiflow",
3
- "version": "1.0.25",
3
+ "version": "1.0.31",
4
4
  "description": "AI-powered development workflow management system with multi-model support",
5
5
  "main": "lib/index.js",
6
6
  "bin": {