@hypercarrier/rarebit 0.1.0-alpha.5 → 0.2.0

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 (38) hide show
  1. package/CHANGELOG.md +24 -2
  2. package/README.md +96 -20
  3. package/RUNBOOK.md +32 -9
  4. package/bin/piq.mjs +14 -0
  5. package/docs/examples/rarebit.settings.json +19 -0
  6. package/package.json +29 -3
  7. package/scripts/e2e-fork-pi.mjs +824 -0
  8. package/scripts/e2e-recap-pi.mjs +456 -0
  9. package/scripts/e2e-settings-pi.mjs +267 -0
  10. package/scripts/e2e-v020-pi.mjs +269 -0
  11. package/scripts/verify-package.mjs +20 -12
  12. package/src/extension.mjs +280 -21
  13. package/src/index.mjs +1 -0
  14. package/src/lifecycle.mjs +32 -7
  15. package/src/pi-session.mjs +237 -0
  16. package/src/piq-cli.mjs +96 -0
  17. package/src/piq.mjs +265 -0
  18. package/src/rarebit-activity.mjs +8 -2
  19. package/src/rarebit-cli.mjs +103 -5
  20. package/src/rarebit-command.mjs +29 -1
  21. package/src/rarebit-core.mjs +87 -9
  22. package/src/rarebit-fork-lineage.mjs +69 -0
  23. package/src/rarebit-fork.mjs +241 -0
  24. package/src/rarebit-recap.mjs +422 -0
  25. package/src/rarebit-service.mjs +60 -7
  26. package/src/rarebit-session.mjs +12 -160
  27. package/src/rarebit-settings-ui.mjs +479 -0
  28. package/src/rarebit-settings.mjs +90 -7
  29. package/src/types.d.ts +91 -3
  30. package/test/lifecycle-contract-independent.test.mjs +2 -0
  31. package/test/package-artifact-identity.test.mjs +54 -0
  32. package/test/piq.test.mjs +212 -0
  33. package/test/rarebit-command.test.mjs +11 -4
  34. package/test/rarebit-fork.test.mjs +124 -0
  35. package/test/rarebit-recap.test.mjs +513 -0
  36. package/test/rarebit-settings-ui.test.mjs +388 -0
  37. package/test/rarebit-v020.test.mjs +294 -0
  38. package/test/summary-attention-independent.test.mjs +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 — 2026-09-27
4
+
5
+ - Add the `/rarebit` action palette and tabbed `/rarebit settings` editor.
6
+ - Add a configurable `summary_prompt` for Summary format and length. Preserve
7
+ paragraphs and bullets; reject oversized output instead of silently cutting it.
8
+ - Show the complete Recap in a muted, labelled TUI section. Remove
9
+ `/rarebit recap expand`.
10
+ - Keep Recap outside Session messages and model context. Typing preserves it;
11
+ submitted input, new turns, and Session or branch changes clear it.
12
+ - Default Summary diagnostics to off, support host or explicit IANA timezones,
13
+ and expose the estimated Summary input budget in settings.
14
+ - Include a complete example config in `docs/examples/rarebit.settings.json`.
15
+
16
+ ## 0.1.0-alpha.6 — 2026-09-21
17
+
18
+ - Add bounded `/rarebit fork` and CLI fork flows with native Pi headroom checks.
19
+ - Add PiQ read-only recovery, machine-only lineage, repeat-fork ancestry, and
20
+ activity exclusion for imported entries.
21
+ - Keep read-only package commands usable without optional Pi host peers; fork
22
+ runtime loads the Pi adapter only when needed.
23
+
3
24
  ## 0.1.0-alpha.5 — 2026-08-16
4
25
 
5
26
  - Repair Pi 0.84.2 Summary calls to use the active Pi model runtime. The
@@ -7,8 +28,9 @@
7
28
  - Declare the unbounded Pi AI peer range from Pi 0.83.0. The release gate runs
8
29
  Recall against Pi 0.83.0 and Pi 0.84.2.
9
30
 
10
- This is an unpublished local release candidate. Intended npm routing after
11
- publication is `next=alpha.5` and `latest=alpha.4`.
31
+ Published through GitHub Actions OIDC to npm `next`; `latest` remains alpha.4.
32
+ The exact source, package, registry, provenance, and GitHub prerelease evidence
33
+ is in the [alpha.5 release receipt](release/v0.1.0-alpha.5-release-receipt.md).
12
34
 
13
35
  ## 0.1.0-alpha.4 — 2026-08-02
14
36
 
