opencode-lossless 0.1.0 → 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 +15 -0
- package/README.md +49 -235
- package/dist/index.d.mts +1 -16
- package/dist/index.mjs +29 -12240
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
- package/skills/opencode-lossless/SKILL.md +77 -0
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-lossless",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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",
|
|
7
7
|
"context",
|
|
8
8
|
"lcm",
|
|
9
9
|
"memory",
|
|
10
|
-
"opencode"
|
|
10
|
+
"opencode",
|
|
11
|
+
"tanstack-intent"
|
|
11
12
|
],
|
|
12
13
|
"homepage": "https://github.com/stainless-code/lossless#readme",
|
|
13
14
|
"bugs": {
|
|
@@ -22,7 +23,8 @@
|
|
|
22
23
|
},
|
|
23
24
|
"files": [
|
|
24
25
|
"dist",
|
|
25
|
-
"CHANGELOG.md"
|
|
26
|
+
"CHANGELOG.md",
|
|
27
|
+
"skills"
|
|
26
28
|
],
|
|
27
29
|
"type": "module",
|
|
28
30
|
"main": "./dist/index.mjs",
|
|
@@ -35,7 +37,7 @@
|
|
|
35
37
|
"scripts": {
|
|
36
38
|
"pack:watch": "vp pack --watch",
|
|
37
39
|
"prepack": "vp pack",
|
|
38
|
-
"prepublishOnly": "vp check && vp test"
|
|
40
|
+
"prepublishOnly": "vp check && vp test && intent validate"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
43
|
"@opencode/ai": "2.1.4",
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
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-gc; or tune the swap point."
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
type: composition
|
|
7
|
+
library: "opencode-lossless"
|
|
8
|
+
library_version: "0.1.2"
|
|
9
|
+
requires:
|
|
10
|
+
- lossless
|
|
11
|
+
sources:
|
|
12
|
+
- stainless-code/lossless:packages/opencode/src
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# opencode-lossless
|
|
16
|
+
|
|
17
|
+
Passive mirroring starts with zero config: every prompt, assistant reply, and tool exchange lands 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
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
opencode plugin add opencode-lossless
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Equivalent `opencode.json` entry:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{ "plugins": [{ "package": "opencode-lossless", "options": { "sidecarDir": "./.lossless" } }] }
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Commands
|
|
32
|
+
|
|
33
|
+
- `/lossless-status` — message and compaction summary counts per live sidecar.
|
|
34
|
+
- `/lossless-report` — this session's metrics: projection, checkpoint, pass, recall, reader.
|
|
35
|
+
- `/lossless-pass` — run one DAG pass over the aged span now, without waiting for the swap.
|
|
36
|
+
- `/lossless-heal` — dry-run repair of tainted summaries; `--apply` spends model calls.
|
|
37
|
+
- `/lossless-backup` — copy this session's sidecar beside it.
|
|
38
|
+
- `/lossless-export` — write the verbatim transcript and summaries as JSONL (mode 0600).
|
|
39
|
+
- `/lossless-import` — restore rows from an export.
|
|
40
|
+
- `/lossless-diagnose` — redacted, pasteable diagnostics block; `--save` writes it at mode 0600.
|
|
41
|
+
- `/lossless-migrate` — upgrade older-schema sidecars in place (dry-run by default).
|
|
42
|
+
- `/lossless-gc` — list old sidecars, or export and delete them (never the current session).
|
|
43
|
+
|
|
44
|
+
## Recall tools
|
|
45
|
+
|
|
46
|
+
- `lcm_grep` — full-text search over this session; `scope` reaches past sessions.
|
|
47
|
+
- `lcm_describe` — inspect one summary (kind, costs, children) without expanding it.
|
|
48
|
+
- `lcm_expand` — read the verbatim originals a summary covers.
|
|
49
|
+
- `lcm_expand_query` — a bounded child session reads and answers, so originals never enter the parent context.
|
|
50
|
+
|
|
51
|
+
## Config essentials
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{ "enabled": true, "sidecarDir": "./.lossless", "assembly": true }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- `sidecarDir` holds one SQLite file per session (0700 dir, 0600 files; delete one to forget that session).
|
|
58
|
+
- `assembly: true` (default) owns the context boundary: projection swaps aged history and compaction stores the DAG frontier.
|
|
59
|
+
- Every other key (swap thresholds, summarizer chain and budgets, heal window, reader timeout) lives on the config reference with its default: https://stainless-code.com/lossless/reference/opencode/config
|
|
60
|
+
|
|
61
|
+
## Verify
|
|
62
|
+
|
|
63
|
+
From a checkout of this repo (these scripts only exist there, not in a consumer project):
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
bun run opencode:check # read-only: host version, config, bundle hash, sidecar counts
|
|
67
|
+
bun run opencode:smoke # one real model call, asserts the verbatim mirror
|
|
68
|
+
bun run opencode:compact # compaction gate, makes real model calls
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Common mistakes
|
|
72
|
+
|
|
73
|
+
- **`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.
|
|
74
|
+
- **`scope` equivalence** — `scope: "session"` (default) reads this session only; pass `scope: "sessions"` or `"all_sessions"` to reach past sessions.
|
|
75
|
+
- **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.
|
|
76
|
+
- **Forgetting is file deletion** — remove that session's sidecar file; there is no delete tool.
|
|
77
|
+
- **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.
|