Repository navigation
Releases
Releases · linellazatin/openclaude-memory
v0.7.1
Updated
- V2 verified through OpenCode 2.2.7 (was 2.0.31). All smoke tests (128) and real-V2 host test pass against 2.2.7. No API compatibility issues.
@opencode/plugindevDependency relaxed to>=2.0.31(was pinned 2.0.31).- All version references updated across CLAUDE.md, docs/faq.md, docs/memory-injection.md, and docs/architecture.md.
v0.7.0
Added
- Dual OpenCode V1/V2 support from a single set of entrypoints. The server plugin now default-exports
{ id, setup, server }(V1 callsserver, V2 callssetup); the TUI plugin exports{ id, setup, tui }. Floor version remains OpenCode 1.18.29; verified through 2.0.31. - Root
index.mjs/tui.mjsre-export shims so a local checkout referenced by directory path loads under V2 (which resolves<dir>/index.mjsand<dir>/tui.mjs, not the directory'spackage.jsonexports). - V2 tool registration via
ctx.tool.transformwith object JSON Schema input,options: { codemode: false }for V1-parity function-tool exposure, and{ content }result wrapping. Memory/rules injection viactx.session.hook("context")SystemParts; cache invalidation viactx.tool.hook("execute.after"). - V2 skill, command, and compaction hooks (
ctx.skill.transform,ctx.command.transform,ctx.session.hook("compaction")). - V2 TUI browser (
setup) using promise dialogs and actrl+alt+mkeymap layer, alongside the byte-identical V1tuicallback interface.
Changed
consolidate_on_compactunder V2 is driven by asession.compactedevent subscription and enqueues an additional consolidation prompt; V2 has no native-continuation suppression, so it cannot replace the running loop as it does under V1.- The V2
setupentrypoint now returns a cleanup that aborts the consolidation subscription, so a config-triggered plugin reload does not leave a stale loop that double-consolidates alongside the new one.
Tests
- 128 smoke tests plus a V2 fake-context seam (
__core.setupV2) and promise-dialog TUI coverage. - Host suites split by major:
npm run test:host:v1(OpenCode 1.18.x) andnpm run test:host:v2(OpenCode 2.0.31).
v0.6.7
Fixed
- Attach memory and rules to every fresh OpenCode model request, including later steps and other sessions. Detect config, index, directory, tombstone, and sentinel changes before cache reuse; do not consume cross-process notifications.
- Queue automatic consolidation with
noReply: true, preserve agent/model/variant, retain native continuation on API failure, and resume pending work in the fallback prompt. - Fail closed on local and shared contention; treat
EPERMas alive, capture per-acquisition release tokens, and bound stale reclaim when deletion fails. - Validate safe regular topic files and no-follow reads, reserve the index filename, preserve unrelated removed-topic slug collisions, and enforce pinned TUI removal inside the lock.
- Refuse FIFO reads without blocking; detect trusted config-symlink target edits before cache reuse.
- Flush and clean atomic temporary writes, persist removal intent before dropping discoverability, roll back ordinary topic/index write failures, and preserve racing config creation and existing legacy backups.
- Lock local-to-shared migration in consistent order, copy atomically, respect both removal lists, and retry failed migrations only marking success after completion.
- Preserve JSONC literal commas, refresh topic metadata, compare full duplicate timestamps while retaining pins, heal stale flags, correct repair totals and malformed-field recovery, and surface TUI refusal/filesystem results.
Changed
inject_every_n_turnsnow controls forced disk refreshes in model requests; memory is always injected and system tokens are not inherently free.- Documentation records current host compatibility, co-tenant coordination, and per-file recovery boundaries.
Tests
- 92 to 120 smoke tests, plus real-process OpenCode/OpenCode and OpenCode/pi writer checks.
npm run test:hostverifies native tool execution, subsequent requests, another session, and automatic consolidation with a real OpenCode 1.18.34 server and local fake model.
v0.6.6
Fixed
- Ambiguous partial matches refused:
remove_memory/pin_memoryno longer mutate the first substring hit — an exact name wins, multiple partial candidates are reported and nothing is touched (openpi-memory parity). - Lock double-reclaim race:
.locknow holds apid\tts\trandtoken; stale reclaim re-verifies inode+mtime before unlinking (two simultaneous reclaimers can't clobber each other's fresh lock) and release is compare-and-delete. - Stuck drift note: the
/memory repairmaintenance note no longer counts intentionally-removed (tombstoned) files, so it can't persist forever after repeated removals. - Repair timestamp forgery:
repair_memorysanitizes recovered frontmatter timestamps — a corrupted co-tenantlast_updated:can no longer forge a[pin]onto an index line. - Split-brain consolidation recap: the recap now uses one canonical topic,
OCL Last Session Recap, whose slug is exactlyocl-last-session-recap.md(the old prompt promised a filename it never produced). - TUI over-match:
setPin/removeEntryact only on the parsed entry line, never on a foreign line whose summary merely mentions](file.md). - Carry-over retry: a failed or lock-contended first merge is retried on the next cache refresh within the same process, not only on the next session.
Changed
write_memorycollapsessummarywhitespace and caps it at 500 chars (openpi parity) before frontmatter, index, and result message..ocl-removedis now documented as shared: openpi-memory reads/writes the same file in the shared dir, so either tool's removals are honored by both.
Tests
- 86 → 92: ambiguous-match refusal, lock token + stolen-lock release, tombstone-aware drift count, repair timestamp sanitizing, summary cap, TUI parse-based matching.
v0.6.5
MEMORY.md is a line-oriented flatfile (one topic = one index line), but topic names and summaries are free-form markdown. This release closes the gap between the two, plus a JSONC-parser and a filename-validation hardening.
Fixed
- Phantom index-line injection: a
topicorsummarycontaining a newline used to be written verbatim into an index line, splitting one record into two physical lines. Undershared_dir(where foreign index lines are trusted on read) a crafted summary could therefore inject an arbitrary- [Name](file)entry.sanitizeIndexFieldnow collapses newlines to spaces and strips link-breaking[,],(,)from the name and summary before they reach the index. Topic-file content is unchanged (newlines there are normal). - Link-metacharacter topic names: a
]in a topic name silently brokeparseIndexLineon read-back, making the entry invisible to every tool and the TUI while its file remained on disk (drift). Names are now sanitized at the source so the whole write path (slug, name-match, frontmatter, index) uses one consistent clean value. - Block comments in
memory.jsonc:stripJsonchandled only//line comments, so a valid/* … */JSONC comment made the entire config fail to parse — silently reverting every setting to defaults (only aconsole.error) and injecting raw JSONC into the prompt.stripJsoncis now string-literal-aware for both comment styles.
Changed
isSafeFilenamehardened: filenames are now also rejected if they start with a.(tool-internal / hidden files:.ocl-removed,.lock, dotfiles) or contain[]()(which break the- [name](filename)index shape). Applied automatically at every existing read-time boundary — the TUI hides such entries,remove_memory/pin_memory/write_memoryrefuse them, andrepair_memoryskips such orphan files.- A topic whose name has no slug-formable characters (e.g.
"!!!") is rejected with a clear error instead of producing a.mdfile that the read-back guard would then silently orphan.
Tests
- 79 → 86: newline-in-summary injection, newline/bracket topic collapse, paren-in-filename entry hidden + refused, leading-dot file skipped by repair,
/* */block-comment parsing,*/-inside-a-string safety, and the extendedisSafeFilenamerejections.
v0.6.4
Fixed
- Fail-closed shared writes: on lock contention, wait + auto-retry once, then return "store busy" instead of writing unlocked (all tools + TUI, via
withLock). - Lock liveness reclaim:
.lockis PID-stamped; a >10s stale lock is reclaimed only afterkill(pid,0)proves the holder dead (foreign/unparseable payloads: >60s). - Append-mode timestamp is frontmatter-scoped:
write_memoryappend no longer runs itslast_updated/createdbump over the whole file — it now edits only the frontmatter block (matchingmode: "replace"), so a body line beginninglast_updated:is never rewritten. - No unlocked read-path index write:
readMemoryIndexreturns the initial index in-memory whenMEMORY.mdis absent instead of writing it without the lock; the file is now created only via the locked tool/carry-over paths (removes the last unlocked write undershared_dir). - TUI missing-index guard:
setPin/removeEntryreturn "No memory index found." if the index was deleted mid-session instead of throwing an unhandled rejection.
Added
/memory repair(repair_memory): additive re-index of on-disk topic files missing fromMEMORY.md([stale?], dated from frontmatter); idempotent. Shared-mode drift surfaces a non-mutating maintenance note.- Intentional-removal tombstone:
remove_memoryrecords the removed topic's filename in a.ocl-removedlist inside the active memory dir.repair_memorynow skips anything listed, separating removed from "orphan".- Re-
write_memory-ing that topic reclaims its on-disk file and clears the tombstone.
Changed
- Topic frontmatter now quotes
name/description(matches openpi-memory). - Recap renamed to
ocl-last-session-recap.md(dodges openpi's reserved-slug retirement).
Tests
- 68 → 79: fail-closed, auto-retry, local best-effort, live/dead-PID reclaim, repair (additive/idempotent/unsafe-skip), drift note, quoted frontmatter, recap filename, frontmatter-scoped append bump, TUI missing-index guard, intentional-removal tombstone (skip + reclaim-on-rewrite).
v0.6.3
Fixed
- Unsafe index filenames:
write_memoryand the TUI now reject unsafe filenames from corrupted or sharedMEMORY.mdentries before file access. - Real 50 KB cap: injected index content is now byte-bounded, not merely flagged after oversize content is assembled.
- Shared merge discovery: an identical pre-existing shared topic file now gains its missing index line without being copied or renamed.
Documentation
- Corrected cache-refresh behavior: periodic injection re-emits cached state; manual file/config edits need a mutation, compaction, or restart to refresh.
Tests
- 3 new regressions (65 → 68) for unsafe existing-topic/TUI filenames, the actual byte bound, and an identical shared file missing its index entry.
v0.6.2
Fixed
- Filename slug collisions: two topics slugifying to the same filename no longer silently merge/overwrite — falls back to a numeric suffix.
stripJsonc: no longer breaks on//inside config string values (e.g. URLs); parse failures now log viaconsole.errorinstead of silently reverting to defaults.- Tool argument validation: all 3 memory tools reject missing/invalid
topic/content/summarywith a clean error instead of throwing. pincoercion: strictly boolean now — no longer truthy-matches a stray string"false".- Path traversal guard: filenames read back from
MEMORY.md(remove/pin/merge) are validated before any file operation.
Documentation
- New
docs/faq.mdknown-limitations entries: carry-over/lock race window,shared_dir-toggle cache staleness, lock/NFS trade-offs, TUI test coverage, cross-tool coordination, subagent-memory parity gap.
Tests
- 17 new tests (48 → 65). Beyond coverage for each fix above, three previously-untested paths are now covered: the 50 KB byte-cap truncation branch (distinct from the line-cap branch),
resolveDestName's-oclm-2numeric-suffix fallback on a triple collision, and lock acquisition against a lock genuinely held by a separate OS process (spawned viachild_process, not simulated in-process).
v0.6.1
Added
- Merge-aware
shared_dircarry-over: first enable now merges with pre-existing shared-dir content instead of silently skipping. Collisions resolved by content comparison; differing-content files renamed with-oclmsuffix. Idempotent across multiple process starts, and now skips the full merge scan entirely on every process after the first successful one, via a.shared-dir-migratedsentinel file in the local memory dir. See docs/shared-directory.md. - TUI follows
shared_dir: TUI plugin readsmemory.jsoncfresh on every open and resolves the active directory dynamically. Mutations (pin/unpin/remove) use the same cross-process lock and atomic writes as the server tools. ocl-memory-shared.mjs: pure-logic module shared by both plugins — path/config resolution, locking, atomic writes, carry-over. Eliminates duplication and ensures TUI and server plugin always agree on the active directory.- Consolidation seeded by compaction summary:
consolidate_on_compactnow fetches the most recent compaction summary (already in 0.6.0, just clarified in changelog) and seeds the consolidation prompt from it, rather than re-scanning the full conversation. Falls back to full-scan if no summary is found.
Changed
- Removed redundant backup-dir creation from carry-over (originals stay in local dir untouched; a copy-not-move operation needs no separate backup).
- 22 new tests (26 → 48); all 48 pass.
v0.6.0
Mirrors several features from the pi coding agent port (openpi-memory) back into this project.
Added
shared_dir: opt-in cross-tool memory store at~/.agents/memory/. First enable copies local memory across (non-destructive). See docs/shared-directory.md.- Cross-process advisory lock + atomic writes: guards concurrent writes from this tool and other processes sharing the directory; all file writes now go through temp-file-then-rename.
- Config relocated to
memory.jsonc: moved frommemory/RULES.jsoncto~/.config/opencode/memory.jsonc. Legacy installs auto-migrate on first read (RULES.jsonc.bakkept). See docs/configuration.md. /memory consolidate: scans the session for unpersisted facts, writes each, and updates aLast Session Recaptopic.consolidate_on_compact: whentrue, replaces opencode's post-compaction auto-continue with a consolidation pass seeded by the compaction summary. Only fires on automatic compaction (not manual/compact). See docs/faq.md.- TUI follows
shared_dir: both plugins now share path/config resolution viaocl-memory-shared.mjs; TUI mutations use the same lock + atomic-write path as the server tools. - Larger defaults: byte cap 25 KB → 50 KB;
max_linesdefault 200 → 300, clamp[50, 500]→[50, 1000].
Changed
- Plugin factory captures
input.clientforclient.session.prompt(...)/client.session.messages(...)(consolidation). - 22 new tests (26 → 48).