pi-condense 2.0.0 → 2.0.1

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/CHANGELOG.md CHANGED
@@ -1,73 +1,81 @@
1
1
  # Changelog
2
2
 
3
- Format follows sibling pi packages (e.g. [`pi-cohort`](https://github.com/jjuraszek/pi-cohort/blob/main/CHANGELOG.md)):
4
- one entry per `vX.Y.Z` tag, newest first, terse bullets, dated.
3
+ Keep-a-Changelog style (`## [X.Y.Z] - <date>`, newest first), matching sibling
4
+ pi packages (e.g. [`pi-cohort`](https://github.com/jjuraszek/pi-cohort/blob/main/CHANGELOG.md)).
5
5
 
6
6
  Published to npm as [`pi-condense`](https://www.npmjs.com/package/pi-condense) (`pi install npm:pi-condense`).
7
7
  Pushing a `vX.Y.Z` tag triggers `.github/workflows/release.yml`, which runs the tests and
8
8
  publishes via OIDC trusted publishing. See `.agents/skills/release/SKILL.md`.
9
9
 
10
- ## v2.0.0 — 2026-07-02
10
+ ## [Unreleased]
11
+
12
+ ## [2.0.1] - 2026-07-03
13
+
14
+ - **Prune summaries are now hidden from Pi's main window** (`display: false` at both injection sites in `index.ts`). They stay in LLM context and session history (recoverable via `context_tree_query`) but no longer print the full markdown block into the TUI. Mirrors upstream `pi-context-prune` `2fd6127`.
15
+ - **Sharpened the summarizer prompt** (`src/summarizer.ts`): the key-outcome bullet now requires copying file paths, identifiers, signatures, and error strings *verbatim* (never reworded), and the summarizer skips tool calls that succeeded with nothing reusable to record. Scoped to short tokens - values/full output stay summarized, so the ~8x median compression and the oversized guard are unaffected.
16
+ - **`context_tree_query` description now shows a literal call example** (`{ toolCallIds: ["t12", "t3"] }`) and consolidates the two near-duplicate parameter descriptions into one that marks the field required. Reduces the empty-first-call retry seen in real sessions. No schema or behavior change.
17
+
18
+ ## [2.0.0] - 2026-07-02
11
19
 
12
20
  - **Renamed the package `pi-context-prune` -> `pi-condense`** and switched distribution from git-tag pins to npm. Install with `pi install npm:pi-condense` (was `git:github.com/jjuraszek/pi-context-prune@vX.Y.Z`). Migrate pinned `settings.json` entries; `release.sh sync-presets` reports stale pins.
13
21
  - **Added npm release machinery:** `.github/workflows/release.yml` (tag-triggered, OIDC + provenance, `tag == package.json` gate) and `test.yml` (bun, Ubuntu + Windows matrix). Ported `release.sh` to the shared sibling skeleton (`propose` / `patch|minor|major` / `current` / `verify` / `sync-presets`), replacing the old tag-pin `release.mjs`.
14
22
  - **Added** `LICENSE` (MIT), `files` allowlist, `engines`, and `author` to `package.json`; removed dead `pi.skills` / `pi.prompts` manifest entries (those directories never existed).
15
23
  - **Renamed** the cost-event producer id `EXTERNAL_COST_SOURCE` `"pi-context-prune"` -> `"pi-condense"`. Aggregators keyed on the old `source` string see it as a new producer.
16
24
 
17
- ## v1.0.0 2026-05-31
25
+ ## [1.0.0] - 2026-05-31
18
26
 
19
27
  - **Removed three `pruneOn` modes**, leaving `agent-message` (default) and `on-demand`:
20
- - `every-turn` debugging-only trigger with the worst prompt-cache churn.
21
- - `on-context-tag` depended on the external `ttttmr/pi-context` extension and overlapped its `context_compact`.
22
- - `agentic-auto` the scaffolded DCP-style model-driven `context_prune` tool was never wired to range compression (see `PRUNING.md § Future Work`).
28
+ - `every-turn` - debugging-only trigger with the worst prompt-cache churn.
29
+ - `on-context-tag` - depended on the external `ttttmr/pi-context` extension and overlapped its `context_compact`.
30
+ - `agentic-auto` - the scaffolded DCP-style model-driven `context_prune` tool was never wired to range compression (see `PRUNING.md`, Future Work).
23
31
  - **Removed** the `context_prune` tool, the agentic-auto system prompt, the `<pruner-note>` unpruned-count reminder, and the `remindUnprunedCount` setting. Deleted `src/reminder.ts`, `src/context-prune-tool.ts`, `src/progress-text.ts`.
24
32
  - **Migration:** none required. Configs pinned to a removed mode fall back to `agent-message` via `isPruneOn()`. A stale `remindUnprunedCount` key in `settings.json` is ignored.
25
33
 
26
- ## v0.11.1 2026-05-28
34
+ ## [0.11.1] - 2026-05-28
27
35
 
28
36
  - **Release flow:** `release.sh` now rewrites every `~/.pi/agent*/settings.json` pin of `git:github.com/jjuraszek/pi-context-prune@<ref>` to the new `@vX.Y.Z` automatically after pushing the tag. Opt out with `--no-update-pins`. Aligns this fork's release workflow with sibling pi-* packages.
29
37
  - **Docs:** `README.md` install section leads with the jjuraszek tag-pin (was upstream npm/sha references). `AGENTS.md` release blurb updated to reflect tag pins + automatic settings rewrite. `.agents/skills/release/SKILL.md` documents the new flow + flags. Adds this `CHANGELOG.md` for parity with sibling pi-* packages.
30
38
 
31
- ## v0.11.0 2026-05-28
39
+ ## [0.11.0] - 2026-05-28
32
40
 
33
- - **Pre-flush pipeline:** content-hash dedup (re-reads of identical `(toolName, content)` pairs alias the original instead of going through the LLM), trivial-batch skip (`minBatchChars`), protected tools allowlist, stub-replace rather than delete. See `PRUNING.md § Pre-flush Pipeline & Safeguards`.
41
+ - **Pre-flush pipeline:** content-hash dedup (re-reads of identical `(toolName, content)` pairs alias the original instead of going through the LLM), trivial-batch skip (`minBatchChars`), protected tools allowlist, stub-replace rather than delete. See `PRUNING.md`, Pre-flush Pipeline & Safeguards.
34
42
  - **Settings:** moved to `<agent-dir>/settings.json#contextPrune` namespace (was a separate file). Honors `$PI_CODING_AGENT_DIR`.
35
43
 
36
- ## v0.10.0 2026-05-11
44
+ ## [0.10.0] - 2026-05-11
37
45
 
38
46
  - `quietOversizedSkips` setting to suppress `skipped-oversized` notifications.
39
47
  - Demote oversized-skip notification severity to info.
40
48
  - Use short refs in pruned summaries (e.g. `t1`, `t2` rather than full toolCallIds) so the model can pass them back through `context_tree_query` more reliably.
41
49
 
42
- ## v0.9.x 2026-05-05 2026-05-11
50
+ ## [0.9.x] - 2026-05-05 to 2026-05-11
43
51
 
44
52
  - `0.9.3`: spinner animation fix for `/pruner now`.
45
53
  - `0.9.2`: replace footer progress with aboveEditor widget during `/pruner now`.
46
54
  - `0.9.1`: allow `ESC` to cancel `context_prune` tool call.
47
55
  - `0.9.0`: agentic-auto mode (`pruneOn: "agentic-auto"`), `context_prune` tool surfaced to the LLM, `remindUnprunedCount` setting.
48
56
 
49
- ## v0.8.x 2026-05-04 2026-05-05
57
+ ## [0.8.x] - 2026-05-04 to 2026-05-05
50
58
 
51
59
  - `0.8.1`: bug fixes around session-start index rebuild.
52
60
  - `0.8.0`: `agent-message` trigger mode + batching, footer status widget.
53
61
 
54
- ## v0.7.0 2026-05-04
62
+ ## [0.7.0] - 2026-05-04
55
63
 
56
64
  - `on-context-tag` trigger mode (integrates with `pi-context` `context_checkpoint`).
57
65
 
58
- ## v0.6.x 2026-05-02
66
+ ## [0.6.x] - 2026-05-02
59
67
 
60
68
  - Tree browser (`/pruner tree`) + summary overlay (`Ctrl-O`).
61
69
  - `dedupByContentHash` cross-flush dedup.
62
70
 
63
- ## v0.5.0 2026-05-01
71
+ ## [0.5.0] - 2026-05-01
64
72
 
65
73
  - Cumulative summarizer token/cost stats (`/pruner stats`).
66
74
 
67
- ## v0.4.0 2026-05-01
75
+ ## [0.4.0] - 2026-05-01
68
76
 
69
77
  - Configurable summarizer model + thinking level (`/pruner model`, `/pruner thinking`).
70
78
 
71
- ## Earlier (v0.1.x v0.3.x)
79
+ ## Earlier (v0.1.x - v0.3.x)
72
80
 
73
81
  Initial extension scaffolding, `context_tree_query` tool, base summarization loop, session-JSONL index persistence. See `git log` for granular history.
package/index.ts CHANGED
@@ -194,7 +194,7 @@ export default function (pi: ExtensionAPI) {
194
194
 
195
195
  const appendEntry = (customType: string, data?: unknown) => sessionManager!.appendCustomEntry(customType, data);
196
196
  const appendSummaryMessage = (content: string, details: unknown) =>
197
- sessionManager!.appendCustomMessageEntry(CUSTOM_TYPE_SUMMARY, content, true, details);
197
+ sessionManager!.appendCustomMessageEntry(CUSTOM_TYPE_SUMMARY, content, false, details);
198
198
 
199
199
  // Routes alias persistence through whichever delivery is active so the
200
200
  // dedup pre-flush pass writes CUSTOM_TYPE_DEDUP_ALIAS entries via the
@@ -400,11 +400,14 @@ export default function (pi: ExtensionAPI) {
400
400
 
401
401
  try {
402
402
  if (!shouldSkipOversized) {
403
- // Write one summary message per turn and index its tool calls.
403
+ // Write one hidden summary message per turn and index its tool calls.
404
+ // `display: false` keeps the summary in future LLM context (convertToLlm
405
+ // ignores `display`) while suppressing the full markdown block from Pi's
406
+ // main window; rebuild keys on customType, not display.
404
407
  const batchToolCallIds = batch.toolCalls.map((tc) => tc.toolCallId);
405
408
  if (delivery === "runtime") {
406
409
  pi.sendMessage(
407
- { customType: CUSTOM_TYPE_SUMMARY, content: summaryText, display: true, details: batchDetails },
410
+ { customType: CUSTOM_TYPE_SUMMARY, content: summaryText, display: false, details: batchDetails },
408
411
  { deliverAs: "steer" }
409
412
  );
410
413
  indexer.registerSummaryRefs(summaryRefs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-condense",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Pi extension that summarizes completed tool-call batches, replaces raw outputs with short stubs in future context, and recovers any original on demand via context_tree_query.",
5
5
  "author": "Jacek Juraszek",
6
6
  "license": "MIT",
@@ -50,7 +50,7 @@ function summaryMsg(timestamp: number, toolCallIds: string[]): any {
50
50
  role: "custom",
51
51
  customType: "context-prune-summary",
52
52
  content: "summary text",
53
- display: true,
53
+ display: false,
54
54
  details: { toolCallRefs: toolCallIds.map((id, i) => ({ shortId: `t${i + 1}`, toolCallId: id })) },
55
55
  timestamp,
56
56
  };
package/src/query-tool.ts CHANGED
@@ -9,14 +9,14 @@ export function registerQueryTool(pi: ExtensionAPI, indexer: ToolCallIndexer): v
9
9
  name: "context_tree_query",
10
10
  label: "Query Original Tool History",
11
11
  description:
12
- "Retrieve original tool call results that have been pruned from active context. Pass the short refs from a pruner-summary message to get back the full original outputs.",
12
+ "Retrieve original tool call results that have been pruned from active context. Pass the short refs listed in a pruner-summary message, e.g. context_tree_query({ toolCallIds: [\"t12\", \"t3\"] }), to get back the full original outputs.",
13
13
  promptSnippet: "Retrieve original pruned tool outputs by short ref",
14
14
  promptGuidelines: [
15
15
  "When you need the full output of a tool call that was summarized and pruned from context, use context_tree_query with the short refs listed in the relevant pruner-summary message.",
16
16
  ],
17
17
  parameters: Type.Object({
18
- toolCallIds: Type.Array(Type.String({ description: "One or more short refs or tool call IDs to retrieve" }), {
19
- description: "List of short refs or toolCallIds to look up",
18
+ toolCallIds: Type.Array(Type.String(), {
19
+ description: 'Required. One or more short refs (e.g. "t12") or raw tool call IDs from a pruner-summary message.',
20
20
  }),
21
21
  }),
22
22
 
package/src/summarizer.ts CHANGED
@@ -14,10 +14,10 @@ import { serializeBatchForSummarizer } from "./batch-capture.js";
14
14
  const SYSTEM_PROMPT = `You are summarizing a batch of tool calls made by an AI coding assistant.
15
15
  For each tool call provide:
16
16
  - Tool name and a one-sentence description of what it did
17
- - Key outcome: success/failure and the most important data returned
17
+ - Key outcome, plus any file paths, identifiers, signatures, or error strings copied verbatim - never reword these
18
18
  - Any findings the future conversation needs to remember
19
19
 
20
- Keep each tool call to 1-3 bullet points. Be concise.`;
20
+ Keep each tool call to 1-3 bullet points. Skip calls that succeeded with nothing reusable to record. Be concise.`;
21
21
 
22
22
  const RANGE_SYSTEM_PROMPT = `You are fusing several per-step summaries of one CLOSED sub-task from an AI coding assistant's history into a SINGLE cohesive summary.
23
23
  - Merge overlapping or repeated information; do not restate each step separately.