pi-goosedump 0.12.26 → 0.12.27

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.
Files changed (3) hide show
  1. package/README.md +45 -102
  2. package/dist/index.ts +18 -20
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # pi-goosedump
2
2
 
3
- `pi-goosedump` adds goosedump-backed session-history search, durable-memory
4
- recall, entry expansion, and compaction to Pi. Its tools use the `goose_`
5
- prefix.
3
+ `pi-goosedump` adds goosedump-backed session search, durable memory, session
4
+ management, and compaction to Pi. Its tools use the `goose_` prefix.
6
5
 
7
6
  ## Install
8
7
 
@@ -10,81 +9,41 @@ prefix.
10
9
  pi install npm:pi-goosedump
11
10
  ```
12
11
 
13
- The package installs `@jarkkojs/goosedump`, including native binaries for Linux
14
- x64, macOS arm64, and Windows x64. If no compatible binary is available, the
15
- extension keeps Pi's normal compaction behavior and its goosedump features
16
- report that they are unavailable.
17
-
18
- Local inference models are downloaded automatically when first needed and reused
19
- from the local cache; no separate model setup command is required.
20
-
21
- ## Memory in a nutshell
22
-
23
- 1. **Remember:** [`gpt-oss-20b`](https://github.com/jarkkojs/goosedump/blob/main/docs/models/gpt-oss-20b.md)
24
- extracts typed, atomic statements with source provenance. [`bge-small-en-v1.5`](https://github.com/jarkkojs/goosedump/blob/main/docs/models/bge-small-en-v1.5.md)
25
- embeds each statement. SQLite stores the statements, vectors, and provenance.
26
- 2. **Recall:** lexical and entity matches come first. Cosine-similar BGE vectors
27
- fill the remaining slots. There is no separate vector database.
28
-
29
- Explicit `goose_remember` requests and learning after successful compactions are
30
- queued in the background, so model extraction and embedding do not block Pi.
12
+ The package includes native binaries for Linux x64, macOS arm64, and Windows
13
+ x64. On unsupported platforms, Pi keeps its normal compaction behavior and the
14
+ goosedump tools report that they are unavailable. Local models download on
15
+ first use.
31
16
 
32
17
  ## Tools
33
18
 
34
- - **`goose_search`** ranks session messages and returns compact overviews with
35
- entry IDs.
36
- - **`goose_get`** expands entry IDs returned by `goose_search` or `goose_grep`.
37
- - **`goose_grep`** filters session messages with a glob pattern.
38
- - **`goose_remember`** queues durable memory learning from a session. It defaults
39
- to the current Pi session and returns before extraction and embedding finish.
40
- - **`goose_recall`** recalls typed memories with source provenance. It searches
41
- active memories in the current project by default; `history` includes
42
- superseded statements and `allProjects` searches every project.
43
- - **`goose_compact`** starts asynchronous compaction of the current Pi session.
44
- `keep` preserves the last N user turns verbatim.
45
- - **`goose_sessions`** lists or deletes sessions from the current working
46
- directory. The active session cannot be deleted.
47
- - **`goose_forget`** deletes one memory or all retained sources from a session.
48
- - **`goose_memory_status`** reports storage, embedding coverage, tombstones, and
49
- type counts.
50
-
51
- Session-history tools default to the current Pi session and active lineage.
52
- Non-Pi providers require an explicit session ID.
53
-
54
- Examples:
55
-
56
- ```text
57
- goose_search({ query: "bug fix" })
58
- goose_search({ query: "auth", scope: "all", page: 2 })
59
- goose_get({ ids: ["entry-a", "entry-b"] })
60
- goose_grep({ pattern: "*timeout*" })
61
- goose_recall({ query: "prior architecture decision" })
62
- goose_recall({ query: "database", type: "decision" })
63
- goose_recall({ query: "database", history: true })
64
- goose_remember({})
65
- goose_compact({ keep: 2 })
66
- goose_sessions({ action: "list" })
67
- goose_forget({ target: "mem_a1b2c3d4" })
68
- goose_memory_status({})
69
- ```
19
+ - `goose_search` ranks session messages and returns entry IDs.
20
+ - `goose_get` expands entries returned by search or grep.
21
+ - `goose_grep` filters messages with a glob.
22
+ - `goose_remember` queues memory learning from a session.
23
+ - `goose_recall` recalls project-scoped memory with provenance.
24
+ - `goose_compact` compacts the current Pi session asynchronously.
25
+ - `goose_sessions` lists or deletes sessions in the current working directory.
26
+ - `goose_forget` deletes a memory or a session's retained sources.
27
+ - `goose_memory_status` reports storage and indexing health.
28
+
29
+ Session tools default to the current Pi session and active lineage. Non-Pi
30
+ providers require a session ID. Recall returns up to five memories by default.
31
+ Use each tool's schema for its full options.
70
32
 
71
33
  ## Commands
72
34
 
73
- - **`/goose-search [query]`** searches the current session. A bare command opens
74
- an inline prompt; selecting a result expands it.
75
- - **`/goose-compact [keep:N]`** compacts now. With `keep:N`, the last N user
76
- turns remain verbatim; without it, Pi chooses the cut point.
77
- - **`/goose-sessions`** lists or deletes saved sessions scoped to the current working directory.
78
- - **`/goose-forget [memory-id|provider:id]`** deletes stored durable memory by ID or session.
79
- - **`/goose-memory-status`** displays durable-memory storage health and indexing counts.
80
- - **`/goose-settings`** edits global and project compaction settings.
35
+ - `/goose-search [query]` searches the current session.
36
+ - `/goose-compact [keep:N]` compacts now and can preserve recent user turns.
37
+ - `/goose-sessions` lists project sessions and can resume or delete them.
38
+ Resume is available only for Pi sessions.
39
+ - `/goose-forget [memory-id|provider:id]` forgets stored memory.
40
+ - `/goose-memory-status` shows memory storage and indexing status.
41
+ - `/goose-settings` edits global and project compaction settings.
81
42
 
82
43
  ## Settings
83
44
 
84
- Optional settings live under `goosedump` in:
85
-
86
- - `~/.pi/agent/settings.json` for global settings.
87
- - `.pi/settings.json` for project overrides.
45
+ Put global settings in `~/.pi/agent/settings.json` and project overrides in
46
+ `.pi/settings.json`:
88
47
 
89
48
  ```json
