Skip to content

CLI Commands

Quick reference for all zk commands.


Create an untethered note (no project required)

Section titled “Create an untethered note (no project required)”
Terminal window
zk create "Quick idea about X" --category untethered
zk create "My note title" # Default is untethered
Terminal window
zk create "Project idea" --category untethered --project my-project
zk create "Project idea" --category untethered -p my-project
Terminal window
zk create "Refined concept" --category tethered --project my-project

Terminal window
zk set-project path/to/note.md my-project

Tether an untethered note (promote to tethered)

Section titled “Tether an untethered note (promote to tethered)”
Terminal window
# With explicit project
zk tether path/to/note.md --project my-project
zk tether path/to/note.md -p my-project
# Auto-detect from git (if in a repo)
zk tether path/to/note.md

Untether a tethered note (demote to untethered)

Section titled “Untether a tethered note (demote to untethered)”
Terminal window
# Reverts a tethered note back to untethered
zk untether path/to/note.md

Terminal window
zk add-tags path/to/note.md golang
zk add-tags path/to/note.md golang api security

Tags are appended to the existing tags: list in the zettel’s YAML frontmatter. Duplicate tags are ignored.


Terminal window
zk validate path/to/note.md

Validates the zettel’s YAML frontmatter against the CUE schema. Reports any missing or invalid fields.


Terminal window
zk index path/to/note.md
Terminal window
zk index ~/zk_vault/
zk index .

Terminal window
zk search "authentication patterns"
zk search "golang error handling"
Terminal window
zk search --project my-project
zk search -p my-project
zk search "query" --project my-project # Combined
Terminal window
zk search --category untethered
zk search --category tethered
zk search -c tethered
Terminal window
zk search --tag golang
zk search --tag golang --tag api # AND (must have both)
zk search -T golang -T testing
Terminal window
zk search --type todo
zk search --type daily-note
zk search -t issue
Terminal window
zk search --status open
zk search --priority high
zk search --type todo --status open --priority high
Terminal window
zk search --due-before 2026-03-01
zk search --due-after 2026-02-01
zk search --due-after 2026-02-01 --due-before 2026-02-28 # Date range
Terminal window
zk search --limit 10
zk search -l 50
Terminal window
zk search --json
zk search "query" --json | jq '.[] | .title'
Terminal window
zk search "authentication" --project my-project --category tethered --tag security
zk search --type todo --status open --project my-project --priority high

Terminal window
zk graph ~/zk_vault/
zk graph .
Terminal window
zk graph . --limit 20
zk graph . -l 5
Terminal window
zk graph . --start 20260219143000-a1b2c3d4
Terminal window
zk graph . --depth 3
Terminal window
zk graph --sync

The 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.


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.

Terminal window
zk graph-sync # Sync from configured root
zk graph-sync ~/zk_vault/ # Sync from explicit path
zk graph-sync --validate # Sync + validate edge integrity

Output shows added, updated, deleted counts. With --validate, reports dangling edges (links to non-existent notes) and structurally invalid edges.

Terminal window
zk graph-query backlinks <id>
zk graph-query backlinks <id> --json
Terminal window
zk graph-query cluster <id>
zk graph-query cluster <id> --depth 2 --limit 20
zk graph-query cluster <id> --json
Terminal window
zk graph-query tag golang
zk graph-query tag golang --json
Terminal window
zk graph-query dangling
zk graph-query dangling --json

List and use note templates for structured content.

Terminal window
zk templates
Terminal window
zk create "Sprint Planning Q1" --template meeting
zk create "Clean Code Review" --template book-review
zk create "OAuth Implementation" --template feature
zk create "Add Login Flow" --template user-story
zk create "CLI Tool Idea" --template project-idea
zk create "Go Error Handling" --template snippet

Available templates:

  • meeting - Meeting notes with attendees and action items
  • book-review - Book review with rating and key takeaways
  • snippet - Code snippet with context and explanation
  • project-idea - Project idea with goals and next steps
  • user-story - User story in standard format with acceptance criteria
  • feature - Feature specification with requirements and design notes
  • daily - Daily note for thoughts, tasks, and reflections
  • todo - Actionable task with status tracking
  • issue - Issue tracking like GitHub (bug, enhancement, question)

Find all notes that link to a specific zettel.

Terminal window
zk backlinks 202602131045
Terminal window
zk backlinks ./notes/202602131045.md
Terminal window
zk backlinks 202602131045 --json
zk backlinks 202602131045 --json | jq '.[].title'

Create and manage daily notes for capturing thoughts, tasks, and reflections.

Terminal window
zk daily
Terminal window
zk daily --yesterday
Terminal window
zk daily --date 2026-02-10
Terminal window
zk daily --list # Last 14 days
zk daily --list --week # This week
zk daily --list --month # This month
zk daily --list --json # JSON output

Daily notes are stored in untethered/daily/YYYY/MM/YYYY-MM-DD.md.

See Daily Notes Workflow for a comprehensive guide to daily note workflows.


Terminal window
zk todo "Fix login bug"
zk todo "Update docs" --project my-project
Terminal window
zk todo "Critical fix" --due 2026-02-20 --priority high
zk todo "Nice to have" --priority low
Terminal window
zk todos # List open todos
zk todos --project my-project # Filter by project
zk todos --overdue # Overdue todos
zk todos --today # Due today
zk todos --this-week # Due this week
zk todos --closed # Show closed todos
zk todos --json # JSON output
Terminal window
zk set-status 202602131045 closed # Mark as closed
zk set-status 202602131045 in_progress # Set to in progress
zk set-status 202602131045 open # Reopen a closed todo
Terminal window
zk todo-list # Generate todo list
zk todo-list --project my-project
zk todo-list --output my-todos.md

