ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 liquid1982

pin

内容を `<pin>...</pin>` タグで囲み、すべてのコンパクション後に固定したテキストをそのまま再注入して `/compact`、自動コンパクション、プラグインが起こすコンパクション、precompute を生き残らせる Claude Mod(function-hooks プラグイン)。`session.compact` hook で登録され、任意で `ui.render` インジケーターも表示できます。

liquid1982@liquid1982

liquid1982/claude-plugins/tree/main/plugins/pin

翻訳済み

この mod について

pin は、コンパクションに耐えるコンテキストを提供する Claude Code function-hooks プラグインです。<pin>...</pin> ブロックで囲んだプロンプト内容は、session.compact の下り処理で抽出され(要約器に固定内容を保持するよう指示も渡します)、コンパクション後にタグを保った単一のキャリアユーザーメッセージとして再付加されます。次のコンパクションで再び抽出できるため、蓄積なしに pin が無期限に残ります。CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir ./pin-mod で読み込みます。任意の ui.render hook はプロンプトの上に 📌 N pinned を表示します。既知の制限:hook の時間予算によって mod がスキップされることがあります。環境変数を有効にしないと modules フィールドは黙って無視されます。ツール出力内の pin は走査しません。ui.render のストリップはリリース間で変わる可能性がある early-access の AbovePrompt コンポーネントを対象にします。

インストール

まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。

claude plugin marketplace add liquid1982/claude-plugins
claude plugin install pin
原文 / 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.render hook draws 📌 N pinned in 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, the modules field 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.render is written against the AbovePrompt component 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.

同名の他の作品

関連作品