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 stderrIdentity-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.
# 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 activeCore Commands
add
Create a bookmark from a file and range.
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 withbprefix (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.
echo "code snippet" | codemark add-from-snippet --file <path>resolve
Find the current location of a bookmark.
codemark resolve <id>show
Display full details and resolution history.
codemark show <id>list
List bookmarks with filters.
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.
codemark open <id>Search & Maintenance
search
Search across notes, context, and tags.
codemark search "query"
codemark search --semantic "natural language query"reindex
Rebuild embeddings for semantic search.
codemark reindex [--force]heal
Batch-resolve all bookmarks and update their status (active/drifted/stale).
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.
codemark gc --older-than 30dCollections
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.
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 branchWithout --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.
codemark tour move auth-flow --to main --dry-run
codemark tour move auth-flow --to main --on-unmatched dropOptions for copy and move:
| Flag | Meaning |
|---|---|
--to <branch> | Resolve against this branch. Default: the current branch's working tree. |
--on-unmatched fail|drop | fail (default) writes nothing and exits non-zero; drop leaves unmatched steps out. A move never deletes their bookmarks. |
--allow-fuzzy | Also accept relaxed, minimized and hash-fallback matches (recorded as drifted). Off by default, because a loose query can match unrelated code. |
--dry-run | Report 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.
codemark annotate <id> --note "new note" --tag bugpreview
Show a syntax-highlighted preview of bookmarked code.
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.
codemark repo listrepo show [owner/name]
Show details for a repository (defaults to current repo).
codemark repo show
codemark repo show facebook/reactrepo set-server [owner/name] <url>
Set the default server URL for a repository.
codemark repo set-server facebook/react https://codetours.example.com