90
49
  {
@@ -95,39 +54,23 @@ Optional settings live under `goosedump` in:
95
54
  }
96
55
  ```
97
56
 
98
- `turnsBeforeCompact` is an integer from 0 to 255. `0` disables the turn-based
99
- trigger. Pi's `compaction.enabled` setting controls all automatic compaction, including
100
- the turn-based trigger. Each completed model response counts as one turn, including
101
- responses that call tools. The countdown is restored when a session resumes and
102
- appears in the footer with a status dot (green when >25% turns remain, yellow when
103
- ≤25%, red when ≤12.5%) followed by a hexadecimal countdown. `● GD:0A` means ten
104
- turns remain, `● GD:00` is ready to compact, and `● GD:--` means the turn trigger is
105
- disabled. The footer adds `queued` while compaction is waiting to start and
106
- `compacting` while the summary is being built. When the counter hits zero mid
107
- tool-loop, compaction starts immediately after the current tool batch is persisted
108
- and the task is resumed automatically. When the counter hits zero on a terminal
109
- turn, compaction starts after the agent has settled. Pi remains the scheduler for
110
- its context threshold. Whichever enabled limit is reached first compacts once, and
111
- every successful compaction resets the countdown. A failed or cancelled compaction
112
- leaves the counter armed at zero and retries on the next tool turn or settlement.
113
-
114
- `summaryMaxTokens` is an integer from 512 to 65536 (default 4096). The effective
115
- summary budget is the lower of this value and 80% of Pi's `compaction.reserveTokens`,
116
- leaving room for the next model response. Clearing a project value restores the
117
- global setting.
118
-
119
- ## Compaction behavior
120
-
121
- The extension uses `goosedump session compact` for manual, scheduled, and automatic
122
- compaction. It preserves the previous summary, summarizes only the new range, and
123
- passes the effective token budget. `keep:N` leaves the last N user turns verbatim.
124
- Tool requests are queued until Pi is idle; if Pi reaches its context threshold
125
- first, the queued request is coalesced into that compaction.
126
-
127
- After success, memory learning is queued in the background. A learning failure
128
- keeps the summary and displays a warning. Custom instructions use Pi's normal
129
- compactor; other goosedump failures fall back to Pi.
57
+ - `turnsBeforeCompact`: `0` to `255`; `0` disables the turn trigger. Each
58
+ completed model response counts as one turn. The footer shows the remaining
59
+ count in hexadecimal.
60
+ - `summaryMaxTokens`: `512` to `65536`; defaults to `4096`. Pi limits the
61
+ effective budget to 80% of `compaction.reserveTokens` when that is lower.
62
+
63
+ Pi's `compaction.enabled` controls automatic compaction. The first enabled
64
+ context or turn limit reached starts one compaction; successful compaction
65
+ resets the turn counter.
66
+
67
+ Manual and automatic compaction preserve the previous summary and summarize
68
+ only new entries. `keep:N` leaves the last N user turns verbatim. Manual requests
69
+ wait until Pi is idle, and memory learning runs in the background after success.
70
+ If the turn limit expires during a tool loop, Pi saves the current batch, starts
71
+ compaction at that turn boundary, and resumes automatically. Goosedump failures
72
+ fall back to Pi's compactor.
130
73
 
131
74
  ## License
132
75
 
133
- `pi-goosedump` is licensed under `Apache-2.0`. See [LICENSE](LICENSE).
76
+ Apache-2.0. See [LICENSE](LICENSE).
package/dist/index.ts CHANGED
@@ -1515,23 +1515,21 @@ function createGoosedumpIntegration(options = {}) {
1515
1515
  display: false
1516
1516
  }, { triggerTurn: true });
1517
1517
  }
1518
- function tryMidRunCounterCompaction(ctx) {
1519
- if (!goosedumpAvailable || !turnCompactionEnabled())
1520
- return false;
1521
- if (!counterTriggered)
1522
- return false;
1523
- if (ctx.hasPendingMessages())
1524
- return false;
1525
- if (!hasCompactableHistory(ctx))
1526
- return false;
1527
- if (compactionState.phase === "idle") {
1528
- queueTurnCompaction(ctx, settlementGeneration);
1529
- } else if (compactionState.phase === "queued" && compactionState.request.origin === "turn") {
1530
- setCompactionState(ctx, requeueRequest(compactionState.request, Math.min(compactionState.request.eligibleSettlement, settlementGeneration)));
1531
- } else {
1532
- return false;
1533
- }
1534
- return startQueuedCompaction(ctx, { resumeAfter: true, allowActiveRun: true });
1518
+ function deferMidRunCounterCompaction(ctx) {
1519
+ if (!goosedumpAvailable || !turnCompactionEnabled() || !counterTriggered)
1520
+ return;
1521
+ if (ctx.hasPendingMessages() || !hasCompactableHistory(ctx))
1522
+ return;
1523
+ if (compactionState.phase !== "queued" || compactionState.request.origin !== "turn")
1524
+ return;
1525
+ const request = compactionState.request;
1526
+ setImmediate(() => {
1527
+ if (compactionState.phase !== "queued" || compactionState.request !== request || !contextIsCurrent(ctx)) {
1528
+ return;
1529
+ }
1530
+ const runStillActive = settlementGeneration < request.eligibleSettlement;
1531
+ startQueuedCompaction(ctx, runStillActive ? { allowActiveRun: true, resumeAfter: true } : undefined);
1532
+ });
1535
1533
  }
1536
1534
  function checkGoosedump(ctx) {
1537
1535
  try {
@@ -1600,7 +1598,7 @@ function createGoosedumpIntegration(options = {}) {
1600
1598
  const operation = ++operationGeneration;
1601
1599
  const generation = request.sessionGeneration;
1602
1600
  const sessionFile = request.sessionFile;
1603
- const resumeAfter = options2.resumeAfter === true;
1601
+ const resumeAfter = request.origin === "turn" && options2.resumeAfter === true;
1604
1602
  setCompactionState(ctx, {
1605
1603
  phase: "running",
1606
1604
  request,
@@ -2071,7 +2069,7 @@ ${lines.join(`
2071
2069
  if (isCompletedAssistant(event.message))
