opencode-lossless
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.
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 4
- Forks
- 0
01 前言 Front Matter
- name
- opencode-lossless
- license
- MIT
- sources
- [ "stainless-code/lossless:packages/opencode/src" ]
- metadata
- { "type": "composition", "library": "opencode-lossless", "library_version": "0.1.3" }
- requires
- [ "lossless" ]
- 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.
03 SKILL.md 正文
opencode-lossless
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.
Install
opencode plugin add opencode-lossless
Equivalent opencode.json entry:
{ "plugins": [{ "package": "opencode-lossless" }] }
To keep sidecars inside the project, set sidecarDir to "./.lossless".
Commands
/lossless-status, message and compaction summary counts per live sidecar./lossless-report, this session's metrics: projection, checkpoint, pass, recall, reader./lossless-pass, run one DAG pass over the aged span now, without waiting for the swap./lossless-heal, dry-run repair of tainted summaries.--applyspends model calls./lossless-backup, copy this session's sidecar beside it./lossless-export, write the verbatim transcript and summaries as JSONL (mode 0600)./lossless-import, restore rows from an export./lossless-diagnose, redacted, pasteable diagnostics block.--savewrites it at mode 0600./lossless-migrate, upgrade older-schema sidecars in place (dry-run by default)./lossless-gc, list old sidecars, or export and delete them (never the current session)./lossless-dump, read-only dump of the session sidecar.--include-removedkeeps removed-branch rows,--savewrites the output to a file at mode 0600.
Recall tools
lcm_grepsearches full text over this session, andscopereaches past sessions.rolekeeps only rows stored with that role,date_startanddate_endbound rows by timestamp, andtool_namekeeps only tool-result rows for that tool.lcm_describeinspects one summary (kind, costs, children) without expanding it.lcm_expandreads the verbatim originals a summary covers, andanchorcenters the listing on one entry.lcm_expand_queryruns a bounded child session that reads and answers, so originals never enter the parent context.
Config essentials
{ "enabled": true, "sidecarDir": "./.lossless", "assembly": true }
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
sidecarDirholds one SQLite file per session (0700 dir, 0600 files). Delete one to forget that session. After upgrading a project that used./.lossless, keepsidecarDirset to"./.lossless"to keep that history:/lossless-migrateworks in place in the configured directory only (dry run by default, moves nothing). To carry history elsewhere,/lossless-exporteach session under the old config and/lossless-importinto an empty store under the new one, or stop the server first and copy the.sqlite,-wal, and-shmfiles across and then migrate.assembly: true(default) owns the context boundary. Projection swaps aged history and compaction stores the DAG frontier.- 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
Verify
From a checkout of this repo (these scripts only exist there, not in a consumer project):
bun run opencode:check # read-only: host version, config, bundle hash, sidecar counts
bun run opencode:smoke # one real model call, asserts the verbatim mirror
bun run opencode:compact # compaction gate, makes real model calls
Common mistakes
assembly: falsedrops/lossless-passandlcm_expand_query. Keep the defaulttrueunless the host must own compaction. Withfalse, compaction falls back to the host.scopeequivalence.scope: "session"(default) reads this session only. Passscope: "sessions"or"all_sessions"to reach past sessions.- Reader is session-scoped.
lcm_expand_queryreturns findings only through its child session, never the raw transcript. Ask a question it can answer from the sources, not for a dump. - Forgetting is file deletion. Remove that session's sidecar file. There is no delete tool.
- 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.
04 同仓库更多 Skills
pi-lossless
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, dump, or diagnose; or tune compaction thresholds.
lossless-core
Use when wiring a host to lossless-core or working on the engine itself: implement ModelHost or Reader, run a compaction, retrieval, or heal pass, or read the store directly with LcmStore.