@atonev/opencode-short-term-memory

中文文档
1.4.0发布于 2026/10/30MITTypeScriptES Module近 30 天下载 1786

OpenCode plugin for automatic structured session memory with generation-specific context delivery and manual memory tools.

原始使用文档
文档目录5 节
  1. What it does
  2. Install
  3. Use it
  4. Configure
  5. Local files and limits

OpenCode Short-Term Memory

Automatically updates structured memory for each conversation and brings useful saved context back into later requests. OpenCode V1 and V2 support the same core features through their native server and terminal UI integrations.

Unofficial plugin; not affiliated with or maintained by the OpenCode team.

What it does

  • Summarizes visible conversation into User Instructions, Long Horizon Context, Decisions, Conclusions and Active References.
  • Updates in the background after idle and attempts a refresh before compaction.
  • Uses a separate clean summarizer session by default, or the active conversation when configured. An explicit memory model works in either mode.
  • Delivers saved memory as a session message without requesting a reply by default. Optional system/context transformation is available in clean mode.
  • Gives task sub-agents a frozen snapshot of their parent's saved memory.
  • Provides a native /stm menu with scrolling results and agent-facing tools.
  • Saves readable Markdown locally. Reset clears saved memory and starts future updates after a persistent history boundary without deleting the conversation.

Memory is an LLM summary, not a complete transcript or guaranteed instruction store. Provider credentials, model compatibility and quotas are managed by OpenCode; STM generation consumes that model's usage allowance.

Install

These guides describe 1.4. The examples pin 1.4.0 for reproducible installation; use @latest to select npm's current stable release. See the changelog for release history.

OpenCode V1: run from your project for a local installation:

opencode plugin '@atonev/[email protected]' --force
# Or install globally:
opencode plugin '@atonev/[email protected]' --global --force

Enable the same package in the singular plugin arrays of server opencode.json and terminal UI tui.json.

OpenCode V2: the installation command is global:

opencode plugin add '@atonev/[email protected]'

Enable the same package in the plural plugins arrays of global server opencode.json and terminal UI cli.json. Keep server and UI versions aligned; server tools alone do not establish that the terminal menu is loaded.

See installation and configuration for config examples, paths, automatic setup and supported installation routes.

Use it

Open a conversation and select /stm from native autocomplete to open the picker. Use the bare menu; /stm show and /stm-cmd are not current command formats.

ActionResult
Show memoryCurrent session's saved Markdown.
LogsAbsolute log-file path on the OpenCode server.
SettingsEffective options and configuration paths.
StatusMemory path/size, model and live diagnostic counters.
UpdateRequests an eligible memory update; uses the memory model.
ResetConfirms before clearing saved memory and setting a history boundary.
Create example configOptional customization; preserves existing STM config.

Menu actions run without asking the chat model to select a tool or explain the result. Update alone can call the memory model. Use Up/Down, PgUp/PgDn and Home/End to navigate results, and Esc to close. Logs returns a path only: inspect that file yourself on the server.

Both versions also expose seven dedicated stm_memory_* tools and the short_term_memory compatibility wrapper. Asking the chat agent to use them can involve the main model. See commands and tools.

Configure

Supported native installations create a minimal stm.json on first activation, without replacing existing stm.json or stm.jsonc. Optional example creation is not a prerequisite. If the installation origin cannot be verified, Settings explains why automatic creation was skipped.

All settings are optional. For a separate memory model and reminders every four eligible user turns:

{
  "summarizerMode": "clean",
  "memoryModel": "your-provider/your-model",
  "remindEveryN": 4,
  "enableLegacyPeriodicSystemTransform": false,
}

Leave memoryModel blank to use OpenCode's fresh-session default in clean mode, or the session model in active mode. Configure authentication and provider options in OpenCode first.

Set enableLegacyPeriodicSystemTransform: true for primary system/context reminders in clean mode. Active mode always uses session-message delivery. Message delivery avoids rewriting the system prefix; actual provider cache reuse and billing remain provider-dependent. In V2, the transcript may show only a Short-term session memory label; Show reads the saved text.

See the full settings reference, generation guide and delivery guide.

Local files and limits

Memory defaults to .opencode/memory, relative to the server's working directory. Use Status to find the actual file. Keep memory private and ignore it in Git where appropriate: stored summaries are plain text and can contain conversation details.

Reset does not erase chat history, previous injection messages or existing child snapshots. New conversation can reintroduce old facts. Updates checkpoint successful chunks; a later failure can leave earlier progress saved.

Diagnostic logs omit prompt/memory dumps and redact recognized credentials. Redaction is best effort; memory, model inputs and older logs are not scrubbed. Inspect files before sharing them.

Memory files and reset explains storage and cleanup. Child sessions and compression covers snapshot timing and the completed-compress bridge. The feature comparison and V1/V2 differences describe host-specific limits.

See the documentation index for all guides. Release history, fixes and acceptance records are separate from these current-feature guides.

版本与发布记录

@atonev/opencode-short-term-memory 共发布 19 个版本,首次发布于 2026/05/08;过去 12 个月发布了 19 个版本。

版本发布日期距今
1.4.0latest2026/10/309 天前
1.4.0-rc.15rc2026/10/2811 天前
1.4.0-rc.142026/10/2811 天前
1.4.0-rc.112026/10/2712 天前
1.4.0-rc.102026/10/2613 天前
1.4.0-rc.92026/10/2613 天前

关于 @atonev/opencode-short-term-memory 的常见问题

@atonev/opencode-short-term-memory 是什么?

OpenCode plugin for automatic structured session memory with generation-specific context delivery and manual memory tools.

如何安装 @atonev/opencode-short-term-memory?

在项目目录运行 npm install @atonev/opencode-short-term-memory,或使用 pnpm add / yarn add / bun add。

@atonev/opencode-short-term-memory 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@atonev/opencode-short-term-memory 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@atonev/opencode-short-term-memory 可以商用吗?

@atonev/opencode-short-term-memory 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@atonev/opencode-short-term-memory 的下载量有多少?

根据 npm 官方下载统计,@atonev/opencode-short-term-memory 在 2026/10/07 – 2026/11/05 这 30 天内被下载 1,786 次,日均约 60 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@atonev/opencode-short-term-memory 还在维护吗?

最新版本 1.4.0 发布于 2026/10/30(9 天前);至今共发布 19 个版本,其中过去 12 个月发布了 19 个;首次发布于 2026/05/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。