CLI Commands
Quick reference for all zk commands.
Note Creation
Section titled “Note Creation”Create an untethered note (no project required)
Section titled “Create an untethered note (no project required)”zk create "Quick idea about X" --category untetheredzk create "My note title" # Default is untetheredCreate an untethered note with project
Section titled “Create an untethered note with project”zk create "Project idea" --category untethered --project my-projectzk create "Project idea" --category untethered -p my-projectCreate a tethered note (project required)
Section titled “Create a tethered note (project required)”zk create "Refined concept" --category tethered --project my-projectNote Management
Section titled “Note Management”Set project on a note
Section titled “Set project on a note”zk set-project path/to/note.md my-projectTether an untethered note (promote to tethered)
Section titled “Tether an untethered note (promote to tethered)”# With explicit projectzk tether path/to/note.md --project my-projectzk tether path/to/note.md -p my-project
# Auto-detect from git (if in a repo)zk tether path/to/note.mdUntether a tethered note (demote to untethered)
Section titled “Untether a tethered note (demote to untethered)”# Reverts a tethered note back to untetheredzk untether path/to/note.mdAdd tags to a zettel
Section titled “Add tags to a zettel”zk add-tags path/to/note.md golangzk add-tags path/to/note.md golang api securityTags are appended to the existing tags: list in the zettel’s YAML frontmatter. Duplicate tags are ignored.
Validation
Section titled “Validation”Validate a zettel’s frontmatter
Section titled “Validate a zettel’s frontmatter”zk validate path/to/note.mdValidates the zettel’s YAML frontmatter against the CUE schema. Reports any missing or invalid fields.
Indexing
Section titled “Indexing”Index a single file
Section titled “Index a single file”zk index path/to/note.mdIndex all notes in a directory
Section titled “Index all notes in a directory”zk index ~/zk_vault/zk index .Searching
Section titled “Searching”Full-text search
Section titled “Full-text search”zk search "authentication patterns"zk search "golang error handling"Filter by project
Section titled “Filter by project”zk search --project my-projectzk search -p my-projectzk search "query" --project my-project # CombinedFilter by category
Section titled “Filter by category”zk search --category untetheredzk search --category tetheredzk search -c tetheredFilter by tags
Section titled “Filter by tags”zk search --tag golangzk search --tag golang --tag api # AND (must have both)zk search -T golang -T testingFilter by type
Section titled “Filter by type”zk search --type todozk search --type daily-notezk search -t issueFilter by status and priority
Section titled “Filter by status and priority”zk search --status openzk search --priority highzk search --type todo --status open --priority highFilter by due date
Section titled “Filter by due date”zk search --due-before 2026-03-01zk search --due-after 2026-02-01zk search --due-after 2026-02-01 --due-before 2026-02-28 # Date rangeLimit results
Section titled “Limit results”zk search --limit 10zk search -l 50JSON output (for scripting/tooling)
Section titled “JSON output (for scripting/tooling)”zk search --jsonzk search "query" --json | jq '.[] | .title'Combined filters
Section titled “Combined filters”zk search "authentication" --project my-project --category tethered --tag securityzk search --type todo --status open --project my-project --priority highGraph Visualization
Section titled “Graph Visualization”Generate a graph from a directory
Section titled “Generate a graph from a directory”zk graph ~/zk_vault/zk graph .Limit the number of nodes
Section titled “Limit the number of nodes”zk graph . --limit 20zk graph . -l 5Start from a specific note
Section titled “Start from a specific note”zk graph . --start 20260219143000-a1b2c3d4Control tree depth
Section titled “Control tree depth”zk graph . --depth 3Sync graph database before querying
Section titled “Sync graph database before querying”zk graph --syncThe graph command outputs Mermaid flowchart syntax to stdout. When a graph database (.zk_graph.db) exists, it uses indexed data for faster queries. Use --sync to force a fresh sync before querying.
Graph Database
Section titled “Graph Database”The graph database (.zk_graph.db) enables O(1) indexed backlink lookups and fast traversals. It is optional — all commands fall back to filesystem scanning when the database doesn’t exist.
Sync the graph database
Section titled “Sync the graph database”zk graph-sync # Sync from configured rootzk graph-sync ~/zk_vault/ # Sync from explicit pathzk graph-sync --validate # Sync + validate edge integrityOutput shows added, updated, deleted counts. With --validate, reports dangling edges (links to non-existent notes) and structurally invalid edges.
Query backlinks (indexed)
Section titled “Query backlinks (indexed)”zk graph-query backlinks <id>zk graph-query backlinks <id> --jsonQuery connected cluster (N-depth BFS)
Section titled “Query connected cluster (N-depth BFS)”zk graph-query cluster <id>zk graph-query cluster <id> --depth 2 --limit 20zk graph-query cluster <id> --jsonQuery by tag
Section titled “Query by tag”zk graph-query tag golangzk graph-query tag golang --jsonFind dangling edges
Section titled “Find dangling edges”zk graph-query danglingzk graph-query dangling --jsonNote Templates
Section titled “Note Templates”List and use note templates for structured content.
List available templates
Section titled “List available templates”zk templatesCreate a note from a template
Section titled “Create a note from a template”zk create "Sprint Planning Q1" --template meetingzk create "Clean Code Review" --template book-reviewzk create "OAuth Implementation" --template featurezk create "Add Login Flow" --template user-storyzk create "CLI Tool Idea" --template project-ideazk create "Go Error Handling" --template snippetAvailable templates:
meeting- Meeting notes with attendees and action itemsbook-review- Book review with rating and key takeawayssnippet- Code snippet with context and explanationproject-idea- Project idea with goals and next stepsuser-story- User story in standard format with acceptance criteriafeature- Feature specification with requirements and design notesdaily- Daily note for thoughts, tasks, and reflectionstodo- Actionable task with status trackingissue- Issue tracking like GitHub (bug, enhancement, question)
Backlinks
Section titled “Backlinks”Find all notes that link to a specific zettel.
Find backlinks by ID
Section titled “Find backlinks by ID”zk backlinks 202602131045Find backlinks by file path
Section titled “Find backlinks by file path”zk backlinks ./notes/202602131045.mdJSON output
Section titled “JSON output”zk backlinks 202602131045 --jsonzk backlinks 202602131045 --json | jq '.[].title'Daily Notes
Section titled “Daily Notes”Create and manage daily notes for capturing thoughts, tasks, and reflections.
Create or open today’s daily note
Section titled “Create or open today’s daily note”zk dailyOpen yesterday’s daily note
Section titled “Open yesterday’s daily note”zk daily --yesterdayOpen a specific date’s daily note
Section titled “Open a specific date’s daily note”zk daily --date 2026-02-10List recent daily notes
Section titled “List recent daily notes”zk daily --list # Last 14 dayszk daily --list --week # This weekzk daily --list --month # This monthzk daily --list --json # JSON outputDaily notes are stored in untethered/daily/YYYY/MM/YYYY-MM-DD.md.
See Daily Notes Workflow for a comprehensive guide to daily note workflows.
Todo Management
Section titled “Todo Management”Create a todo
Section titled “Create a todo”zk todo "Fix login bug"zk todo "Update docs" --project my-projectCreate with due date and priority
Section titled “Create with due date and priority”zk todo "Critical fix" --due 2026-02-20 --priority highzk todo "Nice to have" --priority lowList todos
Section titled “List todos”zk todos # List open todoszk todos --project my-project # Filter by projectzk todos --overdue # Overdue todoszk todos --today # Due todayzk todos --this-week # Due this weekzk todos --closed # Show closed todoszk todos --json # JSON outputManage todo status
Section titled “Manage todo status”zk set-status 202602131045 closed # Mark as closedzk set-status 202602131045 in_progress # Set to in progresszk set-status 202602131045 open # Reopen a closed todoGenerate todo list markdown
Section titled “Generate todo list markdown”zk todo-list # Generate todo listzk todo-list --project my-projectzk todo-list --output my-todos.mdSee Todo Workflow for a comprehensive guide to todo workflows.
Git Workflow
Section titled “Git Workflow”Manage your zettelkasten git repository with dated branches.
Start your day (hello)
Section titled “Start your day (hello)”zk helloThis command:
- Checks out the
mainbranch - Pulls latest changes
- Creates a new branch named with today’s date (
YYYYMMDDformat, e.g.,20260213) - Warns if the branch already exists (does nothing)
- Warns if there are uncommitted changes (does nothing)
End your day (goodbye)
Section titled “End your day (goodbye)”zk goodbyeThis command:
- Commits all changes with a timestamped message
- Checks out
main - Merges the dated branch into
main - Deletes the dated branch after merge
- Warns if not on a date branch (does nothing)
- Warns if there are no changes to commit (still merges)
Typical daily workflow
Section titled “Typical daily workflow”# Morningzk hello # Create today's branch
# Throughout the dayzk create "Meeting notes" --template meetingzk todo "Follow up on action item"zk daily # Add to daily note
# End of dayzk goodbye # Commit and merge to mainGeneral help
Section titled “General help”zk --helpzk -hCommand-specific help
Section titled “Command-specific help”zk create --helpzk index --helpFlags Reference
Section titled “Flags Reference”zk create
Section titled “zk create”| Flag | Short | Default | Description |
|---|---|---|---|
--category | -c | untethered | Note category (untethered or tethered) |
--project | -p | (auto-detect) | Project context |
--template | - | - | Use a note template (e.g., meeting, user-story) |
--help | -h | - | Show help |
zk templates
Section titled “zk templates”| Flag | Short | Default | Description |
|---|---|---|---|
--help | -h | - | Show help |
zk tether
Section titled “zk tether”| Flag | Short | Default | Description |
|---|---|---|---|
--project | -p | (auto-detect) | Project context for tethered note |
--help | -h | - | Show help |
zk untether
Section titled “zk untether”| Flag | Short | Default | Description |
|---|---|---|---|
--help | -h | - | Show help |
zk set-project
Section titled “zk set-project”| Flag | Short | Default | Description |
|---|---|---|---|
--help | -h | - | Show help |
zk add-tags
Section titled “zk add-tags”Usage: zk add-tags <file> <tag1> [tag2...]
| Flag | Short | Default | Description |
|---|---|---|---|
--help | -h | - | Show help |
zk validate
Section titled “zk validate”Usage: zk validate <file>
| Flag | Short | Default | Description |
|---|---|---|---|
--help | -h | - | Show help |
zk index
Section titled “zk index”| Flag | Short | Default | Description |
|---|---|---|---|
--help | -h | - | Show help |
zk search
Section titled “zk search”| Flag | Short | Default | Description |
|---|---|---|---|
--project | -p | - | Filter by project |
--category | -c | - | Filter by category (untethered/tethered) |
--tag | -T | - | Filter by tag (repeatable, AND logic) |
--type | -t | - | Filter by type (note/todo/daily-note/issue) |
--status | - | - | Filter by status (open/in_progress/closed) |
--priority | - | - | Filter by priority (high/medium/low) |
--due-before | - | - | Filter todos due before date (YYYY-MM-DD) |
--due-after | - | - | Filter todos due after date (YYYY-MM-DD) |
--limit | -l | 20 | Maximum number of results |
--json | - | false | Output as JSON |
--help | -h | - | Show help |
zk graph
Section titled “zk graph”| Flag | Short | Default | Description |
|---|---|---|---|
--limit | -l | 10 | Maximum number of nodes to display |
--start | - | Start tree from a specific note ID | |
--depth | 0 (unlimited) | Maximum tree depth | |
--sync | false | Sync graph database before querying | |
--help | -h | - | Show help |
zk graph-sync
Section titled “zk graph-sync”| Flag | Short | Default | Description |
|---|---|---|---|
--validate | false | Run CUE edge validation and report integrity issues | |
--help | -h | - | Show help |
zk graph-query
Section titled “zk graph-query”Subcommands: backlinks <id>, cluster <id>, tag <tag>, dangling
| Flag | Short | Default | Description |
|---|---|---|---|
--json | false | Output as JSON | |
--depth | 0 (unlimited) | Maximum BFS depth (cluster only) | |
--limit | -l | 10 | Maximum number of nodes (cluster only) |
--help | -h | - | Show help |
zk backlinks
Section titled “zk backlinks”| Flag | Short | Default | Description |
|---|---|---|---|
--json | - | false | Output as JSON |
--help | -h | - | Show help |
zk daily
Section titled “zk daily”| Flag | Short | Default | Description |
|---|---|---|---|
--date | - | - | Target date (YYYY-MM-DD format) |
--yesterday | - | false | Use yesterday’s date |
--list | - | false | List recent daily notes |
--week | - | false | Show this week’s notes (with —list) |
--month | - | false | Show this month’s notes (with —list) |
--json | - | false | Output as JSON (with —list) |
--help | -h | - | Show help |
zk todo
Section titled “zk todo”| Flag | Short | Default | Description |
|---|---|---|---|
--project | -p | (auto-detect) | Project context |
--due | - | - | Due date (YYYY-MM-DD format) |
--priority | - | - | Priority (high, medium, low) |
--help | -h | - | Show help |
zk todos
Section titled “zk todos”| Flag | Short | Default | Description |
|---|---|---|---|
--project | -p | - | Filter by project |
--overdue | - | false | Show overdue todos |
--today | - | false | Show todos due today |
--this-week | - | false | Show todos due this week |
--closed | - | false | Show closed todos |
--json | - | false | Output as JSON |
--help | -h | - | Show help |
zk set-status
Section titled “zk set-status”Usage: zk set-status [id_or_file] [status]
Status must be one of: open, in_progress, closed.
| Flag | Short | Default | Description |
|---|---|---|---|
--help | -h | - | Show help |
zk todo-list
Section titled “zk todo-list”| Flag | Short | Default | Description |
|---|---|---|---|
--project | -p | - | Filter by project |
--output | -o | todos-TIMESTAMP.md | Output filename |
--help | -h | - | Show help |
zk hello
Section titled “zk hello”| Flag | Short | Default | Description |
|---|---|---|---|
--help | -h | - | Show help |
zk goodbye
Section titled “zk goodbye”| Flag | Short | Default | Description |
|---|---|---|---|
--help | -h | - | Show help |
Note ID Format
Section titled “Note ID Format”Notes use a 12-digit timestamp ID: YYYYMMDDHHMM
Examples:
202602131045= February 13, 2026 at 10:45202601010900= January 1, 2026 at 09:00
Frontmatter Template
Section titled “Frontmatter Template”---id: "YYYYMMDDHHMM"title: "Note Title"project: "project-name"category: "untethered" # or "tethered"tags: - "tag1" - "tag2"created: "YYYY-MM-DDTHH:MM:SSZ"parent: "YYYYMMDDHHMM" # optional---Directory Structure
Section titled “Directory Structure”Default layout (configurable):
~/zk_vault/├── untethered/ # Quick captures, ideas│ └── 202602131045.md├── tethered/ # Refined, linked notes│ └── 202602131100.md└── tmp/ # Scratch spaceEnvironment
Section titled “Environment”zk automatically detects:
- Git project: Uses repo name as
projectfield - Working directory: For relative paths
Common Workflows
Section titled “Common Workflows”Capture an idea quickly (no project context)
Section titled “Capture an idea quickly (no project context)”zk create "Random thought while commuting"Capture while working on a project
Section titled “Capture while working on a project”cd ~/projects/my-projectzk create "Interesting pattern in auth flow"# Project auto-detected from gitAdd project context later
Section titled “Add project context later”zk set-project ~/zk_vault/untethered/202602131045.md my-projectTether an untethered note
Section titled “Tether an untethered note”# Review and refine the untethered note, then tetherzk tether ~/zk_vault/untethered/202602131045.md --project my-project
# Or if in a git repo, project is auto-detectedcd ~/projects/my-projectzk tether ~/zk_vault/untethered/202602131045.mdUntether a tethered note
Section titled “Untether a tethered note”# Revert a tethered note back to untetheredzk untether ~/zk_vault/tethered/202602131100.mdBuild a note chain
Section titled “Build a note chain”# Create parentzk create "Main concept" --category tethered -p my-project# Note the ID (e.g., 202602131045)
# Create child (manually add parent field to frontmatter)zk create "Sub-concept" --category tethered -p my-project# Edit to add: parent: "202602131045"Makefile Targets
Section titled “Makefile Targets”make build # Build binarymake test # Run Go tests + CUE validationmake lint # Run go vet + staticcheckmake fmt # Format Go + CUE filesmake install # Install to $GOPATH/binmake clean # Remove binary and indexmake tidy # Run go mod tidymake ui-check # Lint Lua pluginmake integration-test # Test NeoVim integration