ClaudeMods
☰
KO
● 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 시간 예산으로 모드가 건너뛰어질 수 있고, 환경 변수 플래그가 없으면 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.

동명의 다른 작품

비슷한 프로젝트