By dullfig
Origami - context folding for Claude Code. Keeps full conversation history at variable resolution instead of lossy compaction.
Context folding for Claude Code. Replaces lossy compaction with variable-resolution context: every conversation section keeps an always-visible self-compressed summary, with full detail stored on disk and expandable on demand.
Normal conversation flow
│
▼
Auto-compact triggers
│
▼
PreCompact hook ──► Save transcript sections as folds
│ Run Haiku librarian for relevance scoring
│ Return fold-aware compact instructions
▼
Claude Code compaction (produces fold-aware summary)
│
▼
SessionStart hook ─► Inject fold index + relevant unfolded sections
│
▼
Conversation resumes with folded context
│
Opus calls unfold_section MCP tool as needed
folded (summary only) or unfolded (full detail in context)ANTHROPIC_API_KEY environment variable (for the Haiku librarian)git clone https://github.com/dullfig/origami.git
cd origami
pip install -r requirements.txt
The MCP server is self-contained (no npm install needed — zero Node.js dependencies).
Then add the plugin to your Claude Code project (copy or symlink into your project, or configure via Claude Code settings).
The plugin works automatically during compaction. You can also use these commands:
| Command | Description |
|---|---|
/fold-status | Show all folds with their state and summaries |
/unfold <id> | Manually expand a folded section |
/fold-reset | Clear all fold state and start fresh |
| Tool | Description |
|---|---|
unfold_section(fold_id) | Expand a fold to full detail |
fold_section(fold_id) | Collapse back to summary-only |
list_folds() | Show fold index |
write_summary(fold_id, summary) | Update a fold's self-compressed summary |
Fold state is stored at .claude/context-folding/ in the project root:
.claude/context-folding/
├── state.json # Fold index with summaries, scores, metadata
└── folds/
├── fold-001.md # Full detail of section 1
├── fold-002.md # Full detail of section 2
└── ...
Aggressive folding by default. Research (Lost in the Middle, context length vs. performance) shows LLM performance degrades well before context is exhausted. The system targets:
Summaries are always included regardless of budget. The model can still unfold on demand via the MCP tool when it needs specific detail.
PreCompact parses transcripts and saves folds; SessionStart injects folded contextMIT
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub dullfig/claude-plugins --plugin origamiPersistent project memory for Claude Code
Persistent local memory for Claude Code. Cross-session recall with vector search, automatic archiving, zero cloud dependencies.
DAG-based lossless context management for Claude Code. Every message from every session is persisted in a SQLite vault with FTS5 search. Summaries form a directed acyclic graph - nothing is ever lost.
Lossless context management — DAG-based summarization that preserves every message
Persistent long-term memory for Claude Code via MCP — captures coding decisions, bugfixes, and context across sessions. Hybrid FTS5 + TF-IDF search with episode batching. Single SQLite DB, no external services. A lighter, lower-cost alternative to claude-mem (episode batching + a smaller model; cost savings are an internal estimate, not a measured benchmark).
Persistent memory system for Claude Code with enforced context
Memory compression system for Claude Code - persist context across sessions