pi-mega-compact 0.4.14 → 0.4.15

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.
@@ -69,6 +69,15 @@ function dashboardHtml(tierName) {
69
69
  .card.safe h2 { color: #3fb950; }
70
70
  .safe-note { font-size: 12px; color: #8b949e; margin: 12px 0 0; line-height: 1.5; }
71
71
  .value.ok { color: #3fb950; }
72
+ .label {
73
+ cursor: help;
74
+ border-bottom: 1px dotted #484f58;
75
+ }
76
+ .card.legend { grid-column: 1 / -1; }
77
+ .legend-list { margin: 0; padding-left: 18px; color: #c9d1d9; }
78
+ .legend-list li { margin-bottom: 8px; line-height: 1.5; }
79
+ .legend-list b { color: #f0f6fc; }
80
+ .legend-note { font-size: 12px; color: #8b949e; margin: 12px 0 0; font-style: italic; }
72
81
  .card h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #8b949e; margin-bottom: 12px; font-weight: 600; }
73
82
  .meter-track { background: #21262d; border-radius: 4px; height: 20px; overflow: hidden; margin: 8px 0; }
74
83
  .meter-fill { height: 100%; border-radius: 4px; transition: width .6s ease; min-width: 2px; }
@@ -126,15 +135,15 @@ function dashboardHtml(tierName) {
126
135
  <div class="card">
127
136
  <h2>Vector Store</h2>
128
137
  <div class="stat-grid">
129
- <span class="label">Checkpoints</span><span class="value" id="st-count">0</span>
130
- <span class="label">Tokens Stored</span><span class="value" id="st-tokens">0</span>
131
- <span class="label">Original Tokens</span><span class="value" id="st-orig">0</span>
132
- <span class="label">Tokens Saved</span><span class="value" id="st-saved">0</span>
133
- <span class="label">Injected</span><span class="value" id="st-injected">0</span>
134
- <span class="label">Dedup Rate</span><span class="value" id="st-dedup">0%</span>
135
- <span class="label">Storage Dedup</span><span class="value" id="st-sdedup">0%</span>
136
- <span class="label">Collapsed</span><span class="value" id="st-collapsed">0</span>
137
- <span class="label">Last ID</span><span class="value" id="st-lastid">—</span>
138
+ <span class="label" title="A saved summary of a chunk of your conversation that was compacted to free up space.">Checkpoints</span><span class="value" id="st-count">0</span>
139
+ <span class="label" title="How much conversation we are currently holding as compact summaries (the 'memory' this extension keeps). Smaller is better.">Tokens Stored</span><span class="value" id="st-tokens">0</span>
140
+ <span class="label" title="Total size of the original conversation text before it was compacted.">Original Tokens</span><span class="value" id="st-orig">0</span>
141
+ <span class="label" title="How much conversation space we have freed up for you (original size minus the compact summary we kept).">Tokens Saved</span><span class="value" id="st-saved">0</span>
142
+ <span class="label" title="How many times old context was automatically brought back into the conversation because it was relevant to what you were doing.">Injected</span><span class="value" id="st-injected">0</span>
143
+ <span class="label" title="Of the times we recalled old context, how often it was actually on-topic.">Recall Relevance</span><span class="value" id="st-dedup">0%</span>
144
+ <span class="label" title="How often new content matched something we already had, so we skipped storing a duplicate copy. Higher = less wasted space.">Storage Dedup</span><span class="value" id="st-sdedup">0%</span>
145
+ <span class="label" title="How many duplicate chunks we collapsed into one instead of storing separately.">Collapsed</span><span class="value" id="st-collapsed">0</span>
146
+ <span class="label" title="The ID of the most recent saved checkpoint.">Last ID</span><span class="value" id="st-lastid">—</span>
138
147
  </div>
139
148
  </div>
140
149
  <div class="card">
@@ -177,6 +186,18 @@ function dashboardHtml(tierName) {
177
186
  <span class="label">Status</span><span class="value" id="cr-status">idle</span>
178
187
  </div>
179
188
  </div>
189
+ <div class="card legend">
190
+ <h2>What these numbers mean</h2>
191
+ <ul class="legend-list">
192
+ <li><b>Tokens saved</b> — conversation space this extension has freed up for you (it compacted old text into short summaries).</li>
193
+ <li><b>Tokens stored</b> — how much "memory" (compact summaries) the extension is currently holding for this repo.</li>
194
+ <li><b>Injected</b> — times old context was automatically pasted back in because it was relevant to your current task.</li>
195
+ <li><b>Recall relevance</b> — of those, how often the recalled context was actually on-topic.</li>
196
+ <li><b>Storage dedup</b> — how often new content matched something already saved, so a duplicate copy was skipped (saves space).</li>
197
+ <li><b>Data safety</b> — every compacted region is kept verbatim (compressed). Nothing is permanently deleted; you can restore any of it.</li>
198
+ </ul>
199
+ <p class="legend-note">Hover any label above for a quick explanation.</p>
200
+ </div>
180
201
  </div>
181
202
 
182
203
  <div class="events">
@@ -260,8 +260,8 @@ export default function (pi) {
260
260
  // Phase 3 — pulsing status glyph while a compaction is in flight.
261
261
  const pulse = pulsing ? `${C.cyan}${PULSE[Math.floor(Date.now() / 250) % PULSE.length]}${C.reset} ` : "";
262
262
  const lines = [
263
- ` ${C.amber}⚡ ${config.tier}${C.reset} │ ${tokStr}/${maxStr} tokens (${C.bold}${pctStr}${C.reset}) │ ${st.checkpointCount} chkpt${agentStr}${turnStr}`,
264
- ` ${triggerLabel} │ ${C.magenta}dedup: ${dedupStr}${C.reset} │ ${C.gray}used:${C.reset} ${usedStr} │ ${C.gray}saved:${C.reset} ${savedStr}`,
263
+ ` ${C.amber}⚡ ${config.tier}${C.reset} │ ${tokStr}/${maxStr} tokens (${C.bold}${pctStr}${C.reset}) │ ${st.checkpointCount} saved${agentStr}${turnStr}`,
264
+ ` ${triggerLabel} │ ${C.magenta}repeat-skipped: ${dedupStr}${C.reset} │ ${C.gray}memory held:${C.reset} ${usedStr} │ ${C.gray}space freed:${C.reset} ${savedStr}`,
265
265
  ];
266
266
  // Phase 3 — compact progress bar: session tokens saved toward the rolling goal.
267
267
  if (rt.tokensSaved > 0) {
@@ -289,11 +289,16 @@ export default function (pi) {
289
289
  // Phase 3 — recall/activity ticker (most-recent first), fresh only.
290
290
  if (fresh) {
291
291
  for (let i = ticker.length - 1; i >= 0; i--) {
292
- if (lines.length >= 10)
293
- break; // MAX_WIDGET_LINES guard
292
+ if (lines.length >= 9)
293
+ break; // leave room for the hint line (MAX 10)
294
294
  lines.push(` ${i === ticker.length - 1 ? "" : C.dim}${ticker[i].text}${C.reset}`);
295
295
  }
296
296
  }
297
+ // Plain-language hint so first-time users understand the widget. Always
298
+ // last, dimmed. "/mega-help explains these terms."
299
+ if (lines.length < 10) {
300
+ lines.push(` ${C.dim}auto-compresses old context to free space · nothing deleted · /mega-help${C.reset}`);
301
+ }
297
302
  ctx.ui.setWidget(WIDGET_KEY, lines, { placement: "aboveEditor" });
298
303
  }
299
304
  }
@@ -844,6 +849,20 @@ export default function (pi) {
844
849
  `${original.slice(0, 1500)}${original.length > 1500 ? "\n…(truncated)" : ""}`);
845
850
  },
846
851
  });
852
+ pi.registerCommand("mega-help", {
853
+ description: "Plain-language glossary of what mega-compact's stats mean.",
854
+ handler: async (_args, ctx) => {
855
+ ctx.ui.notify(`[mega-compact] glossary — what the numbers mean:\n` +
856
+ `• token — a chunk of text (~4 chars). Context window = how much text fits in memory at once.\n` +
857
+ `• space freed — how much conversation we've compressed away to make room (the win).\n` +
858
+ `• memory held — how much compact summary we're currently keeping as your 'notes'.\n` +
859
+ `• saved checkpoint — a compact summary of an old conversation chunk we stored.\n` +
860
+ `• repeat-skipped — how often new text matched something we already had, so we didn't store a duplicate.\n` +
861
+ `• injected — times we pasted an old saved note back into the chat because it was relevant.\n` +
862
+ `• recall relevance — of those, how often the note was actually on-topic.\n` +
863
+ `• data safety — every compressed region is kept verbatim; nothing is permanently deleted. /mega-restore brings any of it back.`);
864
+ },
865
+ });
847
866
  pi.registerCommand("mega-tier", {
848
867
  description: "Show or change the compaction tier at runtime. Usage: /mega-tier [low|medium|high|ultra|mega]",
849
868
  handler: async (args, ctx) => {
@@ -133,6 +133,15 @@ function dashboardHtml(tierName: string): string {
133
133
  .card.safe h2 { color: #3fb950; }
134
134
  .safe-note { font-size: 12px; color: #8b949e; margin: 12px 0 0; line-height: 1.5; }
135
135
  .value.ok { color: #3fb950; }
136
+ .label {
137
+ cursor: help;
138
+ border-bottom: 1px dotted #484f58;
139
+ }
140
+ .card.legend { grid-column: 1 / -1; }
141
+ .legend-list { margin: 0; padding-left: 18px; color: #c9d1d9; }
142
+ .legend-list li { margin-bottom: 8px; line-height: 1.5; }
143
+ .legend-list b { color: #f0f6fc; }
144
+ .legend-note { font-size: 12px; color: #8b949e; margin: 12px 0 0; font-style: italic; }
136
145
  .card h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #8b949e; margin-bottom: 12px; font-weight: 600; }
137
146
  .meter-track { background: #21262d; border-radius: 4px; height: 20px; overflow: hidden; margin: 8px 0; }
138
147
  .meter-fill { height: 100%; border-radius: 4px; transition: width .6s ease; min-width: 2px; }
@@ -190,15 +199,15 @@ function dashboardHtml(tierName: string): string {
190
199
  <div class="card">
191
200
  <h2>Vector Store</h2>
192
201
  <div class="stat-grid">
193
- <span class="label">Checkpoints</span><span class="value" id="st-count">0</span>
194
- <span class="label">Tokens Stored</span><span class="value" id="st-tokens">0</span>
195
- <span class="label">Original Tokens</span><span class="value" id="st-orig">0</span>
196
- <span class="label">Tokens Saved</span><span class="value" id="st-saved">0</span>
197
- <span class="label">Injected</span><span class="value" id="st-injected">0</span>
198
- <span class="label">Dedup Rate</span><span class="value" id="st-dedup">0%</span>
199
- <span class="label">Storage Dedup</span><span class="value" id="st-sdedup">0%</span>
200
- <span class="label">Collapsed</span><span class="value" id="st-collapsed">0</span>
201
- <span class="label">Last ID</span><span class="value" id="st-lastid">—</span>
202
+ <span class="label" title="A saved summary of a chunk of your conversation that was compacted to free up space.">Checkpoints</span><span class="value" id="st-count">0</span>
203
+ <span class="label" title="How much conversation we are currently holding as compact summaries (the 'memory' this extension keeps). Smaller is better.">Tokens Stored</span><span class="value" id="st-tokens">0</span>
204
+ <span class="label" title="Total size of the original conversation text before it was compacted.">Original Tokens</span><span class="value" id="st-orig">0</span>
205
+ <span class="label" title="How much conversation space we have freed up for you (original size minus the compact summary we kept).">Tokens Saved</span><span class="value" id="st-saved">0</span>
206
+ <span class="label" title="How many times old context was automatically brought back into the conversation because it was relevant to what you were doing.">Injected</span><span class="value" id="st-injected">0</span>
207
+ <span class="label" title="Of the times we recalled old context, how often it was actually on-topic.">Recall Relevance</span><span class="value" id="st-dedup">0%</span>
208
+ <span class="label" title="How often new content matched something we already had, so we skipped storing a duplicate copy. Higher = less wasted space.">Storage Dedup</span><span class="value" id="st-sdedup">0%</span>
209
+ <span class="label" title="How many duplicate chunks we collapsed into one instead of storing separately.">Collapsed</span><span class="value" id="st-collapsed">0</span>
210
+ <span class="label" title="The ID of the most recent saved checkpoint.">Last ID</span><span class="value" id="st-lastid">—</span>
202
211
  </div>
203
212
  </div>
204
213
  <div class="card">
@@ -241,6 +250,18 @@ function dashboardHtml(tierName: string): string {
241
250
  <span class="label">Status</span><span class="value" id="cr-status">idle</span>
242
251
  </div>
243
252
  </div>
253
+ <div class="card legend">
254
+ <h2>What these numbers mean</h2>
255
+ <ul class="legend-list">
256
+ <li><b>Tokens saved</b> — conversation space this extension has freed up for you (it compacted old text into short summaries).</li>
257
+ <li><b>Tokens stored</b> — how much "memory" (compact summaries) the extension is currently holding for this repo.</li>
258
+ <li><b>Injected</b> — times old context was automatically pasted back in because it was relevant to your current task.</li>
259
+ <li><b>Recall relevance</b> — of those, how often the recalled context was actually on-topic.</li>
260
+ <li><b>Storage dedup</b> — how often new content matched something already saved, so a duplicate copy was skipped (saves space).</li>
261
+ <li><b>Data safety</b> — every compacted region is kept verbatim (compressed). Nothing is permanently deleted; you can restore any of it.</li>
262
+ </ul>
263
+ <p class="legend-note">Hover any label above for a quick explanation.</p>
264
+ </div>
244
265
  </div>
245
266
 
246
267
  <div class="events">
@@ -363,8 +363,8 @@ export default function (pi: ExtensionAPI) {
363
363
  // Phase 3 — pulsing status glyph while a compaction is in flight.
364
364
  const pulse = pulsing ? `${C.cyan}${PULSE[Math.floor(Date.now() / 250) % PULSE.length]}${C.reset} ` : "";
365
365
  const lines = [
366
- ` ${C.amber}⚡ ${config.tier}${C.reset} │ ${tokStr}/${maxStr} tokens (${C.bold}${pctStr}${C.reset}) │ ${st.checkpointCount} chkpt${agentStr}${turnStr}`,
367
- ` ${triggerLabel} │ ${C.magenta}dedup: ${dedupStr}${C.reset} │ ${C.gray}used:${C.reset} ${usedStr} │ ${C.gray}saved:${C.reset} ${savedStr}`,
366
+ ` ${C.amber}⚡ ${config.tier}${C.reset} │ ${tokStr}/${maxStr} tokens (${C.bold}${pctStr}${C.reset}) │ ${st.checkpointCount} saved${agentStr}${turnStr}`,
367
+ ` ${triggerLabel} │ ${C.magenta}repeat-skipped: ${dedupStr}${C.reset} │ ${C.gray}memory held:${C.reset} ${usedStr} │ ${C.gray}space freed:${C.reset} ${savedStr}`,
368
368
  ];
369
369
  // Phase 3 — compact progress bar: session tokens saved toward the rolling goal.
370
370
  if (rt.tokensSaved > 0) {
@@ -389,10 +389,15 @@ export default function (pi: ExtensionAPI) {
389
389
  // Phase 3 — recall/activity ticker (most-recent first), fresh only.
390
390
  if (fresh) {
391
391
  for (let i = ticker.length - 1; i >= 0; i--) {
392
- if (lines.length >= 10) break; // MAX_WIDGET_LINES guard
392
+ if (lines.length >= 9) break; // leave room for the hint line (MAX 10)
393
393
  lines.push(` ${i === ticker.length - 1 ? "" : C.dim}${ticker[i].text}${C.reset}`);
394
394
  }
395
395
  }
396
+ // Plain-language hint so first-time users understand the widget. Always
397
+ // last, dimmed. "/mega-help explains these terms."
398
+ if (lines.length < 10) {
399
+ lines.push(` ${C.dim}auto-compresses old context to free space · nothing deleted · /mega-help${C.reset}`);
400
+ }
396
401
  ctx.ui.setWidget(WIDGET_KEY, lines, { placement: "aboveEditor" });
397
402
  }
398
403
  }
@@ -994,6 +999,23 @@ export default function (pi: ExtensionAPI) {
994
999
  },
995
1000
  });
996
1001
 
1002
+ pi.registerCommand("mega-help", {
1003
+ description: "Plain-language glossary of what mega-compact's stats mean.",
1004
+ handler: async (_args: string, ctx: ExtensionContext) => {
1005
+ ctx.ui.notify(
1006
+ `[mega-compact] glossary — what the numbers mean:\n` +
1007
+ `• token — a chunk of text (~4 chars). Context window = how much text fits in memory at once.\n` +
1008
+ `• space freed — how much conversation we've compressed away to make room (the win).\n` +
1009
+ `• memory held — how much compact summary we're currently keeping as your 'notes'.\n` +
1010
+ `• saved checkpoint — a compact summary of an old conversation chunk we stored.\n` +
1011
+ `• repeat-skipped — how often new text matched something we already had, so we didn't store a duplicate.\n` +
1012
+ `• injected — times we pasted an old saved note back into the chat because it was relevant.\n` +
1013
+ `• recall relevance — of those, how often the note was actually on-topic.\n` +
1014
+ `• data safety — every compressed region is kept verbatim; nothing is permanently deleted. /mega-restore brings any of it back.`,
1015
+ );
1016
+ },
1017
+ });
1018
+
997
1019
  pi.registerCommand("mega-tier", {
998
1020
  description: "Show or change the compaction tier at runtime. Usage: /mega-tier [low|medium|high|ultra|mega]",
999
1021
  handler: async (args: string, ctx: ExtensionContext) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-mega-compact",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "description": "Layered, local, vector-backed context compressor for pi — supersede/collapse/cluster compaction with deduped inline recall.",
5
5
  "type": "module",
6
6
  "license": "BSD-2-Clause",