Skip to content

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

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

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

Conversation

@herjarsa
Copy link
Copy Markdown

Issue for this PR

Closes # (new feature, no existing issue)

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

Sisyphus-AI added 2 commits April 25, 2026 21:19
When the primary model fails after all retries, automatically try the next model from the fallback chain. This adds:

- fallbackModels field to MessageV2.User schema
- resolveFallbackChain helper to Provider service
- outer fallback loop in SessionProcessor.process()
- error classification: only retryable errors trigger fallback
  - No fallback for: AuthError, AbortedError, non-retryable APIError
  - Fallback for: rate limits, 5xx, other transient errors
- Add agent_memory table with full-text search and tags support
- Add AgentMemory service (save, search, consolidate) in Effect
- Add memory-tools plugin for cloud backup/restore via Supabase
- Plugin tools: memory.configure, memory.backup, memory.restore, memory.status, memory.schedule
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.

1 participant