pi-lossless 0.1.1 → 0.1.2
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 +6 -0
- package/package.json +6 -4
- package/skills/pi-lossless/SKILL.md +83 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# pi-lossless
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- de419eb: Ship a versioned Intent skill with each package (`skills/<name>/SKILL.md` in the published tarball): install, command and recall vocabulary, config essentials, and common mistakes, stamped with the package version on release. Adds `skills` to each package's published files and validates skills on publish and in CI.
|
|
8
|
+
|
|
3
9
|
## 0.1.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-lossless",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Lossless Context Management for the Pi coding agent: long sessions keep working past the point where the model would forget, and every verbatim message stays searchable and readable (lcm_grep / lcm_describe / lcm_expand_query).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"coding-agent",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"lcm",
|
|
9
9
|
"memory",
|
|
10
10
|
"pi",
|
|
11
|
-
"pi-package"
|
|
11
|
+
"pi-package",
|
|
12
|
+
"tanstack-intent"
|
|
12
13
|
],
|
|
13
14
|
"homepage": "https://github.com/stainless-code/lossless#readme",
|
|
14
15
|
"bugs": "https://github.com/stainless-code/lossless/issues",
|
|
@@ -21,7 +22,8 @@
|
|
|
21
22
|
},
|
|
22
23
|
"files": [
|
|
23
24
|
"dist",
|
|
24
|
-
"CHANGELOG.md"
|
|
25
|
+
"CHANGELOG.md",
|
|
26
|
+
"skills"
|
|
25
27
|
],
|
|
26
28
|
"type": "module",
|
|
27
29
|
"main": "./dist/index.mjs",
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
"scripts": {
|
|
35
37
|
"pack:watch": "vp pack --watch",
|
|
36
38
|
"prepack": "vp pack",
|
|
37
|
-
"prepublishOnly": "vp check && vp test"
|
|
39
|
+
"prepublishOnly": "vp check && vp test && intent validate"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@earendil-works/pi-agent-core": "1.4.0",
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pi-lossless
|
|
3
|
+
description: "Use when a Pi session has pi-lossless installed: search compacted history with lcm_grep, lcm_describe, or lcm_expand_query; run /lcm status, settings, backup, export, report, doctor, gc, migrate, heal, or diagnose; or tune compaction thresholds."
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
type: composition
|
|
7
|
+
library: "pi-lossless"
|
|
8
|
+
library_version: "0.1.2"
|
|
9
|
+
requires: []
|
|
10
|
+
sources:
|
|
11
|
+
- stainless-code/lossless:packages/pi/src
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# pi-lossless
|
|
15
|
+
|
|
16
|
+
Aged conversation becomes DAG summaries the model can navigate; the full
|
|
17
|
+
verbatim history stays searchable and recoverable. Session file is never
|
|
18
|
+
modified; the store (`~/.pi/agent/lcm/`, plaintext SQLite, chmod 0600) is a
|
|
19
|
+
derived index that can be deleted and rebuilt.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pi install npm:pi-lossless
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Passive logging starts immediately with zero config; swaps begin past the
|
|
28
|
+
soft threshold (default 70% of the model window).
|
|
29
|
+
|
|
30
|
+
## /lcm subcommands
|
|
31
|
+
|
|
32
|
+
- `/lcm` — same as `/lcm status` (default subcommand).
|
|
33
|
+
- `/lcm status` — current projection state: messages, pin, occupancy, thresholds.
|
|
34
|
+
- `/lcm settings` — the LCM Cockpit: live gauge, cycle-edit every threshold (TUI only).
|
|
35
|
+
- `/lcm backup` — copy the live store to a timestamped file.
|
|
36
|
+
- `/lcm export` — write the full store as JSONL (verbatim bytes, secrets included).
|
|
37
|
+
- `/lcm report` — metrics summary for the current session.
|
|
38
|
+
- `/lcm doctor` — diagnostics: store checks, thresholds, summarizer chain, footprint; `--repair` rebuilds the index and drops unreachable rows.
|
|
39
|
+
- `/lcm gc` — dry-run list of retired stores; `--apply` exports then DELETEs them (destructive; export lands beside the stores).
|
|
40
|
+
- `/lcm migrate` — dry-run list of older-schema stores; `--apply` upgrades them in place for cross-session search.
|
|
41
|
+
- `/lcm heal` — dry-run repair of tainted summaries; `--apply` spends model calls, `--max-nodes <n>` bounds the run.
|
|
42
|
+
- `/lcm diagnose` — one pasteable block for a bug report; `--save <path>` writes it to a file (mode 0600, capped at 8 KB, no message bodies).
|
|
43
|
+
|
|
44
|
+
## Recall tools
|
|
45
|
+
|
|
46
|
+
- `lcm_grep` — search ALL history, including compacted-out content. `query` is full-text over the token index (words, quoted phrases, `AND`/`OR`, prefixes; first 100,000 chars per message). `pattern` is a case-insensitive regex over full text (up to 200,000 chars per message, 1s cap per call) — use it for pointers, calls, punctuation, or spans the index cannot hold. Hits page 20 at a time via `offset`; `query` reports a total, `pattern` reports whether more exist. `summary_id` scopes to one node; `scope: "sessions"` / `"all_sessions"` reaches past sessions.
|
|
47
|
+
- `lcm_describe` — inspect a summary: what reading its originals would cost and which files it covers.
|
|
48
|
+
- `lcm_expand_query` — bounded reader over stored originals; returns findings without that text entering the main conversation. Default budget 10,000 tokens over at most 6 reader turns; `max_tokens` changes the per-call budget. `summary_id` reads one node, `entry_id` one message. Cross-session: `lcm_expand_query({ session: "<hash>", entry_id: "<id>" })` on a grep hit; findings are tagged as past-session history. Unknown ids are refused before any model call.
|
|
49
|
+
|
|
50
|
+
Reach for recall tools when the answer is in history; reach for subcommands when acting on the store (backup, repair, migrate, gc, diagnose).
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
lcm_grep({ query: "migration plan", scope: "sessions", limit: 20 });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Config (`~/.pi/agent/lcm.json`, strict JSON)
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"smartZone": 110000,
|
|
61
|
+
"zones": {
|
|
62
|
+
"openrouter/z-ai/glm-5.3-flash": { "swapAtTokens": 110000, "recutAtTokens": 130000 }
|
|
63
|
+
},
|
|
64
|
+
"swapAtRatio": 0.7,
|
|
65
|
+
"recutAtRatio": 0.85,
|
|
66
|
+
"summarizer": ["openrouter/z-ai/glm-5.3-flash", "anthropic/claude-haiku-4-5", "auto"]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- `smartZone`: easy mode, one number; recut derived (x1.18).
|
|
71
|
+
- `zones`: per-model overrides keyed `"provider/id"` (thresholds only); explicit tokens beat ratios.
|
|
72
|
+
- `swapAtRatio` / `recutAtRatio`: ratio mode, the default when no token thresholds are set.
|
|
73
|
+
- `summarizer`: one model or an ordered fallback chain. No comma form (ids may contain commas). `auto` is the session model only, never "something cheap"; unset behaves as `auto`. Tried in order on missing/failing/empty output; failures demote to the back for the pass. `/lcm doctor` prints the chain that actually runs.
|
|
74
|
+
- Corrupt file is left untouched with defaults applied; out-of-range numbers and wrong types are ignored. Overwrites back up to `lcm.json.bak`.
|
|
75
|
+
- Full key list (largeFileChars, per-call and per-pass budgets, heal budgets, redaction flag) with defaults: https://stainless-code.com/lossless/reference/pi/config
|
|
76
|
+
|
|
77
|
+
## Common mistakes
|
|
78
|
+
|
|
79
|
+
- **Expecting the settings UI outside the TUI** — `/lcm settings` is an interactive cockpit; in print/RPC mode there is no live gauge, use `/lcm status` and `/lcm doctor`.
|
|
80
|
+
- **`query` vs `pattern` confusion** — `query` cannot see punctuation, ids, or spans; anything a pointer, call signature, or exact span needs must be `pattern`.
|
|
81
|
+
- **Assuming cross-session search is unbounded** — stops at 20 stores, 40 hits, or 1.5s, whichever comes first; older-generation stores are counted, not read, until `/lcm migrate`.
|
|
82
|
+
- **Treating a gc transcript as searchable** — a store `/lcm gc` deletes is no longer readable by any scope; the export beside the stores keeps bytes only.
|
|
83
|
+
- **Disabling redaction and expecting disk changes** — `redactSecrets: false` (config flag, default on) affects outbound reads only; stored rows are never rewritten.
|