Skip to content

[FEATURE]: Native auto-memory for cross-session learning #20322

@lleontor705

Description

@lleontor705

Verification

Problem

OpenCode has no native mechanism to persist learnings across sessions. Users have to manually add everything to AGENTS.md. Related issues (#16077, #8043, #9211) discuss this conceptually but none have an implementation PR.

Proposed Solution

A lightweight memory module that:

  1. Extracts patterns from session events (repeated build commands, error+fix sequences, user corrections)
  2. Stores in SQLite + auto-generates .opencode/MEMORY.md
  3. Injects MEMORY.md into system prompt at session start

Configurable:

{ "memory": { "enabled": true, "auto_extract": true, "max_memory_lines": 200 } }

Why now

I'm working on a PR for this and want to link it properly per the issue-first policy.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions