OpenCode plugin for transcript recall after context compaction
npm install opencode-chat-recallAn OpenCode plugin that provides transcript recall capabilities after context compaction. When your conversation gets too long and OpenCode summarizes it, this plugin saves the full transcript and gives the agent tools to search through it later.
``bash`Add to your opencode.json
{
"plugin": ["opencode-chat-recall"]
}
`bash`
git clone https://github.com/R44VC0RP/opencode-chat-recall
cd opencode-chat-recall
bun install
Then add to your project's .opencode/plugin/ directory:
`typescript`
// .opencode/plugin/chat-recall.ts
export { default } from "opencode-chat-recall"
1. Automatic Saving: The plugin listens for session.idle events and saves transcripts automatically after each conversation turn.
2. Compaction Integration: When OpenCode compacts/summarizes a long conversation, the plugin:
- Saves the full transcript before compaction
- Injects instructions into the summary telling the agent how to recall details
3. Search Tools: Two tools are provided for the agent to use:
- list_transcripts - List available saved transcriptsrecall_transcript
- - Search through conversation history
Lists saved conversation transcripts with filtering options.
Parameters:
- currentSession (boolean, optional) - Only show transcript for current sessionallSessions
- (boolean, optional) - Show transcripts from all sessions/projects limit
- (number, optional) - Maximum results (default: 20)
Example usage by agent:
``
list_transcripts({ allSessions: true, limit: 10 })
Search through saved transcripts to find specific information.
Parameters:
- query (string, required) - Keywords to search forsessionID
- (string, optional) - Search specific session onlyformat
- (string, optional) - Output format: "markdown", "text", or "both"limit
- (number, optional) - Maximum results (default: 5)fullTranscript
- (boolean, optional) - Return entire transcript instead of search results
Example usage by agent:
``
recall_transcript({ query: "S3 bucket upload path" })
recall_transcript({ query: "database schema", limit: 10 })
recall_transcript({ sessionID: "ses_xxx", fullTranscript: true })
Transcripts are saved to:
``
~/.local/share/opencode/transcripts/
├── index.json # Global index of all transcripts
└── {sessionID}/
├── metadata.json # Session metadata
├── transcript.md # Full markdown transcript
├── transcript.txt # Plain text version
└── chunks/ # Searchable chunks for fast search
└── chunk_*.json
Logs are written to ~/.local/share/opencode/log/chat-recall.log (no console output).
Transcripts are automatically deleted after 7 days to save disk space.
`bashInstall dependencies
bun install
MIT