Skip to content

feat(memory): add agent_memory table and memory-tools plugin - #42425

Open
herjarsa wants to merge 2 commits into
anomalyco:devfrom
herjarsa:feat/agent-memory-plugin
Open

feat(memory): add agent_memory table and memory-tools plugin#42425
herjarsa wants to merge 2 commits into
anomalyco:devfrom
herjarsa:feat/agent-memory-plugin

Conversation

@herjarsa

Copy link
Copy Markdown

Issue for this PR

Closes #41998

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds the \�gent_memory\ table and \memory-tools\ plugin for cloud backup/restore of OpenCode AgentMemory via Supabase.

Changes:

  1. Database: \�gent_memory\ table with FTS5 full-text search and tags support
  2. AgentMemory Service: Effect-based service with save, search, consolidate operations
  3. memory-tools Plugin: 5 tools for cloud sync:
    • \memory.configure\ - Configure Supabase connection
    • \memory.backup\ - Push local memories to cloud
    • \memory.restore\ - Pull cloud memories to local (merge)
    • \memory.status\ - Show sync status
    • \memory.schedule\ - Get/set auto-sync interval

Cloud sync features:

  • Conflict resolution: newest wins by timestamp
  • Auto-scheduler with configurable intervals (5m, 15m, 1h, 1d, manual)
  • Works with existing OpenCode AgentMemory data

Files Changed

File Purpose
\packages/memory-tools/src/index.ts\ Plugin entry with 5 tool definitions
\packages/memory-tools/src/sync.ts\ Cloud sync (backup/restore) with Supabase
\packages/memory-tools/supabase/migrations/001_agent_memory.sql\ SQL migration reference
\packages/opencode/src/session/memory.ts\ AgentMemory service (save, search, consolidate)
\packages/opencode/migration/20260425194233_agent_memory/\ Drizzle migration

How did you verify your code works?

  • TypeScript compiles without errors in memory-tools package
  • All Bun.sqlite bindings use proper type casts
  • Plugin follows the correct \Plugin\ interface from @opencode-ai/plugin
  • Code follows OpenCode module conventions (Effect, self-export pattern)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I encountered API access issues when trying to search for duplicate PRs. However, based on the PR details provided:

Without successful search results, I cannot definitively identify duplicate PRs. To complete this check:

  1. You could manually search on GitHub for PRs with keywords like "memory-tools", "agent_memory", or "memory backup"
  2. Check issue feat(memory): add agent_memory table and memory-tools plugin #41998 for any linked PRs
  3. Review recent PRs in the packages/memory-tools and packages/opencode directories

If you can retry the search or have access to search results, please share them and I can help identify any related work.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(memory): add agent_memory table and memory-tools plugin

1 participant