CLI

All commands and flags.

Commands

CommandDescription
pk initCreate a knowledge project (local by default, --global for ~/.pk/). Harness installs globally.
pk primePrint session-start context for an agent.
pk searchFind notes by keyword or meaning.
pk newCreate a note, decision, question, or source.
pk readPrint the full contents of a note.
pk writeUpdate a note and commit the change.
pk deleteDelete a note and commit.
pk lintValidate note shape, required sections, and duplicate ids.
pk indexRebuild the search index and embedding vectors.
pk historyShow episodic store activity from commits and git notes.
pk vocabList tags by frequency across all notes.
pk configShow or update global configuration.
pk useSet the current global project. Writes currentProject to ~/.pk/config.json.
pk projectsList all global projects under ~/.pk/. Shows which is current.

pk new

pk new
$pk new note "Title"
$pk new decision "Title"
$pk new question "Title"
$pk new source "Title"
$pk new note "Title" --tags auth,security

Prints the absolute path of the created file. Frontmatter is generated automatically — do not edit id, type, or created after creation.

pk search

pk search
$pk search "database schema"
$pk search "api" --type question --status open
$pk search "deploy" --tag infra --limit 5
$pk search "slow queries" --semantic
FlagDescription
--typeFilter by note type: note, decision, question, source
--statusFilter by status: open, accepted, superseded…
--tagFilter by tag
--limitMaximum results (default 10)

When embeddings are configured, search uses hybrid mode (BM25 + vector) automatically.

pk init

pk init
$pk init --harness opencode
$pk init my-project --harness opencode --global
$pk init my-project --harness opencode,pi --global

Available harnesses: opencode, pi. Without flags, pk runs interactively.

Harness configs are installed globally — not in the project directory: ~/.config/opencode/plugins/, ~/.pi/agent/extensions/, ~/.agents/skills/pk/. The plugin calls pk prime, which resolves context from CWD, so one install works everywhere.

Default: knowledge store in .pk/ (local). Use --global to store in ~/.pk/<name>/ instead. Local mode writes .pk/config.json to the project root and adds .pk/ to .gitignore. Global mode sets currentProject in ~/.pk/config.json. Harness configs are installed globally once — they work from every directory.

pk use

pk use
$pk use my-project
$pk use journal --pretty

Sets the current global project. Writes currentProject to ~/.pk/config.json. Used by requireKnowledgeDir() as a fallback when no project-local config is found. Validates that the project exists.

pk projects

pk projects
$pk projects
$pk projects --pretty

Lists all global projects under ~/.pk/. Indicates which is current.

Machine output

Every command accepts --json for structured output. Use --pretty for human-readable formatting.

json output
$pk search "pricing" --json
$pk prime --json
$pk history --json