By morphllm
Replace Claude Code's context compaction with Morph's service by installing an API key in ~/.claude/morph/.env and appending override instructions to ~/.claude/CLAUDE.md. Uninstall cleans up files. Run TypeScript hooks via Bun on PreCompact, SessionStart, SubagentStart, and UserPromptSubmit for session lifecycle automation.
A Claude Code marketplace that houses Morph integration plugins. There is currently only one plugin:
[!IMPORTANT] This plugin enables morph's Flash Compact, but does NOT provide warpgrep OR fast apply. Those are available through the mcp. We strongly reccomend having BOTH the MCP and Plugin installed.
The morph-compact plugin hooks parts of the compaction lifecycle in order to inject Morph Compact into its context.
[!IMPORTANT] Currently there is no way to make the default calude code compaction NOT run. So we prompt inject, asking claude's own summarization model to not waste time summarizing, instead only output a few words. Your claude will use morph's provided context instead. Prompt injection is not a fool proof method, we're working on making this more reliable and consisten. We are open to PRs for this. More detailes below
The former uses the PreCompact hook and the latter uses the SessionStart hook.
Run the install skill to set up your API key and compact instructions:
/morph-compact:install
This will:
~/.claude/morph/.env~/.claude/CLAUDE.mdTo remove:
/morph-compact:uninstall
The API key can also be provided via the MORPH_API_KEY environment variable, which takes precedence over the file.
Due to limitations with Claude Code's hooks, we are unable to alter the output of a compaction.
To work around this, the install skill adds compact instructions to ~/.claude/CLAUDE.md that tell Claude to skip its own summarization when Morph is handling it. This reduces time spent compacting.
For manual compaction, simply run:
/compact morph
Claude will see the morph instruction and output only the sentinel text, letting Morph's summary take over.
If the compact instructions are not followed (more likely on very large sessions), the plugin will detect this and prompt you to run /compact morph again. The second compaction operates on a much smaller context and is far more likely to succeed. The Morph summary is cached, so no additional API call is made on retry.
[!WARNING] Even with these instructions, there's no guarantee that compaction will respect them. We are currently working on a more reliable way to fully disable claude's own compaction.
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 morphllm/morph-claude-code-plugin --plugin morph-compactReplace /compact with intelligent context transfer - analyzes current thread and generates focused prompts for new threads based on your goal
Automatic context preservation - saves 50-60% tokens across sessions
Automatic context monitoring that prevents mid-task compaction. Shows real-time free space in status line and injects context state so Claude knows when to recommend /compact.
Governor: always-on compact professional output, telemetry, context slimming, tool-output filtering, prompt guidance, and drift guardrails for Claude Code Max users.
Ultra-compressed communication mode. Cuts ~75% of tokens while keeping full technical accuracy by speaking like a caveman.
Memory compression system for Claude Code - persist context across sessions