pi-goosedump 0.12.25 → 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.
- package/README.md +45 -99
- package/dist/index.ts +18 -20
- 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
|
|
4
|
-
|
|
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,78 +9,41 @@ prefix.
|
|
|
10
9
|
pi install npm:pi-goosedump
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
The package
|
|
14
|
-
x64
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Memory in a nutshell
|
|
19
|
-
|
|
20
|
-
1. **Remember:** [`gpt-oss-20b`](https://github.com/jarkkojs/goosedump/blob/main/docs/models/gpt-oss-20b.md)
|
|
21
|
-
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)
|
|
22
|
-
embeds each statement. SQLite stores the statements, vectors, and provenance.
|
|
23
|
-
2. **Recall:** lexical and entity matches come first. Cosine-similar BGE vectors
|
|
24
|
-
fill the remaining slots. There is no separate vector database.
|
|
25
|
-
|
|
26
|
-
Explicit `goose_remember` requests and learning after successful compactions are
|
|
27
|
-
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.
|
|
28
16
|
|
|
29
17
|
## Tools
|
|
30
18
|
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- **`goose_forget`** deletes one memory or all retained sources from a session.
|
|
45
|
-
- **`goose_memory_status`** reports storage, embedding coverage, tombstones, and
|
|
46
|
-
type counts.
|
|
47
|
-
|
|
48
|
-
Session-history tools default to the current Pi session and active lineage.
|
|
49
|
-
Non-Pi providers require an explicit session ID.
|
|
50
|
-
|
|
51
|
-
Examples:
|
|
52
|
-
|
|
53
|
-
```text
|
|
54
|
-
goose_search({ query: "bug fix" })
|
|
55
|
-
goose_search({ query: "auth", scope: "all", page: 2 })
|
|
56
|
-
goose_get({ ids: ["entry-a", "entry-b"] })
|
|
57
|
-
goose_grep({ pattern: "*timeout*" })
|
|
58
|
-
goose_recall({ query: "prior architecture decision" })
|
|
59
|
-
goose_recall({ query: "database", type: "decision" })
|
|
60
|
-
goose_recall({ query: "database", history: true })
|
|
61
|
-
goose_remember({})
|
|
62
|
-
goose_compact({ keep: 2 })
|
|
63
|
-
goose_sessions({ action: "list" })
|
|
64
|
-
goose_forget({ target: "mem_a1b2c3d4" })
|
|
65
|
-
goose_memory_status({})
|
|
66
|
-
```
|
|
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.
|
|
67
32
|
|
|
68
33
|
## Commands
|
|
69
34
|
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
- **`/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.
|
|
78
42
|
|
|
79
43
|
## Settings
|
|
80
44
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- `~/.pi/agent/settings.json` for global settings.
|
|
84
|
-
- `.pi/settings.json` for project overrides.
|
|
45
|
+
Put global settings in `~/.pi/agent/settings.json` and project overrides in
|
|
46
|
+
`.pi/settings.json`:
|
|
85
47
|
|
|
86
48
|
```json
|
|
87
49
|
{
|
|
@@ -92,39 +54,23 @@ Optional settings live under `goosedump` in:
|
|
|
92
54
|
}
|
|
93
55
|
```
|
|
94
56
|
|
|
95
|
-
`turnsBeforeCompact`
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
and
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
`summaryMaxTokens` is an integer from 512 to 65536 (default 4096). The effective
|
|
112
|
-
summary budget is the lower of this value and 80% of Pi's `compaction.reserveTokens`,
|
|
113
|
-
leaving room for the next model response. Clearing a project value restores the
|
|
114
|
-
global setting.
|
|
115
|
-
|
|
116
|
-
## Compaction behavior
|
|
117
|
-
|
|
118
|
-
The extension uses `goosedump session compact` for manual, scheduled, and automatic
|
|
119
|
-
compaction. It preserves the previous summary, summarizes only the new range, and
|
|
120
|
-
passes the effective token budget. `keep:N` leaves the last N user turns verbatim.
|
|
121
|
-
Tool requests are queued until Pi is idle; if Pi reaches its context threshold
|
|
122
|
-
first, the queued request is coalesced into that compaction.
|
|
123
|
-
|
|
124
|
-
After success, memory learning is queued in the background. A learning failure
|
|
125
|
-
keeps the summary and displays a warning. Custom instructions use Pi's normal
|
|
126
|
-
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.
|
|
127
73
|
|
|
128
74
|
## License
|
|
129
75
|
|
|
130
|
-
|
|
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
|
|
1519
|
-
if (!goosedumpAvailable || !turnCompactionEnabled())
|
|
1520
|
-
return
|
|
1521
|
-
if (!
|
|
1522
|
-
return
|
|
1523
|
-
if (
|
|
1524
|
-
return
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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": "^
|
|
46
|
+
"@types/node": "^26.1.2",
|
|
47
47
|
"oxfmt": "^0.60.0",
|
|
48
48
|
"oxlint": "^1.68.0",
|
|
49
49
|
"typescript": "^7.0.2",
|