package/README.md CHANGED
@@ -10,15 +10,15 @@ and visual language can change. It is not a Task, Project, runtime, priority,
10
10
  attention, or delivery authority. Native Pi Session JSONL remains the evidence
11
11
  authority.
12
12
 
13
- Alpha.5 is an unpublished local candidate that repairs Pi 0.84.2 Summary
14
- calls by using the active Pi model runtime. The injected Pi AI completion path
15
- remains the fallback for hosts without that runtime registry. Intended npm
16
- routing after publication is `next=alpha.5` and `latest=alpha.4`.
13
+ Rarebit is released from an immutable version tag by
14
+ [`.github/workflows/publish.yml`](.github/workflows/publish.yml). The workflow
15
+ runs the package gates, verifies one packed artifact, scans that artifact, and
16
+ publishes it with npm provenance. Install the exact version required by your
17
+ Pi host.
17
18
 
18
19
  The old alpha.1, alpha.2, and alpha.3 tag graphs remain public and are not
19
- privacy-clean. Existing alpha.1 through alpha.4 tags, releases, and npm
20
- artifacts remain immutable. The source-only candidate derivation and
21
- vendored-scanner binding is
20
+ privacy-clean. Existing package versions, tags, and releases remain immutable.
21
+ The source-only candidate derivation and vendored-scanner binding is
22
22
  [`release/privacy-lineage.v1.json`](release/privacy-lineage.v1.json). It is
23
23
  excluded from npm and does not claim publication completion.
24
24
 
@@ -27,7 +27,7 @@ excluded from npm and does not claim publication completion.
27
27
  Use Node 22 or later and Pi 0.83 or later. Install it in Pi from npm:
28
28
 
29
29
  ```sh
30
- pi install npm:@hypercarrier/rarebit@0.1.0-alpha.5
30
+ pi install npm:@hypercarrier/rarebit@0.2.0
31
31
  pi list
32
32
  ```
33
33
 
@@ -46,7 +46,7 @@ To use the CLI in a normal Node project, install it and invoke the local bin
46
46
  with npm:
47
47
 
48
48
  ```sh
49
- npm install @hypercarrier/rarebit@0.1.0-alpha.5
49
+ npm install @hypercarrier/rarebit@0.2.0
50
50
  npm exec -- rarebit --help
51
51
  ```
52
52
 
@@ -60,14 +60,54 @@ npm exec -- rarebit query --session /absolute/path/to/session.jsonl --json
60
60
  npm exec -- rarebit extract --session /absolute/path/to/session.jsonl --json
61
61
  ```
62
62
 
63
- The Pi extension adds `/rarebit` controls after installation. It has `status`,
64
- `config`, `auto-title`, `title`, `summarize`, and `recall` subcommands.
63
+ The Pi extension adds one `/rarebit` parent command. In the TUI, the bare
64
+ command opens an action palette. `/rarebit settings` opens a tabbed editor
65
+ with Actions, Summary, Recap, and Session sections. Choose global settings or
66
+ a trusted Project override; each field shows its effective value and source.
67
+ Edits require Save confirmation. Blank input or Remove override restores
68
+ inheritance. Settings apply to future operations; disabling automatic Recap
69
+ also clears its pending or visible widget.
70
+
71
+ Direct `help`, `status`, `settings`, `config`, `auto-title`, `title`, `recap`,
72
+ `summarize`, `recall`, and `fork` subcommands remain available. Use
73
+ `/rarebit settings global` or `/rarebit settings project` to choose the editing
74
+ scope directly. `recap` reads the current Summary receipt and renders the
75
+ complete multiline Summary in the TUI. It never starts synthesis.
76
+
77
+ `/rarebit fork` validates the newest contiguous Rarebit suffix, writes a new
78
+ Session in Pi's Session store for the current working directory, and switches
79
+ to it without starting a model turn. Use `/rarebit fork --max-token-length 64000` to set the
80
+ imported prose budget. Imported messages keep their roles and source outcomes,
81
+ use zero usage, and carry machine-only lineage. The generated opening message
82
+ records source ID/path/leaf, target directory, coverage, and the read-only PiQ
83
+ recovery command. Legacy source entries retain `(sessionId, sourceOrder)` when
84
+ native entry IDs are absent; Rarebit does not migrate those sources.
85
+
86
+ The CLI performs the same operation without changing the caller's Session:
87
+
88
+ ```sh
89
+ rarebit fork /absolute/source.jsonl
90
+ rarebit fork /absolute/source.jsonl --max-token-length 64000 --no-launch
91
+ ```
92
+
93
+ The first form launches Pi in the invocation working directory. The second
94
+ returns JSON for automation. Fork mode requires an installed Pi coding-agent
95
+ peer; read-only query, extract, and PiQ commands do not. Use `piq entries
96
+ --session <path>` to read omitted native evidence without writing or migrating
97
+ the source.
65
98
 
66
99
  ## Model setup and optional derivations
67
100
 
68
101
  Summary and Title use a dedicated configured model. They never inherit Pi's
69
- interactive `defaultModel`. Put this in global Pi settings, or in a trusted
70
- project's `.pi/settings.json`:
102
+ interactive `defaultModel`. Start with
103
+ [the example config](docs/examples/rarebit.settings.json). Merge its `rarebit`
104
+ object into global Pi settings (`~/.pi/agent/settings.json`, or
105
+ `$PI_CODING_AGENT_DIR/settings.json` when set), or a trusted project's
106
+ `.pi/settings.json`. Preserve other settings and select a model available
107
+ through your authenticated provider. The example includes all Pi extension
108
+ settings with their defaults; its model is an example choice.
109
+
110
+ The configuration shape is:
71
111
 
72
112
  ```json
