Skip to content

[FEATURE]: Treat external memory as a first-class extension category (docs + reference example) #52934

Closed as not planned

Description

@everest-an

External memory backends are a growing class of OpenCode extension — local-first libraries, MCP memory servers, and daemons that keep long-lived project knowledge out of the transcript and recall it on demand. Today there is no first-class story for them; each one independently rediscovers the same seam and lands on the same two workarounds (summarise the kept history into the compaction context[], or prune in the context hook and race the host — see #50862 and #47810).

I'd like OpenCode to treat "external memory" as a supported category, even before the underlying hooks are widened:

  1. Document the pattern. A short plugin-docs page on "external memory": what the compaction hook can and cannot do today, the summary-only ceiling, the experimental.chat.system.transform option for durable rules, and the current limitations. Right now this is only discoverable by reading the plugin type definitions and filing issues.
  2. Ship a reference example. A minimal official example (or a curated "memory" example under the plugin docs) that wires a local memory backend through the native plugin API — so a user can get persistent, cross-session memory in minutes instead of porting a Claude Code compactor.
  3. Name the seam. If a first-class memory seam is out of scope for now, state that explicitly (and why), so backends stop building on internal-gated mechanisms (refactor(core): move native compaction mechanisms into a plugin #49575) and know the current contract.

Why now / evidence

Motivating case (reference implementation)

Awareness keeps a small, stable active window and recalls only what's relevant:

  • registers awareness_init / recall / record / lookup as native tools,
  • auto-recalls before work, auto-captures a non-blocking session brief on idle,
  • injects a structured handoff (not raw history) at compaction via experimental.session.compacting,
  • scopes memory per project, works fully offline, no account.

It works today — but it is capped by the summary-only compaction return (#50862) and by not owning the compaction trigger (#47810). Documenting the pattern + shipping an example would let users adopt it now, and give the wider hooks work (#50862, #47810) real integrations to validate against.

Related

#50862 (compaction hook return type) · #47810 (compaction trigger) · #41590 (long-context dilution) · #16101 (session lifecycle) · #49575 (internal-only native seam)

Acceptance criteria

  • A documented "external memory" pattern in the plugin docs, including current limitations.
  • A runnable reference example wiring a local memory backend through the native plugin API.
  • A stated position on whether a first-class memory seam is in scope (even if the answer is "not yet, because …").

Activity

  1. everest-an commented on Oct 3, 2026

    @everest-an
    Author

    Reference implementation details — so this isn't abstract, here's the concrete, open surface we maintain (all findable):

    Links

    How to integrate with OpenCode (works today — no custom build)

    Local-first, offline, no account:

    npx @awareness.market/local start     # local daemon on :37800

    then in opencode.json:

    { "plugin": ["@awareness.market/opencode-plugin"] }

    The plugin registers awareness_init / recall / record / lookup as native tools (no MCP config required), auto-captures a non-blocking session brief on idle, and injects a structured handoff at experimental.session.compacting.

    One-command setup across 13+ IDEs: npx @awareness.market/setup (auto-detects the IDE; first-class OpenCode/HyperCode support is landing in a PR).

    Benchmark — so the "memory" claim isn't hand-waving

    • LongMemEval R@5 = 96.0%, measured through the real local-daemon retrieval pipeline (production E5 embeddings + live SQLite), zero LLM calls on the retrieval side, reproducible via the script above.
    • Net effect on the exact problem this issue is about: the active window stays small and stable because long history lives outside the transcript.

    That's precisely why "external memory" deserves a docs page + an official example: the pattern already works today — it's just undocumented, and currently capped by #50862 / #47810. We'd be glad to contribute the docs/example.

  2. github-actions commented on Oct 3, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • Add the required verification checkbox from the Feature Request template. The description is present, but the checkbox is missing.

    Please edit this issue to address the above within 72 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    • #29022: a prior memory-plugin showcase describing a working plugin implementation and suggesting an addition to the plugin docs.

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window.

    Feel free to open a new issue that follows our issue templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions