istok

CLI reference

Every istok command in one page, with environment variables, data paths and JSON output.

The istok command works on the same local state your agent uses through MCP. You need it to set things up, look at what agents recorded, sync devices and script; the everyday agent workflow does not need it.

istok COMMAND --help is the authoritative list of flags for your installed version. This page names the commands and the flags that matter.

The current project

Most commands work on the project that contains the current directory. With nested projects, the closest one wins. Commands that take --project (or -p) accept a project ID, an unambiguous ID prefix or a name.

Almost every command accepts --database PATH (or ISTOK_DATABASE) and --json.

Commands

Command Purpose
istok init [PATH] Register the current directory or PATH as a project. --name sets the name.
istok mcp Run the MCP server over stdin/stdout. See MCP tools.
istok project Show and manage projects.
istok task Create, inspect and operate tasks.
istok run Runs, executions, validations and artifacts.
istok context Saved project context: rules, decisions, constraints, notes.
istok knowledge Reviewed project knowledge.
istok index, istok search, istok graph The local code index, code search and the code graph.
istok sync Sync projects between devices through a hub.
istok hub Run a hub and manage its devices.
istok export, istok import Move projects through a file.
istok hooks Install Istok hooks into Claude Code or Codex.
istok resume Print the interrupted work of the current project.
istok usage Report how agents used Istok through MCP on this device.
istok update Check for and install a new release.
istok completion [SHELL] Set up shell completion.
istok version Print version information.

project

Command Purpose
project show [SELECTOR] Show the current project, or the one named.
project list List projects; --deleted includes the trash.
project rename NAME Rename the current project (or --project).
project rebind SELECTOR [PATH] Bind a project to a new folder, for example after you moved the repository.
project delete Move the current project (or --project) to the trash. --yes skips the confirmation and is required with --json.
project restore SELECTOR [PATH] Restore a deleted project, at its old folder or at PATH.

task

Tasks are addressed by their project-scoped number, such as 12.

Command Purpose
task create --title T Create a task; also --description, --acceptance-criteria, --notes.
task list List open tasks; --status open|blocked|done, repeatable.
task ready List tasks ready to claim.
task show N Show a task with its dependencies, the checks of its runs (run by Istok or reported by the agent), history and linked commits.
task comment N --body B Add a comment.
task progress N --body B Record progress.
task dependency add|remove N --blocker M Make task M block task N, or remove that.
task claim N Claim a ready task and start a run. Prints the run ID and its lease.
task done N --expected-revision R --note TEXT Complete a task with --run-id and --validation-id of a passed check, or with --override-reason.

task claim also accepts the context options of context preview (below), --base-branch and --base-commit.

run

Runs are addressed by their UUID. Commands that change an active run need its current lease (--lease); the lease changes on recovery.

Command Purpose
run list List runs; --task N, --status, --limit.
run show ID Show a run with its context snapshot, executions, checks and artifacts.
run exec ID --lease L -- CMD... Run a command and store its output as evidence.
run validate ID --lease L -- CMD... Run a check; its exit code decides passed or failed. --summary overrides the derived summary.
run heartbeat ID --lease L Extend the lease.
run recover ID --reason TEXT Get a new lease for your own run after the old one expired; --force rotates it before then.
run abandon ID --expected-revision R --reason TEXT Abandon an active run; its task stays open.
run finish ID --lease L --expected-revision R --status S --summary TEXT Finish a run as succeeded, failed, blocked or cancelled. Success needs a passed check, or --allow-unvalidated with --override-reason.
run artifact list RUN List the run’s stored files.
run artifact verify ARTIFACT --run RUN Check an artifact’s size and SHA-256.
run execution start|finish Record a process that ran outside Istok.
run validation record EXECUTION --run RUN ... Record an attested check for a finished execution.

exec and validate accept --cwd, --timeout (30 minutes for exec, 10 for validate), --termination-grace, --output-limit, and --allow-dangerous with --override-reason for commands Istok classifies as dangerous.

Run statuses are active, succeeded, failed, blocked, cancelled and abandoned.

context

Context records are short notes delivered to runs. Records are addressed by their UUID; changes need --expected-revision.

Command Purpose
context add TITLE --body B Add a record. --kind note|decision|instruction|constraint, --delivery always|ranked|manual, --priority critical|high|normal|low, --tag, --review-after, --expires-at.
context list, context search QUERY List or search records; --deleted, --include-disabled, --limit.
context show [ID] Show one record, or all of them as Markdown.
context update ID Change any field.
context enable|disable ID Turn an instruction on or off.
context delete ID Archive a record.
context preview N Show the context a claim of task N would receive, without starting a run.
context doctor Report context size and records that are expired, superseded or due for review.

preview and claim take --context-limit (1-64), --context-id to include records by ID, and, with an audited reason, --all-context or --without-retrieval.

knowledge

Knowledge items are longer documents that go through draft, review and promotion. Items are addressed by their UUID; changes need --expected-revision.

Command Purpose
knowledge add TITLE --summary S Create a draft; --body or --body-file, --kind architecture|domain|decision|runbook|note, --tag, --source.
knowledge distill TITLE --summary S --source ... Create a draft from explicit sources.
knowledge list (or catalog), knowledge search QUERY Titles and summaries without bodies; --limit, --offset, filters.
knowledge show ID, knowledge read ID One complete item.
knowledge update ID Change a draft.
knowledge review ID --note TEXT Record a review of a draft.
knowledge promote ID Make a reviewed draft current.
knowledge supersede ID NEW_ID Replace current knowledge with a new item.
knowledge export ID --output FILE Write an item to a file; --format markdown|json. Existing files are refused.

A source is TYPE:ID[@REVISION][#DETAIL], where the type is task, run, context, knowledge, repository or import.

index, search, graph

The index refreshes itself when search, graph reads or a claim need it.

Command Purpose
index status Show the index state of the current project.
index rebuild Rebuild the index from scratch, for repairs.
search QUERY Search code by text, path or symbol; --limit (10).
graph symbol NAME Find symbols by name.
graph neighbors NAME Show a symbol’s relations; --kind, --limit.
graph path FROM TO Find paths between two symbols; --max-depth (6), --limit.

The graph covers Go, TypeScript and JavaScript.

sync

Sync keeps projects in step on several devices through a hub you run yourself. See Working on another device.

Command Purpose
sync join CODE Join a hub with an invitation from hub device add. The first device creates the sync key; others pass --key from sync key.
sync key Print the sync key other devices join with.
sync enable Publish the current project to the hub. In a fresh clone, fetch the hub project of the same git repository into this folder.
sync enable --project ID Fetch a specific hub project into the current folder.
sync enable --new Publish the current project although the hub has another project of the same repository.
sync (or sync run) Pull changes from the hub and push local ones; --project limits it to one project.
sync projects List the hub’s projects with their repositories.
sync status Show the hub and the projects this device syncs.
sync disable Stop syncing the current project on this device. Its data stays here and on the hub.

All sync commands accept --sync-dir (or ISTOK_SYNC_DIR), the directory with this device’s key and hub membership.

Once a device joined, sync runs by itself: the MCP server pulls before task_start and pushes a few seconds after each write, and the hooks sync the project when a session starts and, with --stop, when it stops. While a project syncs, new task numbers and task claims go through the hub, so two devices never share a number or work on one task. Without the hub, both happen locally and are reconciled on the next sync.

hub

Command Purpose
hub serve Run the hub. --listen (:7443), --advertise HOST:PORT for invitations, --data for the data directory.
hub device add NAME Print a one-time invitation; --expires (15 minutes), --address overrides the advertised address.
hub device list List devices, revoked ones included.
hub device revoke DEVICE Disconnect a device for good, by name or ID prefix.
hub backup FILE Write a consistent copy of the hub database.

Devices and the hub pin each other’s key over mutual TLS, so the hub needs no domain, certificate or proxy. Rows are encrypted on the device; the hub cannot read them. Releases publish the image ghcr.io/vtimame/istok-hub, which keeps its data in /data.

export and import

Command Purpose
export Write the current project to istok-export-<time>.json. -p (repeatable) or --all choose projects; -o FILE, or -o - for stdout.
import FILE Merge a bundle into this device’s database; - reads stdin. --dry-run shows what would change.

Import merges with the same rules as sync. Bundles from Istok 0.4.0 do not import into newer versions; update both devices.

hooks, resume, usage

Command Purpose
hooks install claude|codex Add hooks that print the interrupted work on session start and sync the project. For Claude Code they also keep Istok state in compaction summaries and link new commits to the task of the only active run.
hooks install ... --stop Also ask the agent once for a handoff when it stops with an outdated one.
hooks install ... --scope project Install for the current project only; the default user covers every project. --print shows the settings instead of writing them.
hooks status, hooks uninstall AGENT Show or remove the hooks. Other settings are kept, with a backup.
resume Print the interrupted work of the current project; --actor limits it to one agent.
usage Which tools agents call, how often they fail and where they leave the workflow. --since (30 days; the log keeps 90), --project.

update, completion, version

Command Purpose
update Download, verify and install the latest release. --check only checks; --yes skips the confirmation. The database is backed up during the update and restored if migration fails.
completion [bash|fish|zsh] Print the command that enables completion; --code prints the script itself.
version Print the version.

Environment variables

A flag takes precedence over its variable.

Variable Purpose
ISTOK_DATABASE Database path.
ISTOK_INDEX_ROOT Root directory for code indexes.
ISTOK_AGENT_ID, ISTOK_AGENT_NAME Agent identity of istok mcp; ISTOK_AGENT_ID also filters resume.
ISTOK_MCP_TOOLS Tool set of istok mcp: core or full.
ISTOK_SYNC_DIR This device’s sync key and hub membership.
ISTOK_HUB_DATA Hub data directory.
ISTOK_HUB_LISTEN Hub listen address.
ISTOK_HUB_ADVERTISE HOST:PORT devices use to reach the hub.

Commands started by run exec, run validate and the matching MCP tools get an allowlisted environment plus ISTOK_RUN_ID, ISTOK_EXECUTION_ID and ISTOK_PROJECT_ROOT.

Data paths

<data-home> is ${XDG_DATA_HOME:-~/.local/share} on Linux and ~/Library/Application Support on macOS.

Path Contents
<data-home>/istok/istok.db All durable state (SQLite). Back it up.
<data-home>/istok/artifacts/ Files stored by runs; next to the database file when you set a custom one.
<data-home>/istok/indexes/ Code indexes, rebuilt as needed; no backup needed.
<data-home>/istok/sync/ Device key, hub membership and the sync key.
<data-home>/istok-hub/ Hub data, on the machine that runs the hub. Back it up with hub backup.

Istok writes nothing into your repositories. On Linux and macOS the database is created with mode 0600 and the default data directory with 0700; Istok refuses a database that is a symbolic link or sits in a directory other users can write to. The CLI, the MCP server and the hooks must use the same database to see the same state.

JSON output

--json writes a versioned response for scripts; the human-readable output may change.

istok task list --json
  • Every response has a top-level schema_version: "2" for run results, "1" for the rest. Check it before you rely on a structure.
  • Search and graph payloads carry their own contract (istok.retrieval.v1, istok.graph.v1); knowledge export --format json writes istok.knowledge-export.v1.
  • Task results contain both the task UUID and the project-scoped number.
  • Results include the revision that --expected-revision needs. A stale revision fails instead of overwriting newer state: read again and retry.
  • Empty collections are [], never null.
  • Errors are structured, with stable codes; branch on the code, not the message.
  • JSON mode never asks for confirmation, so destructive commands need --yes.