Skip to content

[FEATURE]: Long-term persistence memory system (/teach, /recall, /learn, /memory) #48497

Closed as duplicate

Description

@prethiv

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Feature hasn't been suggested before

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Add a persistent long-term memory engine backed by SQLite (memory.db) to allow OpenCode to retain user conventions, architectural guidelines, and learned lessons across sessions.

Proposed Capabilities:

  1. /teach <context>: Persist user instructions, architectural preferences, and rules.
  2. /recall <query>: Retrieve relevant memories via SQLite FTS5 full-text search.
  3. /learn [content]: Automatically extract or manually save lessons and insights discovered during coding sessions.
  4. /memory [query]: Explore, search, filter, and inspect saved memories via CLI and TUI dialog.

Benefits:

  • Eliminates repeating context, repository guidelines, and coding preferences across new sessions.
  • Fast, local, zero-dependency persistence using SQLite WAL mode and FTS5 indexing.
  • Accessible conversationally by the agent (tool call), via CLI commands (opencode memory ...), and via TUI slash commands and dialogs.

Activity

  1. github-actions commented on Sep 11, 2026

    @github-actions
    Contributor

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

    Consider joining the discussion there or clarifying how this proposal differs.

  2. izgorodin commented on Sep 12, 2026

    @izgorodin

    Looking at #48498 (204fe56), source is stored as teach/learn but omitted from the rendered recall output; exposing it would at least preserve that provenance. I'd keep "explicit user decision" separate from "inferred lesson" too, since an agent can call either action and the action name alone doesn't establish authority. A useful same-project restart test is: the user explicitly chooses pnpm, a later lesson extracted from an old log says npm, and recall retains the evidence without silently promoting that lesson over the user's rule.

    Disclosure: I work on Mnemoverse; this comment was drafted with AI assistance.

  3. prethiv commented on Sep 12, 2026

    @prethiv
    Author

    @izgorodin - I agree that your point makes sense. But think this way that you can always override memory with explicit teachings at any point of time. And while recalling suppose both the chunks retrieved from memory the llm itself would decide which one is valid or /teach with proper information appended at the end of the chunk stating this is proven way.

    Using these above as inferences we can override or explicitly let llm knows the right way by putting more context.

  4. prethiv commented on Sep 12, 2026

    @prethiv
    Author

    I also did a consultation with AI as well:
    Here's the recommendation

    "Good call on preserving provenance. Exposing the source ([User Rule] vs. [Inferred Lesson]) and timestamp in the rendered /recall block is an easy win with virtually no token overhead. That gives the system prompt a deterministic anchor to instruct the model to prioritize explicit user rules over inferred observations when conflicting chunks are retrieved, while still keeping the SQLite FTS retrieval engine simple and lightweight."

  5. vshulcz commented on Sep 23, 2026

    @vshulcz

    on keeping an explicit user decision separate from a lesson inferred from an old log: one way is not to infer. deja hands back the session, the date and the line, never a distilled fact — so "the user chose pnpm" and "a note from an old log says npm" come back as two hits with their provenance rather than one merged claim, with the newer one ranked first. your restart test is the right shape; it's precisely the case where a synthesiser silently promotes the lesson over the rule. disclosure: i maintain deja-vu, which works this way because summarising other people's decisions is the part i didn't want to be wrong about.

  6. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the detailed proposal, @prethiv! I think this is a duplicate of #20322, which asks for the same thing: native SQLite-backed memory that keeps conventions and lessons across sessions. Your /teach, /recall, /learn and /memory commands are a way of using that memory, but the request underneath is the same.

    Possible duplicates and related issues, ordered by likelihood:

    In the meantime, something like this could be built as an OpenCode plugin (a custom memory tool plus commands), so you can use it without changes to core.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your request differs.

  7. opencodejr commented on Oct 29, 2026

    @opencodejr

    Closing this as a duplicate of #20322, which asks for the same thing: native persistent memory that keeps conventions and lessons across sessions. No one has replied in the day since it was flagged. The related issues listed above (#8043, #9211, #16077, #43068) are worth a look too. Thanks again for the detailed proposal, @prethiv! If your request is different in a way we missed, reply here and we'll take another look.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions