whatisgithub

What is claude-anchor?

rodrigooler/claude-anchor — explained in plain English

Analysis updated 2026-05-18

2ShellAudience · developerComplexity · 2/5LicenseSetup · easy

In one sentence

A Claude Code plugin that stops important context, like file paths and past decisions, from being lost every time a session compacts.

Mindmap

mindmap
  root((claude-anchor))
    What it does
      Preserves context on compact
      Re-injects custom rules
      Delays compaction trigger
    Tech stack
      Shell hooks
      Claude Code plugin
    Use cases
      Long coding sessions
      Persistent project rules
      Avoid re-solving bugs
    Audience
      Claude Code developers
    Setup
      One curl install
      No configuration needed

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Prevent Claude Code from losing important file paths and decisions during long sessions.

USE CASE 2

Keep persistent project rules and preferences across every context compaction.

USE CASE 3

Delay compaction until a session is closer to its true context limit.

USE CASE 4

Preserve the reasoning behind past bug fixes so they don't get rediscovered later.

What is it built with?

ShellClaude Code

How does it compare?

rodrigooler/claude-anchorchrisor-dev/claude-autosyncdangerousyams/muxer
Stars222
LanguageShellShellShell
Setup difficultyeasymoderatemoderate
Complexity2/53/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

One curl command or a Claude Code plugin install, no configuration required to get started.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

So what is it?

Claude Anchor is a shell-based plugin for Claude Code, Anthropic's AI coding assistant, that solves a specific problem with long sessions. Every time Claude Code runs its built-in compact command to shrink a conversation that is running out of space, it tends to lose important details. Exact file paths get paraphrased, error messages and root causes get summarized away, the reasoning behind past decisions disappears, and any corrections or preferences expressed earlier get wiped out. Claude Anchor works by hooking into two lifecycle events that Claude Code fires around each compaction. A pre-compact hook runs just before compression and instructs Claude to preserve certain things word for word in the summary, such as file paths, error messages, decisions, and corrections. A post-compact hook runs immediately after and re-injects a file the user controls, called anchor-context.md, back into the session. That file lives at a fixed path in the user's Claude Code settings folder and can hold anything meant to persist across the whole session: tool preferences, project conventions, and notes about ongoing work. The plugin also adjusts when compaction triggers by raising the threshold to 85 percent of context capacity instead of the default, giving the session more room before compression kicks in. The README points to research from Factory.ai showing that structured, instruction-driven summarization retains context noticeably better than the default approach, especially over multiple compaction cycles. Installation is either a Claude Code plugin command or a single curl command, and no configuration is required to get started, though the compaction threshold percentage is adjustable, for example for models with much larger context windows. The project is written in Shell and released under the MIT license.

Copy-paste prompts

Prompt 1
Install claude-anchor using the one-liner curl command and explain what it changes in my Claude Code setup.
Prompt 2
Help me write a good anchor-context.md file for my project's conventions and ongoing work.
Prompt 3
Explain the difference between the PreCompact and PostCompact hooks this plugin uses.
Prompt 4
Show me how to change the compaction threshold for a large-context model like Opus.

Frequently asked questions

What is claude-anchor?

A Claude Code plugin that stops important context, like file paths and past decisions, from being lost every time a session compacts.

What language is claude-anchor written in?

Mainly Shell. The stack also includes Shell, Claude Code.

What license does claude-anchor use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is claude-anchor to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is claude-anchor for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.