Skip to content

feat: add OpenCode persistent memory plugin#853

Open
DK09876 wants to merge 2 commits intomainfrom
feat/opencode-integration
Open

feat: add OpenCode persistent memory plugin#853
DK09876 wants to merge 2 commits intomainfrom
feat/opencode-integration

Conversation

@DK09876
Copy link
Copy Markdown
Contributor

@DK09876 DK09876 commented Apr 2, 2026

Summary

  • Adds @vectorize-io/opencode-hindsight plugin for OpenCode with persistent long-term memory
  • Three custom tools (hindsight_retain, hindsight_recall, hindsight_reflect) + three automatic hooks (session recall, auto-retain on idle, compaction preservation)
  • 4-level config hierarchy, dynamic bank ID derivation, document deduplication via document_id, sliding window retain with retainOverlapTurns
  • CI job in test.yml, release script entry, docs page, 79 tests across 6 files

Test plan

  • npm test — 79/79 tests pass
  • npm run build — tsup builds cleanly
  • CI passes on PR
  • Manual smoke test with OpenCode + local Hindsight server

🤖 Generated with Claude Code

DK09876 and others added 2 commits April 2, 2026 11:04
Add hindsight-opencode integration with:
- Three custom tools: hindsight_retain, hindsight_recall, hindsight_reflect
- Auto-retain on session.idle with document_id deduplication
- Memory injection on session start via system transform hook
- Memory preservation during context window compaction
- Sliding window retain with retainOverlapTurns support
- 4-level config hierarchy (defaults, user file, plugin options, env vars)
- Dynamic bank ID derivation (agent, project, channel, user dimensions)
- CI job, release script entry, docs page

79 tests across 6 test files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. Pre-compaction retain now uses shared retainSession() helper,
   respecting retainMode, documentId, and session_id metadata
   consistently with idle-retain (was bypassing retention policy).

2. System transform recall is only consumed after successful injection.
   If Hindsight is briefly unavailable, the plugin retries on the next
   LLM call instead of permanently skipping recall for the session.

3. Config validation for retainMode and recallBudget — typos like
   "full_session" or "maximum" now log a warning and fall back to
   the default instead of silently changing retention semantics.

85 tests (6 new covering compaction documentId, recall retry, and
config validation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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