AnchorDB is a local code-memory service for Git repositories.
This is experimental software. The core ideas are stable enough to use locally, but the storage format, APIs, and ergonomics may still change as the project is refined.
It stores durable notes attached to files, spans, and symbols, then exposes that data through:
anchordfor HTTP and the web vieweranchorctlfor shell workflows and scriptsanchordb-mcpfor MCP hosts such as Claude Code
AnchorDB is primarily useful as durable working memory for coding agents. It gives an agent or a human a place to store code-local warnings, debugging notes, TODOs, handoff context, and rationale that should stay attached to the implementation instead of disappearing into chat history.
AnchorDB is best suited for:
- AI agents that need to read context before editing a file or symbol
- agent handoffs where one run should leave precise notes for the next run
- long debugging sessions where repros and findings should stay attached to code
- human review notes on risky paths such as billing, auth, migrations, or retry logic
- local or team workflows that want both a web viewer and an MCP surface over the same code memory
The main workflows are:
anchordb-mcpfor coding agentsanchorctlfor scripts, shells, and CIanchordfor browsing code, anchors, comments, and diffs in a browser
AnchorDB stores anchors.
Each anchor contains:
- repo metadata
- a note body and kind
- a file path
- a line and column range
- selected text plus surrounding context
- an optional symbol path
When files change, AnchorDB re-resolves anchors using the saved span, text context, and symbol information. Tree-sitter improves symbol extraction and relocation, but the system still works without it.
Built-in symbol extractors:
- Go
- Python
- JavaScript
- TypeScript
Install the binaries into your Go bin directory:
go install github.com/jolovicdev/anchor-db/cmd/anchord@latest
go install github.com/jolovicdev/anchor-db/cmd/anchorctl@latest
go install github.com/jolovicdev/anchor-db/cmd/anchordb-mcp@latestTo install from a local checkout instead:
go install ./cmd/anchord
go install ./cmd/anchorctl
go install ./cmd/anchordb-mcpCheck where Go installs binaries with:
go env GOBIN
go env GOPATHStart the server:
anchord -db ./anchor.db -sync-interval 30sRegister a repo:
anchorctl repo add --name demo --path /path/to/repoCreate an anchor:
anchorctl anchor create \
--repo-id repo_123 \
--ref WORKTREE \
--path internal/service/run.go \
--start-line 42 \
--start-col 1 \
--end-line 49 \
--end-col 2 \
--kind warning \
--title "Retry must stay idempotent" \
--body "This path duplicated writes during incident 2026-02-14." \
--author human://aliceOpen the viewer:
http://127.0.0.1:7740/
Start the MCP server:
anchordb-mcp --db ./anchor.dbanchorctl talks to the running HTTP server.
It reads the base URL from ANCHOR_DB_URL. Default:
http://127.0.0.1:7740
Add a repo:
anchorctl repo add --name demo --path /path/to/repoList repos:
anchorctl repo listGet one repo:
anchorctl repo get --id repo_123Sync one repo:
anchorctl repo sync --id repo_123Remove one repo:
anchorctl repo remove --id repo_123List anchors:
anchorctl anchor list --repo-id repo_123 --path internal/api/server.go --limit 20 --offset 0Get one anchor:
anchorctl anchor get --id anchor_123Create an anchor:
anchorctl anchor create \
--repo-id repo_123 \
--ref WORKTREE \
--path internal/api/server.go \
--start-line 40 \
--start-col 1 \
--end-line 52 \
--end-col 2 \
--kind warning \
--title "Keep request validation strict" \
--body "This handler should reject empty repo_id values." \
--author human://aliceUpdate anchor metadata:
anchorctl anchor update \
--id anchor_123 \
--kind handoff \
--title "Next step" \
--body "Trace the retry path before changing the timeout logic." \
--author agent://planner \
--tags billing,handoffArchive an anchor:
anchorctl anchor close --id anchor_123Reopen an anchor:
anchorctl anchor reopen --id anchor_123Re-run anchor resolution:
anchorctl anchor resolve --id anchor_123Get file or symbol context:
anchorctl context --repo-id repo_123 --ref WORKTREE --path internal/api/server.go --symbol "*Server.handleRepos"List comments:
anchorctl comment list --anchor-id anchor_123Add a comment:
anchorctl comment add --anchor-id anchor_123 --author human://alice --body "Confirmed in production replay."Full-text search:
anchorctl search --query retry --repo-id repo_123 --path internal/api/server.goAll CLI commands return JSON.
Default listen address:
http://127.0.0.1:7740
GET /healthGET /v1/reposPOST /v1/reposGET /v1/repos/{repo_id}POST /v1/repos/{repo_id}/syncDELETE /v1/repos/{repo_id}GET /v1/anchorsPOST /v1/anchorsGET /v1/anchors/{anchor_id}PATCH /v1/anchors/{anchor_id}POST /v1/anchors/{anchor_id}/closePOST /v1/anchors/{anchor_id}/reopenPOST /v1/anchors/{anchor_id}/resolveGET /v1/anchors/{anchor_id}/commentsPOST /v1/anchors/{anchor_id}/commentsGET /v1/contextGET /v1/searchGET /view
Create a repo:
POST /v1/repos
Content-Type: application/json
{
"name": "demo",
"path": "/path/to/repo"
}Response:
{
"id": "repo_123",
"name": "demo",
"root_path": "/path/to/repo",
"default_ref": "abc123...",
"created_at": "2026-03-11T10:00:00Z",
"updated_at": "2026-03-11T10:00:00Z"
}Create an anchor:
POST /v1/anchors
Content-Type: application/json
{
"repo_id": "repo_123",
"ref": "WORKTREE",
"path": "internal/service/run.go",
"start_line": 42,
"start_col": 1,
"end_line": 49,
"end_col": 2,
"kind": "warning",
"title": "Retry must stay idempotent",
"body": "This path duplicated writes during incident 2026-02-14.",
"author": "human://alice",
"tags": ["billing", "warning"]
}Update an anchor:
PATCH /v1/anchors/anchor_123
Content-Type: application/json
{
"kind": "handoff",
"title": "Next step",
"body": "Check the retry path before changing timeout handling.",
"author": "agent://planner",
"tags": ["billing", "handoff"]
}Close, reopen, or resolve an anchor:
POST /v1/anchors/anchor_123/close
POST /v1/anchors/anchor_123/reopen
POST /v1/anchors/anchor_123/resolveRead file context:
GET /v1/context?repo_id=repo_123&ref=WORKTREE&path=internal/service/run.go&symbol=*Runner.RunFull-text search:
GET /v1/search?query=retry&repo_id=repo_123&path=internal/service/run.go&limit=20&offset=0Add a comment:
POST /v1/anchors/anchor_123/comments
Content-Type: application/json
{
"author": "human://alice",
"body": "Confirmed in staging replay."
}All API responses are JSON. Validation failures return:
{
"error": "message"
}anchordb-mcp serves the same data over MCP stdio and reads the SQLite database directly. It does not require anchord to be running.
Run it:
anchordb-mcp --db ./anchor.dbOn Linux or WSL, Anthropic currently documents two install paths for Claude Code:
- native installer:
curl -fsSL https://claude.ai/install.sh | bash - npm installer:
npm install -g @anthropic-ai/claude-code
After Claude Code is installed, add AnchorDB as a stdio MCP server:
claude mcp add anchordb --scope project -- /absolute/path/to/anchordb-mcp --db /absolute/path/to/anchor.dbUseful follow-up commands:
claude mcp list
claude mcp get anchordbInside Claude Code, use /mcp to inspect configured MCP servers and their status.
Notes:
--scope projectstores the configuration in.mcp.jsonfor the current project--scope localkeeps it private to your local project setup--scope usermakes it available across projects on your machine- everything after
--is the actual server command and its arguments
Equivalent .mcp.json entry:
{
"mcpServers": {
"anchordb": {
"command": "/absolute/path/to/anchordb-mcp",
"args": ["--db", "/absolute/path/to/anchor.db"]
}
}
}Once connected, a coding agent can:
- read anchor context before editing a file
- search previous notes and comments
- create or update anchors during debugging
- leave handoff notes for the next run
repo_addanchor_reposrepo_getrepo_syncrepo_removeanchor_contextanchor_createanchor_updateanchor_closeanchor_reopenanchor_resolveanchor_commentanchor_searchanchor_text_searchanchor_getanchor_commentsanchor_file_view
anchordb://reposanchordb://repo/{repo_id}anchordb://context/{repo_id}{?ref,path,symbol}anchordb://search{?query,repo_id,path,symbol,kind,limit,offset}anchordb://anchors/{repo_id}{?path,symbol,status,limit,offset}anchordb://file/{repo_id}{?ref,path}anchordb://anchor/{anchor_id}anchordb://comments/{anchor_id}
The web viewer shows:
- a repo file list
- the selected file with highlighted anchor ranges
- anchor cards and threaded comments
- the Git working-tree diff for that file
Highlighted lines mark anchor coverage. The diff panel shows the actual Git diff for the selected file.
AnchorDB stores data in SQLite.
The same database can be used by:
anchordanchorctlanchordb-mcp
Typical local path:
./anchor.db