wogiflow 1.0.21 → 1.0.22
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-bug.md +43 -0
- package/.claude/commands/wogi-bulk.md +144 -0
- package/.claude/commands/wogi-changelog.md +36 -0
- package/.claude/commands/wogi-compact.md +99 -0
- package/.claude/commands/wogi-config.md +50 -0
- package/.claude/commands/wogi-context.md +68 -0
- package/.claude/commands/wogi-correction.md +73 -0
- package/.claude/commands/wogi-debt.md +128 -0
- package/.claude/commands/wogi-deps.md +32 -0
- package/.claude/commands/wogi-epics.md +145 -0
- package/.claude/commands/wogi-export.md +100 -0
- package/.claude/commands/wogi-feature.md +149 -0
- package/.claude/commands/wogi-guided-edit.md +83 -0
- package/.claude/commands/wogi-health.md +43 -0
- package/.claude/commands/wogi-help.md +96 -0
- package/.claude/commands/wogi-hybrid-edit.md +36 -0
- package/.claude/commands/wogi-hybrid-off.md +24 -0
- package/.claude/commands/wogi-hybrid-setup.md +79 -0
- package/.claude/commands/wogi-hybrid-status.md +45 -0
- package/.claude/commands/wogi-hybrid.md +54 -0
- package/.claude/commands/wogi-import.md +44 -0
- package/.claude/commands/wogi-init.md +618 -0
- package/.claude/commands/wogi-log.md +38 -0
- package/.claude/commands/wogi-map-add.md +29 -0
- package/.claude/commands/wogi-map-check.md +35 -0
- package/.claude/commands/wogi-map-index.md +98 -0
- package/.claude/commands/wogi-map-scan.md +38 -0
- package/.claude/commands/wogi-map-sync.md +91 -0
- package/.claude/commands/wogi-map.md +33 -0
- package/.claude/commands/wogi-morning.md +65 -0
- package/.claude/commands/wogi-onboard.md +99 -0
- package/.claude/commands/wogi-plan.md +173 -0
- package/.claude/commands/wogi-ready.md +84 -0
- package/.claude/commands/wogi-resume.md +95 -0
- package/.claude/commands/wogi-review.md +636 -0
- package/.claude/commands/wogi-roadmap.md +241 -0
- package/.claude/commands/wogi-rules.md +104 -0
- package/.claude/commands/wogi-search.md +33 -0
- package/.claude/commands/wogi-session-end.md +49 -0
- package/.claude/commands/wogi-setup-stack.md +151 -0
- package/.claude/commands/wogi-skill-learn.md +66 -0
- package/.claude/commands/wogi-skills.md +87 -0
- package/.claude/commands/wogi-standup.md +28 -0
- package/.claude/commands/wogi-start.md +465 -0
- package/.claude/commands/wogi-status.md +41 -0
- package/.claude/commands/wogi-statusline-setup/skill.md +109 -0
- package/.claude/commands/wogi-story.md +98 -0
- package/.claude/commands/wogi-suspend.md +87 -0
- package/.claude/commands/wogi-test-browser.md +43 -0
- package/.claude/commands/wogi-trace.md +198 -0
- package/.claude/docs/architecture.md +37 -0
- package/.claude/docs/commands.md +343 -0
- package/.claude/docs/knowledge-base/01-setup-onboarding/README.md +177 -0
- package/.claude/docs/knowledge-base/01-setup-onboarding/component-indexing.md +341 -0
- package/.claude/docs/knowledge-base/01-setup-onboarding/framework-detection.md +269 -0
- package/.claude/docs/knowledge-base/01-setup-onboarding/installation.md +146 -0
- package/.claude/docs/knowledge-base/01-setup-onboarding/onboarding-existing.md +317 -0
- package/.claude/docs/knowledge-base/01-setup-onboarding/team-setup.md +346 -0
- package/.claude/docs/knowledge-base/02-task-execution/01-task-planning.md +259 -0
- package/.claude/docs/knowledge-base/02-task-execution/02-execution-loop.md +443 -0
- package/.claude/docs/knowledge-base/02-task-execution/03-verification.md +417 -0
- package/.claude/docs/knowledge-base/02-task-execution/04-completion.md +374 -0
- package/.claude/docs/knowledge-base/02-task-execution/05-session-review.md +170 -0
- package/.claude/docs/knowledge-base/02-task-execution/README.md +173 -0
- package/.claude/docs/knowledge-base/02-task-execution/external-integrations.md +133 -0
- package/.claude/docs/knowledge-base/02-task-execution/model-management.md +202 -0
- package/.claude/docs/knowledge-base/02-task-execution/specification-mode.md +292 -0
- package/.claude/docs/knowledge-base/02-task-execution/sync-daemon.md +96 -0
- package/.claude/docs/knowledge-base/02-task-execution/trade-offs.md +345 -0
- package/.claude/docs/knowledge-base/02-task-execution/workflow-steps.md +357 -0
- package/.claude/docs/knowledge-base/03-self-improvement/README.md +199 -0
- package/.claude/docs/knowledge-base/03-self-improvement/long-input-processing.md +160 -0
- package/.claude/docs/knowledge-base/03-self-improvement/model-learning.md +334 -0
- package/.claude/docs/knowledge-base/03-self-improvement/project-learning.md +301 -0
- package/.claude/docs/knowledge-base/03-self-improvement/skill-learning.md +372 -0
- package/.claude/docs/knowledge-base/03-self-improvement/skill-matching.md +304 -0
- package/.claude/docs/knowledge-base/03-self-improvement/team-learning.md +342 -0
- package/.claude/docs/knowledge-base/04-memory-context/README.md +189 -0
- package/.claude/docs/knowledge-base/04-memory-context/context-management.md +308 -0
- package/.claude/docs/knowledge-base/04-memory-context/memory-commands.md +176 -0
- package/.claude/docs/knowledge-base/04-memory-context/memory-systems.md +359 -0
- package/.claude/docs/knowledge-base/04-memory-context/prd-management.md +115 -0
- package/.claude/docs/knowledge-base/04-memory-context/session-persistence.md +359 -0
- package/.claude/docs/knowledge-base/04-memory-context/team-history.md +317 -0
- package/.claude/docs/knowledge-base/05-development-tools/README.md +84 -0
- package/.claude/docs/knowledge-base/05-development-tools/code-traces.md +278 -0
- package/.claude/docs/knowledge-base/05-development-tools/figma-analyzer.md +253 -0
- package/.claude/docs/knowledge-base/05-development-tools/guided-edit.md +173 -0
- package/.claude/docs/knowledge-base/05-development-tools/mcp-integrations.md +286 -0
- package/.claude/docs/knowledge-base/06-safety-guardrails/README.md +153 -0
- package/.claude/docs/knowledge-base/06-safety-guardrails/checkpoint-rollback.md +302 -0
- package/.claude/docs/knowledge-base/06-safety-guardrails/commit-gates.md +309 -0
- package/.claude/docs/knowledge-base/06-safety-guardrails/damage-control.md +292 -0
- package/.claude/docs/knowledge-base/06-safety-guardrails/security-scanning.md +291 -0
- package/.claude/docs/knowledge-base/README.md +92 -0
- package/.claude/docs/knowledge-base/configuration/README.md +228 -0
- package/.claude/docs/knowledge-base/configuration/all-options.md +1632 -0
- package/.claude/docs/knowledge-base/future-features.md +277 -0
- package/.claude/docs/stack.md +25 -0
- package/.claude/docs/testing.md +71 -0
- 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/code-style/naming-conventions.md +55 -0
- package/.claude/rules/security/security-patterns.md +116 -0
- package/.claude/skills/.gitkeep +0 -0
- package/.claude/skills/README.md +131 -0
- package/.claude/skills/_template/commands/.gitkeep +0 -0
- package/.claude/skills/_template/knowledge/anti-patterns.md +49 -0
- package/.claude/skills/_template/knowledge/learnings.md +60 -0
- package/.claude/skills/_template/knowledge/patterns.md +45 -0
- package/.claude/skills/_template/rules/.gitkeep +0 -0
- package/.claude/skills/_template/skill.md +99 -0
- package/.claude/skills/_template/templates/.gitkeep +0 -0
- package/.claude/skills/figma-analyzer/knowledge/anti-patterns.md +216 -0
- package/.claude/skills/figma-analyzer/knowledge/patterns.md +144 -0
- package/.claude/skills/figma-analyzer/skill.md +236 -0
- package/lib/installer.js +59 -19
- package/package.json +5 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Memory & Context Management
|
|
2
|
+
|
|
3
|
+
Preventing hallucinations, managing context windows, and preserving session history.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## The Problem
|
|
8
|
+
|
|
9
|
+
AI struggles with:
|
|
10
|
+
- **Context Overflow**: Losing track when context gets too large
|
|
11
|
+
- **Session Amnesia**: Forgetting work between sessions
|
|
12
|
+
- **Hallucinations**: Making up components that don't exist
|
|
13
|
+
- **Lost History**: Not remembering past decisions
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## The Solution
|
|
18
|
+
|
|
19
|
+
WogiFlow manages memory through:
|
|
20
|
+
- Context monitoring and compaction
|
|
21
|
+
- Durable sessions for crash recovery
|
|
22
|
+
- Memory blocks for key facts
|
|
23
|
+
- Request log as institutional memory
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
| Feature | Purpose |
|
|
30
|
+
|---------|---------|
|
|
31
|
+
| [Context Management](./context-management.md) | Monitor and compact context |
|
|
32
|
+
| [Session Persistence](./session-persistence.md) | Preserve work across sessions |
|
|
33
|
+
| [Memory Systems](./memory-systems.md) | Facts, decay, tiers |
|
|
34
|
+
| [Team History](./team-history.md) | Shared logs, audit trails |
|
|
35
|
+
| [PRD Management](./prd-management.md) | Load and query product specs |
|
|
36
|
+
| [Memory Commands](./memory-commands.md) | CLI for entropy, sync, routing |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
### Enable Context Monitoring
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"contextMonitor": {
|
|
47
|
+
"enabled": true,
|
|
48
|
+
"warnAt": 0.7, // Warn at 70%
|
|
49
|
+
"criticalAt": 0.85, // Critical at 85%
|
|
50
|
+
"contextWindow": 200000
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Check Context Health
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
Context is monitored automatically.
|
|
59
|
+
When high, you'll see:
|
|
60
|
+
|
|
61
|
+
⚠️ Context Health Warning
|
|
62
|
+
Usage: 165,000 / 200,000 tokens (82.5%)
|
|
63
|
+
Recommendation: Run /compact before continuing
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Compact When Needed
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
/wogi-compact
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Key Configuration
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"contextMonitor": {
|
|
79
|
+
"enabled": true,
|
|
80
|
+
"warnAt": 0.7,
|
|
81
|
+
"criticalAt": 0.85,
|
|
82
|
+
"contextWindow": 200000,
|
|
83
|
+
"checkOnSessionStart": true,
|
|
84
|
+
"checkAfterTask": true
|
|
85
|
+
},
|
|
86
|
+
"sessionState": {
|
|
87
|
+
"enabled": true,
|
|
88
|
+
"autoRestore": true,
|
|
89
|
+
"maxGapHours": 24,
|
|
90
|
+
"trackFiles": true,
|
|
91
|
+
"trackDecisions": true
|
|
92
|
+
},
|
|
93
|
+
"memory": {
|
|
94
|
+
"enabled": true,
|
|
95
|
+
"localDb": ".workflow/memory/local.db",
|
|
96
|
+
"maxLocalFacts": 1000,
|
|
97
|
+
"autoRemember": false
|
|
98
|
+
},
|
|
99
|
+
"requestLog": {
|
|
100
|
+
"enabled": true,
|
|
101
|
+
"autoArchive": true,
|
|
102
|
+
"maxRecentEntries": 50
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Memory Flow
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
113
|
+
│ MEMORY ARCHITECTURE │
|
|
114
|
+
├─────────────────────────────────────────────────────────────┤
|
|
115
|
+
│ │
|
|
116
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
117
|
+
│ │ Context │ │ Session │ │ Request │ │
|
|
118
|
+
│ │ Monitor │ │ State │ │ Log │ │
|
|
119
|
+
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
|
|
120
|
+
│ │ │ │ │
|
|
121
|
+
│ ▼ ▼ ▼ │
|
|
122
|
+
│ ┌─────────────────────────────────────────────────┐ │
|
|
123
|
+
│ │ Memory Blocks │ │
|
|
124
|
+
│ │ - Key facts │ │
|
|
125
|
+
│ │ - Recent files │ │
|
|
126
|
+
│ │ - Current task │ │
|
|
127
|
+
│ │ - Important decisions │ │
|
|
128
|
+
│ └─────────────────────────────────────────────────┘ │
|
|
129
|
+
│ │ │
|
|
130
|
+
│ ▼ │
|
|
131
|
+
│ ┌─────────────────────────────────────────────────┐ │
|
|
132
|
+
│ │ Durable Session │ │
|
|
133
|
+
│ │ - Crash recovery │ │
|
|
134
|
+
│ │ - Step tracking │ │
|
|
135
|
+
│ │ - Resume context │ │
|
|
136
|
+
│ └─────────────────────────────────────────────────┘ │
|
|
137
|
+
│ │
|
|
138
|
+
└─────────────────────────────────────────────────────────────┘
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Context Thresholds
|
|
144
|
+
|
|
145
|
+
| Level | Threshold | Behavior |
|
|
146
|
+
|-------|-----------|----------|
|
|
147
|
+
| Normal | < 70% | Continue normally |
|
|
148
|
+
| Warning | 70-85% | Suggest compaction |
|
|
149
|
+
| Critical | > 85% | Strongly recommend compact |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Compaction Strategy
|
|
154
|
+
|
|
155
|
+
When context is high:
|
|
156
|
+
|
|
157
|
+
1. **Preserve**: Key facts, current task, recent decisions
|
|
158
|
+
2. **Summarize**: Long conversations, completed work
|
|
159
|
+
3. **Archive**: Old request log entries
|
|
160
|
+
4. **Clear**: Temporary context, resolved issues
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Commands
|
|
165
|
+
|
|
166
|
+
| Command | Purpose |
|
|
167
|
+
|---------|---------|
|
|
168
|
+
| `/wogi-compact` | Compact conversation context |
|
|
169
|
+
| `/wogi-standup` | Morning briefing with context |
|
|
170
|
+
| `flow session status` | Check session state |
|
|
171
|
+
| `flow session restore` | Restore previous session |
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Best Practices
|
|
176
|
+
|
|
177
|
+
1. **Compact Regularly**: Every 2-3 tasks or 15-20 messages
|
|
178
|
+
2. **Update Progress**: Before compacting, update progress.md
|
|
179
|
+
3. **Log Changes**: Keep request-log current
|
|
180
|
+
4. **Use Morning Briefing**: Start sessions with context
|
|
181
|
+
5. **Trust the Warnings**: Compact when suggested
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Related
|
|
186
|
+
|
|
187
|
+
- [Task Execution](../02-task-execution/) - Uses session context
|
|
188
|
+
- [Self-Improvement](../03-self-improvement/) - Memory feeds learning
|
|
189
|
+
- [Configuration](../configuration/all-options.md) - All memory settings
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# Context Management
|
|
2
|
+
|
|
3
|
+
Monitor context usage and compact when needed.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Why Context Matters
|
|
8
|
+
|
|
9
|
+
Claude has a context window limit. When exceeded:
|
|
10
|
+
- Earlier conversation is lost
|
|
11
|
+
- AI may hallucinate or repeat itself
|
|
12
|
+
- Work quality degrades
|
|
13
|
+
|
|
14
|
+
WogiFlow monitors context and helps you manage it.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Configuration
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"contextMonitor": {
|
|
23
|
+
"enabled": true,
|
|
24
|
+
"warnAt": 0.7, // Warn at 70%
|
|
25
|
+
"criticalAt": 0.85, // Critical at 85%
|
|
26
|
+
"contextWindow": 200000, // Token limit
|
|
27
|
+
"checkOnSessionStart": true,
|
|
28
|
+
"checkAfterTask": true,
|
|
29
|
+
"trackingMethod": "auto" // auto, native, or estimated
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Tracking Methods (v1.0.3+)
|
|
35
|
+
|
|
36
|
+
| Method | Description |
|
|
37
|
+
|--------|-------------|
|
|
38
|
+
| `auto` | Uses native if available, falls back to estimated (default) |
|
|
39
|
+
| `native` | Uses Claude Code's native context tracking (v1.0.52+) |
|
|
40
|
+
| `estimated` | Uses token estimation from state files |
|
|
41
|
+
|
|
42
|
+
Native tracking is more accurate but requires Claude Code v1.0.52+ and status line configuration via `/wogi-statusline-setup`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## How Monitoring Works
|
|
47
|
+
|
|
48
|
+
### Automatic Checks
|
|
49
|
+
|
|
50
|
+
Context is checked:
|
|
51
|
+
1. At session start (`checkOnSessionStart`)
|
|
52
|
+
2. After task completion (`checkAfterTask`)
|
|
53
|
+
3. Before large operations
|
|
54
|
+
|
|
55
|
+
### Warning Levels
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
Usage: 45,000 / 200,000 (22.5%)
|
|
59
|
+
Status: ✓ Healthy
|
|
60
|
+
|
|
61
|
+
Usage: 145,000 / 200,000 (72.5%)
|
|
62
|
+
Status: ⚠️ Warning - Consider compacting
|
|
63
|
+
|
|
64
|
+
Usage: 175,000 / 200,000 (87.5%)
|
|
65
|
+
Status: 🚨 Critical - Compact now
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Compaction
|
|
71
|
+
|
|
72
|
+
### What is Compaction?
|
|
73
|
+
|
|
74
|
+
Compaction summarizes the conversation to free context space while preserving essential information.
|
|
75
|
+
|
|
76
|
+
### When to Compact
|
|
77
|
+
|
|
78
|
+
- After completing 2-3 tasks
|
|
79
|
+
- After 15-20 messages
|
|
80
|
+
- Before starting large tasks
|
|
81
|
+
- When warned about context usage
|
|
82
|
+
|
|
83
|
+
### How to Compact
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
/wogi-compact
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### What's Preserved
|
|
90
|
+
|
|
91
|
+
- Current task and acceptance criteria
|
|
92
|
+
- Recent key facts
|
|
93
|
+
- Important decisions made
|
|
94
|
+
- Files currently being worked on
|
|
95
|
+
|
|
96
|
+
### What's Summarized
|
|
97
|
+
|
|
98
|
+
- Completed work details
|
|
99
|
+
- Long code discussions
|
|
100
|
+
- Exploration and research
|
|
101
|
+
- Resolved issues
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Memory Blocks
|
|
106
|
+
|
|
107
|
+
Key facts are stored in memory blocks:
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
// From flow-memory-blocks.js
|
|
111
|
+
|
|
112
|
+
const memoryBlocks = {
|
|
113
|
+
currentTask: {
|
|
114
|
+
id: "TASK-015",
|
|
115
|
+
title: "Add authentication"
|
|
116
|
+
},
|
|
117
|
+
keyFacts: [
|
|
118
|
+
"Using existing api wrapper from lib/api.ts",
|
|
119
|
+
"Auth tokens stored in localStorage"
|
|
120
|
+
],
|
|
121
|
+
recentFiles: [
|
|
122
|
+
"src/services/AuthService.ts",
|
|
123
|
+
"src/components/LoginForm.tsx"
|
|
124
|
+
],
|
|
125
|
+
decisions: [
|
|
126
|
+
"Use Zustand for auth state",
|
|
127
|
+
"JWT tokens with refresh"
|
|
128
|
+
]
|
|
129
|
+
};
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Adding Key Facts
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
addKeyFact("Auth tokens expire after 1 hour");
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Clearing on Task Complete
|
|
139
|
+
|
|
140
|
+
```javascript
|
|
141
|
+
clearCurrentTask();
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Pre-Compaction Checklist
|
|
147
|
+
|
|
148
|
+
Before running `/compact`:
|
|
149
|
+
|
|
150
|
+
1. **Update Progress**
|
|
151
|
+
```bash
|
|
152
|
+
# Ensure progress.md reflects current state
|
|
153
|
+
cat .workflow/state/progress.md
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
2. **Log Completed Work**
|
|
157
|
+
```bash
|
|
158
|
+
# Add entries to request-log
|
|
159
|
+
/wogi-log
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
3. **Commit Changes**
|
|
163
|
+
```bash
|
|
164
|
+
git add -A && git commit -m "checkpoint before compact"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Compaction Strategy
|
|
170
|
+
|
|
171
|
+
### Default Strategy
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"automaticMemory": {
|
|
176
|
+
"compactOnSessionEnd": true
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Custom Strategies
|
|
182
|
+
|
|
183
|
+
Available in config:
|
|
184
|
+
- `entropyThreshold`: How aggressively to compact
|
|
185
|
+
- `relevanceDecay`: How quickly old info loses relevance
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Tracking Context Health
|
|
190
|
+
|
|
191
|
+
### CLI Check
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
flow context status
|
|
195
|
+
|
|
196
|
+
# Output:
|
|
197
|
+
# Context Health
|
|
198
|
+
# ─────────────────────
|
|
199
|
+
# Usage: 145,000 / 200,000 (72.5%)
|
|
200
|
+
# Status: Warning
|
|
201
|
+
# Last compaction: 2024-01-15 10:30
|
|
202
|
+
# Recommendation: Compact before next large task
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### In-Session Check
|
|
206
|
+
|
|
207
|
+
After completing a task:
|
|
208
|
+
```
|
|
209
|
+
✓ Completed: TASK-015
|
|
210
|
+
|
|
211
|
+
Context Health:
|
|
212
|
+
Usage: 72.5%
|
|
213
|
+
Status: ⚠️ Consider running /compact
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Automatic Archival
|
|
219
|
+
|
|
220
|
+
Old request log entries are archived automatically:
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"requestLog": {
|
|
225
|
+
"autoArchive": true,
|
|
226
|
+
"maxRecentEntries": 50,
|
|
227
|
+
"keepRecent": 30,
|
|
228
|
+
"createSummary": true
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### How It Works
|
|
234
|
+
|
|
235
|
+
1. When entries exceed `maxRecentEntries`
|
|
236
|
+
2. Old entries moved to archive
|
|
237
|
+
3. Summary created if `createSummary` is true
|
|
238
|
+
4. Archived entries still searchable
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Context Window Sizes
|
|
243
|
+
|
|
244
|
+
| Model | Context Window |
|
|
245
|
+
|-------|---------------|
|
|
246
|
+
| Claude Opus | 200,000 |
|
|
247
|
+
| Claude Sonnet | 200,000 |
|
|
248
|
+
| Claude Haiku | 200,000 |
|
|
249
|
+
| GPT-4 | 128,000 |
|
|
250
|
+
| Local models | Varies (4K-128K) |
|
|
251
|
+
|
|
252
|
+
Configure for your model:
|
|
253
|
+
```json
|
|
254
|
+
{
|
|
255
|
+
"contextMonitor": {
|
|
256
|
+
"contextWindow": 128000
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Best Practices
|
|
264
|
+
|
|
265
|
+
1. **Compact Proactively**: Don't wait for critical
|
|
266
|
+
2. **Save Before Compact**: Commit your work first
|
|
267
|
+
3. **Use Memory Blocks**: Mark important facts
|
|
268
|
+
4. **Review Compaction**: Check nothing important was lost
|
|
269
|
+
5. **Adjust Thresholds**: Lower if you need more buffer
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Troubleshooting
|
|
274
|
+
|
|
275
|
+
### Lost Context After Compact
|
|
276
|
+
|
|
277
|
+
Check preserved data:
|
|
278
|
+
- Memory blocks should retain key facts
|
|
279
|
+
- Current task should be preserved
|
|
280
|
+
- progress.md should have handoff notes
|
|
281
|
+
|
|
282
|
+
### Context Growing Too Fast
|
|
283
|
+
|
|
284
|
+
Consider:
|
|
285
|
+
- Breaking large tasks into smaller ones
|
|
286
|
+
- Using hybrid mode for boilerplate
|
|
287
|
+
- More frequent compaction
|
|
288
|
+
|
|
289
|
+
### Warning Not Appearing
|
|
290
|
+
|
|
291
|
+
Check configuration:
|
|
292
|
+
```json
|
|
293
|
+
{
|
|
294
|
+
"contextMonitor": {
|
|
295
|
+
"enabled": true,
|
|
296
|
+
"checkOnSessionStart": true,
|
|
297
|
+
"checkAfterTask": true
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Related
|
|
305
|
+
|
|
306
|
+
- [Session Persistence](./session-persistence.md) - Preserving across sessions
|
|
307
|
+
- [Memory Systems](./memory-systems.md) - Fact storage and decay
|
|
308
|
+
- [Compaction Command](../../commands.md) - Full command reference
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Memory Management Commands
|
|
2
|
+
|
|
3
|
+
CLI commands for managing WogiFlow's memory system.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Memory management commands help monitor, maintain, and optimize the memory database and learned patterns.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Entropy Monitor
|
|
14
|
+
|
|
15
|
+
Track memory fragmentation and context efficiency.
|
|
16
|
+
|
|
17
|
+
**Script**: `flow-entropy-monitor.js`
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Show memory entropy stats
|
|
21
|
+
flow entropy
|
|
22
|
+
|
|
23
|
+
# Auto-compact if entropy is high
|
|
24
|
+
flow entropy --auto
|
|
25
|
+
|
|
26
|
+
# Show entropy history
|
|
27
|
+
flow entropy --history
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### What is Entropy?
|
|
31
|
+
|
|
32
|
+
Memory entropy measures:
|
|
33
|
+
- Fragmentation of stored facts
|
|
34
|
+
- Staleness of patterns
|
|
35
|
+
- Context window efficiency
|
|
36
|
+
|
|
37
|
+
High entropy (>0.7) suggests compaction needed.
|
|
38
|
+
|
|
39
|
+
### Output Example
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Memory Entropy Analysis
|
|
43
|
+
════════════════════════════════════════
|
|
44
|
+
Current Entropy: 0.45
|
|
45
|
+
Threshold: 0.70
|
|
46
|
+
Status: ✓ Healthy
|
|
47
|
+
|
|
48
|
+
Breakdown:
|
|
49
|
+
Facts: 234 (12 stale)
|
|
50
|
+
Patterns: 45 (3 low-confidence)
|
|
51
|
+
PRD Chunks: 89
|
|
52
|
+
|
|
53
|
+
Recommendation: No action needed
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Memory Sync
|
|
59
|
+
|
|
60
|
+
Promote high-confidence patterns to project rules.
|
|
61
|
+
|
|
62
|
+
**Script**: `flow-memory-sync.js`
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Check for promotable patterns
|
|
66
|
+
flow memory-sync
|
|
67
|
+
|
|
68
|
+
# List candidates only
|
|
69
|
+
flow memory-sync --list
|
|
70
|
+
|
|
71
|
+
# Auto-promote without asking
|
|
72
|
+
flow memory-sync --auto
|
|
73
|
+
|
|
74
|
+
# Show sync status
|
|
75
|
+
flow memory-sync --status
|
|
76
|
+
|
|
77
|
+
# Promote specific fact
|
|
78
|
+
flow memory-sync --promote <fact-id>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Promotion Criteria
|
|
82
|
+
|
|
83
|
+
A pattern is promotable when:
|
|
84
|
+
- Relevance score ≥ 80%
|
|
85
|
+
- Access count ≥ 3
|
|
86
|
+
- Not already in `decisions.md`
|
|
87
|
+
|
|
88
|
+
### Promotion Flow
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Memory DB → Candidate Analysis → decisions.md → .claude/rules/
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Promoted patterns become project rules that load automatically.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Memory Database
|
|
99
|
+
|
|
100
|
+
Direct database operations.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Show memory stats
|
|
104
|
+
flow memory stats
|
|
105
|
+
|
|
106
|
+
# Output:
|
|
107
|
+
# Facts: 234
|
|
108
|
+
# Proposals: 12
|
|
109
|
+
# PRD Chunks: 89
|
|
110
|
+
# Database Size: 2.4 MB
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Database Location
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
.workflow/memory/local.db
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
SQLite database managed by `flow-memory-db.js`.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Knowledge Router
|
|
124
|
+
|
|
125
|
+
Route learnings to appropriate storage locations.
|
|
126
|
+
|
|
127
|
+
**Script**: `flow-knowledge-router.js`
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Detect route for a learning
|
|
131
|
+
flow knowledge-route detect "Always use explicit types"
|
|
132
|
+
|
|
133
|
+
# Store with detected route
|
|
134
|
+
flow knowledge-route store "Use kebab-case" project
|
|
135
|
+
|
|
136
|
+
# Show all route types
|
|
137
|
+
flow knowledge-route routes
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Route Types
|
|
141
|
+
|
|
142
|
+
| Route | Storage Location |
|
|
143
|
+
|-------|------------------|
|
|
144
|
+
| `model-specific` | `.workflow/model-adapters/<model>.md` |
|
|
145
|
+
| `skill:<name>` | `.claude/skills/<name>/knowledge/learnings.md` |
|
|
146
|
+
| `project` | `.workflow/state/decisions.md` |
|
|
147
|
+
| `team` | Team proposal queue (requires subscription) |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Compact Memory
|
|
152
|
+
|
|
153
|
+
Full memory compaction and optimization.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Run full compaction
|
|
157
|
+
flow compact-memory
|
|
158
|
+
|
|
159
|
+
# Or via entropy command
|
|
160
|
+
flow entropy --auto
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### What Compaction Does
|
|
164
|
+
|
|
165
|
+
1. Removes stale/low-relevance facts
|
|
166
|
+
2. Deduplicates similar patterns
|
|
167
|
+
3. Rebuilds embeddings index
|
|
168
|
+
4. Vacuums SQLite database
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Related
|
|
173
|
+
|
|
174
|
+
- [Memory Systems](./memory-systems.md) - Architecture overview
|
|
175
|
+
- [Context Management](./context-management.md) - Token budgets
|
|
176
|
+
- [PRD Management](./prd-management.md) - Document storage
|