73
113
  {
@@ -75,11 +115,48 @@ project's `.pi/settings.json`:
75
115
  "model": "provider/model",
76
116
  "min_total_length": 80000,
77
117
  "max_rarebit_ratio": 0.4,
78
- "auto_title": true
118
+ "auto_title": true,
119
+ "max_input_tokens": 64000,
120
+ "summary_prompt": "The summary is free-form prose. State when evidence is uncertain, confusing, contradictory, or importantly missing instead of inventing a coherent account.",
121
+ "diagnostics": {
122
+ "summary_triggered": false,
123
+ "summary_updated": false
124
+ },
125
+ "recap": {
126
+ "enabled": true,
127
+ "delay_ms": 60000,
128
+ "timezone": "host"
129
+ }
79
130
  }
80
131
  }
81
132
  ```
82
133
 
134
+ After a successful automatic or explicit Summary materialization, the Pi TUI
135
+ offers the current Summary above the editor after one minute. The offer stays
136
+ visible while you type and clears when Pi sends input, starts a new turn,
137
+ changes Session or branch, or shuts down. Set `rarebit.recap.enabled` to
138
+ `false` to disable the offer, or change `rarebit.recap.delay_ms` to adjust the
139
+ delay. Set `rarebit.recap.timezone` to `host` or an IANA time zone such as
140
+ `Asia/Hong_Kong` to format the Recap header. The header identifies the host
141
+ zone or selected IANA zone and its offset at the observation time. The widget
142
+ reads an existing receipt and never adds a Session message. In the Pi extension,
143
+ `max_input_tokens` limits the Summary prompt by the existing
144
+ `ceil(prompt characters / 4)` estimate. It
145
+ defaults to 64,000 estimated input tokens and is not a provider output limit.
146
+ Summary trigger and update notifications stay off unless
147
+ `rarebit.diagnostics.summary_triggered` or
148
+ `rarebit.diagnostics.summary_updated` is enabled.
149
+
150
+ `rarebit.summary_prompt` is one scalar guidance string. It uses the default
151
+ guidance shown in the example when omitted. The editor accepts multiline text,
152
+ preserves its line breaks, and trims only outer whitespace. A blank value
153
+ removes the override. The fixed evidence and JSON status contract remains
154
+ owned by Rarebit. Keep custom guidance to a few short bullets so it leaves room
155
+ for evidence in the configured Summary input budget. The editor rejects unsafe
156
+ control characters and guidance longer than 64,000 UTF-16 characters. This
157
+ guidance bound is separate from the 8,000-character Summary output safety
158
+ limit.
159
+
83
160
  Then request explicit model work when you want it:
84
161
 
85
162
  ```sh
@@ -127,17 +204,16 @@ sensitive. Do not put their paths or content in a ticket.
127
204
 
128
205
  ## Update, uninstall, and rollback
129
206
 
130
- Pin alpha versions for reproducible installs:
207
+ Pin a version for reproducible installs:
131
208
 
132
209
  ```sh
133
- pi install npm:@hypercarrier/rarebit@0.1.0-alpha.5
210
+ pi install npm:@hypercarrier/rarebit@0.2.0
134
211
  pi remove npm:@hypercarrier/rarebit
135
212
  ```
136
213
 
137
214
  The exact-version install also moves an existing Rarebit npm installation to
