opencode-lossless 0.1.2 → 0.1.3
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 +13 -0
- package/README.md +18 -13
- package/dist/index.d.mts +18 -65
- package/dist/index.mjs +643 -75
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/skills/opencode-lossless/SKILL.md +31 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-lossless",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Lossless Context Management for OpenCode v2: long sessions keep working past the point where the model would forget, and every verbatim message stays searchable and readable.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"coding-agent",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: opencode-lossless
|
|
3
|
-
description: "Use when an OpenCode v2 session has opencode-lossless installed: read compacted history with lcm_grep, lcm_describe, lcm_expand, or lcm_expand_query; run /lossless-status, /lossless-report, /lossless-pass, /lossless-heal, /lossless-backup, /lossless-export, /lossless-import, /lossless-diagnose, /lossless-migrate, or /lossless-
|
|
3
|
+
description: "Use when an OpenCode v2 session has opencode-lossless installed: read compacted history with lcm_grep, lcm_describe, lcm_expand, or lcm_expand_query; run /lossless-status, /lossless-report, /lossless-pass, /lossless-heal, /lossless-backup, /lossless-export, /lossless-import, /lossless-diagnose, /lossless-migrate, /lossless-gc, or /lossless-dump; or tune the swap point."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
type: composition
|
|
7
7
|
library: "opencode-lossless"
|
|
8
|
-
library_version: "0.1.
|
|
8
|
+
library_version: "0.1.3"
|
|
9
9
|
requires:
|
|
10
10
|
- lossless
|
|
11
11
|
sources:
|
|
@@ -14,7 +14,7 @@ sources:
|
|
|
14
14
|
|
|
15
15
|
# opencode-lossless
|
|
16
16
|
|
|
17
|
-
Passive mirroring starts with
|
|
17
|
+
Passive mirroring starts with no configuration. The adapter stores every prompt, assistant reply, and tool exchange in a per-session SQLite sidecar. Past the swap point the DAG projection replaces aged history, and on host compaction the adapter hands over the frontier as the checkpoint instead of a summary.
|
|
18
18
|
|
|
19
19
|
## Install
|
|
20
20
|
|
|
@@ -25,28 +25,31 @@ opencode plugin add opencode-lossless
|
|
|
25
25
|
Equivalent `opencode.json` entry:
|
|
26
26
|
|
|
27
27
|
```json
|
|
28
|
-
{ "plugins": [{ "package": "opencode-lossless"
|
|
28
|
+
{ "plugins": [{ "package": "opencode-lossless" }] }
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
To keep sidecars inside the project, set `sidecarDir` to `"./.lossless"`.
|
|
32
|
+
|
|
31
33
|
## Commands
|
|
32
34
|
|
|
33
|
-
- `/lossless-status
|
|
34
|
-
- `/lossless-report
|
|
35
|
-
- `/lossless-pass
|
|
36
|
-
- `/lossless-heal
|
|
37
|
-
- `/lossless-backup
|
|
38
|
-
- `/lossless-export
|
|
39
|
-
- `/lossless-import
|
|
40
|
-
- `/lossless-diagnose
|
|
41
|
-
- `/lossless-migrate
|
|
42
|
-
- `/lossless-gc
|
|
35
|
+
- `/lossless-status`, message and compaction summary counts per live sidecar.
|
|
36
|
+
- `/lossless-report`, this session's metrics: projection, checkpoint, pass, recall, reader.
|
|
37
|
+
- `/lossless-pass`, run one DAG pass over the aged span now, without waiting for the swap.
|
|
38
|
+
- `/lossless-heal`, dry-run repair of tainted summaries. `--apply` spends model calls.
|
|
39
|
+
- `/lossless-backup`, copy this session's sidecar beside it.
|
|
40
|
+
- `/lossless-export`, write the verbatim transcript and summaries as JSONL (mode 0600).
|
|
41
|
+
- `/lossless-import`, restore rows from an export.
|
|
42
|
+
- `/lossless-diagnose`, redacted, pasteable diagnostics block. `--save` writes it at mode 0600.
|
|
43
|
+
- `/lossless-migrate`, upgrade older-schema sidecars in place (dry-run by default).
|
|
44
|
+
- `/lossless-gc`, list old sidecars, or export and delete them (never the current session).
|
|
45
|
+
- `/lossless-dump`, read-only dump of the session sidecar. `--include-removed` keeps removed-branch rows, `--save` writes the output to a file at mode 0600.
|
|
43
46
|
|
|
44
47
|
## Recall tools
|
|
45
48
|
|
|
46
|
-
- `lcm_grep`
|
|
47
|
-
- `lcm_describe`
|
|
48
|
-
- `lcm_expand`
|
|
49
|
-
- `lcm_expand_query`
|
|
49
|
+
- `lcm_grep` searches full text over this session, and `scope` reaches past sessions. `role` keeps only rows stored with that role, `date_start` and `date_end` bound rows by timestamp, and `tool_name` keeps only tool-result rows for that tool.
|
|
50
|
+
- `lcm_describe` inspects one summary (kind, costs, children) without expanding it.
|
|
51
|
+
- `lcm_expand` reads the verbatim originals a summary covers, and `anchor` centers the listing on one entry.
|
|
52
|
+
- `lcm_expand_query` runs a bounded child session that reads and answers, so originals never enter the parent context.
|
|
50
53
|
|
|
51
54
|
## Config essentials
|
|
52
55
|
|
|
@@ -54,9 +57,11 @@ Equivalent `opencode.json` entry:
|
|
|
54
57
|
{ "enabled": true, "sidecarDir": "./.lossless", "assembly": true }
|
|
55
58
|
```
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
+
The example stores sidecars in the project. Without `sidecarDir`, the plugin uses the global auto-detected path, which holds sessions from every project. The config reference lists the exact paths at https://stainless-code.com/lossless/reference/opencode/config
|
|
61
|
+
|
|
62
|
+
- `sidecarDir` holds one SQLite file per session (0700 dir, 0600 files). Delete one to forget that session. After upgrading a project that used `./.lossless`, keep `sidecarDir` set to `"./.lossless"` to keep that history: `/lossless-migrate` works in place in the configured directory only (dry run by default, moves nothing). To carry history elsewhere, `/lossless-export` each session under the old config and `/lossless-import` into an empty store under the new one, or stop the server first and copy the `.sqlite`, `-wal`, and `-shm` files across and then migrate.
|
|
63
|
+
- `assembly: true` (default) owns the context boundary. Projection swaps aged history and compaction stores the DAG frontier.
|
|
64
|
+
- The config reference documents every other key and its default: swap thresholds, summarizer chain and budgets, heal window, and reader timeout. See https://stainless-code.com/lossless/reference/opencode/config
|
|
60
65
|
|
|
61
66
|
## Verify
|
|
62
67
|
|
|
@@ -70,8 +75,8 @@ bun run opencode:compact # compaction gate, makes real model calls
|
|
|
70
75
|
|
|
71
76
|
## Common mistakes
|
|
72
77
|
|
|
73
|
-
- **`assembly: false` drops `/lossless-pass` and `lcm_expand_query
|
|
74
|
-
- **`scope` equivalence
|
|
75
|
-
- **Reader is session-scoped
|
|
76
|
-
- **Forgetting is file deletion
|
|
77
|
-
- **Expecting host compaction to summarize
|
|
78
|
+
- **`assembly: false` drops `/lossless-pass` and `lcm_expand_query`.** Keep the default `true` unless the host must own compaction. With `false`, compaction falls back to the host.
|
|
79
|
+
- **`scope` equivalence.** `scope: "session"` (default) reads this session only. Pass `scope: "sessions"` or `"all_sessions"` to reach past sessions.
|
|
80
|
+
- **Reader is session-scoped.** `lcm_expand_query` returns findings only through its child session, never the raw transcript. Ask a question it can answer from the sources, not for a dump.
|
|
81
|
+
- **Forgetting is file deletion.** Remove that session's sidecar file. There is no delete tool.
|
|
82
|
+
- **Expecting host compaction to summarize.** With assembly on, the checkpoint is the DAG frontier, not a prose summary. Read it with `lcm_describe`, not by asking the host.
|