OpenCode plugin that stores session compaction summaries to local disk
npm install @oussamadouhou/compaction-storageOpenCode plugin that automatically stores session compaction summaries to local disk.
``bash`
npm install -g @oussamadouhou/compaction-storage
Or in your opencode.json:
`json`
{
"plugin": ["@oussamadouhou/compaction-storage"]
}
No configuration required! The plugin works out of the box.
Backups are stored in: ~/.local/share/opencode/compaction-backups/
- Zero Configuration: Works immediately with no setup required
- Dynamic Group Detection: Automatically detects project context for organized backups
- Deduplication: Prevents duplicate processing within 10-second windows
- Local Backup: All summaries saved to ~/.local/share/opencode/compaction-backups/~/.local/share/opencode/persistent-agents/compaction.report
- Job Reporting: Tracks all compaction operations in persistent log at
- Metadata Tracking: Each backup includes session ID, timestamp, project group, and title
1. Listens for session.compacted events from OpenCode
2. Extracts compaction summary from session messages
3. Detects project context for organized backup storage
4. Creates local backup file with full metadata
5. Updates job report with processing details
Each backup file includes:
- Title: Extracted from session summary
- Timestamp: When the compaction was created
- Session ID: Reference to original session
- Group: Detected project group (e.g., project_opencode, global)
- Summary: Full compaction content
`bashInstall dependencies
bun install
MIT
Oussama Douhou