138
- that pin. Pi skips versioned npm sources during package updates. Do not use an
139
- unpinned source for alpha.5 recovery: unpinned npm resolution follows the
140
- retained `latest`, which remains alpha.4.
215
+ that pin. Pi skips versioned npm sources during package updates. Restart Pi
216
+ after installation to load the new extension code.
141
217
 
142
218
  To roll back, reinstall a known version with `pi install npm:@hypercarrier/rarebit@<version>`.
143
219
  Removal stops package loading. It does not alter Pi Session JSONL or delete
@@ -146,7 +222,7 @@ only after you review it.
146
222
 
147
223
  ## Compatibility and support
148
224
 
149
- This alpha supports Node 22+ and Pi 0.83.0 or later. Its Pi AI peer has no
225
+ Rarebit supports Node 22+ and Pi 0.83.0 or later. Its Pi AI peer has no
150
226
  upper bound. The release gate runs Recall against Pi 0.83.0 and Pi 0.84.2. It
151
227
  works as a deterministic CLI without a model. Summary, Title, and the Pi
152
228
  extension require a compatible Pi installation and configured provider
package/RUNBOOK.md CHANGED
@@ -1,20 +1,27 @@
1
1
  # Rarebit runbook
2
2
 
3
- This runbook applies to `0.1.0-alpha.5`. This candidate repairs Pi 0.84.2
4
- Summary calls by using the active Pi model runtime. The injected Pi AI completion
5
- path remains the fallback for hosts without that runtime registry. See
6
- [CHANGELOG.md](CHANGELOG.md) for release details.
3
+ Rarebit release automation lives in
4
+ [`.github/workflows/publish.yml`](.github/workflows/publish.yml). It validates
5
+ an immutable version tag, runs the package gates, verifies one packed artifact,
6
+ and publishes that artifact with npm provenance. See [CHANGELOG.md](CHANGELOG.md)
7
+ for product changes.
7
8
 
8
9
  Set `rarebit.model` in global Pi settings or in a trusted Project's
9
10
  `.pi/settings.json`. It must be `provider/model` or an object with `provider`
10
11
  and `id`. Rarebit fails closed when it is missing or invalid. It does not use
11
12
  Pi's interactive `defaultModel`.
12
13
 
13
- Install or move this package to the alpha.5 pin with
14
- `pi install npm:@hypercarrier/rarebit@0.1.0-alpha.5`. Pi treats versioned npm
15
- sources as pinned, so package update commands skip it. Do not use an unpinned
16
- source for alpha.5 recovery: unpinned npm resolution follows the retained
17
- `latest`, which remains alpha.4. Run `pi remove npm:@hypercarrier/rarebit` to
14
+ Use `/rarebit settings` to edit the dedicated namespace. `summary_prompt`
15
+ changes the Summary text's format and length; the evidence and structured
16
+ status rules remain fixed. Remove the override to restore the built-in prompt.
17
+ If a response exceeds the 8,000-character safety limit, request a shorter
18
+ Summary in the prompt and run `/rarebit summarize` again. Oversized output
19
+ fails explicitly instead of producing a cut-off Recap.
20
+
21
+ Install or move this package to an exact version with
22
+ `pi install npm:@hypercarrier/rarebit@<version>`. Pi treats versioned npm
23
+ sources as pinned, so package update commands skip it. Run `pi remove
24
+ npm:@hypercarrier/rarebit` to
18
25
  stop loading it. These commands do not modify native Sessions or remove Rarebit
19
26
  retained data.
20
27
 
@@ -25,6 +32,22 @@ npm exec -- rarebit query --session <exact-session.jsonl> --json
25
32
  npm exec -- rarebit extract --session <exact-session.jsonl> --json
