anchor-edit
Stateful single-token anchored file editing for agents
Install / Use
claude mcp add Joilence -- npx -y github:Joilence/anchor-editIf the server publishes to npm under a different name, use that package instead โ check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
Development & EngineeringSupported Platforms
Tags
Our assessment of anchor-edit
anchor-edit scores 67/100 on our quality scale, 3968th of 4,698 Development & Engineering skills we index.
Its MCP Server is 4.4 KB long, well organised into 13 sections with 3 code examples: a solid amount of guidance for an agent.
It has 10 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated about 6 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
- Our last check on 2026-11-13 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 86/100, with 2 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit โ read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-11-11. Automated pattern scan on 2026-11-11. It catches known dangerous patterns, not every risk โ read a skill before letting an agent act on it.
anchor-edit compared with similar skills
All 4 of these similar skills score higher than anchor-edit; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| anchor-edit (this skill)by Joilence | 67 | 10 | 6mo ago | MCP Server |
| taste-skillby Leonxlnx | 100 | 116.8k | 8d ago | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 112.3k | 8d ago | CLAUDE.md |
| rufloby ruvnet | 100 | 81.9k | today | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 79.8k | today | CLAUDE.md |
Frequently asked questions
- How do I install anchor-edit?
- Run
claude mcp add Joilence -- npx -y github:Joilence/anchor-edit. The install tabs above show the steps for each supported agent. - Which AI agents does anchor-edit work with?
- It is written for Claude Code and Claude Desktop, as a MCP Server file. Other agents that read the same format can often use it too.
- Is anchor-edit safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 86/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is anchor-edit still maintained?
- The repository was last updated about 6 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
Skill content
View source on GitHubanchor-edit
Stateful single-token anchored file editing tools for coding agents, bringing[^dirac-post]:
- ~60% less token usage for file editing (from
O(S+R)toO(R)) - Smaller context, better LLM reasoning
Usage
The anchor-edit mcp subcommand exposes the editor as an MCP server for coding agents like Claude Code.
Claude Code as MCP
-
CLI:
claude mcp add anchor-edit --scope user -- npx -y anchor-edit mcp -
Example
.mcp.json:{ "mcpServers": { "anchor-edit": { "command": "npx", "args": ["-y", "anchor-edit", "mcp"] } } } -
Verify:
claude mcp list
Pi coding agent as extension
anchor-edit also ships a native pi extension.
pi install npm:anchor-edit
Restart pi, or run /reload in an existing pi session. The extension registers:
read_anchorededit_anchoredwrite_to_file
Paths may be relative to pi's current working directory or absolute. The extension keeps anchor state in memory for the active pi runtime. After /reload, restart, /new, /resume, or /fork, call read_anchored again before edit_anchored.
The pi renderer adds line numbers to read output and a unified-diff view for edits with intra-line word highlighting for single-line replacements. The MCP content[0].text payload is unchanged.
For local development from this repository:
pi -e ./src/pi-extension.ts
Implementation
Reimplements the design from Dirac (anchored edits + Myers-diff reconciler) in TypeScript with AI assistance.
anchor-edit is the stateful single-token variant:
- Pool of ~6,744 single-BPE English words from
o200k_baseis the anchor namespace. - Per-session in-memory
Map<file_path, FileState>(lines, anchors, used-pool words) persists across edits. - After every edit, a Myers-diff reconciler reassigns anchors only on changed lines, so unchanged lines keep their identity across the session.
For the full mechanism and design rationale, see Dirac's blog post[^dirac-post] and the dirac-run/dirac source.
Allocation
Mirrors Dirac's AnchorStateManager. Implementation: src/state.ts.
- Each file has its own monotonically growing
usedWordsset. Anchors are pulled from the pool in order on first allocation; deleted lines do not return their anchors to the pool. - When the pool (6,744 words from
o200k_base) is exhausted, the allocator falls back to random two-word combinations (MorelloMagnificent); on collision, three-word, then four-word. - Line splitting is
/\r?\n/(CRLF tolerated). Anchored edits rewrite logical lines with\n;write_to_filewrites content as supplied.
Tools
read_anchored: returns file content with one anchor prefix per line in the format<anchor>ยง<content>.edit_anchored:replace/insert_before/insert_after/deleteby anchor; emptynew_contentwithmode=replacealso deletes the range.write_to_file: creates or overwrites a file; returns newly-allocated anchor runs (Myers-added regions). Callread_anchoredafterwards if you need the full post-write anchor map.
For multi-line content and new_content, pass real newline characters (LF, U+000A); literal backslash-n is written to the file verbatim.
When not
Edits made via anchor-edit don't render in Claude Code's native diff UI; tool responses are text-only. Reach for Claude Code's built-in Edit tool when visual diffs matter.
Anchor-edit's value is chained surgical edits where line stability matters. Skip it for:
- Bulk same-string rename in one file: prefer the host's existing replace-all tool, or a CLI command (
sed/sd,rg --replace). One tool call. - Same-string rename across many files: prefer a CLI command (
sd,rg --replace) or a one-shot script. One tool call total.
Development
# Install dependencies
pnpm install
# Build the bin and types
pnpm run build:pool # one-time pool generation
pnpm run build
# Run tests
pnpm test # bun test, all suites
pnpm run typecheck
pnpm run lint
Credits
Original idea comes from Dirac (Apache-2.0).
[^dirac-post]: Hash Anchors + Myers Diff + Single-Token Anchors
Related Skills
taste-skill
116.8kAgent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
Agent-Reach
112.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu โ one CLI, zero API fees.
ruflo
81.9k๐ The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
headroom
79.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit โ see the Safety scan above for what the skill file itself contains.
