liquid1982/claude-plugins/tree/main/plugins/pin
pin
A Claude Mod (function-hooks plugin) that wraps content in `<pin>...</pin>` tags and re-injects pinned text verbatim after every compaction, so it survives `/compact`, auto-compaction, plugin-triggered compaction and precompute. Registered via a `session.compact` hook with an optional `ui.render` indicator.
About this mod
pin is a Claude Code function-hooks plugin providing compaction-proof context. Any prompt content wrapped in <pin>...</pin> blocks is extracted on the way down of session.compact (with an instruction telling the summarizer to preserve pinned content) and re-appended as a single carrier user message after compaction, with tags intact so the next compaction re-extracts them — making pins persist indefinitely without accumulation. Load with CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir ./pin-mod. An optional ui.render hook shows 📌 N pinned above the prompt. Known limits: hook time budgets can skip the mod, the modules field is silently ignored without the env flag, pins inside tool output are not scanned, and the ui.render strip targets an early-access AbovePrompt component that may change between releases.
Installation
Check the author's README for the marketplace and plugin name first. Commands may change as the repository evolves.
claude plugin marketplace add liquid1982/claude-plugins claude plugin install pin
Original text / README
pin — compaction-proof context for Claude Code
A Claude Mod (function-hooks plugin). Wrap anything in <pin>...</pin> in your prompts and it will survive /compact, auto-compaction, plugin-triggered compaction, and precompute.
Usage
<pin>
The prod database is read-only until Friday. Never suggest migrations.
API base: https://api.internal.example/v2
</pin>
Now help me refactor the ingestion job.
Run with the mod loaded (Mods are early access and gated behind function hooks):
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir ./pin-mod
How it works
- Hooks
session.compact. On the way down it extracts every unique<pin>block from the transcript and appends an instruction telling the summarizer to preserve pinned content. - On the way up (after the engine compacts), it appends a single "carrier" user message containing all pins, tags intact. Because the tags survive, the next compaction re-extracts them — pins persist indefinitely. Old carriers are dropped before a new one is appended, so nothing accumulates.
- An optional
ui.renderhook draws📌 N pinnedin the band above the prompt on the terminal surface.
Verify before trusting it
claude plugin validate ./pin-mod
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude plugin test ./pin-mod
Then in a throwaway session: pin something, generate filler conversation, run /compact, and confirm the pinned text is still in context (ask the model to repeat it, or inspect with /context).
Regenerate type declarations after any Claude Code update with /plugin-types — the API is early access and may change between releases without notice.
Known limits
- Hooks have a time budget; a hook that overruns is skipped and core compaction runs alone (your pins would be lost for that pass). This mod does no I/O beyond one transcript read, so it stays well under budget.
- Without
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1, themodulesfield in hooks.json is silently ignored — no error, no pinning. - Pins are extracted from message text (user and assistant). Pins inside tool output are not scanned; move important tool findings into a pinned prompt line if you need them kept.
- The strip in
ui.renderis written against theAbovePromptcomponent of Claude Code 2.1.277's published types; if your build's contract differs, delete that block — the compaction hook is independent of it.
