{"id":51169575,"url":"https://github.com/mrcarb0n/opencode-memory-enhanced","last_synced_at":"2026-06-26T23:03:37.490Z","repository":{"id":366589003,"uuid":"1264688817","full_name":"MrCarb0n/opencode-memory-enhanced","owner":"MrCarb0n","description":"[Experimental] Persistent local memory plugin for OpenCode — SQLite, FTS5, knowledge graph, hybrid search, curated dual stores, write approval, procedural skills, session scanning, external DB merge","archived":false,"fork":false,"pushed_at":"2026-06-22T13:43:22.000Z","size":113,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-22T14:24:16.673Z","etag":null,"topics":["ai-memory","fts5","knowledge-graph","local-first","memory","opencode","opencode-plugin","sqlite","sqljs","typescript","vector-search"],"latest_commit_sha":null,"homepage":"https://github.com/MrCarb0n/opencode-memory-enhanced","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrCarb0n.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-10T05:16:22.000Z","updated_at":"2026-06-22T13:43:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/MrCarb0n/opencode-memory-enhanced","commit_stats":null,"previous_names":["mrcarb0n/opencode-memory-enhanced"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/MrCarb0n/opencode-memory-enhanced","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrCarb0n%2Fopencode-memory-enhanced","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrCarb0n%2Fopencode-memory-enhanced/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrCarb0n%2Fopencode-memory-enhanced/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrCarb0n%2Fopencode-memory-enhanced/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrCarb0n","download_url":"https://codeload.github.com/MrCarb0n/opencode-memory-enhanced/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrCarb0n%2Fopencode-memory-enhanced/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34835782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-memory","fts5","knowledge-graph","local-first","memory","opencode","opencode-plugin","sqlite","sqljs","typescript","vector-search"],"created_at":"2026-06-26T23:03:37.088Z","updated_at":"2026-06-26T23:03:37.481Z","avatar_url":"https://github.com/MrCarb0n.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opencode-memory-enhanced\n\nAdvanced autonomous memory plugin for [OpenCode](https://opencode.ai). Persistent, local, zero-cloud memory with hybrid search, knowledge graphs, session scanning, curated memory, procedural skills, and **self-learning episodic memory**.\n\n## Features\n\n- **Auto-Remember** — silently captures important context from conversation (preferences, decisions, config, tech stack, API details) using pattern-matched importance scoring\n- **Hybrid Search** — FTS5 full-text search + neural vector embeddings (all-local, no API calls) for semantic recall\n- **Knowledge Graph** — entity extraction, relationship discovery, concept tagging, and graph export (SVG/DOT/JSON)\n- **Session Scan** — reconstructs memories from past conversation logs on startup; learns tool usage, files touched, and decisions made\n- **Curated Memory** — persistent `agent_note` and `user_profile` stores with write-approval workflow for high-signal, editable reference blocks\n- **Predictive Context Injection** — before tool execution and on each message, relevant memories are injected into context for zero-shot awareness\n- **Procedural Knowledge** — recall and apply learned procedures and workflows from past sessions\n- **Memory Decay** — configurable relevance decay and access boost so stale memories fade and active ones stay fresh\n- **Automatic Entity Consolidation** — background entity pattern detection, relationship mining, and orphan cleanup\n- **Self-Learning Episodic Memory** — auto-captures tool executions into episodes, LLM-synthesizes decisions/patterns/outcomes, promotes successful patterns to reference memory, and retrieves relevant episodes predictively\n- **Background Pattern Learning** — clusters similar episodes into meta-patterns for cross-project knowledge transfer\n- **Toast Notifications** — non-intrusive in-app notifications for memory count, search matches, and system events\n- **All-Local** — SQLite via better-sqlite3 (native, large-DB safe) + local ONNX-session embeddings; zero data leaves your machine\n\n## Installation\n\n```bash\ngit clone https://github.com/MrCarb0n/opencode-memory-enhanced\ncd opencode-memory-enhanced\nnpm install\n```\n\nThe `preinstall` hook copies plugin files to `~/.config/opencode/plugins/` and installs dependencies. Restart OpenCode to load.\n\n## Quick Start\n\nOnce installed, the plugin works silently:\n\n1. **Auto-remember:** conversations are scanned for important data (preferences, decisions, tech config) and stored automatically\n2. **Search:** use `memory-recall` tool to query past context\n3. **Store explicitly:** use `memory-store` to save specific information\n4. **View status:** use `memory-info` to see memory count, health, and configuration\n5. **Curate:** use `memory-curated` to create persistent notes (`agent_note`/`user_profile`)\n6. **Learn:** use `memory-learn` to record facts, preferences, and relationships\n7. **Entity search:** use `memory-query {mode: entity, query: \"...\"}` to explore the knowledge graph\n\n## Tools\n\n| Tool | Description |\n|------|-------------|\n| `memory-query` | Search, browse, and explore memories + entities (recall/inject/browse/entity modes) |\n| `memory-store` | Explicitly save a memory with importance, tags, type, and scope |\n| `memory-learn` | Store structured facts with entity tracking, relationships, and pattern detection |\n| `memory-info` | System status, config editor, and activity timeline |\n| `memory-curated` | Persistent agent_note/user_profile with write-approval workflow |\n| `memory-maintain` | Optimize, consolidate, prune stale memories, deduplicate, and health check |\n| `memory-export` | Export memories (JSON) and knowledge graph (SVG/DOT/JSON) with entity expansion |\n| `memory-scan` | Scan past sessions into memories (DB direct or API fallback) |\n\n*Episodic memory is fully automatic — no user-facing tools needed. It captures, synthesizes, and retrieves episodes in the background.*\n\n## Configuration\n\nConfig stored at `~/.config/opencode/memory-config.json`. View/edit via `memory-info {mode: config}`.\n\nKey settings:\n\n| Key | Default | Description |\n|-----|---------|-------------|\n| `auto_remember` | `true` | Auto-capture important conversation context |\n| `decay_rate` | `0.01` | Per-day relevance decay (0-1) |\n| `access_boost` | `0.05` | Relevance boost on access (0-1) |\n| `context_budget` | `2000` | Max token budget for injected context window |\n| `toast_enabled` | `true` | Show in-app notifications |\n| `scan_on_start` | `true` | Scan past sessions on startup |\n| `enable_vectors` | `true` | Enable neural embeddings |\n| `background_consolidate` | `true` | Background entity detection |\n| `security_scan` | `true` | Scan for secrets in stored memories |\n| `episode_capture` | `true` | Auto-capture tool executions into episodes |\n| `episode_boundary_threshold` | `0.5` | Heuristic score threshold to auto-detect episode boundaries |\n| `pattern_promotion_threshold` | `0.7` | Success score threshold to promote patterns to reference memory |\n| `synthesis_enabled` | `true` | Enable LLM synthesis of completed episodes |\n| `predictive_retrieval` | `true` | Enable predictive episode retrieval during context injection |\n| `predictive_top_k` | `3` | Max episodes to inject per query |\n| `global_pattern_learning` | `true` | Enable background clustering into cross-project meta-patterns |\n| `cross_project_sharing` | `true` | Share promoted patterns across all projects |\n\n## Database\n\n- **Location:** `~/.config/opencode/memory-enhanced.db`\n- **Engine:** SQLite via [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) (native) with FTS5; falls back to [sql.js](https://github.com/sql-js/sql.js/) if unavailable\n- **Session scanner:** reads OpenCode's `opencode.db` directly via better-sqlite3 — handles 700MB+ databases without issue\n- **Embeddings:** Local ONNX-session (no external API)\n- **Tables:** memories, entities, relationships, conversation_arcs, concept_tags, learning_patterns, memory_links, scanned_sessions, curated_store, pending_memories, procedural_knowledge\n\n## Architecture\n\n```\nmemory-enhanced.ts         — Plugin entry point, lifecycle hooks\nlib/\n  config.ts                — Config load/save with schema validation\n  constants.ts             — Paths, tables, version\n  curated.ts               — Curated memory builder\n  db.ts                    — SQLite/FTS5 wrapper with auto-save\n  embeddings.ts            — Local neural embeddings (ONNX)\n  entities.ts              — Entity extraction, relationship discovery\n  helpers.ts               — Toast, prompt injection, AGENTS.md\n  memory.ts                — Auto-remember, hybrid search, decay\n  optimize.ts              — Consolidation, pruning, dedup\n  scan.ts                  — Session log scanner\n  schema.ts                — DDL and index definitions\n  security.ts              — Secret scanning\n  types.ts                 — Type definitions, pattern matching\n  utils.ts                 — Tokenization, cosine similarity\n  episodes.ts              — Episode state manager, boundary detection, tool capture\n  episode-synthesis.ts     — LLM synthesis: decisions, patterns, outcome, anti-patterns\n  episode-retrieval.ts     — Vector search + predictive context injection\n  episode-patterns.ts      — Background clustering into meta-patterns\n  tools/\n    query.ts               — memory-query tool\n    store.ts               — memory-store tool\n    learn.ts               — memory-learn tool\n    info.ts                — memory-info tool\n    curated.ts             — memory-curated tool\n    maintain.ts            — memory-maintain tool\n    export.ts              — memory-export tool\n    scan.ts                — memory-scan tool\n    _shared.ts             — Shared tool utilities\n```\n\n### Database Schema (Episodes)\n\n| Table | Purpose |\n|-------|---------|\n| `episodes` | Session-scoped tool execution traces with synthesized intent, outcome, decisions, patterns |\n| `episode_steps` | Individual tool calls with args, results, success/failure, duration |\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcarb0n%2Fopencode-memory-enhanced","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrcarb0n%2Fopencode-memory-enhanced","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcarb0n%2Fopencode-memory-enhanced/lists"}