2072
2070
  noteCompletedTurn(ctx);
2073
2071
  if (event.toolResults.length > 0)
2074
- tryMidRunCounterCompaction(ctx);
2072
+ deferMidRunCounterCompaction(ctx);
2075
2073
  });
2076
2074
  pi.on("agent_settled", async (_event, ctx) => {
2077
2075
  handleAgentSettled(ctx);
@@ -2108,7 +2106,7 @@ ${lines.join(`
2108
2106
  let request;
2109
2107
  let owner;
2110
2108
  if (compactionState.phase === "running") {
2111
- if (compactionState.hookClaimed || compactionState.owner === "pi") {
2109
+ if (compactionState.hookClaimed || compactionState.owner === "pi" || event.reason !== "manual") {
2112
2110
  return { cancel: true };
2113
2111
  }
2114
2112
  operation = compactionState.operation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-goosedump",
3
- "version": "0.12.26",
3
+ "version": "0.12.27",
4
4
  "description": "Pi extension for goosedump session search, durable memory, and compaction",
5
5
  "keywords": [
6
6
  "compaction",
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@earendil-works/pi-tui": "^0.82.1",
41
- "@jarkkojs/goosedump": "^0.12.26",
41
+ "@jarkkojs/goosedump": "^0.12.27",
42
42
  "@sinclair/typebox": "^0.34.49"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@earendil-works/pi-coding-agent": "^0.82.1",
46
- "@types/node": "^24.0.0",
46
+ "@types/node": "^26.1.2",
47
47
  "oxfmt": "^0.60.0",
48
48
  "oxlint": "^1.68.0",
49
49
  "typescript": "^7.0.2",