opencode-lossless 0.1.1 → 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/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "opencode-lossless",
3
- "version": "0.1.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",
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,82 @@
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, /lossless-gc, or /lossless-dump; or tune the swap point."
4
+ license: MIT
5
+ metadata:
6
+ type: composition
7
+ library: "opencode-lossless"
8
+ library_version: "0.1.3"
9
+ requires:
10
+ - lossless
11
+ sources:
12
+ - stainless-code/lossless:packages/opencode/src
13
+ ---
14
+
15
+ # opencode-lossless
16
+
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
+
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" }] }
29
+ ```
30
+
31
+ To keep sidecars inside the project, set `sidecarDir` to `"./.lossless"`.
32
+
33
+ ## Commands
34
+
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.
46
+
47
+ ## Recall tools
48
+
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.
53
+
54
+ ## Config essentials
55
+
56
+ ```json
57
+ { "enabled": true, "sidecarDir": "./.lossless", "assembly": true }
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
65
+
66
+ ## Verify
67
+
68
+ From a checkout of this repo (these scripts only exist there, not in a consumer project):
69
+
70
+ ```sh
71
+ bun run opencode:check # read-only: host version, config, bundle hash, sidecar counts
72
+ bun run opencode:smoke # one real model call, asserts the verbatim mirror
73
+ bun run opencode:compact # compaction gate, makes real model calls
74
+ ```
75
+
76
+ ## Common mistakes
77
+
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.