@oussamadouhou/compaction-storage
v5.0.0
Published
OpenCode plugin that stores session compaction summaries to local disk
Maintainers
Readme
@oussamadouhou/compaction-storage
OpenCode plugin that automatically stores session compaction summaries to local disk.
Installation
npm install -g @oussamadouhou/compaction-storageOr in your opencode.json:
{
"plugin": ["@oussamadouhou/compaction-storage"]
}Configuration
No configuration required! The plugin works out of the box.
Backups are stored in: ~/.local/share/opencode/compaction-backups/
Features
- 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/ - Job Reporting: Tracks all compaction operations in persistent log at
~/.local/share/opencode/persistent-agents/compaction.report - Metadata Tracking: Each backup includes session ID, timestamp, project group, and title
How It Works
- Listens for
session.compactedevents from OpenCode - Extracts compaction summary from session messages
- Detects project context for organized backup storage
- Creates local backup file with full metadata
- Updates job report with processing details
Output Format
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
Development
# Install dependencies
bun install
# Build TypeScript
bun run build
# Watch mode
bun run dev
# Test locally (in OpenCode project)
# Add to .opencode/opencode.jsonc:
# "plugin": ["file:///absolute/path/to/dist/index.js"]License
MIT
Author
Oussama Douhou
