Skip to content

Command Reference ​

Full list of subcommands and flags for codemark.

Global Options ​

codemark [--db <path>]... [--repo <owner/name>]... [--format <fmt>] [--verbose] <subcommand>

--db <path>          Database location (repeatable for multi-repo queries)
--repo <owner/name>  Repository reference for identity-based discovery (repeatable)
--format <fmt>       Output format: json (default), table, line, tv, markdown
--verbose            Enable debug-level logging to stderr

Identity-Based Discovery ​

The --repo flag enables querying repositories by their identity (e.g., facebook/react) instead of their filesystem path. This uses the global registry at ~/.config/codemark/registry.db to resolve repository references to their local paths.

bash
# List bookmarks from multiple repositories by identity
codemark list --repo facebook/react --repo acme/api

# Search across specific repositories
codemark search "authentication" --repo facebook/react

# Combine with other filters
codemark list --repo facebook/react --tag performance --health active

Core Commands ​

add ​

Create a bookmark from a file and range.

bash
codemark add --file <path> --range <start-end> [--tag <tag>]... [--note <note>]
  • --range: Line range (e.g., 42, 42-67, 10:5-10:20) or byte range with b prefix (e.g., b1024-1280).
  • --hunk: Derive range from a git diff hunk header.

add-from-snippet ​

Create a bookmark by matching a snippet from stdin.

bash
echo "code snippet" | codemark add-from-snippet --file <path>

resolve ​

Find the current location of a bookmark.

bash
codemark resolve <id>

show ​

Display full details and resolution history.

bash
codemark show <id>

list ​

List bookmarks with filters.

bash
codemark list [--tag <tag>] [--health <status>] [--file <path>] [--repo <owner/name>]
  • --repo: Query specific repositories by identity (repeatable)

open ​

Open a bookmarked file in your configured editor.

bash
codemark open <id>

Search & Maintenance ​

Search across notes, context, and tags.

bash
codemark search "query"
codemark search --semantic "natural language query"

reindex ​

Rebuild embeddings for semantic search.

bash
codemark reindex [--force]

heal ​

Batch-resolve all bookmarks and update their status (active/drifted/stale).

bash
codemark heal [--auto-archive]

status ​

Print a health summary of all bookmarks.

diff ​

Show bookmarks affected by recent git changes.

gc ​

Permanently remove old archived bookmarks.

bash
codemark gc --older-than 30d

Collections ​

Group bookmarks for specific investigations or tasks.

collection create <name> ​

collection add <name> <id>... ​

collection list ​

collection show <name> ​

collection reorder <name> <id>... ​

collection copy <name> / tour copy <name> ​

Clone a collection as a starting point for a new one. Every step is forked: it becomes a new bookmark with the original's notes, tags and comments, so editing the clone never changes the original.

bash
codemark tour copy auth-flow --as auth-2fa             # clone onto the current branch
codemark tour copy auth-flow --as auth-main --to main  # clone onto another branch

Without --as, the copy is named <name>-<branch>.

collection move <name> / tour move <name> ​

Move a collection to another branch, typically the one its branch merged into. Steps are re-resolved on the target straight from git (no checkout needed), renamed files are followed, and the collection keeps its id, name and links.

bash
codemark tour move auth-flow --to main --dry-run
codemark tour move auth-flow --to main --on-unmatched drop

Options for copy and move:

FlagMeaning
--to <branch>Resolve against this branch. Default: the current branch's working tree.
--on-unmatched fail|dropfail (default) writes nothing and exits non-zero; drop leaves unmatched steps out. A move never deletes their bookmarks.
--allow-fuzzyAlso accept relaxed, minimized and hash-fallback matches (recorded as drifted). Off by default, because a loose query can match unrelated code.
--dry-runReport each step's match tier, hash change and rename without writing.

The JSON report includes the collection's prompt, so an agent can rebuild unmatched steps on the target branch.


Advanced ​

annotate ​

Add notes, context, or tags to an existing bookmark without re-parsing.

bash
codemark annotate <id> --note "new note" --tag bug

preview ​

Show a syntax-highlighted preview of bookmarked code.

bash
codemark preview <id>

export / import ​

Transfer bookmarks via JSON or CSV.

completions ​

Generate shell completions for bash, zsh, fish, or powershell.


Repository Registry ​

Manage repository identities and server bindings for cross-repo discovery.

repo list ​

List all known repositories in the global registry.

bash
codemark repo list

repo show [owner/name] ​

Show details for a repository (defaults to current repo).

bash
codemark repo show
codemark repo show facebook/react

repo set-server [owner/name] <url> ​

Set the default server URL for a repository.

bash
codemark repo set-server facebook/react https://codetours.example.com