opencode-vccAlgorithmic conversation compactor for opencode - transcript-preserving structured summaries with lossless recall (port of pi-vcc)
0
46
近 7 天 9
28.2
生态多维模型
1 个月前
2026-07-06
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-vcc@0.1.0-alpha.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-vcc@0.1.0-alpha.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-vccopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
A lossless recall plugin for opencode — a port of
pi-vcc. When opencode compacts a
conversation, opencode-vcc appends a note to the summary telling the agent it
can recover pre-compaction context via the recall tool. The agent can then
search prior turns for specific decisions, file changes, and completed work that
the LLM summary may have omitted.
- Lossless recall — the
recalltool re-reads the full session history (including turns hidden by compaction), so nothing is truly gone. - Zero LLM cost — the plugin only appends a static note to opencode's own compaction summary; no extra LLM calls are made.
- Non-invasive — opencode's native compaction summary is always preserved; the plugin just augments it.
How it works
When opencode compacts a conversation, it produces an LLM-generated summary.
opencode-vcc's experimental.text.complete hook detects compaction summary
messages (hard-gated by info.summary === true && info.agent === "compaction")
and appends a RECALL_NOTE — a short imperative telling the agent to use the
recall tool before starting new work.
The recall tool searches the full session history (including pre-compaction
turns) using BM25-ranked search, regex patterns, or browse/expand modes. Results
are fed back to the agent as tool output, recovering any detail the LLM summary
omitted.
Install
Add to your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-vcc"]
}
Or drop it in .opencode/plugins/ / ~/.config/opencode/plugins/ as a local
plugin.
Commands
/recall <query> [page:N]
Search the full session history and feed the results to the agent as a new turn.
<query>— search terms (natural-language, BM25-ranked) or a regex (any query containing regex metacharacters is treated as a pattern).page:N— results are paged 5 at a time.
Examples:
/recall auth bug
/recall "file path" page:2
/recall \b(auth|login)\b
Tool: recall
An agent-invocable tool for searching / browsing / expanding prior context — including turns removed from the live context by compaction.
| Argument | Type | Meaning |
|---|---|---|
query |
string? | Search terms or regex. Omit to browse. |
expand |
number[]? | Entry indices to return in full (untruncated). |
page |
number? | 1-based page for search results (5 per page). |
Modes:
- search (
queryset) — ranked, paged matches with context snippets. - browse (nothing set) — the last 25 entries.
- expand (
expandset, noquery) — full content of the given entry indices. Invalid indices return an explanatory message.
Configuration
Settings resolve with the precedence env > plugin options > sidecar file > defaults.
| Key | Default | Meaning |
|---|---|---|
debug |
false |
Reserved for future diagnostic use. |
- Sidecar file —
~/.config/opencode/opencode-vcc.json(auto-scaffolded with defaults on first load; missing keys are merged non-destructively). Override the path withOPENCODE_VCC_CONFIG_PATH. - Env —
OPENCODE_VCC_DEBUG(true/1orfalse/0).
Development
just validate # nix fmt + tsc --noEmit + bun test
just test
just typecheck
Formatting is handled entirely by nix fmt (treefmt: prettier + nixfmt). Run
just validate before committing.
CI (.github/workflows/ci.yml) runs just ci (format check + typecheck +
tests) on every push and pull request.
Releasing
Releases are tag-driven — the git tag is the source of truth for the version.
Push an annotated tag matching
vX.Y.Z(or a prerelease likevX.Y.Z-rc.1):git tag v0.2.0 git push origin v0.2.0.github/workflows/release.ymlthen:- re-runs the full CI gate,
- sets
package.jsonversion from the tag, - publishes to npm (
latestfor releases,nextfor prereleases) with provenance, tokenlessly via OIDC trusted publishing, - creates a GitHub Release with auto-generated notes.
Publishing uses npm trusted publishing
(OIDC) — no NPM_TOKEN secret is stored. The opencode-vcc package must exist
on npm (the first publish is done manually) and have a trusted publisher
configured for this repo's release.yml workflow. You do not commit a
version bump — the workflow derives it from the tag.
License
MIT