@tecet/ollm 0.1.4-b → 0.1.5
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/docs/README.md +3 -410
- package/package.json +2 -2
- package/docs/Context/CheckpointFlowDiagram.md +0 -673
- package/docs/Context/ContextArchitecture.md +0 -898
- package/docs/Context/ContextCompression.md +0 -1102
- package/docs/Context/ContextManagment.md +0 -750
- package/docs/Context/Index.md +0 -209
- package/docs/Context/README.md +0 -390
- package/docs/DevelopmentRoadmap/Index.md +0 -238
- package/docs/DevelopmentRoadmap/OLLM-CLI_Releases.md +0 -419
- package/docs/DevelopmentRoadmap/PlanedFeatures.md +0 -448
- package/docs/DevelopmentRoadmap/README.md +0 -174
- package/docs/DevelopmentRoadmap/Roadmap.md +0 -572
- package/docs/DevelopmentRoadmap/RoadmapVisual.md +0 -372
- package/docs/Hooks/Architecture.md +0 -885
- package/docs/Hooks/Index.md +0 -244
- package/docs/Hooks/KeyboardShortcuts.md +0 -248
- package/docs/Hooks/Protocol.md +0 -817
- package/docs/Hooks/README.md +0 -403
- package/docs/Hooks/UserGuide.md +0 -1483
- package/docs/Hooks/VisualGuide.md +0 -598
- package/docs/Index.md +0 -506
- package/docs/Installation.md +0 -586
- package/docs/Introduction.md +0 -367
- package/docs/LLM Models/Index.md +0 -239
- package/docs/LLM Models/LLM_GettingStarted.md +0 -748
- package/docs/LLM Models/LLM_Index.md +0 -701
- package/docs/LLM Models/LLM_MemorySystem.md +0 -337
- package/docs/LLM Models/LLM_ModelCompatibility.md +0 -499
- package/docs/LLM Models/LLM_ModelsArchitecture.md +0 -933
- package/docs/LLM Models/LLM_ModelsCommands.md +0 -839
- package/docs/LLM Models/LLM_ModelsConfiguration.md +0 -1094
- package/docs/LLM Models/LLM_ModelsList.md +0 -1071
- package/docs/LLM Models/LLM_ModelsList.md.backup +0 -400
- package/docs/LLM Models/README.md +0 -355
- package/docs/MCP/MCP_Architecture.md +0 -1086
- package/docs/MCP/MCP_Commands.md +0 -1111
- package/docs/MCP/MCP_GettingStarted.md +0 -590
- package/docs/MCP/MCP_Index.md +0 -524
- package/docs/MCP/MCP_Integration.md +0 -866
- package/docs/MCP/MCP_Marketplace.md +0 -160
- package/docs/MCP/README.md +0 -415
- package/docs/Prompts System/Architecture.md +0 -760
- package/docs/Prompts System/Index.md +0 -223
- package/docs/Prompts System/PromptsRouting.md +0 -1047
- package/docs/Prompts System/PromptsTemplates.md +0 -1102
- package/docs/Prompts System/README.md +0 -389
- package/docs/Prompts System/SystemPrompts.md +0 -856
- package/docs/Quickstart.md +0 -535
- package/docs/Tools/Architecture.md +0 -884
- package/docs/Tools/GettingStarted.md +0 -624
- package/docs/Tools/Index.md +0 -216
- package/docs/Tools/ManifestReference.md +0 -141
- package/docs/Tools/README.md +0 -440
- package/docs/Tools/UserGuide.md +0 -773
- package/docs/Troubleshooting.md +0 -1265
- package/docs/UI&Settings/Architecture.md +0 -729
- package/docs/UI&Settings/ColorASCII.md +0 -34
- package/docs/UI&Settings/Commands.md +0 -755
- package/docs/UI&Settings/Configuration.md +0 -872
- package/docs/UI&Settings/Index.md +0 -293
- package/docs/UI&Settings/Keybinds.md +0 -372
- package/docs/UI&Settings/README.md +0 -278
- package/docs/UI&Settings/Terminal.md +0 -637
- package/docs/UI&Settings/Themes.md +0 -604
- package/docs/UI&Settings/UIGuide.md +0 -550
|
@@ -1,673 +0,0 @@
|
|
|
1
|
-
# Progressive Checkpoint Compression - Flow Diagram
|
|
2
|
-
|
|
3
|
-
**Last Updated:** January 26, 2026
|
|
4
|
-
**Status:** Source of Truth
|
|
5
|
-
|
|
6
|
-
**Related Documents:**
|
|
7
|
-
|
|
8
|
-
- `ContextCompression.md` - Detailed compression system documentation
|
|
9
|
-
- `ContextManagement.md` - Context sizing and management
|
|
10
|
-
- `ContextArchitecture.md` - Overall system architecture
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## System Overview
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
18
|
-
│ Context Manager │
|
|
19
|
-
│ │
|
|
20
|
-
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
|
|
21
|
-
│ │ System │ │ Checkpoints│ │ Recent │ │
|
|
22
|
-
│ │ Prompt │ │ (History) │ │ Messages │ │
|
|
23
|
-
│ └────────────┘ └────────────┘ └────────────┘ │
|
|
24
|
-
│ │
|
|
25
|
-
│ Token Count: ████████░░░░░░░░░░ 62% (8,500 / 13,600) │
|
|
26
|
-
│ Tier: 3 (Standard - 16K) | Mode: Developer │
|
|
27
|
-
│ Context: FIXED for session | Prompt: 1,000 tokens │
|
|
28
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
**Key Points:**
|
|
32
|
-
|
|
33
|
-
- Context size is FIXED for the entire session
|
|
34
|
-
- System prompt never compressed
|
|
35
|
-
- User messages never compressed
|
|
36
|
-
- Only assistant messages compressed into checkpoints
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Tier-Specific Compression
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
44
|
-
│ Tier Detection: Based on Context Size (FIXED at startup) │
|
|
45
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
46
|
-
│
|
|
47
|
-
▼
|
|
48
|
-
┌──────────────┐
|
|
49
|
-
│ Context Size?│
|
|
50
|
-
└──────────────┘
|
|
51
|
-
│
|
|
52
|
-
┌───────────────────┼───────────────────┼───────────────┬───────────────┐
|
|
53
|
-
│ │ │ │ │
|
|
54
|
-
▼ ▼ ▼ ▼ ▼
|
|
55
|
-
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
56
|
-
│ Tier 1 │ │ Tier 2 │ │ Tier 3 ⭐ │ │ Tier 4 │ │ Tier 5 │
|
|
57
|
-
│ Minimal │ │ Basic │ │ Standard │ │ Premium │ │ Ultra │
|
|
58
|
-
│ 2K, 4K │ │ 8K │ │ 16K │ │ 32K │ │ 64K, 128K │
|
|
59
|
-
│ │ │ │ │ │ │ │ │ │
|
|
60
|
-
│ Rollover │ │ Smart │ │ Progressive │ │ Structured │ │ Rich │
|
|
61
|
-
│ 0 checkpts │ │ 1 checkpt │ │ 3 checkpts │ │ 10 checkpts │ │ 15 checkpts │
|
|
62
|
-
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**Tier Characteristics:**
|
|
66
|
-
|
|
67
|
-
| Tier | Context | Ollama (85%) | Checkpoints | Strategy |
|
|
68
|
-
| ---- | --------- | ------------- | ----------- | ----------------------- |
|
|
69
|
-
| 1 | 2K, 4K | 1700, 3400 | 0 | Snapshot rollover |
|
|
70
|
-
| 2 | 8K | 6800 | 1 | Single checkpoint |
|
|
71
|
-
| 3 ⭐ | 16K | 13600 | 3 | Progressive aging |
|
|
72
|
-
| 4 | 32K | 27200 | 10 | Structured preservation |
|
|
73
|
-
| 5 | 64K, 128K | 54400, 108800 | 15 | Rich metadata |
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## Compression Flow
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
81
|
-
│ Step 1: Monitor Context Usage │
|
|
82
|
-
│ │
|
|
83
|
-
│ Available Budget = ollama_context_size - system - checkpoints │
|
|
84
|
-
│ Trigger at: 80% of available budget │
|
|
85
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
86
|
-
│
|
|
87
|
-
▼
|
|
88
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
89
|
-
│ Step 2: Context Reaches Threshold (80% of available) │
|
|
90
|
-
│ │
|
|
91
|
-
│ Example (16K context): │
|
|
92
|
-
│ - Ollama limit: 13,600 tokens │
|
|
93
|
-
│ - System prompt: 1,000 tokens │
|
|
94
|
-
│ - Checkpoints: 2,100 tokens │
|
|
95
|
-
│ - Available: 10,500 tokens │
|
|
96
|
-
│ - Trigger at: 8,400 tokens (80% of 10,500) │
|
|
97
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
98
|
-
│
|
|
99
|
-
▼
|
|
100
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
101
|
-
│ Step 3: Identify Messages to Compress │
|
|
102
|
-
│ │
|
|
103
|
-
│ ✅ Compress: Assistant messages (LLM output) │
|
|
104
|
-
│ ❌ Never compress: User messages │
|
|
105
|
-
│ ❌ Never compress: System prompt │
|
|
106
|
-
│ ❌ Never compress: Active goals │
|
|
107
|
-
│ ❌ Never compress: Locked decisions │
|
|
108
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
109
|
-
│
|
|
110
|
-
▼
|
|
111
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
112
|
-
│ Step 4: LLM Summarization │
|
|
113
|
-
│ │
|
|
114
|
-
│ Send to LLM: │
|
|
115
|
-
│ "Summarize the following conversation history, │
|
|
116
|
-
│ preserving key decisions, code changes, and context..." │
|
|
117
|
-
│ │
|
|
118
|
-
│ LLM returns summary (50-70% compression) │
|
|
119
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
120
|
-
│
|
|
121
|
-
▼
|
|
122
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
123
|
-
│ Step 5: Create New Checkpoint │
|
|
124
|
-
│ │
|
|
125
|
-
│ Checkpoint { │
|
|
126
|
-
│ id: "cp-3" │
|
|
127
|
-
│ level: 3 (DETAILED) │
|
|
128
|
-
│ range: "Messages 51-100" │
|
|
129
|
-
│ summary: "Implemented JWT authentication..." │
|
|
130
|
-
│ keyDecisions: ["Use JWT", "httpOnly cookies"] │
|
|
131
|
-
│ filesModified: ["auth/login.ts", "auth/jwt.ts"] │
|
|
132
|
-
│ originalTokens: 5000 │
|
|
133
|
-
│ currentTokens: 1200 │
|
|
134
|
-
│ compressionCount: 1 │
|
|
135
|
-
│ } │
|
|
136
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
137
|
-
│
|
|
138
|
-
▼
|
|
139
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
140
|
-
│ Step 6: Age Existing Checkpoints │
|
|
141
|
-
│ │
|
|
142
|
-
│ Checkpoint 3 (new) → Level 3 (DETAILED) ~1200 tokens │
|
|
143
|
-
│ Checkpoint 2 (recent) → Level 2 (MODERATE) ~600 tokens │
|
|
144
|
-
│ Checkpoint 1 (old) → Level 1 (COMPACT) ~300 tokens │
|
|
145
|
-
│ │
|
|
146
|
-
│ Each aging step compresses further: │
|
|
147
|
-
│ - Recent: 50-70% compression │
|
|
148
|
-
│ - Old: 60% compression │
|
|
149
|
-
│ - Ancient: 70% compression │
|
|
150
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
151
|
-
│
|
|
152
|
-
▼
|
|
153
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
154
|
-
│ Step 7: Recalculate Available Budget │
|
|
155
|
-
│ │
|
|
156
|
-
│ New available budget: │
|
|
157
|
-
│ 13,600 - 1,000 (system) - 2,100 (checkpoints) = 10,500 │
|
|
158
|
-
│ │
|
|
159
|
-
│ New trigger threshold: 10,500 * 0.80 = 8,400 tokens │
|
|
160
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
161
|
-
│
|
|
162
|
-
▼
|
|
163
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
164
|
-
│ Step 8: Continue Conversation │
|
|
165
|
-
│ │
|
|
166
|
-
│ Context now has more available space for new messages │
|
|
167
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
## Dynamic Budget Calculation
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
176
|
-
│ Available Budget Over Time │
|
|
177
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
178
|
-
|
|
179
|
-
Initial State (16K context):
|
|
180
|
-
├─ Ollama context: 13,600 tokens (FIXED)
|
|
181
|
-
├─ System prompt: 1,000 tokens (fixed)
|
|
182
|
-
├─ Checkpoints: 0 tokens
|
|
183
|
-
└─ Available: 12,600 tokens
|
|
184
|
-
└─ Trigger at: 10,080 tokens (80%)
|
|
185
|
-
|
|
186
|
-
After 1st Compression:
|
|
187
|
-
├─ Ollama context: 13,600 tokens (FIXED)
|
|
188
|
-
├─ System prompt: 1,000 tokens (fixed)
|
|
189
|
-
├─ Checkpoint 1: 1,200 tokens (recent, 50-70% compressed)
|
|
190
|
-
└─ Available: 10,400 tokens
|
|
191
|
-
└─ Trigger at: 8,320 tokens (80%)
|
|
192
|
-
|
|
193
|
-
After 2nd Compression:
|
|
194
|
-
├─ Ollama context: 13,600 tokens (FIXED)
|
|
195
|
-
├─ System prompt: 1,000 tokens (fixed)
|
|
196
|
-
├─ Checkpoint 1: 600 tokens (aged, 60% compressed)
|
|
197
|
-
├─ Checkpoint 2: 1,200 tokens (recent, 50-70% compressed)
|
|
198
|
-
└─ Available: 10,800 tokens
|
|
199
|
-
└─ Trigger at: 8,640 tokens (80%)
|
|
200
|
-
|
|
201
|
-
After 3rd Compression:
|
|
202
|
-
├─ Ollama context: 13,600 tokens (FIXED)
|
|
203
|
-
├─ System prompt: 1,000 tokens (fixed)
|
|
204
|
-
├─ Checkpoint 1: 300 tokens (ancient, 70% compressed)
|
|
205
|
-
├─ Checkpoint 2: 600 tokens (old, 60% compressed)
|
|
206
|
-
├─ Checkpoint 3: 1,200 tokens (recent, 50-70% compressed)
|
|
207
|
-
└─ Available: 10,500 tokens
|
|
208
|
-
└─ Trigger at: 8,400 tokens (80%)
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
**Key Insight:** Available budget shrinks with each checkpoint, but aging keeps it sustainable for 3-5+ compressions.
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
## Checkpoint Lifecycle
|
|
216
|
-
|
|
217
|
-
```
|
|
218
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
219
|
-
│ Checkpoint Aging │
|
|
220
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
221
|
-
|
|
222
|
-
Creation (Checkpoint 3 - Recent):
|
|
223
|
-
┌──────────────────────────────────────┐
|
|
224
|
-
│ Level 3 - DETAILED │
|
|
225
|
-
│ ────────────────────────────────────│
|
|
226
|
-
│ Range: Messages 51-100 │
|
|
227
|
-
│ Summary: Full detailed summary... │
|
|
228
|
-
│ Key Decisions: [Use JWT, cookies] │
|
|
229
|
-
│ Files Modified: [login.ts, jwt.ts] │
|
|
230
|
-
│ Next Steps: [Add registration] │
|
|
231
|
-
│ Original: 5,000 tokens │
|
|
232
|
-
│ Current: 1,200 tokens (50-70% comp) │
|
|
233
|
-
│ Compression Count: 1 │
|
|
234
|
-
└──────────────────────────────────────┘
|
|
235
|
-
│
|
|
236
|
-
│ Next compression triggered
|
|
237
|
-
▼
|
|
238
|
-
┌──────────────────────────────────────┐
|
|
239
|
-
│ Level 2 - MODERATE │
|
|
240
|
-
│ ────────────────────────────────────│
|
|
241
|
-
│ Range: Messages 51-100 │
|
|
242
|
-
│ Summary: Condensed summary... │
|
|
243
|
-
│ Key Decisions: [...] ← Preserved │
|
|
244
|
-
│ Current: 600 tokens (60% comp) │
|
|
245
|
-
│ Compression Count: 2 │
|
|
246
|
-
└──────────────────────────────────────┘
|
|
247
|
-
│
|
|
248
|
-
│ Next compression triggered
|
|
249
|
-
▼
|
|
250
|
-
┌──────────────────────────────────────┐
|
|
251
|
-
│ Level 1 - COMPACT │
|
|
252
|
-
│ ────────────────────────────────────│
|
|
253
|
-
│ Range: Messages 51-100 │
|
|
254
|
-
│ Summary: "Built JWT auth..." │
|
|
255
|
-
│ Current: 300 tokens (70% comp) │
|
|
256
|
-
│ Compression Count: 3 │
|
|
257
|
-
└──────────────────────────────────────┘
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## Never-Compressed Content
|
|
263
|
-
|
|
264
|
-
```
|
|
265
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
266
|
-
│ Content Preservation Rules │
|
|
267
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
268
|
-
|
|
269
|
-
ALWAYS PRESERVED (Never Compressed):
|
|
270
|
-
┌──────────────────────────────────────┐
|
|
271
|
-
│ ✅ System Prompt │
|
|
272
|
-
│ - Core Mandates │
|
|
273
|
-
│ - Sanity Checks │
|
|
274
|
-
│ - Mode Guidance │
|
|
275
|
-
│ │
|
|
276
|
-
│ ✅ User Messages │
|
|
277
|
-
│ - All user input │
|
|
278
|
-
│ - All user questions │
|
|
279
|
-
│ - All user instructions │
|
|
280
|
-
│ │
|
|
281
|
-
│ ✅ Active Goals │
|
|
282
|
-
│ - Goal description │
|
|
283
|
-
│ - Checkpoints (pending/progress) │
|
|
284
|
-
│ - Locked decisions │
|
|
285
|
-
│ - Artifacts (files created) │
|
|
286
|
-
│ │
|
|
287
|
-
│ ✅ Architecture Decisions │
|
|
288
|
-
│ - Design patterns chosen │
|
|
289
|
-
│ - Technology stack decisions │
|
|
290
|
-
│ - API contracts │
|
|
291
|
-
│ - Database schemas │
|
|
292
|
-
└──────────────────────────────────────┘
|
|
293
|
-
|
|
294
|
-
COMPRESSED WHEN NEEDED:
|
|
295
|
-
┌──────────────────────────────────────┐
|
|
296
|
-
│ 🔄 Assistant Messages │
|
|
297
|
-
│ - LLM output │
|
|
298
|
-
│ - Code generated │
|
|
299
|
-
│ - Explanations │
|
|
300
|
-
│ │
|
|
301
|
-
│ 🔄 Tool Outputs │
|
|
302
|
-
│ - File contents │
|
|
303
|
-
│ - Search results │
|
|
304
|
-
│ - Command outputs │
|
|
305
|
-
│ │
|
|
306
|
-
│ 🔄 Exploratory Work │
|
|
307
|
-
│ - Debugging attempts │
|
|
308
|
-
│ - Experimental code │
|
|
309
|
-
│ - Brainstorming │
|
|
310
|
-
└──────────────────────────────────────┘
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
---
|
|
314
|
-
|
|
315
|
-
## Context Structure Example
|
|
316
|
-
|
|
317
|
-
```
|
|
318
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
319
|
-
│ Context After 3 Compressions (16K) │
|
|
320
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
321
|
-
|
|
322
|
-
[System Prompt] - 1,000 tokens (never compressed)
|
|
323
|
-
├─ Core Mandates: 200 tokens
|
|
324
|
-
├─ Sanity Checks: 100 tokens
|
|
325
|
-
├─ Active Goal: 200 tokens (never compressed)
|
|
326
|
-
│ ├─ Goal: "Implement user authentication"
|
|
327
|
-
│ ├─ Checkpoints: ✅ Design, ✅ Login, 🔄 JWT
|
|
328
|
-
│ ├─ Decisions: 🔒 Use JWT, 🔒 httpOnly cookies
|
|
329
|
-
│ └─ Artifacts: login.ts, jwt.ts, api.ts
|
|
330
|
-
└─ Mode Guidance: 500 tokens
|
|
331
|
-
|
|
332
|
-
[Checkpoint 1] - 300 tokens (ancient, 70% compressed)
|
|
333
|
-
└─ "Early exploration and design decisions..."
|
|
334
|
-
|
|
335
|
-
[Checkpoint 2] - 600 tokens (old, 60% compressed)
|
|
336
|
-
└─ "Implemented login endpoint with validation..."
|
|
337
|
-
|
|
338
|
-
[Checkpoint 3] - 1,200 tokens (recent, 50-70% compressed)
|
|
339
|
-
└─ "Added JWT token generation and refresh logic..."
|
|
340
|
-
|
|
341
|
-
[User Messages] - 3,000 tokens (never compressed)
|
|
342
|
-
└─ All user input preserved in full
|
|
343
|
-
|
|
344
|
-
[Recent Assistant Messages] - 7,500 tokens (not yet compressed)
|
|
345
|
-
└─ Most recent LLM output
|
|
346
|
-
|
|
347
|
-
────────────────────────────────────────────────────────────────
|
|
348
|
-
Total: 13,600 tokens (100% of Ollama limit)
|
|
349
|
-
Available for new: ~2,000 tokens before next compression
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
---
|
|
353
|
-
|
|
354
|
-
## Token Budget Over Time
|
|
355
|
-
|
|
356
|
-
```
|
|
357
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
358
|
-
│ Token Usage Across Compressions │
|
|
359
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
360
|
-
|
|
361
|
-
Compression 1 (16K context):
|
|
362
|
-
├─ System: 1,000 tokens
|
|
363
|
-
├─ CP1 (D): 1,200 tokens
|
|
364
|
-
└─ Recent: 7,500 tokens
|
|
365
|
-
Total: 9,700 tokens (71% of 13,600)
|
|
366
|
-
Available: 3,900 tokens
|
|
367
|
-
|
|
368
|
-
Compression 2:
|
|
369
|
-
├─ System: 1,000 tokens
|
|
370
|
-
├─ CP1 (M): 600 tokens ← Aged!
|
|
371
|
-
├─ CP2 (D): 1,200 tokens
|
|
372
|
-
└─ Recent: 7,500 tokens
|
|
373
|
-
Total: 10,300 tokens (76% of 13,600)
|
|
374
|
-
Available: 3,300 tokens
|
|
375
|
-
|
|
376
|
-
Compression 3:
|
|
377
|
-
├─ System: 1,000 tokens
|
|
378
|
-
├─ CP1 (C): 300 tokens ← Aged!
|
|
379
|
-
├─ CP2 (M): 600 tokens ← Aged!
|
|
380
|
-
├─ CP3 (D): 1,200 tokens
|
|
381
|
-
└─ Recent: 7,500 tokens
|
|
382
|
-
Total: 10,600 tokens (78% of 13,600)
|
|
383
|
-
Available: 3,000 tokens
|
|
384
|
-
|
|
385
|
-
Legend: D=DETAILED, M=MODERATE, C=COMPACT
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
---
|
|
389
|
-
|
|
390
|
-
## Goal-Aware Compression
|
|
391
|
-
|
|
392
|
-
```
|
|
393
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
394
|
-
│ Goal-Guided Summarization │
|
|
395
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
396
|
-
|
|
397
|
-
LLM receives goal context when summarizing:
|
|
398
|
-
|
|
399
|
-
ACTIVE GOAL: Implement user authentication system
|
|
400
|
-
Priority: high
|
|
401
|
-
Status: active
|
|
402
|
-
|
|
403
|
-
COMPLETED CHECKPOINTS:
|
|
404
|
-
✅ Design authentication flow
|
|
405
|
-
✅ Implement login endpoint
|
|
406
|
-
|
|
407
|
-
IN PROGRESS:
|
|
408
|
-
🔄 Add JWT token generation
|
|
409
|
-
|
|
410
|
-
LOCKED DECISIONS:
|
|
411
|
-
🔒 Use JWT for authentication
|
|
412
|
-
🔒 Store tokens in httpOnly cookies
|
|
413
|
-
|
|
414
|
-
ARTIFACTS:
|
|
415
|
-
- Created: src/auth/login.ts
|
|
416
|
-
- Created: src/auth/jwt.ts
|
|
417
|
-
- Modified: src/routes/api.ts
|
|
418
|
-
|
|
419
|
-
───────────────────────────────────────
|
|
420
|
-
|
|
421
|
-
Summarize the following conversation, focusing on progress toward the goal:
|
|
422
|
-
[Messages to compress...]
|
|
423
|
-
|
|
424
|
-
PRESERVE:
|
|
425
|
-
- Decisions made toward the goal
|
|
426
|
-
- Checkpoints completed
|
|
427
|
-
- Files created/modified
|
|
428
|
-
- Technical details relevant to the goal
|
|
429
|
-
|
|
430
|
-
SUMMARIZE AGGRESSIVELY:
|
|
431
|
-
- Off-topic discussions
|
|
432
|
-
- Exploratory conversations
|
|
433
|
-
- Debugging steps that succeeded
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
---
|
|
437
|
-
|
|
438
|
-
## System Benefits
|
|
439
|
-
|
|
440
|
-
### Progressive Preservation
|
|
441
|
-
|
|
442
|
-
**Without Progressive Checkpoints:**
|
|
443
|
-
|
|
444
|
-
```
|
|
445
|
-
After 3 compressions:
|
|
446
|
-
[System] + [Single Summary] + [Recent]
|
|
447
|
-
1,000 + 500 + 7,500 = 9,000 tokens
|
|
448
|
-
↑
|
|
449
|
-
❌ Lost most conversation history!
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
**With Progressive Checkpoints:**
|
|
453
|
-
|
|
454
|
-
```
|
|
455
|
-
After 3 compressions:
|
|
456
|
-
[System] + [CP1] + [CP2] + [CP3] + [Recent]
|
|
457
|
-
1,000 + 300 + 600 + 1,200 + 7,500 = 10,600 tokens
|
|
458
|
-
↑
|
|
459
|
-
✅ Full journey preserved!
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
**Key Advantages:**
|
|
463
|
-
|
|
464
|
-
- ✅ **No Information Loss**: All conversation history preserved
|
|
465
|
-
- ✅ **Hierarchical Compression**: Recent = detailed, old = compact
|
|
466
|
-
- ✅ **Automatic Aging**: Checkpoints compress as they age
|
|
467
|
-
- ✅ **Dynamic Budget**: Available space recalculated after each compression
|
|
468
|
-
- ✅ **Context Continuity**: LLM maintains full conversation awareness
|
|
469
|
-
- ✅ **Goal Preservation**: Goals and decisions never compressed
|
|
470
|
-
|
|
471
|
-
---
|
|
472
|
-
|
|
473
|
-
## Reliability Tracking
|
|
474
|
-
|
|
475
|
-
```
|
|
476
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
477
|
-
│ Conversation Reliability Score │
|
|
478
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
479
|
-
|
|
480
|
-
Score Calculation:
|
|
481
|
-
modelFactor =
|
|
482
|
-
70B+ models: 0.95
|
|
483
|
-
30B models: 0.85
|
|
484
|
-
13B models: 0.70
|
|
485
|
-
7B models: 0.50
|
|
486
|
-
3B models: 0.30
|
|
487
|
-
|
|
488
|
-
compressionPenalty = max(1.0 - (compressionCount * 0.15), 0.30)
|
|
489
|
-
|
|
490
|
-
finalScore = modelFactor * compressionPenalty
|
|
491
|
-
|
|
492
|
-
Reliability Levels:
|
|
493
|
-
🟢 85-100% High - Excellent reliability
|
|
494
|
-
🟡 60-84% Medium - Good reliability
|
|
495
|
-
🟠 40-59% Low - Degraded reliability
|
|
496
|
-
🔴 <40% Critical - Poor reliability
|
|
497
|
-
|
|
498
|
-
Example (13B model, 3 compressions):
|
|
499
|
-
modelFactor = 0.70
|
|
500
|
-
compressionPenalty = 1.0 - (3 * 0.15) = 0.55
|
|
501
|
-
finalScore = 0.70 * 0.55 = 0.385 (38.5%)
|
|
502
|
-
Status: 🔴 Critical - Consider starting new conversation
|
|
503
|
-
```
|
|
504
|
-
|
|
505
|
-
---
|
|
506
|
-
|
|
507
|
-
## Event Timeline
|
|
508
|
-
|
|
509
|
-
```
|
|
510
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
511
|
-
│ Event Sequence │
|
|
512
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
513
|
-
|
|
514
|
-
Time ──────────────────────────────────────────────────────────▶
|
|
515
|
-
|
|
516
|
-
│
|
|
517
|
-
├─ message-added ──────────────────────────────────────────────┐
|
|
518
|
-
│ │
|
|
519
|
-
├─ message-added ──────────────────────────────────────────────┤
|
|
520
|
-
│ │
|
|
521
|
-
├─ message-added ──────────────────────────────────────────────┤
|
|
522
|
-
│ │
|
|
523
|
-
├─ context-threshold-reached (80% of available) ───────────────┤
|
|
524
|
-
│ │
|
|
525
|
-
├─ compression-triggered ──────────────────────────────────────┤
|
|
526
|
-
│ │
|
|
527
|
-
├─ llm-summarizing ────────────────────────────────────────────┤
|
|
528
|
-
│ └─ LLM generates summary │
|
|
529
|
-
│ │
|
|
530
|
-
├─ checkpoint-created ─────────────────────────────────────────┤
|
|
531
|
-
│ └─ New checkpoint added │
|
|
532
|
-
│ │
|
|
533
|
-
├─ checkpoints-aged ───────────────────────────────────────────┤
|
|
534
|
-
│ └─ Existing checkpoints compressed further │
|
|
535
|
-
│ │
|
|
536
|
-
├─ budget-recalculated ────────────────────────────────────────┤
|
|
537
|
-
│ └─ New available space calculated │
|
|
538
|
-
│ │
|
|
539
|
-
├─ compressed ──────────────────────────────────────────────────┤
|
|
540
|
-
│ │
|
|
541
|
-
└─ message-added ──────────────────────────────────────────────┘
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
---
|
|
545
|
-
|
|
546
|
-
## Dual Storage System
|
|
547
|
-
|
|
548
|
-
```
|
|
549
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
550
|
-
│ Active Context vs Full History │
|
|
551
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
552
|
-
|
|
553
|
-
Active Context (Memory):
|
|
554
|
-
┌──────────────────────────────────────┐
|
|
555
|
-
│ Compressed for LLM efficiency │
|
|
556
|
-
│ ────────────────────────────────────│
|
|
557
|
-
│ [System Prompt] │
|
|
558
|
-
│ [Checkpoints] ← Compressed │
|
|
559
|
-
│ [User Messages] ← Never compressed │
|
|
560
|
-
│ [Recent Messages] ← Not yet │
|
|
561
|
-
│ │
|
|
562
|
-
│ Sent to LLM with each message │
|
|
563
|
-
└──────────────────────────────────────┘
|
|
564
|
-
|
|
565
|
-
Full History (Disk):
|
|
566
|
-
┌──────────────────────────────────────┐
|
|
567
|
-
│ Uncompressed complete record │
|
|
568
|
-
│ ────────────────────────────────────│
|
|
569
|
-
│ ALL messages (uncompressed) │
|
|
570
|
-
│ ALL tool calls │
|
|
571
|
-
│ Metadata (tokens, compressions) │
|
|
572
|
-
│ │
|
|
573
|
-
│ Saved to: │
|
|
574
|
-
│ ~/.ollm/sessions/{sessionId}.json │
|
|
575
|
-
│ │
|
|
576
|
-
│ Never affected by compression │
|
|
577
|
-
│ User can review anytime │
|
|
578
|
-
└──────────────────────────────────────┘
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
**Key Principle:** Compression only affects what's sent to the LLM, not what's saved to disk.
|
|
582
|
-
|
|
583
|
-
---
|
|
584
|
-
|
|
585
|
-
## Configuration
|
|
586
|
-
|
|
587
|
-
```typescript
|
|
588
|
-
interface CompressionConfig {
|
|
589
|
-
enabled: boolean; // Enable compression
|
|
590
|
-
strategy: 'summarize'; // Always use LLM summarization
|
|
591
|
-
preserveRecent: number; // Tokens to preserve (not compress)
|
|
592
|
-
summaryMaxTokens: number; // Max tokens for summary
|
|
593
|
-
triggerThreshold: number; // Trigger at % of available (0.80)
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
const DEFAULT_CONFIG = {
|
|
597
|
-
enabled: true,
|
|
598
|
-
strategy: 'summarize',
|
|
599
|
-
preserveRecent: 2048,
|
|
600
|
-
summaryMaxTokens: 1024,
|
|
601
|
-
triggerThreshold: 0.8,
|
|
602
|
-
};
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
---
|
|
606
|
-
|
|
607
|
-
## Legend
|
|
608
|
-
|
|
609
|
-
```
|
|
610
|
-
Checkpoint Levels:
|
|
611
|
-
D = DETAILED (Level 3) - 1,200 tokens (50-70% compression)
|
|
612
|
-
M = MODERATE (Level 2) - 600 tokens (60% compression)
|
|
613
|
-
C = COMPACT (Level 1) - 300 tokens (70% compression)
|
|
614
|
-
|
|
615
|
-
Symbols:
|
|
616
|
-
✅ = Success / Benefit / Preserved
|
|
617
|
-
❌ = Problem / Issue / Never Compress
|
|
618
|
-
🔄 = Compressed When Needed
|
|
619
|
-
🔒 = Locked / Never Changes
|
|
620
|
-
← = Preserved / Maintained
|
|
621
|
-
→ = Transformed / Compressed
|
|
622
|
-
▼ = Flow direction
|
|
623
|
-
⭐ = Primary / Recommended
|
|
624
|
-
|
|
625
|
-
Status Icons:
|
|
626
|
-
🟢 = High reliability / Normal
|
|
627
|
-
🟡 = Medium reliability / Warning
|
|
628
|
-
🟠 = Low reliability / Critical
|
|
629
|
-
🔴 = Poor reliability / Emergency
|
|
630
|
-
```
|
|
631
|
-
|
|
632
|
-
---
|
|
633
|
-
|
|
634
|
-
## Summary
|
|
635
|
-
|
|
636
|
-
### Key Features
|
|
637
|
-
|
|
638
|
-
1. **Dynamic Budget Management** ✅
|
|
639
|
-
- Available budget recalculated after each compression
|
|
640
|
-
- Accounts for system prompt and checkpoints
|
|
641
|
-
- Triggers at 80% of available space
|
|
642
|
-
|
|
643
|
-
2. **Checkpoint Aging** ✅
|
|
644
|
-
- Recent: 50-70% compression (~1,200 tokens)
|
|
645
|
-
- Old: 60% compression (~600 tokens)
|
|
646
|
-
- Ancient: 70% compression (~300 tokens)
|
|
647
|
-
|
|
648
|
-
3. **LLM-Based Summarization** ✅
|
|
649
|
-
- LLM summarizes its own output
|
|
650
|
-
- Preserves meaning and context
|
|
651
|
-
- Quality scales with model size
|
|
652
|
-
|
|
653
|
-
4. **Never-Compressed Content** ✅
|
|
654
|
-
- System prompts
|
|
655
|
-
- User messages
|
|
656
|
-
- Active goals
|
|
657
|
-
- Locked decisions
|
|
658
|
-
|
|
659
|
-
5. **Goal-Aware Compression** ✅
|
|
660
|
-
- Goals guide summarization
|
|
661
|
-
- Important decisions preserved
|
|
662
|
-
- Progress tracked across compressions
|
|
663
|
-
|
|
664
|
-
6. **Dual Storage** ✅
|
|
665
|
-
- Active context: Compressed for LLM
|
|
666
|
-
- Full history: Uncompressed on disk
|
|
667
|
-
- Complete audit trail maintained
|
|
668
|
-
|
|
669
|
-
---
|
|
670
|
-
|
|
671
|
-
**Document Status:** ✅ Updated
|
|
672
|
-
**Last Updated:** January 26, 2026
|
|
673
|
-
**Purpose:** Visual guide to checkpoint compression flow
|