Claude Code plugin

context-anchor

Pin the facts, decisions and constraints that must survive context compaction, and get them back word for word the moment a long session resumes.

Claude CodeDeveloper ToolsOpen Source
aleksns.com/projects/context-anchor
claude — ~/projects/api
$ claude --plugin-dir ./context-anchor
 
> /context-anchor:pin "don't touch the auth module, it's mid-refactor"
  pinned · 1 anchor in .claude/context-anchor/anchors.jsonl
 
> /context-anchor:pin "staging DB is read-only until Friday"
  pinned · 2 anchors
 
  … 3h later, context compacted …
 
  context-anchor restored 2 pinned anchors:
    · don't touch the auth module, it's mid-refactor
    · staging DB is read-only until Friday
slash commands
3
lifecycle hooks
2
licensed
MIT
01About

The idea

When a Claude Code session runs long, the transcript gets summarized to stay inside the context window. That's necessary, but summaries are lossy. A constraint stated early on, like "don't touch the auth module", "the deadline is Friday" or "we decided X, not Y", can be smoothed over or dropped.

context-anchor gives you an explicit way to pin something so it survives that boundary intact. Pinned anchors are re-injected as a reminder on the first turn after a compaction, instead of relying on the summary to have kept them.

02Capabilities

What it does

03Under the hood

How it works

  1. 01

    Pin

    State a constraint once with /context-anchor:pin.

  2. 02

    Compact

    The PreCompact hook persists anchors before the transcript is summarized.

  3. 03

    Resume

    The SessionStart hook re-injects them word for word after compaction.

04Stack

Built with

It's open source. Read it, fork it, use it.

View on GitHub