26
33
  ```
27
34
 
35
+ To recover omitted source evidence, use the read-only PiQ binary:
36
+
37
+ ```sh
38
+ node ./bin/piq.mjs entries --session <exact-session.jsonl>
39
+ ```
40
+
41
+ `rarebit fork <source-path>` uses the invocation directory and Pi's normal
42
+ Session store, then launches Pi in the new Session. Add `--no-launch` for JSON
43
+ automation. Fork admission uses the target model's native
44
+ `contextWindow - reserveTokens` threshold plus prompt, tool, and per-message
45
+ rounding overhead. It refuses before switching when the seed lacks headroom.
46
+ The aggregate imported-prose budget remains `ceil(total UTF-16 characters / 4)`.
47
+ Imported entries have fork-time timestamps. Original timestamps and source model
48
+ identity remain in machine-only lineage. Legacy entries without native IDs use
49
+ `(source Session ID, sourceOrder)` and remain unmigrated.
50
+
28
51
  The current protocol reads only `materializations-v4`. A `rarebit_head` is the
29
52
  fenced semantic-current pointer. Do not select the physical last JSONL line.
30
53
 
package/bin/piq.mjs ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ import { PIQ_CLI_USAGE, parsePiQCliArgs, runPiQCli } from "../src/piq-cli.mjs";
3
+
4
+ try {
5
+ const options = parsePiQCliArgs(process.argv.slice(2));
6
+ if (options.help) process.stdout.write(`${PIQ_CLI_USAGE}\n`);
7
+ else {
8
+ const records = await runPiQCli(options);
9
+ for (const record of records) process.stdout.write(`${JSON.stringify(record)}\n`);
10
+ }
11
+ } catch (error) {
12
+ process.stderr.write(`${error?.message ?? String(error)}\n${PIQ_CLI_USAGE}\n`);
13
+ process.exitCode = 1;
14
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "rarebit": {
3
+ "model": "openai-codex/gpt-5.6-luna",
4
+ "min_total_length": 80000,
5
+ "max_rarebit_ratio": 0.4,
6
+ "auto_title": true,
7
+ "max_input_tokens": 64000,
8
+ "summary_prompt": "The summary is free-form prose. State when evidence is uncertain, confusing, contradictory, or importantly missing instead of inventing a coherent account.",
9
+ "diagnostics": {
10
+ "summary_triggered": false,
11
+ "summary_updated": false
12
+ },
13
+ "recap": {
14
+ "enabled": true,
15
+ "delay_ms": 60000,
16
+ "timezone": "host"
17
+ }
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypercarrier/rarebit",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.2.0",
4
4
  "description": "Sparse, provenance-bearing conversational evidence recovery for Pi sessions.",
5
5
  "license": "MIT",
6
6
  "author": "HyperCarrier contributors",
@@ -24,20 +24,36 @@
24
24
  },
25
25
  "types": "./src/types.d.ts",
26
26
  "bin": {
27
- "rarebit": "./bin/rarebit.mjs"
27
+ "rarebit": "./bin/rarebit.mjs",
28
+ "piq": "./bin/piq.mjs"
28
29
  },
29
30
  "scripts": {
30
31
  "test": "node --test test/*.test.mjs",
32
+ "test:e2e:tui": "node scripts/e2e-v020-pi.mjs",
31
33
  "test:e2e:summary-cache": "node scripts/e2e-summary-cache.mjs",
32
34
  "test:e2e:recall": "node scripts/e2e-recall-pi0842.mjs",
33
35
  "test:e2e:recall:pi083": "node scripts/e2e-recall-pi083.mjs",
34
36
  "verify:package": "node scripts/verify-package.mjs"
35
37
  },
36
38
  "peerDependencies": {
37
- "@earendil-works/pi-ai": ">=0.83.0"
39
+ "@earendil-works/pi-ai": ">=0.83.0",
40
+ "@earendil-works/pi-coding-agent": ">=0.83.0",
41
+ "@earendil-works/pi-tui": ">=0.83.0"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "@earendil-works/pi-ai": {
45
+ "optional": true
46
+ },
47
+ "@earendil-works/pi-coding-agent": {
48
+ "optional": true
49
+ },
50
+ "@earendil-works/pi-tui": {
51
+ "optional": true
52
+ }
38
53
  },
39
54
  "devDependencies": {
40
55
  "@earendil-works/pi-coding-agent": "0.84.2",
56
+ "@earendil-works/pi-tui": "0.84.2",
41
57
  "ajv": "^6.15.0",
42
58
  "typescript": "^5.9.3"
43
59
  },
@@ -67,6 +83,14 @@
67
83
  "types": "./src/types.d.ts",
68
84
  "import": "./src/rarebit-artifact-state.mjs"
69
85
  },
86
+ "./fork": {
87
+ "types": "./src/types.d.ts",
88
+ "import": "./src/rarebit-fork.mjs"
89
+ },
90
+ "./fork-lineage": {
91
+ "types": "./src/types.d.ts",
92
+ "import": "./src/rarebit-fork-lineage.mjs"
93
+ },
70
94
  "./visual-language": {
71
95
  "types": "./src/types.d.ts",
72
96
  "import": "./src/rarebit-visual-language.mjs"
@@ -83,8 +107,10 @@
83
107
  },
84
108
  "files": [
85
109
  "bin/rarebit.mjs",
110
+ "bin/piq.mjs",
86
111
  "src",
87
112
  "schemas",
113
+ "docs/examples/rarebit.settings.json",
88
114
  "scripts",
89
115
  "test",
90
116
  "README.md",