See Todo Workflow for a comprehensive guide to todo workflows.


Manage your zettelkasten git repository with dated branches.

Terminal window
zk hello

This command:

  • Checks out the main branch
  • Pulls latest changes
  • Creates a new branch named with today’s date (YYYYMMDD format, e.g., 20260213)
  • Warns if the branch already exists (does nothing)
  • Warns if there are uncommitted changes (does nothing)
Terminal window
zk goodbye

This 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)
Terminal window
# Morning
zk hello # Create today's branch
# Throughout the day
zk create "Meeting notes" --template meeting
zk todo "Follow up on action item"
zk daily # Add to daily note
# End of day
zk goodbye # Commit and merge to main

Terminal window
zk --help
zk -h
Terminal window
zk create --help
zk index --help

FlagShortDefaultDescription
--category-cuntetheredNote category (untethered or tethered)
--project-p(auto-detect)Project context
--template--Use a note template (e.g., meeting, user-story)
--help-h-Show help
FlagShortDefaultDescription
--help-h-Show help
FlagShortDefaultDescription
--project-p(auto-detect)Project context for tethered note
--help-h-Show help
FlagShortDefaultDescription
--help-h-Show help
FlagShortDefaultDescription
--help-h-Show help

Usage: zk add-tags <file> <tag1> [tag2...]

FlagShortDefaultDescription
--help-h-Show help

Usage: zk validate <file>

FlagShortDefaultDescription
--help-h-Show help
FlagShortDefaultDescription
--help-h-Show help
FlagShortDefaultDescription
--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-l20Maximum number of results
--json-falseOutput as JSON
--help-h-Show help
FlagShortDefaultDescription
--limit-l10Maximum number of nodes to display
--start-Start tree from a specific note ID
--depth0 (unlimited)Maximum tree depth
--syncfalseSync graph database before querying
--help-h-Show help
FlagShortDefaultDescription
--validatefalseRun CUE edge validation and report integrity issues
--help-h-Show help

Subcommands: backlinks <id>, cluster <id>, tag <tag>, dangling

FlagShortDefaultDescription
--jsonfalseOutput as JSON
--depth0 (unlimited)Maximum BFS depth (cluster only)
--limit-l10Maximum number of nodes (cluster only)
--help-h-Show help
FlagShortDefaultDescription
--json-falseOutput as JSON
--help-h-Show help
FlagShortDefaultDescription
--date--Target date (YYYY-MM-DD format)
--yesterday-falseUse yesterday’s date
--list-falseList recent daily notes
--week-falseShow this week’s notes (with —list)
--month-falseShow this month’s notes (with —list)
--json-falseOutput as JSON (with —list)
--help-h-Show help
FlagShortDefaultDescription
--project-p(auto-detect)Project context
--due--Due date (YYYY-MM-DD format)
--priority--Priority (high, medium, low)
--help-h-Show help
FlagShortDefaultDescription
--project-p-Filter by project
--overdue-falseShow overdue todos
--today-falseShow todos due today
--this-week-falseShow todos due this week
--closed-falseShow closed todos
--json-falseOutput as JSON
--help-h-Show help

Usage: zk set-status [id_or_file] [status]

Status must be one of: open, in_progress, closed.

FlagShortDefaultDescription
--help-h-Show help
FlagShortDefaultDescription
--project-p-Filter by project
--output-otodos-TIMESTAMP.mdOutput filename
--help-h-Show help
FlagShortDefaultDescription
--help-h-Show help
FlagShortDefaultDescription
--help-h-Show help

Notes use a 12-digit timestamp ID: YYYYMMDDHHMM

Examples:

  • 202602131045 = February 13, 2026 at 10:45
  • 202601010900 = January 1, 2026 at 09:00

---
id: "YYYYMMDDHHMM"
title: "Note Title"
project: "project-name"
category: "untethered" # or "tethered"
tags:
- "tag1"
- "tag2"
created: "YYYY-MM-DDTHH:MM:SSZ"
parent: "YYYYMMDDHHMM" # optional
---

Default layout (configurable):

~/zk_vault/
├── untethered/ # Quick captures, ideas
│ └── 202602131045.md
├── tethered/ # Refined, linked notes
│ └── 202602131100.md
└── tmp/ # Scratch space

zk automatically detects:

  • Git project: Uses repo name as project field
  • Working directory: For relative paths

Capture an idea quickly (no project context)

Section titled “Capture an idea quickly (no project context)”
Terminal window
zk create "Random thought while commuting"
Terminal window
cd ~/projects/my-project
zk create "Interesting pattern in auth flow"
# Project auto-detected from git
Terminal window
zk set-project ~/zk_vault/untethered/202602131045.md my-project
Terminal window
# Review and refine the untethered note, then tether
zk tether ~/zk_vault/untethered/202602131045.md --project my-project
# Or if in a git repo, project is auto-detected
cd ~/projects/my-project
zk tether ~/zk_vault/untethered/202602131045.md
Terminal window
# Revert a tethered note back to untethered
zk untether ~/zk_vault/tethered/202602131100.md
Terminal window
# Create parent
zk 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"

Terminal window
make build # Build binary
make test # Run Go tests + CUE validation
make lint # Run go vet + staticcheck
make fmt # Format Go + CUE files
make install # Install to $GOPATH/bin
make clean # Remove binary and index
make tidy # Run go mod tidy
make ui-check # Lint Lua plugin
make integration-test # Test NeoVim integration