Codemark is a structural bookmarking system for code. Unlike fragile file:line references that break when you insert a single newline, Codemark uses tree-sitter to capture the semantic structure of your code.
Bookmarks self-heal across renames, refactors, and formatting changes, making them perfect for long-running AI agent sessions, code audits, and developer knowledge management.
Standard bookmarks are "dumb"βthey point to a coordinate. When the code moves, the coordinate points to the wrong thing. Codemark is "smart"βit knows what you bookmarked (e.g., "the validateToken function in auth.rs").
- Self-Healing Resolution: Tiered matching (Exact β Relaxed β Hash Fallback) ensures your bookmarks stay alive even if the code drifts.
- Agent Ready: Designed for AI coding agents (like Claude Code) to maintain context across sessions.
- TUI & CLI Native: Works beautifully with
fzf,television,bat, andNeovim. - Semantic Search: Find bookmarks by meaning using local vector embeddings (no API key required).
Codemark doesn't just store a pointer; it stores a comprehensive snapshot of the code's context:
- AST Structure: The exact Tree-Sitter query used to locate the node.
- Git Context: Commit hashes for both creation and every successful resolution.
- Content Hashes: Resilient SHA-256 hashes of normalized code content.
- Append-only Annotations: Multiple notes and context entries from different users or agents.
- Resolution History: A full audit log of how and where the bookmark has moved over time.
- π§ Smart Resolution: Bookmarks survive renames and structural changes.
- π Rich Metadata: Captures AST structure, git context, content hashes, and append-only notes/tags.
- π Semantic Search: Find code by intent (e.g., "where is authentication handled?").
- ποΈ Collections: Group bookmarks into logical sets for specific tasks.
- π¦ Git Integrated: Track bookmarks across commits and branches.
- π§© First-class Integrations:
- Television: Interactive TUI for browsing and fuzzy-finding.
- Neovim: Gut signs, visual selection bookmarking, and Telescope support.
- Claude Code: Specialized plugin for AI-driven bookmarking.
- π Quick Open: Jump directly to bookmarked code in your favorite editor.
brew tap DanielCardonaRojas/codemark
brew install codemarkcargo install codemarkRequires Rust 1.75+. SQLite is bundled.
Bookmark a function by line number. Codemark automatically identifies the AST node.
codemark add --file src/auth.rs --range 42 --tag auth --note "JWT entry point"Even if you've added lines or moved the function, Codemark finds it:
codemark resolve a1b2Reindex once to enable semantic search:
codemark reindex
codemark search --semantic "how are tokens validated?"The recommended way to browse is via television:
tv codemark- Full Command Reference β Detailed flag and subcommand guide.
- Configuration β Editor setup, global/local config, and semantic search.
- Neovim Plugin β Setup for
codemark.nvim. - Claude Code Plugin β Power up your AI agent.
Codemark uses Handlebars templates to format bookmark output. You can customize the codemark show command output by providing your own template.
-
User config directory (highest priority):
~/.config/codemark/templates/codemark_show.md- Create this file to override the default template
- The directory is created automatically if it doesn't exist
-
Project template (for reference):
./templates/codemark_show.md- Contains the default template that you can copy and modify
To create your custom template:
# Copy the default template to your config directory
mkdir -p ~/.config/codemark/templates
cp ./templates/codemark_show.md ~/.config/codemark/templates/
# Edit it to your liking
nano ~/.config/codemark/templates/codemark_show.md| Variable | Description |
|---|---|
{{short_id}} |
First 8 chars of bookmark ID |
{{id}} |
Full bookmark ID |
{{file_path}} |
Path to the file |
{{file_name}} |
Just the filename |
{{language}} |
Programming language |
{{health}} |
active, drifted, stale, or archived |
{{status}} |
Alias for {{health}} (deprecated) |
{{query}} |
Tree-sitter query |
{{created_at}} |
Creation timestamp |
{{created_by}} |
Creator (optional) |
{{commit_hash}} |
Git commit hash (optional) |
{{short_commit}} |
First 8 chars of commit (optional) |
{{last_resolved_at}} |
Last resolution time (optional) |
{{resolution_method}} |
Resolution method (optional) |
{{stale_since}} |
When it became stale (optional) |
{{#each annotations}}β Loop through annotations{{#each resolutions}}β Loop through resolution history{{#each tags}}β Loop through tags{{#if created_by}}β Conditional content{{escape_markdown value}}β Escape special markdown characters{{truncate value}}β Truncate string to 8 characters
For the full template specification, see the templates reference.
Codemark speaks AST for:
- π¦ Rust
- π Swift
- π· TypeScript / TSX
- π Python
- πΉ Go
- β Java
- π― Dart
- β― C#
Released under the MIT License.