Doctor and the index
tkt doctor finds what is wrong in a store and points at tkt index rebuild where needed.
tkt doctor#
Checks every file of the store and never stops at the first problem (tkt lint judges one ticket). Exit 0 clean, 1 info, 2 warning, 3 error, 4 could not run (no store; stdout stays empty even with --json); --strict makes warnings 3, info never escalates. A broken file is a finding (ERR_FILE_PARSE, 3), reported once. --fix-index rebuilds the index (The index); the codes: the doctor table.
Details7 items
-
Run it after every merge (After a merge). A broken file is never also a dangling ref or drift;
--fix-indexrebuilds a drifted, missing or unreadable index. -
Times: the store keeps every event as a UTC timestamp, to the second (
2026-11-10T12:00:00+00:00):createdAt,updatedAt,closedAt, a doc's or gotcha'stimestamp, a decision'sdecidedAt, a release'sshippedAt. Days stay days:targetDate, a decision'sdate,--shipped-at. An old local-offset time stays readable and becomes UTC the next time the item changes;--fix-timesconverts them all in one run to the same moment in UTC, leaves the days and prints what it changed. It never runs by itself. -
Mentions naming nothing:
DANGLING_MENTION(doc://,gotcha://),DANGLING_DECISION(decision://D9or bareD9), with a did-you-mean as in the bundle. -
Anchoring (
info, never in the exit code): docs and gotchas that build on no decision; the list:tkt review --unanchored. -
Report lines, never findings:
counter: storeorcounter: git: <path>(parallel worktrees); in gitmerge drivers: installed/not installed/<view> not covered, hinttkt git install(merge drivers). -
tkt doctorgroups the findings per file (severity, code, field, message,hint:), then the counts; a clean store prints✓ store is healthy.--json:{ok, counts, findings[], index, counter, mergeDrivers};okonly on exit 0. -
Anchoring lines: one
EDGE_COVERAGEper edge declared for coverage (coverage: decisions without affects 31 of 353 (9 %), open items only);UNANCHORED(critical gotchas counted apart),ORPHANED(noappliesToand nothing refers to it),UNTOUCHED_UNANCHORED(unanchored and unchanged foruntouchedDays, 90).tkt review --unanchored [--older 90d]--json:{unanchored[], olderDays}, eachref, kind, title, buildsOn, stress, orphan, changedAt, days; the age is thetimestamp, else the last git commit.
The index#
The SQLite index .aitodo/index.db is derived from the Markdown files: the file always wins; it is gitignored and safe to delete. Every CLI write keeps it in sync, and search, graph, tree reconcile on read (hand edits, git checkout, deleted files), so a rebuild is rarely needed.
tkt index rebuild- a full rebuild in one transaction, only after bulk external changes or corruption; a file it cannot index (
ERR_FILE_PARSE, orERR_INDEX_REBUILDfor a duplicate prefix or ULID) leaves the old index, exit 1. It is also the full re-check: after a write outside tkt (an editor, a merge, a newtkt) line 1 isWARN N open review(s)with→ tkt review;--quietprints only that line, and only when one is open (thetkt git installhook runs it). tkt index status- the counts, the last rebuild, the path; it does not reconcile.
Details4 items
-
The first write into a store without
index.dbbuilds it. An index failure never fails the write: the.mdis saved and stderr saysindex not updated (…). -
tkt doctor:ERR_INDEX_DRIFT(info: a stale row, a row without file, a file without row),ERR_INDEX_CORRUPT.--fix-indexrebuilds, also a missing index (without it doctor never createsindex.db); a failed rebuild is anERR_INDEX_REBUILDerror and the old index stays. -
tkt index statusfields:ticket_count,group_count,last_rebuild_at(nulluntil a full rebuild),db_path. -
tkt index rebuild --json(andPOST /v1/index:rebuild): the counts andopenReviews, thetkt review --jsonitems.
Commands on this page#
tkt doctorCheck the whole store's integrity; exit 0 clean · 1 info · 2 warning · 3 error · 4 could not run (no workspace)→
tkt index rebuildRebuild the SQLite index from scratch (full scan of Markdown store) and re-check every review: an edit outside tkt, a git merge or a new tkt version may have changed what an item builds on (tkt review)→
tkt index statusShow index health (row counts, db path)→