pi-goosedump 0.8.1 → 0.9.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.
Files changed (3) hide show
  1. package/README.md +69 -70
  2. package/index.ts +720 -896
  3. package/package.json +5 -3
package/README.md CHANGED
@@ -1,93 +1,66 @@
1
1
  # pi-goosedump
2
2
 
3
- <img alt="pi-goosedump browser dialog" src="screenshot.png">
3
+ `pi-goosedump` is a pi extension for goosedump-backed session-history search,
4
+ entry expansion, and compaction. It exposes goosedump tools under the `goose_`
5
+ prefix and replaces Pi's default LLM compaction with goosedump-generated
6
+ summaries.
4
7
 
5
- Coding agent context data browser plugin for [pi](https://pi.dev/) using
6
- [`goosedump`](https://github.com/jarkkojs/goosedump).
7
-
8
- ## Install
8
+ ## Installation
9
9
 
10
10
  ```bash
11
11
  pi install npm:pi-goosedump
12
12
  ```
13
13
 
14
- This installs `pi-goosedump` and its `@jarkkojs/goosedump` dependency, which
15
- includes platform-specific native binaries for Linux, macOS, and Windows.
16
-
17
- The upstream `@jarkkojs/goosedump` packages are licensed separately as
18
- `Apache-2.0 AND LGPL-2.1-or-later`.
19
-
20
- ## Usage
21
-
22
- Once installed, pi-goosedump registers a tool and a slash command:
14
+ This installs `pi-goosedump` and its `@jarkkojs/goosedump` dependency (`^0.9.0`),
15
+ which includes platform-specific native binaries for Linux, macOS, and Windows.
16
+ If the goosedump binary cannot be resolved, the extension disables itself and
17
+ the footer status goes dark.
23
18
 
24
- ### Tool: `goosedump`
19
+ ## Tools
25
20
 
26
- The agent can browse the current Pi session by default, or any session by its
27
- 8-hex `contextId` (the id shown by `list`):
21
+ - **goose_search:** ranks messages by query relevance; returns compact entry
22
+ overviews with IDs.
23
+ - **goose_get:** expands specific entry IDs to their full content.
24
+ - **goose_grep:** filters messages by glob pattern; returns compact entries
25
+ with IDs.
26
+ - **goose_compact:** triggers a goosedump compaction now, optionally keeping
27
+ the last N user turns verbatim while summarizing everything before.
28
28
 
29
- | Action | Description |
30
- | -------- | ---------------------------------------- |
31
- | `list` | List all available sessions |
32
- | `search` | Rank messages by query relevance |
33
- | `grep` | Filter messages by glob pattern |
34
- | `expand` | Show full content for specific entry IDs |
35
- | `view` | View the full session transcript |
36
-
37
- Examples:
29
+ The read tools (`goose_search`, `goose_get`, `goose_grep`) each accept an
30
+ optional `provider` (default `pi`; also `claude`, `codex`, `crush`, `gemini`,
31
+ `goose`, `opencode`) and `session` id. `session` defaults to the current Pi
32
+ session for `pi` and is required otherwise. `scope` is `lineage` (default,
33
+ current branch) or `all`. Targets are always provider-qualified
34
+ (`provider:id`); a bare id is never sent to goosedump.
38
35
 
39
36
  ```
40
- goosedump({ action: "list" })
41
- goosedump({ action: "search", query: "bug fix" })
42
- goosedump({ action: "search", contextId: "0000001f", query: "bug fix" })
43
- goosedump({ action: "grep", pattern: "*rand*" })
44
- goosedump({ action: "expand", ids: ["entry-a", "entry-b"] })
45
- goosedump({ action: "view" })
37
+ goose_search({ query: "bug fix" })
38
+ goose_search({ query: "auth", scope: "all", page: 2 })
39
+ goose_get({ ids: ["entry-a", "entry-b"] })
40
+ goose_get({ ids: ["entry-a"], provider: "claude", session: "1f6b1eba-…" })
41
+ goose_grep({ pattern: "*rand*" })
42
+ goose_compact({ keep: 2 })
46
43
  ```
47
44
 
48
- #### Other providers
45
+ ## Commands
49
46
 
50
- By default the tool browses Pi sessions. Set `provider` (one of `claude`,
51
- `codex`, `crush`, `gemini`, `goose`, `opencode`, `pi`) with a `contextId` to
52
- browse another tool's sessions; results render the same way as Pi sessions.
53
- Non-pi providers have no current session, so they require an explicit
54
- `contextId`.
47
+ - **`/goose-search [query]`:** search the current session history; accepts a
48
+ query argument or prompts inline when bare. Shows ranked results in a
49
+ scrollable panel; press enter to expand an entry to its full content.
50
+ - **`/goose-compact [keep:N]`:** compact now with goosedump. With `keep:N`
51
+ (N ≥ 1) the last N user turns stay verbatim and everything before is
52
+ summarized; with no argument goosedump summarizes up to Pi's cut.
53
+ - **`/goose-settings`:** edit the global and project compaction settings.
55
54
 
56
- ```
57
- goosedump({ action: "list", provider: "claude" })
58
- goosedump({ action: "view", provider: "claude", contextId: "0000001f" })
59
- ```
55
+ ## Settings
60
56
 
61
- #### Raw native output
57
+ `pi-goosedump` reads optional JSON settings from:
62
58
 
63
- By default every action renders through the normal structured view. Set
64
- `outputFormat` to emit the raw native session instead one of `claude`,
65
- `codex`, `crush`, `gemini`, `goose`, `opencode`, `pi`, or `json`. JSONL providers
66
- (`claude`, `codex`, `pi`, `gemini`) emit the raw session file; SQLite providers
67
- (`crush`, `goose`, `opencode`) emit a row-oriented JSON projection of their
68
- tables; `json` emits goosedump's structured JSON. This is round-trippable and
69
- applies to `view`, `expand`, `grep`, and `search`.
59
+ - `~/.pi/agent/settings.json` Global
60
+ - `.pi/settings.json` — Project
70
61
 
71
- ```
72
- goosedump({ action: "view", outputFormat: "goose" })
73
- goosedump({ action: "grep", pattern: "*rand*", outputFormat: "claude" })
74
- ```
75
-
76
- ### Command: `/goosedump`
77
-
78
- Opens an interactive dashboard. The sessions tab lists Pi sessions from the
79
- current working directory only. The settings tab edits the global and project
80
- `goosedump` settings sections.
81
-
82
- ### Compaction
83
-
84
- pi-goosedump hooks Pi's `/compact` and auto-compaction flow. It resolves the
85
- current session to its goosedump id and runs `goosedump compact <id>` with Pi's
86
- compaction range (`--from`, `--until`, and `--scope`) so the generated summary
87
- matches the entries Pi is about to replace.
88
-
89
- An optional goosedump counter can also trigger compaction. `0` disables the counter;
90
- when it fires, it resets to its configured value.
62
+ Project settings override global settings. All settings live in a `goosedump`
63
+ section and are optional (defaults shown):
91
64
 
92
65
  ```json
93
66
  {
@@ -97,6 +70,32 @@ when it fires, it resets to its configured value.
97
70
  }
98
71
  ```
99
72
 
73
+ `turnsBeforeCompact` sets how many LLM turns elapse before goosedump triggers
74
+ compaction, as an integer 0–255. `0` disables the counter; when enabled, the
75
+ footer status shows `GD: XX` counting down in hex (e.g. `GD: 0A`), or
76
+ `GD: 00` when the counter is disabled.
77
+
78
+ ### Compaction flow
79
+
80
+ pi-goosedump hooks Pi's `session_before_compact` event — fired by manual
81
+ `/compact`, the turn counter above, and Pi's own auto-compaction — and
82
+ substitutes a goosedump summary for Pi's LLM summary. It resolves the current
83
+ session to its goosedump context by reading the `id` field from the session
84
+ header line, then runs `goosedump compact` over the replacement range:
85
+
86
+ - `--from` is the entry following the most recent prior compaction (so the
87
+ summary starts where the previous one left off); omitted on the first
88
+ compaction.
89
+ - `--until` is the first entry Pi is keeping (`firstKeptEntryId`).
90
+
91
+ goosedump composes the structured summary itself — including merging any prior
92
+ summary — and emits a native Pi compaction entry, from which the extension
93
+ extracts the `summary` field. A `keep:N` override (via `/goose-compact` or the
94
+ `goose_compact` tool) replaces Pi's token-based cut with a turn-based one:
95
+ summarize everything before the Nth-from-last user entry and keep the tail
96
+ verbatim. Fewer than N user turns cancels with a notice. On completion Pi
97
+ notifies the token reduction.
98
+
100
99
  ## License
101
100
 
102
101
  `pi-goosedump` is licensed under `MIT`. See [LICENSE](LICENSE) for more