Status: reference.
Written for anyone running this pipeline: it is the reference you keep open beside a terminal. Assumed: nothing beyond README.md's Quickstart. Not covered here: why any of it is built the way it is; ARCHITECTURE.md has the shape and DESIGN.md the constraints.
Every command this repository provides, every flag it accepts, and which interpreter each one needs.
On Windows or WSL2, read WINDOWS.md first. Both work,
and CI runs a blocking windows-latest leg, but native Windows needs a
POSIX shell and three OS binaries installed by hand, and WSL2 has one
filesystem-layout trap. Everything else on this page applies unchanged.
There are two install paths. Both land in a venv named .venv-full, and
everything below this section is identical either way:
mkdir my-project && cd my-project
python3 -m venv .venv-full && source .venv-full/bin/activate
pip install chitragupta-cli
chitragupta init
or, from a git checkout (for working on the pipeline itself; see
DEVELOPER-AGENTS.md):
git clone https://github.com/prasadtalasila/chitragupta && cd chitragupta
bash scripts/install_full_pipeline.sh all
source .venv-full/bin/activate
A venv keeps pip install clear of Debian/Ubuntu's PEP 668
externally-managed-environment error, and while it is activated in
the shell you launch Claude Code from, the hooks can import
chitragupta (HOOKS.md).
chitragupta init DIR writes the same project directory a checkout
gives you (config.toml, .claude/, papers/,
content/{drafts,dossiers,specs,review,rendered}/, assets/ and the
prose docs), with every harness's folders and its terminal policy
(LLM-AGENTS.md).
The base pip install chitragupta-cli covers tiers 1 and 2
(Which interpreter), everything except the
enrichment layer. chitragupta install <stage> refuses three stage
names by pointing at the pip command that reaches them:
# chitragupta install python-deps refuses, naming `chitragupta install enrich`,
# whose pip equivalent is:
pip install 'chitragupta-cli[enrich]' # tier 3 -- chitragupta enrich (docling, embeddings, topic clustering)
# chitragupta install dev-deps refuses, naming this. Only a checkout ships
# the test suite, so this extra is not useful outside one.
pip install 'chitragupta-cli[dev]'
# The enrich extra, pinned to the chitragupta already running, so asking
# for an extra cannot upgrade the tool underneath the command that asked.
chitragupta install enrich
# chitragupta install all refuses, naming `chitragupta install enrich`
# plus this (Debian/Ubuntu + root; `chitragupta doctor` reports what is
# missing on any other host):
chitragupta install os-deps
PACKAGING.md has the full command-surface table;
NAME.md has why the distribution is chitragupta-cli while
the command stays chitragupta (cg for short).
Three tiers. python means your Python 3 interpreter; python3 is
equally correct. The tiers distinguish environments, not names. The
one place the name is fixed is .claude/settings.json, which launches
the hooks as python (HOOKS.md says
why).
| Tier | Interpreter | Commands |
|---|---|---|
| 1 | python: stdlib only, no venv |
chitragupta.draft (all thirteen commands), chitragupta.corpus ledger, chitragupta.corpus topics, chitragupta.corpus discover (its semantic rung upgrades itself when tier 3 is installed), chitragupta.review (all eleven aids; support needs the enrich extra and exits 0 with a notice without it) |
| 2 | .venv-full/bin/python: venv, for bibtexparser |
chitragupta.corpus sync |
| 3 | .venv-full/bin/python: venv with the enrich group |
python -m chitragupta.enrich; the embedding search (embed_index.search()) that deep-research's agents and draft-reviser may use |
Tier 1 is deliberate. The chain that enforces the one rule
(chitragupta.draft gate -> chitragupta.draft references ->
chitragupta.draft render) imports nothing outside the standard
library, so a broken, missing or wrong-Python virtual environment
cannot block it.
ARCHITECTURE.md has the
full reasoning. draft render shells out to pandoc and LuaLaTeX, and
review verbatim to pdftotext, but those are OS packages, not Python
dependencies.
For a pip installed project there is one environment, and the tiers
collapse to whether a command needs the enrich extra: only tier 3
does. chitragupta <layer> <verb> and python -m chitragupta.<layer> <verb> reach the same command once that interpreter is the venv's own.
The module form is kept because the hooks and every genre skill invoke
python -m chitragupta.draft gate; use either form by hand, but don't
change what a hook or a skill invokes.
In an init-ed project, tier 1's promise covers the code, not finding
the interpreter. A checkout's -m finds chitragupta/ beside it from
any python; an installed project has none, so
python -m chitragupta.draft gate needs the venv's bin/ on PATH.
Without it, citation_gate_hook.py reports an environment fault,
distinct from a bad citekey.
The most likely first error is the wrong interpreter:
ModuleNotFoundError: No module named 'bibtexparser' means you ran
python -m chitragupta.corpus sync instead of .venv-full/bin/python -m chitragupta.corpus sync.
Every command appears below at least once, in the order a first run reaches it; Every command and flag is the exhaustive reference.
chitragupta commandWith .venv-full/bin/activate sourced (see Installing):
# 1. Install, and get a project directory -- see Installing above.
# 2. Export your library to BibTeX at papers/bibliography.bib (gitignored,
# so no install path populates it). ZOTERO.md has Zotero specifics.
mkdir -p papers && cp /path/to/your/exported-library.bib papers/bibliography.bib
# 3. Your config: `chitragupta init` created it, and in a git checkout
# the install script did. See CONFIG.md.
# 4. Sync the corpus. Needs the venv; only one sync (or enrichment run)
# can write at a time -- a second one exits 2 at once.
chitragupta corpus sync
# chitragupta corpus sync --reparse # re-extract text even if the PDF is unchanged
# chitragupta corpus sync --remove-stale # only after reading the stale list it prints
# 5. Inspect what it found. Read-only, takes no lock, needs no venv.
chitragupta corpus ledger
# chitragupta corpus ledger --list
# chitragupta corpus ledger --status parse_failed
# chitragupta corpus ledger --citekey talasila_composable_2025
# chitragupta corpus ledger --collections # your collections, if chitragupta-importer wrote the bib
# 5b. Optional: name your topics in content/seed_topics.toml and see
# which papers match each.
# chitragupta enrich --stages seed-topics
chitragupta corpus topics
# chitragupta corpus topics --topic "digital twin"
# 6. Optional: the enrichment layer. Nothing below needs it --
# RETRIEVAL.md says which stage is worth your time.
chitragupta enrich --stages docling,embed
# chitragupta enrich --stages docling --for-draft content/drafts/<slug>.md
# 7. Search the corpus the way a skill does. Read-only.
chitragupta draft retrieve search "digital twin composability" --k 15
chitragupta draft retrieve search "digital twin composability" --unit passage
chitragupta draft retrieve evidence "calibration" --citekey talasila_composable_2025 \
--log content/drafts/<slug>.md
# 8. In your coding agent (Claude Code, Codex or OpenCode), ask for a draft, e.g.:
# "write a survey section on digital twin composability"
# "draft a thesis chapter on runtime verification for autonomous robots"
# The matching skill runs its own gate -> references -> render chain and
# writes a dossier beside the draft. LLM-AGENTS.md has each agent's setup.
# 9. Re-run that chain by hand (no venv needed). `render` runs the gate
# first and refuses a draft citing a key the ledger does not hold.
chitragupta draft gate content/drafts/<slug>.md
chitragupta draft references content/drafts/<slug>.md --heading "References"
chitragupta draft render content/drafts/<slug>.md --format pdf
chitragupta draft render content/drafts/<slug>.md --format tex
chitragupta draft render content/drafts/<slug>.md --format docx
chitragupta draft render content/drafts/<slug>.md --format md # numbered Markdown copy, no pandoc needed
# 10. Read and maintain the draft's dossier.
chitragupta draft dossier list
chitragupta draft dossier brief content/drafts/<slug>.md
chitragupta draft dossier sections content/drafts/<slug>.md --citekeys --write
chitragupta draft dossier status --all --json
chitragupta draft dossier status content/drafts/<slug>.md --steps # the genre's steps as a checklist
chitragupta draft dossier export <slug>
# 11. Check the draft against its sources. Review aids, not gates.
chitragupta review provenance content/drafts/<slug>.md # what in each source supports the claim citing it
chitragupta review verbatim overlap content/drafts/<slug>.md <citekey> # wording shared with that one source
chitragupta review verbatim scan content/drafts/<slug>.md # ...with *any* parsed source, cited or not
chitragupta review verbatim locate <citekey> "a phrase to find" # which pdf page a phrase is on
chitragupta review coverage content/drafts/<slug>.md --query "digital twin composability"
chitragupta review synthesis content/drafts/<slug>.md # how many sources each unit rests on
chitragupta review figure content/drafts/<topic>/<slug>.md # what the TikZ figures' geometry says
chitragupta review uncited content/drafts/<slug>.md # which sentences carry no citation at all
chitragupta review quotation content/drafts/<slug>.md # is each quoted span really in that source?
chitragupta review agenda content/drafts/<slug>.md # merges the eight draft-level aids into one worklist
chitragupta review support content/drafts/<slug>.md # does the cited source actually entail this claim?
chitragupta review union content/rendered/<book>/book.tex # did assembling the book lose a unit's citekey?
# add --write to any of these to file the report under content/review/,
# mirroring the draft's path -- printing stays the default
Two commands are for working on this repository, so only their checkout form exists:
bash scripts/install_full_pipeline.sh dev-deps # pytest, pytest-cov, actionlint and the git hooks
python -m pytest # the suite itself
python3 scripts/release.py # bundles release/chitragupta-<version>.zip
python -m chitragupta.<layer>)Every command above is also python -m chitragupta.<layer> <verb>, for
example python -m chitragupta.corpus sync or
python -m chitragupta.draft gate content/drafts/<slug>.md. This is the
form hooks and skills invoke, and it works however the package got here.
pip install side by sideA checkout and an installed package run the same commands. Where a
checkout copies config.toml.example and runs
scripts/install_full_pipeline.sh, an installed package runs
chitragupta init, chitragupta install and chitragupta doctor
(PACKAGING.md has the command table).
--json)A command that takes --json prints one JSON document on stdout,
indent=2, and nothing else; whatever text mode writes to stderr still
goes to stderr. The two long-running writers, corpus sync and
enrich, print JSON Lines
instead. Every document carries an envelope, the fields that say
what produced it:
| Key | Type | What it holds |
|---|---|---|
verb |
string | the command's path in the help tree, such as review agenda or review verbatim scan; it names the document's shape |
command |
string | the invocation that reproduces it, built from the arguments the command ran with (see below) |
version |
string | the chitragupta version that ran: this checkout's pyproject.toml when run from a checkout, the installed distribution's otherwise, unknown when neither can be read |
notes |
list of strings | every line text mode writes to stderr as a note while the command runs (a skipped render, a private-use character set aside), verbatim, leading spaces included, in order; [] when there are none. Log records are not notes |
command is canonical: the same arguments give the same string,
however they were typed. It is python -m chitragupta.<layer> <verb>,
then the positionals as given (a relative path stays relative), then
the options in the order --help lists them, not the order typed, then
--json, always, since that is the run that prints the document. An
option at its default is left out, because version says which default
applied, and so are a flag that is off and an option given no value:
review verbatim scan at its default --min-run of 8 records no
--min-run, as it records no --gap 1. Two writes are never in it: review agenda's --accept, recorded in the acceptance file instead, and the
--baseline of an agenda or digest comparison in the report that run
files, which names the run that regenerates it. Values are quoted for a
POSIX shell. A review aid's Markdown report shows the same string on its
- Command: line. Before 7.4.5 each aid built its own, and most
recorded --json only when the run printed JSON; 7.4.5 recorded
--min-run 8 in every scan's.
A review aid's document, printed and filed, opens with notice,
aid, verb, draft, command and version, then the aid's own
findings, and ends with notes. The two shapes of it:
.json sibling: the opening fields, the findings,
notes. It is what a later --baseline run reads.--json prints: the same document with this run's own keys
between the findings and notes: written on every filing aid, and
accepted_now on the agenda's worklist (see
the agenda).review agenda and review digest open their findings with view:
report, or recheck for a --baseline comparison. Their filed
.json is always a report; one filed before 7.6.1 has no view, and
still reads as a --baseline.
notes in a filed .json holds the notes written before it was
filed, and the printed notes every note of the run. No document
carries a timestamp, so two runs over unchanged inputs print the same
bytes.
Every other document opens with verb, command and version, then
the command's own keys in their usual order, and ends with notes. Four
are printed with their keys sorted, so the envelope's keys land where
they sort: draft spec align, draft unit contract, draft unit status and draft tldr show. Six have more to say:
corpus discover opens its own keys with view, which names the
shape: list, topic, search, paper, why, groups, hops,
clusters, path, compare, or written for --html and --app.corpus ledger opens its own keys with view too: summary,
item, items, found, collections, or no_ledger, which holds
the instruction text mode prints and exits 0. Each row carries the
paper's title, null when it has none, and its authors, each
"Given Family", [] when the bib gave none; collections lists each
collection as data, slug, display and papers, beside the
lines text mode prints. The summary carries last_synced, the
latest row's, null for an empty ledger. items echoes find,
field, author, sort (the one applied) and desc; found, the
--grouped view, holds citekeys and titles (rows), authors
(name, papers), each cut to limit, and counts, each group's
full size.draft gate prints one entry per file in files and, when no
key is citable, why in problem. --json may come anywhere among
the files, and replaces the report lines rather than following them.draft retrieve search and evidence print the hits, or the
passages, and where --log recorded the call (logged, or
log_error). Their stderr notes are the same in both modes. search
also prints terms, the words it ranked on: the query's own, then
any that acronym expansion or spelling correction added.draft dossier versions holds its snapshots in
dossier_versions; until 7.4.4 it printed them as a bare array.draft diff prints the report it files as <stem>.diff.json,
byte for byte, so its notes are those written before the report
was filed; a redline's notes come after.A command that writes a file prints what it wrote, never the file's
content: draft evidence the sidecar's path (null when nothing is
quoted), draft render its output, draft dossier export its
archive, draft registry build the registries written and its
index and pages, draft registry index its report, figure sync
each file's outcomes, and figure look its look, page and the
draft's pdf. The lines draft registry build and figure look print
on stdout as each write lands (Wrote ..., wrote ..., and draft render's refusal line when figure look --draft cannot render the
draft) go to stderr under --json, in the same order, since stdout is
the document's. figure look holds its [figure-look] notes in
figure_look_lines as well as in notes, and that refusal line's text
in render_refused (null when the draft rendered, or none was named),
so a reader of the document alone sees why pdf is null.
--jsonWhen a command refuses under --json (a missing draft, no ledger yet,
flags that do not combine), stdout carries a refusal document, where
until 7.4.6 it carried nothing. The exit code is the one text mode
gives:
{
"verb": "review agenda",
"command": "python -m chitragupta.review agenda content/drafts/nope.md --json",
"version": "7.4.6",
"refusal": {
"reason": "not_found",
"message": "No such draft: content/drafts/nope.md",
"exit_code": 1
},
"notes": []
}
The envelope is the one the command's result would have carried, so
command is canonical here too. refusal.message is the sentence text
mode prints, without its prefix. notes holds the notes written
before the refusal. refusal.reason is one of refused, not_found,
outside_project, usage, conflict, tool_missing,
writer_busy, command_removed, no_ledger, stale_ledger,
unreadable_ledger and write_scope, the scope guard's refusal of a
write the webapp agent's scope does not cover
(APPROVAL-MODEL.md). A refusal document is the
only document with a refusal key, so that key tells it from a
result. A review aid's
refusal is this document too, without the aid's notice, aid and
draft.
| Mode | stdout | stderr | Exit |
|---|---|---|---|
| text | as before: nothing, or the sentence, for the commands that print their refusals on stdout | the sentence, with the command's own prefix | unchanged |
--json |
the refusal document, indent=2, and nothing else |
the same sentence with the same prefix, whichever stream text mode uses | unchanged |
These are not refusals, and print as before under --json:
command can be built from it.draft dossier status <draft> with no
dossier is one: its entry, exit 1.draft diff --format pdf's failed redline, or a review aid's failed filing, leaves the
document it already printed as the only one, the sentence on stderr.discover --out write: the view's out_error, exit 1.review support without the enrich extra is a refusal that exits 0,
as its text does: under --json it prints a tool_missing document.
corpus sync and enrichcorpus sync --json and enrich --json run for minutes, so they print
one JSON object per line on stdout while they work, each written whole
and flushed, rather than one document at the end. Every line opens
with kind:
| Line | When | Fields after kind |
|---|---|---|
start |
first, before the write lock is taken | verb, command, version |
| an event | while the run works, as text mode prints its line | the event's own fields (below) |
result |
last, when the run finished | the payload: verb, command, version, the command's own keys, notes |
refusal |
last, when the run refused | verb, command, version, refusal, notes, as a refusal document |
interrupted |
last, on Ctrl+C or SIGINT, or Ctrl-Break on Windows | detail |
error |
last, on an uncaught exception | message (Type: text); the traceback follows on stderr |
Exactly one of the last four ends the stream; read lines until one
arrives. The exit code is text mode's in every case, and 130 after
interrupted. SIGTERM and SIGKILL end the process with no last line.
result is the --json document the command would print in one piece,
with kind first; refusal is a refusal document with kind first.
The two refusals of sync are writer_busy (exit 2) and conflict
(the prune refused for a bib file that read as empty); enrich adds
no_ledger and refused (a --for-draft scope, exit 3).
The events of corpus sync:
kind |
Fields | Text mode's line |
|---|---|---|
notice |
channel (report or note), text |
text, verbatim |
bib_reading |
path |
Reading bibliography from ... |
bib_found |
count |
found N bibliographic item(s) |
parsing |
count, workers |
parsing N document(s) with W workers |
progress |
done, total, citekey, outcome (parsed, failed or backend_unavailable) |
none on stdout; the [k/N] line on stderr |
parsed, no_pdf, stale, pruned |
citekey, and detail but for parsed |
one per document |
interrupted |
detail |
the interrupted -- ... line; it is also the last line |
The events of enrich: notice as above (Target:, Corpus:, a
stage's own reports and warnings), stage (name) as a stage starts,
progress (stage, done, total, item) for each of docling's
[k/N] lines, embed_reached (position, total, citekey) and
embed_done (outcome, chunks) for each document embed reaches,
stage_result (name, status, detail) as a stage ends, and
interrupted from a worker pool.
progress lines arrive in the order documents finish, which differs
from run to run under a pool; parsed lines follow the pool, in the
bib file's order. Key by citekey, never by position. Everything else,
but the result's parse_elapsed, is the same for two runs over
unchanged inputs. A notice is a line on stdout and is not repeated on
stderr; stderr keeps the log records it has in text mode (the
warnings, errors and [k/N] lines), a refusal's sentence, and a
traceback. logs/pipeline.log is unchanged. On a Windows console a
line may end \r\n.
$ chitragupta corpus sync --json
{"kind": "start", "verb": "corpus sync", "command": "python -m chitragupta.corpus sync --json", "version": "7.6.0"}
{"kind": "bib_reading", "path": "/home/you/thesis/papers/bibliography.bib"}
{"kind": "bib_found", "count": 5}
{"kind": "parsing", "count": 5, "workers": 2}
{"kind": "progress", "done": 1, "total": 5, "citekey": "...", "outcome": "parsed"}
...
{"kind": "result", "verb": "corpus sync", "command": "python -m chitragupta.corpus sync --json", "version": "7.6.0", "bib_file": "/home/you/thesis/papers/bibliography.bib", "found": 5, "parsed": 5, ..., "notes": []}
Every document has a JSON Schema (draft 2020-12) under
assets/schemas/, shipped in the wheel and generated from the types
the core declares for it. The path is the verb with each space a
slash: assets/schemas/corpus/ledger.schema.json,
assets/schemas/draft/dossier/status.schema.json,
assets/schemas/doctor.schema.json. Seven files belong to no verb:
refusal.schema.json, the refusal document
every command prints; api/status.schema.json, the body of the
webapp's /api/status; api/agent-prompt.schema.json and
api/agent-approval.schema.json, the bodies of its agent prompt and
approval routes; api/paper.schema.json, the body of its /api/paper;
api/refusal.schema.json, the bare {"refusal": {...}} body a webapp
route answers with when it refuses; and
webapp/agent-event.schema.json, one event of the webapp's agent
stream. The webapp's /api/corpus/ledger,
/api/draft/retrieve/search, /api/draft/dossier/list,
/api/draft/dossier/status, /api/draft/tldr/show and
/api/draft/figures answer with the documents corpus ledger, draft retrieve search, draft dossier list, draft dossier status, draft tldr show and draft figures print under --json, refusals included,
so their schemas are those commands'. So do /api/draft/dossier/outline,
/api/draft/gate, /api/review/synthesis, /api/draft/spec/status,
/api/draft/spec/show and /api/draft/unit/status, for draft dossier outline, draft gate, review synthesis (never with --write),
draft spec status, draft spec show and draft unit status.
webapp.schema.json is webapp --json's document, which names the
webapp's runtime folder and serves nothing;
running is true when its server.json names a live process and the
server's lock is held, and then port and url say where it serves
(never with the token, which only the launch file holds). init and
install print no document and have no schema.
Beside each schema sits a parameter spec, <verb>.params.json: one
per command, init and install included, generated from the
command's parser. It lists each positional and option with its flag,
kind, choices, default and help. The webapp draws a command's form
from it, and its server validates what the form sends, never the spec.
An option whose default comes from config.toml records
"default_from": "config" instead of a value.
What one file describes:
--json prints, envelope included, its properties
in the order the document prints its keys (the four sorted documents
aside). verb is a const, so a document names its own schema, and
required lists every key the document always has.corpus ledger, corpus discover, review agenda, review digest), the
root is an anyOf of them, and each shape's view is a const
that tells them apart.corpus sync and enrich: an anyOf of the
start line, each event and the four last lines, each with its
kind a const. Validate a stream line by line.refusal key and
validates it against refusal.schema.json.Every object is closed (additionalProperties: false): a key the
schema does not declare fails it. title names the root type, and
$defs holds the nested types under their names in the core.
$id is urn:chitragupta:schema: and the path without its suffix,
urn:chitragupta:schema:corpus/ledger, and carries no version: a
document's version says which release printed it, and that release's
wheel holds the schemas it matches. Every field is typed: no schema
has a {} that allows any value, and tests/cli/test_schema_census.py
fails if a command's document gains one. A field whose
description says it holds lines for a person is text, not data: its
wording may change in any release.
chitragupta corpus ledger --json > ledger.json
python -c "import json, jsonschema; jsonschema.validate(json.load(open('ledger.json')), json.load(open('assets/schemas/corpus/ledger.schema.json')))"
The test suite holds the schemas to the documents. Every document a
command prints under --json during the tests, refusals included, and
every line of a corpus sync or enrich stream is validated against
its file, and one that does not match fails the test that printed it,
naming the verb, the JSON path and the rule it broke
(tests/document_schemas.py). A review aid's filed .json is checked
against its verb's file less written and accepted_now, the keys the
aid adds only after filing. The CLI validates nothing at run time: the
command prints what the core built, and the tests are what prove that
matches the schema. The webapp's page is the one reader that checks
at run time: it validates every body it fetches with validators
generated from these files, built from the same release as the server.
A schema changes when a document's shape does, and the version bump
follows the change's class. Every addition is a fix release, so a
reader ignores a property, a view, a status or an event kind it
does not know rather than refusing the document:
| Change | Class |
|---|---|
| A property removed or renamed | MAJOR |
A property's type changed, widened (str to str | None) or moved under another key |
MAJOR |
| A required property made optional | MAJOR |
| A property added, required or optional | PATCH |
A type narrowed (str | None to str, str to a Literal) |
MINOR |
A Literal value or union member added (a new view, status, event kind) |
PATCH |
A description or a $defs name changed |
PATCH |
| A pre-rendered text field's wording | not a schema change |
| A new command's file | MINOR |
A release's version is the highest class among all its changes, so a
new view that arrives with a new option is a MINOR release, though
its schema change alone is a PATCH.
Defaults shown are the value used when the flag is omitted. Examples
use the console script; python -m chitragupta.<layer> <verb> reaches
the same command. Activate .venv-full first. The scheduling and
environment-variable sections spell out .venv-full/bin/python
because a cron job or systemd unit has activated nothing.
Run chitragupta --help for every layer and verb, and
<command> --help (for example chitragupta draft gate --help) for
every flag.
Three commands set a project up rather than work in one: init,
doctor and install. PACKAGING.md has the design
behind them.
chitragupta initScaffolds a project directory: config.toml (from
config.toml.example), .claude/, papers/,
content/{drafts,dossiers,specs,review,rendered}/, assets/, the
prose docs, and every harness's folders (.codex/, .agents/,
.opencode/) with chitragupta's terminal policy in each harness's
config. A config that already exists gets the policy only if you say
yes when asked, on a terminal. Exits 1, writing nothing, when the
source files are missing or the target is unsafe.
| Flag | Default | What it does |
|---|---|---|
[DIR] |
. |
Where to write the project |
--force |
off | Overwrite existing files, named one by one |
--dry-run |
off | Print the tree that would be written; write nothing |
chitragupta doctorProbes and reports: OS binaries, the enrich extra, torch against the GPU
driver, a competing distribution, the hook launchers, and whether the
webapp is built (and, in a checkout, older than frontend/src/). Takes
one flag, --json (Structured output),
installs nothing and always exits 0.
chitragupta installRuns the stage of scripts/install_full_pipeline.sh that a pip install
cannot do itself. Takes one stage name.
| Stage | What it does |
|---|---|
os-deps |
Runs the script's os-deps stage (needs root) |
gpu-torch |
Reinstalls torch from a wheel index matching the GPU driver, when the default wheel would run CPU-only |
enrich |
Installs the enrich extra, pinned to the running version |
all, dev-deps, python-deps |
Refused by name; prints the pip command that reaches them instead (exit 1) |
chitragupta corpus syncBibliography -> ledger -> parsed text. Needs the venv. Takes the write lock, so only one run at a time; a second run exits 2 rather than waiting.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
--reparse |
off | Re-extract every PDF, ignoring the ledger's record of what is already parsed. For when output is recorded as fine but you have reason to doubt it |
--remove-stale |
off (report only) | Delete ledger rows for citekeys no longer in the bib file. Without it they are only reported |
--json |
off | Print JSON Lines: the run's events, then its result |
chitragupta corpus sync
# chitragupta corpus sync --reparse
# chitragupta corpus sync --remove-stale
# chitragupta corpus sync --reparse --remove-stale
# Exit codes: 0 = clean, 1 = documents this host could not parse,
# 2 = another run holds the lock,
# 3 = everything parsed, but the bibliography has a hole in it.
The exit code is the whole API an unattended caller has. The two nonzero completion codes split by remedy:
1 wins when both hold; != 0 means "anything went wrong". After a
dropped entry or unusable citekey, --remove-stale deletes nothing and
prints Refusing to prune: ..., since the run read less than the bib
file holds. A shared citekey is named in a WARNING and none of its
entries is synced, because the pipeline does not guess which paper the
key means. An entry type outside BibTeX's standard list (@software,
@online and the rest of biblatex's) is ignored by design, silently.
Three of the summary's no-PDF breakdown reasons set the exit code:
no-PDF breakdown reason |
Exit | Why |
|---|---|---|
PDF path no longer exists on disk |
3 | The bib file claims a PDF the disk does not have. chitragupta/core/corpus/bib_reader.py calls it "a silent data-loss failure". Fix the path, or drop the file field |
PDF is on disk but could not be read |
3 | Permissions, or a failing device. The file is there, so fixing the path is not the remedy; check the mode, the mount, the disk |
PDF path resolves outside the bib file's own directory |
3 | The bib file claims an attachment this corpus will not open (see below). Move it beside the .bib, point [bib] path at the tree it is really in, or drop the file field |
no file field in bib entry |
0 | An item with no attachment saved. An ordinary state of a bibliography |
non-PDF attachment only |
0 | Typically an HTML snapshot saved instead of the PDF. Invisible to retrieval, but not a hole |
malformed file field |
0 | This project could not parse the file field's Desc:path:mimetype shape |
There is deliberately no flag to suppress the first three; fix the path
or drop the file field.
A .bib export is data someone else's tool wrote, and its file field
may name any file on the host. Without a limit, /etc/passwd or
~/.ssh/id_rsa could be parsed into content/parsed/ and quoted into
a draft. So an attachment is accepted only where it resolves inside
the directory the .bib lives in (papers/ by default, or wherever
[bib] path points); the refusal names the path on stderr. Symlinking
the whole of papers/ elsewhere is fine; symlinking a subdirectory of
it (to a Zotero storage directory, say) is refused. Point [bib] path
at the real location instead.
The same rule applies on the way out. A ledger row whose parsed_path
does not resolve inside content/parsed/ reads as having no parsed
text: search, evidence, tldr, verbatim and the enrichment
stages decline it, and the next corpus sync re-parses it. Both path
columns are stored relative, so moving a project or its content/
directory re-parses nothing (MIGRATION.md).
Whenever a run has stale citekeys to report (in report-only mode, and
again just before --remove-stale deletes anything), sync names what
else in the corpus and enrichment layers still points at each one:
| Artefact | Where it lives | Counted as |
|---|---|---|
| overlap index | content/overlap/docs/<citekey>.fpr and .skipgram.fpr, plus the citekey list in index.json and skipgram_index.json |
files, each named |
| topic graph | content/topic_graph.json's edges_overlap, edges_withheld and edges_semantic |
edges |
| topic membership | content/topic_set.json's topics[].members[].citekey and uncovered, plus content/topics.json's assignments and memberships |
memberships, per file |
| chroma vectors | the chunk collection under content/chroma/ |
vectors |
stale smith_example_2024 (no longer in bibliography.bib)
Checking what else still references the 1 stale citekey(s) ...
smith_example_2024: still referenced by 2 artefact class(es)
overlap index 2 file(s): .../content/overlap/docs/smith_example_2024.fpr, ...
topic graph 3 edge(s): .../content/topic_graph.json
Reported, not repaired -- nothing above is touched by this run.
Drafts and dossiers citing these: chitragupta draft dossier status --all
Review the 1 stale item(s) above, then re-run with --remove-stale ...
The scan only reports; --remove-stale removes only the ledger row.
Drafts and dossiers are the drafting layer's, so sync does not read
them: it records the stale keys in the ledger, and
chitragupta draft dossier status --all lists every draft citing one,
as missing or renamed, before the prune as well as after it. That is
the list to act on; topic hits expire at the next enrichment run.
Citekeys match exactly. A class that could not be scanned (no
content/chroma/, no enrich extra, a truncated file) gets a NOTE:
line rather than a silent zero.
A key that leaves the bib while the same paper arrives under another key
is a rename, not a removal plus an addition. sync recognises one in
two ways:
| Source | When it applies |
|---|---|
The importer's @comment{cg-renames v1 ...} block (old<TAB>new rows) |
the new key is in the bib, directly or through a chain of rows (a -> b, b -> c); the two PDFs may differ. A chain that loops or ends outside the bib falls back to the row below |
A matching pdf_hash |
exactly one key still in the bib has the stale key's PDF, byte for byte, and that key is new to the ledger this sync |
A PDF that several keys share, or that a key already in the ledger had
before this sync (a book and its chapter, one of them deleted), is
reported as same PDF as a, b, never guessed to be a rename. The stale
line names the new key, in report-only and --remove-stale runs alike:
stale lehner_pattern_2023-1 (no longer in bibliography.bib; renamed to lehner_pattern_2023, same PDF)
sync writes two things to the ledger, and nothing else:
renames: each old -> new, recorded before --remove-stale
can prune the old row, so the mapping outlives it.stale_citekeys: every key the last whole read of the bib no longer
has.Nothing is recorded from a read that lost entries, for the reason
--remove-stale refuses on one. sync never opens a draft or a
dossier; the drafting layer reads both tables to report and swap the
keys
(DRAFT-ITERATION.md).
sync re-parses a document it already parsedA PDF whose bytes haven't changed is not re-parsed. The one exception:
a parsed document whose passage sidecar is missing or unreadable is
parsed again, so a .txt or sidecar deleted or damaged by hand is
restored. An empty sidecar is what a parse that found no prose writes,
and does not trigger a re-parse. It costs one parse each, once
(PERFORMANCE.md); --reparse forces all of them now.
chitragupta corpus ledgerRead-only view of the corpus layer. Takes no lock, so it works while a sync is running. With no flags it prints a summary.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
--list |
off | List every item |
--status STATUS |
-- | List only items with this status: parsed, no_pdf, discovered, parse_failed |
--citekey CITEKEY |
-- | Show one item in full |
--collections |
off | List every collection the corpus holds, with its slug path, display path and paper count, and stop |
--collection PATH |
-- | List only items in this collection or one beneath it: a slug path or a / display path. An unknown or ambiguous one exits 2 |
--find TEXT |
-- | List only items where every word of TEXT is in the field --in names, ignoring case and braces |
--in FIELD |
all |
What --find searches: citekey, author (one author's name), title, or all, where each word may match any of the three |
--author NAME |
-- | List only this author's items, by the exact "Given Family" name a row's authors holds |
--sort COLUMN |
match with --find, else citekey |
Order the list by match, citekey, title, authors, year or status; ties fall to the citekey and a missing value sorts last |
--desc |
off | Reverse the order |
--grouped |
off | With --find: the matching citekeys, authors and titles as three groups, each counted, the found view |
--limit N |
5 | With --grouped: show at most N of each group |
--json |
off | Machine-readable output, with view naming its shape (Structured output) |
chitragupta corpus ledger
# chitragupta corpus ledger --list
# chitragupta corpus ledger --status parse_failed
# chitragupta corpus ledger --status no_pdf
# chitragupta corpus ledger --citekey talasila_composable_2025
# chitragupta corpus ledger --collections
# chitragupta corpus ledger --collection digital-twin
# chitragupta corpus ledger --find "digital twin" --in title --sort year --desc
# chitragupta corpus ledger --find synchron --grouped
--find, --author and --sort combine with --status and
--collection, which narrow the rows first. match ranks a citekey
equal to the query first, then one starting with it, then a title
holding the whole query, then an author's name holding it.
Exits 0 with no ledger yet, or one that needs a sync to migrate it,
printing the instruction (under --json, the no_ledger view). Exits
3 with the cause on stderr when SQLite will not read the ledger (an
interrupted write's journal, a lock held past the timeout, a damaged
file). A stale ledger still exits 0 here, unlike the gate.
Collections come from a bib written by chitragupta-importer
(ZOTERO.md); without
them --collections prints nothing and says why. --collections prints
each collection's slug path, display path and paper count, counting the
papers beneath it. --collection takes a slug path or a / display
path, and a parent selects everything beneath it. A value that names no
collection, or several, exits 2 with the choices on stderr.
chitragupta corpus topicsRead-only view of which papers matched each of your seed topics.
Takes no lock and needs no venv, though what it reads is written by
chitragupta enrich --stages seed-topics. With no flags it prints every
topic.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
--topic PHRASE |
-- | Show only this seed topic's papers |
--json |
off | Machine-readable output (Structured output) |
chitragupta corpus topics
# chitragupta corpus topics --topic "digital twin"
Exits 1 when no report has been written yet, or when --topic names a
phrase the report does not hold. A report that is not valid JSON (a
truncated write, say) also exits 1, with one line on stderr naming the
file and nothing on stdout. A paper is listed under every topic it
matched, and the papers that matched none are listed too. See
CONFIG.md.
chitragupta corpus discoverResolve a phrase to a topic the corpus has, list a topic's papers and
linked topics, or invert the question with --paper. Takes no lock.
The relations come from content/topic_graph.json, written by
chitragupta enrich --stages topic-graph.
TOPIC-DISCOVERY.md explains each relation and the
resolution ladder; EXPLORE-CLI.md walks the views.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
PHRASE ... |
-- | A topic to look up: a known label, a near-miss, or any free phrase. Omitted, every topic is listed |
--paper CITEKEY |
-- | Show this paper's topics instead of resolving a phrase |
--groups N |
-- | Cut the stored merge tree into as close to N groups as it allows. Composes with --json only; exits 2 below one, 1 when the artefact stores no hierarchy |
--compare TOPIC TOPIC ... |
-- | Compare two to six topics: shared citekeys, bridge papers, and the edges among them. Composes with --json only; exits 2 past six topics, 1 when the phrases collapse onto fewer than two topics |
--clusters |
-- | The stored MCL partitions of both edge families and where they disagree. Composes with --inflation and --json only; exits 1 when the inflation has no partition or the artefact predates the field |
--inflation X |
2.0 |
Which stored inflation --clusters reads (1.2 to 4.0 by 0.1) |
--path TOPIC TOPIC |
-- | The strongest chain between two topics over one family, each hop with its evidence. Requires --family; "no path" exits 0. Composes with --json only; exits 1 when the artefact predates the matrices |
--family F |
-- | overlap or semantic, never one fused weight. Required by --path; optional on --hops |
--why TOPIC TOPIC |
-- | Why there is no overlap edge between two topics, with the stored threshold. Composes with --json only; exits 1 when a name resolves to no topic or both to the same one |
--hops N |
-- | With a phrase: the topic's neighbourhood as rings by hop distance. N is a positive count or all; add --family F to walk one family |
--origins LIST |
every class | Only topics of these origins: seed, keyword, corroborated, emergent. seed and keyword each include the corroborated topics, so corroborated alone asks for that intersection. Composes with every view; --path refuses a narrowing --origins (exit 2). Exits 1 on an unknown class |
--json |
off | Machine-readable output |
--out FILE |
-- | Also write the topic view as a Markdown overview: papers, linked topics, and verbatim member-paper snippets |
--k N |
5 |
Results to show when falling back to paper search. With [retrieval].spelling_correction on, that search notes any correction on stderr |
--html FILE |
-- | Write the whole topic graph as one self-contained HTML page and exit. With --json, reports the write as "view": "written" and "written": FILE |
--app DIR |
-- | Write the topic graph as an interactive app directory, openable from file:// (EXPLORE-WEB.md). Composes with --json as --html does |
chitragupta corpus discover
# chitragupta corpus discover "digital twin"
# chitragupta corpus discover "digital twin" --out overview.md
# chitragupta corpus discover --paper kritzinger_digital_2018
# chitragupta corpus discover --compare "digital twin" "physical twin" "application"
# chitragupta corpus discover --path "digital twin" "devops" --family overlap
# chitragupta corpus discover --app topicapp/ --origins emergent
Exits 1 when the graph artefact is missing (naming the stage to run),
when --paper names a citekey in no topic, when a phrase resolves
nowhere and even the paper-search fallback finds nothing, and when an
--out, --html or --app target cannot be written. The write
failure goes to stderr. For --out it comes after the view has
printed, so check the exit status; --html and --app print nothing
before the write.
When the resolution degraded (a model that would not load, a reranker
skipped), the text opens with a note: line; under --json the topic
view and the paper-search fallback carry the same text as note, their
last key before notes; the other views' JSON leaves it out.
chitragupta draft gateThe hard gate: fails if a draft cites a citekey the ledger doesn't hold
as a parsed source. A key with no ledger row fails as not found in ledger; one whose PDF never parsed (no_pdf, discovered,
parse_failed) fails naming its status.
Takes one option, --json: every other argument is a file to check.
| Argument | What it does |
|---|---|
-h, --help |
Show usage and exit 0 |
--json |
Machine-readable output, anywhere among the files; the exit codes do not change (Structured output) |
<file> [<file> ...] |
One or more drafts to check |
chitragupta draft gate content/drafts/survey.md
# chitragupta draft gate content/drafts/*.md # several at once
# Exit codes: 0 = every citation verified,
# 1 = at least one unresolved citekey, or a file outside content/,
# 2 = no files given, or a path that names no file
# (missing, or a directory),
# 3 = the ledger could not be read, so nothing was checked.
A file outside content/ is a FAIL for that document and the rest
are still checked, so one bad path cannot hide the others; it exits 1,
not the usage code 2, because it is a document that did not pass.
A path that names no file is not a verdict either. Every path is
checked first, inside content/ or not, before the ledger is read. If
any is missing or a directory, the gate prints
gate: no such file: <path> or gate: is a directory: <path> on
stderr for each one, in argument order, prints nothing on stdout,
checks nothing, and exits 2, even when the ledger could not have been
read either. Under --json stdout is the refusal document, reason
not_found. references, evidence and render refuse their draft
path the same way, each under its own name.
Exit 3 is never a verdict. The ledger is there but could not be
read (an interrupted write's journal, another process holding the
lock, a damaged file, or one needing a sync to migrate). The gate then
checks nothing, prints nothing on stdout, and says on stderr what to
do. It never repairs: chitragupta corpus sync rolls back an
interrupted write when it opens the ledger. A missing ledger is
different: a cited key fails with exit 1 and a citation-free draft
passes.
Check the spelling in any script or CI step that runs this.
chitragupta/core/draft/citation_gate.py has no __main__ block
(ARCHITECTURE.md), so
python -m chitragupta.core.draft.citation_gate <draft> imports the module and
exits 0 with empty stdout: a silent, unconditional pass on a draft
nothing checked. chitragupta draft with no arguments prints the layer's usage,
the fastest way to confirm a spelling.
chitragupta draft referencesAppend or replace a References section built from a draft's own cited
citekeys. Entries are IEEE-style, numbered by first appearance (the
order citeproc numbers in, so this list and the PDF agree on [1]),
and each ends with its citekey in a code span:
[1] J. Doe and R. Roe, "A Paper," *IEEE Trans. Testing*, vol. 3, pp. 1โ9, 2024. `doe_paper_2024`
Authors, venue, volume and pages come from the ledger's bib_fields
column; a row synced before that column existed degrades to title and
year until the next chitragupta corpus sync.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<input> |
required | The draft file (Markdown) |
--heading HEADING |
References |
Heading text, e.g. "6. References" to match a draft's own numbered headings |
--json |
off | Machine-readable output: the draft and the citekeys written (Structured output) |
chitragupta draft references content/drafts/survey.md
# chitragupta draft references content/drafts/thesis.md --heading "6. References"
# Exit codes: 2 = bad usage, or a draft path that names no file
# (`references: no such file: <path>` or
# `references: is a directory: <path>` on stderr; nothing
# read or written, before any other refusal).
chitragupta draft evidenceRender the evidence sidecar beside a draft: each cited source, and
the verbatim spans its dossier marked quotable, grouped by the section
that leans on them. content/drafts/dt/survey.md produces
content/rendered/dt/survey.evidence.{md,tex,pdf}. A sidecar is
never committed (.gitignore excludes
content/rendered/**/*.evidence.*), because it carries verbatim
wording from copyrighted sources.
It prints only quote: fields, never claim: or a legacy support:
(DOSSIER.md); a block with several prints each, in order,
under its source's one heading. Its universe is the draft's own citations,
so it cannot introduce a citekey, and every citekey it prints sits in a
code span the gate blanks, so it adds no citation. With no dossier or
no quote: it prints no quoted evidence recorded and exits 0.
It reads both [@citekey] and \citep{...}, so a thesis .tex
fragment gets a standalone sidecar too.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<input> |
required | The draft file (Markdown or LaTeX) |
--format FORMAT |
md |
Output format, passed to render for anything but md. Exactly one; a comma-separated list is a usage error (exit 2) |
--output-dir DIR |
mirrored | Write here instead of content/rendered/<mirrored path>; confined to content/ |
--json |
off | Machine-readable output: the draft and the sidecar written (Structured output) |
chitragupta draft evidence content/drafts/dt/survey.md --format pdf
# leaves survey.evidence.md beside survey.evidence.pdf -- the Markdown is
# the sidecar's own source, and the only diffable form of it
# Exit codes: 2 = bad usage, or a draft path that names no file
# (`evidence: no such file: <path>` or
# `evidence: is a directory: <path>` on stderr; nothing
# read or written, before any other refusal).
chitragupta draft dossierThe working state behind a draft: create it, inspect it, back it up,
restore it. content/drafts/dt/survey.md gets
content/dossiers/dt/survey/. DOSSIER.md describes every
file in it (including the opt-in outline.md) and
DRAFT-ITERATION.md the design. Stdlib only, never
a gate: it takes no lock and opens the ledger read-only.
| Subcommand | What it does |
|---|---|
init <draft> --genre G |
Create the skeleton. Only adds missing files, so it is safe to re-run |
status <draft> |
What each file holds, the section count, and whether the corpus moved since; with an outline.md, which declared queries ran, returned nothing (no evidence) or were never issued |
status --all |
Corpus drift over every dossier: broken citations (including keys the last sync found stale, before --remove-stale prunes them), citekeys sync recorded as renamed, recorded collections that no longer resolve, and new candidates. Always exits 0 |
sections <draft> |
Heading -> line range, for editing one section instead of the file |
sections <draft> --citekeys |
The sections.md table derived from the draft: each heading with the citekeys cited under it |
outline <draft> |
Read and validate outline.md (sections are ##-or-deeper headings). Exits 1 if there's no outline.md, or a section has neither a brief: nor a claim: |
mark-revision <draft> |
Record a revision boundary in retrieval.md, so status totals retrieval cost per revision, and keep a numbered snapshot of the draft and its figures under versions/ (skipped when unchanged) |
apply-renames <draft> |
Swap every citekey sync recorded as renamed for its replacement, in the draft, evidence.md, sections.md and rejected.md, and log it in revisions.md. Refuses, changing nothing for it, a key whose recorded renames form a cycle or whose replacement is not citable (a parsed row sync did not find stale), swaps the rest, and exits 1 naming each refused key. Writes every file or none: a failed write (a full disk, say) changes nothing and logs nothing. Exits 1 too, changing nothing, for a draft path that does not exist, a draft with no dossier (run dossier init first), or a file that is not UTF-8 text. Names the review quotation re-check when a renamed paper's PDF changed |
snapshot <draft> --label TEXT |
Keep the draft and its figures as a named version (002-sent-to-supervisor) for draft diff --against. Always taken |
versions <draft> |
Every snapshot, oldest first: number, date, trigger, label |
stamp <draft> |
Record the draft's text digest in scope.md, so status reports CHANGED since last stamp after a hand edit. Run after gate passes, never before |
set-language <draft> <language> |
Record the draft's dialect (a BCP-47 tag: en-GB, en-US, en-IN) in scope.md for draft style |
acronyms-suggest <draft> |
Acronyms this draft defines that aren't in [style].acronyms yet. Prints only |
acronyms-suggest <draft> --apply |
The same, then writes them to your acronyms file. Refuses if [style].acronyms is unset, rather than writing into the vendored assets/style/acronyms.toml |
brief <draft> [citekey ...] |
The kept-evidence blocks for a section or citekeys, for a subagent to read. Exits 1 if nothing resolves |
check-evidence <draft> |
Advisory: a citekey with more than one block (readers get only the first), a block that repeats claim:, relevance: or support: (only the first is read), and a claim: that reads like one of its block's quote: lines with the words moved. Exits 1 only when there is no dossier |
prune <draft> |
A dry run listing the evidence.md blocks for citekeys the draft no longer cites. Exits 0 |
prune <draft> --apply |
The same, and removes them by line span, from evidence.md only, never sections.md or rejected.md |
prune <draft> --citekey <key> |
Restrict to one citekey (repeatable). Exits 1 if a named citekey was refused (still cited, unrecorded, sections.md-only, or with more than one block) |
list |
Every dossier on this machine |
export [<name> ...] |
Bundle drafts + dossiers to a .tar.gz |
restore <archive> |
Unpack a bundle. Dry run unless --force |
style <draft> --check |
Read-only: scan style.md for 8-word runs copied from the listed papers, and report each paper's style-notes entry as fresh, stale or missing. Prints findings and exits 0 |
style <draft> --from <spec> |
Measure the example papers named by <spec> (collection "<name>" or a comma-separated citekey list) into style.md: five features, one row each. Re-running rewrites the measured rows and keeps ## Observed, the skill's conflicts and any low/high you edited. Exits 1, writing nothing, for an unknown, unsafe or unparsed citekey, or when Vale is missing |
| Flag | Applies to | What it does |
|---|---|---|
--genre GENRE |
init |
Required: survey, thesis-chapter, textbook-chapter, tutorial, deep-research, digest, research-paper (which also gets a paper.md) |
--outline |
init |
Also create outline.md. Opt-in |
--style-from SPEC |
init |
Learn the writing style from example papers (collection "<name>" or a comma-separated citekey list): writes style.md unless one exists, adds a - style: line to scope.md, and fills an unset language: from the papers' dialect. Refused for the digest genre |
--all |
status |
Report every dossier. Mutually exclusive with a draft path |
--json |
status, versions, apply-renames, sections, outline, brief, acronyms-suggest, check-evidence, list |
Emit JSON, for draft-reviser rather than a terminal (Structured output) |
--from SPEC |
style |
The example papers: collection "<name>" or a comma-separated citekey list |
--check |
style |
Scan instead of measure; mutually exclusive with --from |
--json |
init, mark-revision, snapshot, stamp, prune, set-language, restore, style |
Print what the command wrote as JSON; it writes the same files either way |
--label TEXT |
mark-revision |
Optional name for this revision; unlabelled markers are numbered (revision 1, ...) |
--label TEXT |
snapshot |
Required: the milestone's name. Not all digits, unique within the draft, with at least one ASCII letter or digit |
--citekeys |
sections |
Print the derived sections.md table. A citekey cited above the first heading is reported on stderr |
--write |
sections |
With --citekeys: replace the dossier's sections.md. Refused without --citekeys or a dossier |
--check |
outline, brief |
Report shape problems, or what resolves, without printing the content. What an orchestrator runs before dispatching |
--section NAME |
brief |
Take the citekeys from that sections.md row, matched without numbering; an ambiguous name matches nothing |
--score |
check-evidence |
Also print each warning's overlap score. Off by default, so there is nothing to reword against |
--out FILE |
export |
Archive path (default drafts-<name>-<date>.tar.gz) |
--with-rendered |
export |
Include content/rendered/ and the non-Markdown review renders (large) |
--json |
export |
Emit JSON: the archive written, its file count and size (Structured output) |
--force |
restore |
Actually write, overwriting what is there |
chitragupta draft dossier init content/drafts/survey.md --genre survey --outline
chitragupta draft dossier sections content/drafts/survey.md --citekeys --write
chitragupta draft dossier mark-revision content/drafts/survey.md --label "shorten intro"
chitragupta draft dossier snapshot content/drafts/survey.md --label "sent to supervisor"
chitragupta draft dossier brief content/drafts/survey.md --section "2. Failure modes" --check
chitragupta draft dossier prune content/drafts/survey.md --apply
chitragupta draft dossier status --all --json # after a sync
chitragupta draft dossier export digital-twins-for-software-engineers --with-rendered
chitragupta draft dossier restore drafts-all-2026-08-06.tar.gz --force
Exit codes. status on a draft with no dossier prints the init
command and exits 1, with or without --json; with no ledger, or
an unreadable one, it reports the dossier without the drift check and
exits 0. So status <draft> >/dev/null tests "does this draft have
a dossier yet" in both modes. Until 7.4.4, --json exited 0 with no
dossier. status --all always exits 0, because drift is the
normal state of a live corpus; it reports missing citekeys,
candidates and reconsider
(DRAFT-ITERATION.md),
and under --json each entry's clean, true when the text would say
"no drift" (reconsider alone leaves it clean). list --json gives
each dossier its genre, the - genre: line of scope.md, and
modified, the draft's modification time in ISO 8601 UTC, both null
when absent.
brief exits 1 when it printed no block (no dossier, unknown section,
a row with no citekeys, nothing transcribed), with everything but the
blocks on stderr
(DRAFT-ITERATION.md).
Under --json, sections, outline and brief write nothing on
stderr: what text mode writes there (a citekey cited before the first
heading, the section and problem counts, the brief's headers and
warnings) is in the document instead, as unattributed, sections
and problems, and blocks and missing. A refusal still writes its
sentence there, as for every command.
status <draft> --json prints the envelope, then dossiers, a
one-element list, then notes. The entry is the drift
report --all --json gives each dossier, then eight keys holding what
the text shows and the drift lacks: sections (the draft's heading
count), files (per dossier file: name, present, entries,
shape), versions (count, latest, taken_on, unreadable),
retrieval_calls, retrieval_chars, revisions (per mark-revision
segment: label, calls, chars), outline (run, empty,
not_run, extended, regrounded) and fingerprint (the draft
fingerprint's recorded_digest, current_digest and five finding
lists). versions and fingerprint are null with no draft, and
outline with no outline.md. A key both reports hold keeps the drift's
value, so unconsidered is a count here and a list of citekeys in the
text.
The writes print, between the envelope and notes: init dossier,
created, fingerprinted, ledger, style and language_set;
mark-revision path (the retrieval.md it appended to) and label;
snapshot draft,
snapshot, number and label; stamp draft and digest; prune
draft, apply and results (each citekey's outcome);
set-language language and scope; style path, source,
papers, rows, edited, check, copied and note_states; restore archive,
content_dir, performed, new and overwrite. Each writes the same
files, byte for byte, with or without --json. stamp and prune
print a missing draft or dossier on stdout in text mode; under --json
that sentence goes to stderr, as every refusal's does, and, as for
sections, outline and brief, nothing else does. A
mark-revision warning that no snapshot was taken is a note: on
stderr in both modes, and in notes.
A bundle carries drafts/, dossiers/, and the .md and .json
files under review/ (--with-rendered adds rendered/), paths
relative to content/. It does not
carry content/ledger.sqlite (regenerate with chitragupta corpus sync) or papers/bibliography.bib (your export stays the source of
truth). Restore refuses the whole archive if any entry is a link or
device node, escapes the extraction directory, or sits outside those
four directories. MIGRATION.md covers backups.
chitragupta draft retrieveBM25 retrieval over the synced corpus. Read-only, takes no lock, needs no venv. RETRIEVAL.md has the ranking details.
| Subcommand | What it does |
|---|---|
search "<query>" |
Rank the corpus and return a snippet per candidate |
evidence "<query>" --citekey KEY |
The passages of that one document that bear on the query (--windows, 2 by default) |
evidence is a lookup, not a stage: use it when a search snippet is
not enough to judge a source. Nothing is obliged to call it
(REJECTION.md has why a mandatory first pass was
withdrawn).
| Flag | Applies to | Default | What it does |
|---|---|---|---|
--k N |
search |
5 | How many candidates to rank |
--unit document|passage |
search |
document |
What a result is: passage ranks paragraphs and returns the scoring paragraph with its page. Scores are not comparable across units |
--collection PATH |
search |
-- | Rank only inside this collection or one beneath it: a slug path or a / display path (see ledger --collections). An unknown or ambiguous one exits 2. Scoring stays corpus-wide; only the candidate set narrows |
--chars N |
all | 600 / 500 | Window size (evidence / search) |
--citekey KEY |
evidence |
required | Which document to read |
--windows N |
evidence |
2 | How many passages to return |
--log DRAFT |
all | -- | Record the call, its collection and its payload size in DRAFT's dossier retrieval.md |
--origin declared|extended|reground |
all | -- | With --log: whether this query came from outline.md verbatim, extended a section that came up thin, or re-ran a section's query with --y-prev after a hand edit |
--y-prev TEXT |
search |
-- | Append this text (bounded to 1500 characters) to the query for a second retrieval round, merged with the first and capped back to --k (FEATURE-ROADMAP.md's E4). The text is never spelling-corrected |
--json |
all | off | Machine-readable output (Structured output); the text, which skills parse, is unchanged |
chitragupta draft retrieve search "digital twin architecture" --k 15 \
--log content/drafts/survey.md
chitragupta draft retrieve evidence "digital twin architecture" \
--citekey ferko_architecting_2022 --log content/drafts/survey.md
chitragupta draft retrieve search "digital twin architecture" \
--y-prev "the drift compensator now recomputes offset every cycle" \
--k 15 --origin reground --log content/drafts/survey.md
A --log path outside content/drafts/, or a filesystem error while
writing it, is reported on stderr and skipped; the measurement never
fails the search. Exits 1 with the fix if there is no ledger or one
that needs a sync to migrate. When the ledger is there but SQLite will
not read it, both subcommands exit 3, as corpus ledger does, with
the cause on stderr, a damaged page the first read missed included
(each used to exit 1, and the damaged page printed a traceback). An
empty result is not an error. A single-character query
word never ranks, so either subcommand warns, naming it; two-character
words (AI, 5G) do rank
(RETRIEVAL.md).
Words added to the query before ranking are noted on stderr, and --log
records them in the expanded column: an acronym's expansion
(dt -> digital twin) and, with [retrieval].spelling_correction on, a
spelling correction (strucutral ~> structural)
(RETRIEVAL.md).
chitragupta draft renderRender a Pandoc-Markdown or LaTeX draft. Needs pandoc (and, for PDF,
LuaLaTeX with texlive-luatex and the fonts os-deps installs) on
PATH, but no Python package from the enrich group. chitragupta doctor
says whether each font is there. RENDERING-FLOW.md
explains what happens inside a render: citation resolution, the
References section citeproc replaces, fonts, mathematics, and figure,
table and equation numbering.
Citations render IEEE-style ([1], and [3]โ[6] for a consecutive
run) via assets/csl/ieee.csl, under the draft's own References
heading. The draft file itself is never modified.
Where the output lands. Every format is written mirroring the
draft's path under content/drafts/ into content/rendered/, the same
rule content/dossiers/ follows:
content/drafts/dt-for-engineers/survey.md
-> content/rendered/dt-for-engineers/survey.{md,tex,pdf,docx}
An input under content/ but outside content/drafts/ lands flat.
Both reading and writing are confined to content/. A draft
outside it is refused by name, and so is a configured or symlinked
output directory that resolves off-tree, or a figure symlink landing
outside the draft's directory. A pdf render runs LuaLaTeX without
shell escape and behind a read fence, which needs a TMPDIR with no
dot-directory in its path; a .bib field's raw TeX is printed, never
run. Lua in the draft's own TeX or figures is not fenced:
SECURITY.md
has what this does and does not cover.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<input> |
required | The draft file (Markdown or LaTeX) |
--format FORMAT |
pdf |
Output format, e.g. pdf, tex, docx, md. Exactly one; a comma-separated list is a usage error (exit 2), not rendered as several formats. Render each needed format with its own --format; a review aid's plural --formats is the one that takes a list |
--documentclass CLASS |
article |
LaTeX documentclass |
--fontsize SIZE |
12pt |
LaTeX font size |
--papersize SIZE |
a4 |
LaTeX paper size, without the paper suffix pandoc appends itself, so a4, letter |
--margin MARGIN |
1in |
Page margin, passed to the geometry package |
--csl PATH |
assets/csl/ieee.csl |
CSL style for citations and the bibliography. A relative path is looked for under the current directory first (like <input>), then the project directory, then the shipped assets, so both your own style and the vendored one are found from anywhere |
--no-collapse-citations |
off | Render a run as [3], [4], [5], [6] instead of [3]โ[6], i.e. leave the style exactly as it is on disk |
--fragment |
off | Emit an \input-able LaTeX fragment (no preamble) whose top heading is a chapter, for assembling a book; see below |
--output-dir DIR |
mirrored | Write here instead of content/rendered/<mirrored path>, a pdf's figure looks included; confined to content/ |
--index-terms PATH |
off | With --fragment only: place the book index's entries from the term table registry build --index wrote, and write <unit>.index.json beside the fragment; see the index |
--json |
off | Machine-readable output: the file written, its format and the figure looks' notes (Structured output). A refusal's line goes to stderr, where text mode prints it on stdout |
chitragupta draft render content/drafts/survey.md --format pdf
# chitragupta draft render content/drafts/survey.md --format tex
# chitragupta draft render content/drafts/survey.md --format docx
# chitragupta draft render content/drafts/survey.md --format md # numbered Markdown, no pandoc needed
# chitragupta draft render content/drafts/thesis.md \
# --documentclass report --fontsize 11pt --papersize letter --margin 1.5in
# Exit codes: 2 = bad usage, or a draft path that names no file
# (`render: no such file: <path>` or
# `render: is a directory: <path>` on stderr, not the
# `[error]` line on stdout; nothing read or written,
# before any other refusal).
--format md on a Markdown draft needs no pandoc: it writes a
.md with the PDF's IEEE numbers and reference list, dropping raw
LaTeX. A .tex input still goes through pandoc.
Unicode reaches the output as written; no NFKC fold is applied,
because it would turn mยฒ into m2. A pdf render uses LuaLaTeX with
STIX Two and a fallback font chain; there is no pdflatex option. A
tex or --fragment output gets chitragupta-unicode.sty beside it
when needed, for a template that compiles with pdflatex. A character no
font has fails the pdf build by name; write it as LaTeX, or add a
\DeclareUnicodeCharacter{<hex>}{...} line to
content/unicode-extra.tex
(RENDERING-FLOW.md).
Floats. Standalone renders include
assets/latex/chitragupta-floats.tex (\floatpagefraction 0.8), so a
half-page figure stays on a text page; a --fragment gets the file
copied beside it. A figure still alone on a page is reported as a
[float-page] note.
Figure looks. After a pdf render, every figure gets the pictures
figure look writes, under figures/
beside the PDF, reported as [figure-look] notes; they never fail the
render.
--fragment and --output-dirchitragupta draft render content/drafts/<book>/<unit>.md \
--format tex --fragment
--fragment emits an \input-able fragment: no preamble, the top
heading becomes a \chapter (minus any Chapter 1: prefix, since the
book class numbers chapters), code unhighlighted, and citations left
as \citep{...} with the corpus .bib beside it, so one source has
one number across the book.
RENDERING-FLOW.md
has the rewrites.
A unit already lands in content/rendered/<book>/, where book.tex
is composed, so --output-dir is only for output that belongs
elsewhere under content/. WRITE-A-BOOK.md is the
assembly procedure.
chitragupta draft styleReport where a draft's prose departs from
WRITING-STANDARDS.md: Vale's prose rules, the
recorded dialect, acronym drift, and checks computed in plain Python
(listed in chitragupta/core/draft/style_rules.py's PYTHON_CHECKS). A review
aid: it exits 0 whatever it finds, and nothing blocks on it.
| Rule | What it means |
|---|---|
chitragupta.TableNoCaption, TableNoId, TableDuplicateId, TableMalformedId, TableUnreferenced, TableUnknownRef, TableRefOutsideSection |
A table with no caption, no <!-- table: <id> -->, a duplicate or malformed id, no reference, a tableref to nothing, or references only from another section (ยง13) |
chitragupta.TableNumberAbsent, CaptionInterprets |
A sentence that discusses a table and states a number found nowhere in it, and a table or figure caption that interprets the result instead of describing the table (ยง13). Both are review |
chitragupta.KeyTermsAbsent |
A section that uses none of the key terms scope.md lists. Always review |
chitragupta.ResearchNarrative, CitationAsSubject, WeakEnding |
A "First I searched, then I read" narrative, a paragraph whose sentences keep opening with a citation as their subject, and a draft whose last section closes on a gesture instead of a concrete next question (ยง4, ยง7, ยง11). All review |
chitragupta.FigureNoCaption, FigureDuplicateId, FigureMalformedId, FigureUnreferenced, FigureUnknownRef, FigureRefOutsideSection |
The same contract for <!-- figure: --> markers and figurerefs (ยง10) |
chitragupta.EquationOrphanMarker, EquationDuplicateId, EquationMalformedId, EquationUnreferenced, EquationUnknownRef, EquationRefOutsideSection |
The same for an equation opted in with <!-- equation: id -->; an orphan marker has no <!-- math --> block below it (ยง12) |
chitragupta.AcronymCase |
An acronym's expansion written in a different case from content/acronyms.toml. A capital at a sentence, line or heading start is accepted. Always review |
chitragupta.BareCitekey |
A ledger citekey a reader would see printed raw: in prose without its @, or set as code. A parsed key in prose may be repaired unattended to [@key]; a code span or a key with no parsed PDF is review (WRITING-STANDARDS.md ยง16) |
chitragupta.BareUrl |
A URL is printed raw where a [text](https://โฆ) link would read better and give the pdf something to click. A code span that is only a URL counts; one holding a command that contains a URL does not |
chitragupta.WideCodeLine |
A code line is wider than the page fits. In a Markdown draft the render wraps it, so this is a quality note; in a .tex fragment nothing can wrap it and it runs into the margin |
profile.HeadingCase |
A heading not in the case measured from the example papers in the dossier's style.md (sentence or title case). Reported only when style.md exists; edit |
profile.WePerParagraph |
A paragraph with more "we" than the example papers' high in style.md. Reported only when style.md exists; review |
chitragupta.ChapterSelfNumbered |
A .tex unit's \chapter{} states its own number or appendix letter (Chapter 1: โฆ), so the book prints it twice. A Markdown unit's --fragment render drops the prefix, so nothing is reported for one |
WRITING-STANDARDS.md
maps every rule to its standard. ยง14's third rule (a breakable form for a very
long token) is deliberately not checked: TeX hyphenates long English words
correctly, so there is no overflow to prevent. Terms in
content/style_exceptions.toml are never reported by a prose rule other than
Acronyms. Repeated findings collapse to one with a count.
chitragupta draft style content/drafts/<path>
chitragupta draft style content/drafts/<path> --json
It cannot be made a gate, not even behind a flag: it measures against
a language: line someone typed, which can be wrong
(ARCHITECTURE.md's "Layer 4"). The dialect is
declared, never inferred; the report names which source it used:
--language en-GB, for this run only. Writes nothing.language: line in the dossier's scope.md.[style].language in config.toml.chitragupta draft dossier set-language content/drafts/<path> en-GB
With none set, no dialect rules run, and the command measures the draft both ways and proposes one:
dialect: not checked -- no `language:` in scope.md and no [style].language
it reads as en-GB (en-GB: 0, en-US: 13). To record that:
chitragupta draft dossier set-language content/drafts/<path> en-GB
It proposes and never writes (HOUSE-STYLE.md).
Vale's findings need the vale binary on PATH (chitragupta install os-deps); without it the header says so and the Python checks
still run. assets/vale/README.md lists what the vendored rules
deliberately leave out, such as licence/license, which no string
match settles.
chitragupta draft specThe outline a book is generated from, and the human sign-off on it
(WRITE-A-BOOK.md). Stdlib only. Writes only under
content/specs/, mirroring the book's directory under
content/drafts/.
chitragupta draft spec init content/drafts/<book> --title "<title>" [--author "<name>"]
chitragupta draft spec show content/drafts/<book> [--json]
chitragupta draft spec show content/drafts/<book> --unit sec-1
chitragupta draft spec sign content/drafts/<book> --by "<name>"
chitragupta draft spec status content/drafts/<book> [--json]
chitragupta draft spec status content/drafts/<book> --pipeline [--json]
chitragupta draft spec status --all [--json]
chitragupta draft spec align content/drafts/<book> [--json]
chitragupta draft spec seed content/drafts/<book> --genre <genre> [--dry-run]
| Command | Does | Exit |
|---|---|---|
init |
write an outline skeleton with front and back matter, a preface template (content/drafts/<book>/preface.md), a copyright page template (content/specs/<book>/copyright.tex) and the index's exceptions (content/specs/<book>/index.toml); --author writes the outline's - author: line. Never overwrites the three templates |
1 if a spec is already there |
show |
the outline as a tree, under its title and author: line, or --unit <id> for one unit's slice |
1 on an unknown unit or a spec that does not parse |
sign |
record that a human approved this outline, by whole-file digest and one per chapter; and, while copyright.tex still holds its <year> placeholder, write the current year over it (in practice once, at the first sign-off) |
1 on a spec that does not parse |
status |
what the outline holds, whether it is signed off, and which chapters moved; --pipeline the book's five stops instead, --all every book a spec describes |
1 when unsigned or changed since sign-off; --pipeline and --all exit 0 |
align |
whether each authored chapter still matches the sections the outline declares | 1 on any finding, or on a chapter file symlinked out of its book |
seed |
write each chapter's declared sections into its dossier outline.md, as bare headings |
1 on an unsigned or unparseable outline, or on a chapter file symlinked out of its book |
align --json prints, keys sorted among the envelope's, chapters (one
report per authored chapter), findings (their total), and the text's
header line as two keys: spec, the outline's path, and title, the
book's title. show --json and status --json keep their keys in the
order the text reads them, since status's breakdown is in outline
order: show prints view (tree or unit), title, author,
units, unit and signed_off; status prints view (status),
spec, title, breakdown, recorded, digest, chapters and
state (signed, unsigned or changed).
status --pipeline is one document holding the other two whole:
spec, as spec status --json prints it, and units, as unit status --json prints it, both null when the outline does not parse; then
stops, the five stops (spec, signoff_1, chapters, assemble,
signoff_2), each with its label, state and detail, and
current, the first stop not yet done. assemble is blocked until
the outline is signed and every unit accepted, then ready,
assembled or stale by content/rendered/<book>/book.tex's age
against each unit and its acceptance record; signoff_2 is always
unrecorded, since no command records it. status --all lists every
spec.md under content/specs/ as books, each with its book path,
its title and its state, problems for one that does not parse. A
book path and --all together, or neither, is refused.
Four heading levels: # the book, ## a part, ### a chapter, ####
a section, each with an explicit {#id}, because a derived id changes
when a heading is reworded. The reserved part and generated-page ids
are covered in front matter,
appendices, back matter
and the index.
status's exit code is not a gate: it reads back a record of a
person's decision and refuses no write
(the book design notes).
init, sign and seed take --json too, and print what they wrote
in the order the text reads it: init path (the outline), book and
scaffolded (a line per template it wrote); sign breakdown, in
outline order, digest, path (signoff.md) and stamped (the line
naming the year it wrote into copyright.tex, or null); seed
dry_run and chapters, each with id, title, added and
created. The line init and sign print as the outline or sign-off
is written goes to stderr under --json; the files are the same, byte
for byte.
chitragupta draft unitOne section's generation contract, and the record of its acceptance
(WRITE-A-BOOK.md). Reads the outline spec owns;
writes only content/specs/<book>/units/<id>.json.
chitragupta draft unit contract content/drafts/<book> <unit-id> [--source CITEKEY]...
chitragupta draft unit contract content/drafts/<book> <unit-id> --json
chitragupta draft unit accept content/drafts/<book> <unit-id> [--source CITEKEY]... [--json]
chitragupta draft unit status content/drafts/<book>
| Command | Does | Exit |
|---|---|---|
contract |
the inputs one unit is generated from, and their digest | 1 on an unknown unit, a part/chapter, or a spec that does not parse |
accept |
record a generated unit, once the citation gate passes on it | 1 if the unit's own chapter is unsigned or misaligned, the draft is missing, a --source is not in the ledger, or the gate refuses it |
status |
where every unit stands, and what its dossier says about the same prose (--json); then any acceptance record whose unit has left the outline, as accepted, but no longer in the outline: <ids> ("orphaned" in --json), deleting nothing |
1 while any unit is not accepted and current; orphaned records do not count |
--source is repeatable and part of the input digest, which covers the
inputs only, never the unit's prose. accept invokes the citation
gate, it does not replace it: nothing here is a second gate.
accept --json prints unit, input_digest, path (the acceptance
record) and gate, the gate's report on the unit (path, ok,
citations, unknown, outside); the gate's lines, which text mode
prints first, go to stderr, and the record is the same, byte for byte.
status --json gives each unit its title, its chapter and the
draft path its prose lives at, and adds chapters, one per chapter
in outline order with its title, its units and its state:
accepted when every unit is, stale when any is, unwritten when
every unit is, drafted otherwise.
chitragupta draft registryTerminology, claims and cross-references over a book's accepted
units (WRITE-A-BOOK.md), written under
content/specs/<book>/registries/.
chitragupta draft registry build content/drafts/<book> [--glossary PATH] [--notation PATH] [--index PATH]
chitragupta draft registry check content/drafts/<book> [--json]
chitragupta draft registry excerpt content/drafts/<book> <unit-id> [--json]
chitragupta draft registry index content/drafts/<book> --idx content/rendered/<book>/book.idx
build and index take --json too
(Structured output); build's Wrote
lines then go to stderr.
| Command | Does | Exit |
|---|---|---|
build |
rebuild terms.md, claims.md, xrefs.md from accepted units; with --glossary/--notation, also write the book's Glossary and List of Symbols as LaTeX from the units' scope.md glossaries |
1 if the book has no readable outline; with either flag, also 1 if a glossary bullet cannot be printed or pandoc is missing, and then no page is written |
check |
what the registries disagree on | always 0 |
excerpt |
what one unit's generation should be told the rest of the book settled | 1 only if the book has no readable outline |
build --index PATH |
also write the index's term table, index-terms.json, from the glossaries and content/specs/<book>/index.toml |
1 if index.toml is malformed or names a term, chapter or target that does not exist, and then nothing is written |
index |
after the book's third lualatex pass: turn book.idx into book.ind through upmendex, and write index.md and index.json beside the other registries, each finding with the index.toml line that fixes it |
1 on a stale build (a chapter rendered without, or against an older, term table), a book.idx older than the table or a sidecar, a missing upmendex or pandoc, or an upmendex failure; no book.ind and no report are written then |
check is a review aid and exits 0 whatever it finds: it reports a
machine's reading of prose, not a human's decision, and no flag makes
it block
(the book design notes).
Every report names the units it skipped. check --json prints
accepted, skipped and findings, each finding a [kind, message]
pair; excerpt --json prints book, terms, symbols and anchors.
Contradiction between claims is not detected, only duplication,
because a machine can decide that.
chitragupta draft tldrA one-paragraph summary per citekey. write never generates one: it
stores what a person or skill passes on stdin under
content/tldr/<citekey>.json, keyed to a fingerprint of the current
parsed text, and show reports it stale after a re-parse. With
none written, show falls back to the authors' own abstract from the
passage sidecar, re-derived on every read. It never touches
content/ledger.sqlite, since a summary may be LLM output.
TLDR.md has the design and measurements.
echo "This paper proposes ..." | chitragupta draft tldr write smith2024
chitragupta draft tldr show smith2024
chitragupta draft tldr show smith2024 --json
| Command | Does | Exit |
|---|---|---|
write <citekey> [--json] |
store stdin as <citekey>'s summary |
1 if the citekey isn't in the ledger, has no parsed text yet, or stdin is empty |
show <citekey> [--json] |
print the best available summary, its source, and whether it's stale |
always 0; nothing recorded is not an error |
source |
Meaning |
|---|---|
human |
somebody wrote a TL;DR; stale reports it against the current parse |
abstract |
nobody did, so the authors' own abstract stands in; never stale |
none |
nobody did, and this paper has no abstract ("abstract not available") |
unknown |
nobody did, and there is no passage sidecar, so nothing can tell; a re-parse with [parser].backend = "docling" fixes it |
write --json reads its summary from stdin too, and prints path, the
file it wrote, which is the same either way. Its command has no
summary in it: stdin is not an argument.
chitragupta draft style-notesWhat one example paper's prose does, in the drafting skill's own words,
per citekey. Like tldr, write stores stdin under
content/style-notes/<citekey>.md beside a fingerprint of the current
parsed text, and show reports it stale after a re-parse.
echo "Short declarative sentences ..." | chitragupta draft style-notes write <citekey>
chitragupta draft style-notes show <citekey> --json
| Command | Does | Exit |
|---|---|---|
write <citekey> [--json] |
store stdin as <citekey>'s note |
1 if the citekey is unsafe, not in the ledger, unparsed, the note is empty, or it copies an 8-word run of that paper |
show <citekey> [--json] |
print the note and its state: fresh, stale or missing |
0 |
chitragupta draft figuresOne paper's figures: caption, page, the exact string to cite each by, and the path to the crop, so a drafting session can look at a figure while grounding a claim about it.
chitragupta draft figures smith2024
chitragupta draft figures smith2024 --json
| Command | Does | Exit |
|---|---|---|
<citekey> [--json] |
list that paper's figures | 1 if the citekey isn't in the ledger, or its figure index names an image outside content/docling/; 0 otherwise |
Consider, never replicate. Having a paper in your library grants no
right to reproduce its figures; the cite string is what belongs in a
draft.
| What you see | Means |
|---|---|
| a list of figures | that paper's figures, from its docling parse |
no figures recorded in its docling parse |
the paper has none |
no figure index for <citekey> โฆ |
the docling stage has not run for it; run chitragupta enrich --stages docling, with [enrich].docling_images on |
It reads content/docling/<citekey>.figures.json as a path, never by
importing the enrichment layer.
CONFIG.md says what the index excludes.
chitragupta draft diffWhat changed in a draft since a snapshot of it. The baseline is the
latest snapshot (dossier mark-revision takes one each pass), or
--against a snapshot number, label, or any file. The output is a
review copy: never gated, never a deliverable, never a source.
DRAFT-ITERATION.md has how
to use it.
chitragupta draft diff content/drafts/survey.md
chitragupta draft diff content/drafts/survey.md --against "sent to supervisor" --format pdf
chitragupta draft diff content/drafts/survey.md --against 2 --json
| Flag | Default | What it does |
|---|---|---|
<draft> |
required | The draft, under content/drafts/ |
--against REF |
the latest snapshot | A snapshot number (2, 002), a snapshot label, or a path. A path wins when it exists as a file; a file with no figures/ beside it leaves the figures uncompared |
--format md|pdf |
md |
md writes the change report; pdf also writes a redline, built with latexdiff from both versions rendered with their citations deferred |
--json |
off | Print the report as JSON instead of Markdown. Both files are written either way |
The report lists sections added, removed, moved or changed (each with
the revisions.md entries naming it), citekeys added and dropped,
figures changed, and any changed section no log entry explains. A
changed References section is listed as regenerated. It is written to
content/review/<topic>/<stem>.diff.{md,json} before any PDF work;
pdf adds <stem>.diff.tex and <stem>.diff.pdf. A baseline citation
that is no longer citable becomes (citation withdrawn) in the
redline.
| Situation | Exit |
|---|---|
Report written, including No changes. (no PDF then, and an older redline is removed) |
0 |
No snapshot yet, an unknown --against, a .md draft against a .tex baseline, or a draft outside content/drafts/ |
1 |
Either version cites a key and there is no ledger yet (before the first corpus sync). A draft citing nothing is diffed without one, as draft render renders it |
1, naming the sync to run |
--format pdf without latexdiff, LuaLaTeX or bibtexu, a side the gate refuses, or a redline that does not compile after one retry |
1, the report already written |
Each refusal is reported on stderr as an [error] line.
chitragupta review agendaOne ranked, deduplicated worklist merged across the other eight aids'
.json, chitragupta.draft style --json's prose findings, and the
dossier's drift report. Advisory, not a gate. In its bare form it
reads, never runs, an aid: an aid's .json that does not exist yet
is named as absent in the header. Each item carries a class, a
section anchor, and whether it is unattended (safe for an automated
pass) or surfaced for a person. AGENDA.md walks through an
agenda file section by section, including the JSON sibling, and
AUTO-IMPROVEMENT.md has the item classes.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The Markdown draft to check |
--formats FORMATS |
md,tex,pdf |
Extra formats beside the Markdown report, which is always written; tex needs pandoc, pdf also LuaLaTeX |
--json |
off | Print the worklist as JSON instead of just the written-files summary. The .json sibling is filed either way |
--accept ID |
unset | Record this item id as considered and accepted, keeping it off the worklist while the finding's identity is unchanged. Repeatable. Only claim-support, uncited-claim and unsupported-claim may be accepted; every other class is refused with exit code 2 |
--baseline PATH |
unset | Re-run the eight aids at --formats md, rebuild, and report resolved/persisting/new/accepted against the agenda .json at PATH, with the objective count before and after. The one mode that runs another aid (the bare command above never does), so it costs seconds rather than milliseconds |
chitragupta review agenda content/drafts/survey.md
# chitragupta review agenda content/drafts/survey.md --formats md
# chitragupta review agenda content/drafts/survey.md --json > agenda.json
# chitragupta review agenda content/drafts/survey.md --accept 3f2a91c40b7e
# chitragupta review agenda content/drafts/survey.md \
# --baseline content/review/survey.agenda.json --json
--accept stores identities only, in
content/review/<topic>/<stem>.accepted.json; an edit to the span
raises a new id and the item returns by itself. Defect classes cannot
be accepted, misquoted included;
AUTO-IMPROVEMENT.md has why. Under --baseline --json, stdout carries the comparison payload (view: recheck), not
the worklist (view: report).
--baseline needs a ledger: with none it exits 1 having changed
nothing; a bad baseline exits 2. The .md and .json are filed on
every run (there is no --write).
What every filing aid's --json prints. Each review aid that files
a report (all but verbatim overlap, recheck and locate) prints
under --json the document it files as its .json sibling, with one
more key before the closing notes: written, the {format: path} of
every file this run filed, the same paths the written-files summary
lists on stderr, and {} when it filed nothing (an aid run without
--write). The filed .json never carries written. The agenda's
worklist then adds accepted_now, one string per --accept id,
worded as the text mode prints it ([] without --accept); its
--baseline comparison gains written alone.
Structured output has the fields every
aid's document shares.
chitragupta review figureWhat a draft's TikZ figures' own geometry says about them.
Informational, not a gate: it exits 0 whatever it finds. It reads
the same geometry as figure check over
every figure the draft references, and keeps its own report.
figure-checks/README.md has the rules and
how to read a report. Without tikz.sty it still runs the static
checks and says the geometry was skipped; a figure that does not
compile is a finding on that figure.
Nothing here computes where a node should go. TikZ does the layout,
and this reads back the boxes TikZ decided. Fix a finding by changing
what you asked TikZ for (a sibling distance, a row sep), not by
nudging a coordinate until the number moves; when a finding and your
own eyes disagree, the eyes win (TIKZ-STYLE.md). A
picture that names no nodes reports nothing-measurable rather than a
clean result, so name the nodes you draw. The edge list is recovered
from the source; confirming it against the prose is the author's job.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The draft whose figures to check |
--json |
off | Print the findings as JSON; --write files the .json either way |
--write |
off | Also file the report under content/review/, mirroring the draft's path |
--formats FORMATS |
md,tex,pdf |
With --write, extra formats beside the Markdown report, which is always written |
chitragupta review figure content/drafts/<topic>/survey.md
# ... --write
# ... --json > figure.json
chitragupta review coverageHow much of what retrieval surfaced made it into a draft's citations. Informational, not a gate. Stdlib-only. A written report records the whole invocation, queries included, since a coverage figure means nothing without knowing 62% of what.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The draft to check |
--query QUERY |
required, repeatable | A retrieval query to check coverage against. Give it more than once |
--k K |
5 |
Top-k results per query |
--json |
off | Print the findings as JSON; --write files the .json either way |
--write |
off | Also file the report under content/review/, mirroring the draft's path |
--formats FORMATS |
md,tex,pdf |
With --write, extra formats beside the Markdown report, which is always written; tex needs pandoc, pdf also LuaLaTeX |
chitragupta review coverage content/drafts/survey.md \
--query "digital twin composability" \
--query "runtime verification"
# ... --k 10
# ... --write --formats md
# ... --json > coverage.json
--json: the shared envelope plus queries, k, coverage_pct,
candidates_total, cited_candidates_total, and one findings object
per itemised citekey (id, citekey, title, status:
uncited_candidates or cited_outside_candidates). With
[retrieval].spelling_correction on, a corrections object maps each
corrected query to what was added; both reports list them too. The key
is absent when nothing was corrected.
chitragupta review provenanceReports what in each cited source supports the claim citing it,
quoting a real passage. Advisory, not a gate. Like agenda, it writes
by default, to content/review/<topic>/<stem>.provenance.md with its
.tex/.pdf renders and .json sibling, whether or not --json is
given.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The Markdown draft to check |
--formats FORMATS |
md,tex,pdf |
Extra formats beside the Markdown report, which is always written; tex needs pandoc, pdf also LuaLaTeX |
--json |
off | Print the findings as JSON instead of just the written-files summary. The .json sibling is filed either way |
chitragupta review provenance content/drafts/survey.md
# chitragupta review provenance content/drafts/survey.md --formats md
# chitragupta review provenance content/drafts/survey.md --formats md,tex,pdf
# chitragupta review provenance content/drafts/survey.md --json > provenance.json
--json: the shared envelope plus one findings object per citing
sentence, worst match first: id, line, citekey, claim, score,
band, passage (page/quotable/text, or null) and note.
With --json, the written-files summary moves to stderr.
chitragupta review supportDoes the cited source entail the claim citing it? Scored with an NLI
entailment model rather than provenance's
lexical overlap, and ranked rather than banded. Advisory, exits 0
whatever it finds. Needs the enrich extra; without it, it prints a
notice on stderr and still exits 0 (under --json, with a
tool_missing refusal document on stdout).
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The draft to check |
--json |
off | Print the findings as JSON; --write files the .json either way |
--write |
off | Also file the report under content/review/, mirroring the draft's path |
--formats FORMATS |
md,tex,pdf |
With --write, extra formats beside the Markdown report; tex needs pandoc, pdf also LuaLaTeX |
chitragupta review support content/drafts/survey.md
# ... --write --formats md
# ... --json > support.json
--json: the shared envelope plus scored, unscoreable, and one
findings object per citation (id, line, citekey, claim,
score, note). scored counts findings; unscoreable counts
citekeys with no passage to score against, either because no passage
has readable text or because every readable one is a section heading.
Headings are excluded from the premises because a heading asserts
nothing.
chitragupta review unionDoes an assembled book still carry every citekey its accepted units stand on? The one aid that reads a book. Advisory, exits 0 whatever it finds. Stdlib-only set arithmetic over the assembly's resolved includes. A dropped finding is an accepted unit the assembly never includes; an appeared finding is a citekey in an included file no unit owns. It refuses, with exit 1, a path in no book and a path that is one of the book's own units.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The assembled document, e.g. content/rendered/<book>/book.tex |
--json |
off | Print the findings as JSON; --write files the .json either way |
--write |
off | Also file the report under content/review/, mirroring the book's path |
--formats FORMATS |
md,tex,pdf |
With --write, extra formats beside the Markdown report; tex needs pandoc, pdf also LuaLaTeX |
chitragupta review union content/rendered/twins/book.tex
# ... --write --formats md
# ... --json > union.json
--json: the shared envelope plus units_checked,
units_unchecked, units_omitted, includes_outside_units,
includes_unresolved, citekeys_outside_units,
appeared_determinable, and one findings object per citekey (id,
citekey, status, units). Read appeared_determinable before
trusting an empty appeared: while any unit is unwritten, unaccepted
or edited since acceptance, that direction is withheld and the field is
false. includes_unresolved lists includes that could not be opened,
so a report with entries there covers less than it appears to.
chitragupta review synthesisHow many sources each unit of a draft rests on, at the unit its genre
binds at (WRITING-STANDARDS.md ยง11). Advisory,
exits 0 whatever it finds. The unit comes from the genre in the
dossier's scope.md:
| Genre | Unit |
|---|---|
survey, thesis-chapter, deep-research, research-paper |
paragraph |
textbook-chapter |
section: its paragraphs are free to be single-source, its consecutive paragraphs are not free to be the same single source |
tutorial |
document: the body carries no citations by design, so the floor is on the lesson's derivation |
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The draft to check |
--unit {paragraph,section,document} |
from scope.md |
Measure at this unit instead. For a draft with no dossier, or to look at one deliberately at another scale |
--json |
off | Print the findings as JSON; --write files the .json either way |
--write |
off | Also file the report under content/review/, mirroring the draft's path |
--formats FORMATS |
md,tex,pdf |
With --write, extra formats beside the Markdown report; tex needs pandoc, pdf also LuaLaTeX |
chitragupta review synthesis content/drafts/survey.md
# ... --unit section # a draft whose dossier records no genre
# ... --write --formats md
# ... --json > synthesis.json
The report gives spread (distinct citekeys per unit) and, for a section, the longest run of paragraphs on one citekey. It counts and does not judge: no threshold, nothing acts on it unattended. A marker directly above a unit (no blank line) declares it deliberately single-source:
<!-- single-source: Foo2019 is the only paper in the corpus covering X -->
% single-source: Foo2019 is the only paper in the corpus covering X
--json: the shared envelope plus genre, unit, unit_source,
units_total, uncited, single_source, multi_source, declared,
undeclared, single_source_pct, and one findings object per
itemised unit (id, kind, line, unit, citekeys, declared,
longest_run).
chitragupta review uncitedWhich sentences of a draft carry no citation at all. Advisory, exits 0 whatever it finds. It reads only the draft. Headings, captions, references, comments and code are excluded; table rows are not, since a citekey in backticks is not a citation.
| Genre | Uncited prose is | Findings |
|---|---|---|
survey, thesis-chapter, deep-research |
exceptional | one per uncited sentence |
textbook-chapter, tutorial, research-paper |
ordinary: most prose is original by design, per WRITING-STANDARDS.md ยง11 | none. The counts are still reported |
not recorded in scope.md |
exceptional | raised, and the report says the genre was not recorded |
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The draft to check |
--genre {deep-research,digest,research-paper,survey,textbook-chapter,thesis-chapter,tutorial} |
from scope.md |
Read the draft under this genre instead. For a draft with no dossier, or to read one strictly on purpose |
--json |
off | Print the findings as JSON; --write files the .json either way |
--write |
off | Also file the report under content/review/, mirroring the draft's path |
--formats FORMATS |
md,tex,pdf |
With --write, extra formats beside the Markdown report; tex needs pandoc, pdf also LuaLaTeX |
chitragupta review uncited content/drafts/survey.md
# ... --genre survey # a draft whose dossier records no genre
# ... --write --formats md
# ... --json > uncited.json
Nothing repairs these findings for you: the fix for an uncited claim is evidence, and rewording one would make it look supported without making it supported.
--json: the shared envelope plus genre, genre_source,
standing, sentences_total, uncited, bare, and one findings
object per uncited sentence (id, line, sentence, block_cites).
chitragupta review quotationDoes each quoted span in a draft's dossier, and each prose quotation
of four or more words in a sentence that cites, appear in the source it
is attributed to? A misattributed quotation is the one part of the
fabricated-citekey failure class
chitragupta draft gate cannot see,
because the citekey is real. Advisory, exits 0 whatever it finds.
It checks exactly the quote: fields
draft evidence would print, never a
legacy support: block. A block with several quotes has each checked
on its own, and the report names it as quote N of M.
| Outcome | Means | A finding? |
|---|---|---|
| found | The span is in the source. The report gives the page and the tier that matched | no |
| absent | It is not, and the source was readable in reading order. Carries the page its distinctive words concentrate on, so you can tell a fabrication from an edited quotation | yes |
| not checkable | The source has no reading-ordered passages, only pdftotext -layout text, whose column splicing makes a correct quotation non-contiguous. Reporting it absent would accuse a draft of something it did not do |
no |
Matching is exact over a normalised [a-z0-9] stream, with elided
fragments required in order; there is no similarity score. The
report's - Universe: line is no-dossier, no-quotes or checked;
only checked means a quote was looked at.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The draft to check |
--json |
off | Print the verdicts as JSON; --write files the .json either way |
--write |
off | Also file the report under content/review/, mirroring the draft's path |
--formats FORMATS |
md,tex,pdf |
With --write, extra formats beside the Markdown report; tex needs pandoc, pdf also LuaLaTeX |
chitragupta review quotation content/drafts/survey.md
# ... --write --formats md
# ... --json > quotation.json
--json: the shared envelope plus universe, quotes_total,
found, absent, unverifiable, a quotes object per checked span
(id, citekey, verdict, tier, pages, reason, index, of)
and a findings object per absent one (id, citekey, quote,
near_miss_page, near_miss_score, index, of). index is the
quote's place among its block's quote: lines and of their count,
an identical repeat counted once;
quotes_total counts quotes, not sources. tier is exact, exact-pair,
elided or elided-pair.
chitragupta review digestHow much of a verbatim digest is not the sources' own words, and
what every such sentence is. VERBATIM-DIGEST.md
explains digests, the report's fractions and classes, page notes, and
the repair loop. It uses review quotation's
matcher, so it needs the Docling sidecars chitragupta enrich --stages docling writes; a source without one is reported as not checkable.
Advisory, exits 0 whatever it finds. Any draft can be given to it;
one that is not a digest simply reports most of its prose as not
copied. Its finding classes are unsupported-text, copy-mismatch,
dangling-reference, repeated-text and unquoted-text, each item
[surfaced]. The report and its .json are filed on every run,
because the .json is the next pass's baseline.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
<draft> |
required | The digest to check |
--formats FORMATS |
md,tex,pdf |
Extra formats beside the Markdown report; the .md and .json are always written. tex needs pandoc, pdf also LuaLaTeX |
--json |
off | Print the payload (or, with --baseline, the comparison) as JSON instead of the summary |
--baseline PATH |
-- | Compare this run against a previously filed <stem>.digest.json: resolved, persisting and new items, counts and fractions before and after, and whether unsupported text fell |
chitragupta review digest content/drafts/<topic>/notes.md --formats md
chitragupta review digest content/drafts/<topic>/notes.md --json > digest.json
chitragupta review digest content/drafts/<topic>/notes.md \
--baseline content/review/<topic>/notes.digest.json
--json: the shared envelope plus view (report), the three
fractions (unsupported_fraction, copied_fraction,
unverifiable_fraction), word counts, a counts object per class, an
items list, a spans list per copied span and an unverifiable
list. Under --baseline the printed payload carries view
(recheck), baseline, resolved, persisting, new, the before
and after counts and fractions, and fell; the filed .json is always
the bare report.
chitragupta review verbatimVerbatim overlap with one cited source, a whole-draft x whole-corpus
scan, a re-scan against a recorded one, and page location for a
phrase. Stdlib-only; locate uses pdftotext when present and falls
back to content/parsed/ (page-level) without it. Run with no
arguments to print its usage.
PLAGIARISM.md covers what each tier catches and
misses, severity buckets, cost, the --json fields, repair, and
how the tiers were chosen.
| Subcommand | Arguments | What it does |
|---|---|---|
overlap |
<draft> <citekey> [--n N] [--json] |
Longest verbatim word-n-gram runs shared between the draft's sentences citing <citekey> and that source's parsed text. --n defaults to 8 |
scan |
<draft> [--min-run N] [--gap N] [--limit N] [--json] [--write] [--formats F] |
Slides the whole draft across the whole corpus index, catching reuse overlap cannot: an uncited source, or prose that cites nothing. --min-run (default 8) is the reporting length floor; --gap (default 1) tolerates that many non-matching words inside a run; --limit caps how many findings print (default all). --json, --write and --formats (default md,tex,pdf) as for the other aids |
recheck |
<draft> --baseline PATH [--json] |
Re-scans the draft and compares it against a payload scan --write filed earlier, reporting each finding as resolved, persisting or new plus the change in the objective count. --baseline is required and its --min-run/--gap are reused, so the two scans are comparable. Prints only; there is no --write |
locate |
<citekey> "<phrase>" [more...] [--json] |
Which PDF page each phrase (or its distinctive words) appears on |
Exit codes, shared with the other ten review aids. 0 on every
successful invocation, findings or not: these are advisory, never a
gate. That includes recheck: a draft that got worse still exits 0.
1 is a draft this layer will not read, because it is missing or
resolves outside content/. 2 is a malformed invocation; recheck
also uses 2 for a baseline it cannot compare against.
chitragupta review verbatim overlap content/drafts/survey.md talasila_composable_2025
# chitragupta review verbatim overlap content/drafts/survey.md talasila_composable_2025 --n 12
chitragupta review verbatim scan content/drafts/survey.md
# chitragupta review verbatim scan content/drafts/survey.md --min-run 12 --gap 2 --limit 10
# chitragupta review verbatim scan content/drafts/survey.md --write --formats md
# chitragupta review verbatim scan content/drafts/survey.md --json > findings.json
# chitragupta review verbatim recheck content/drafts/survey.md --baseline content/review/survey.verbatim.json
# chitragupta review verbatim locate talasila_composable_2025 "a digital twin is"
overlap --json prints citekey, n, source_found and runs, each
run with words, page, fragment and context; locate --json
prints citekey, pages and phrases, each phrase with its best
pages as page and score. Neither files anything.
A clean scan is not a clean bill of health. The exact tier cannot
see a substituted word, the skip-gram tier cannot see restatement, and
the embedding tier runs only where the enrichment layer, the Docling
sidecars and the draft's dossier are all present. Read a clean run as
"nothing found by the tiers that ran"; every form of the output names
any tier that did not run, and why (tiers_not_run in --json). Both
paraphrase tiers are advisory only; treat skip-gram findings with
more scrutiny than exact ones.
--json serialises what scan computed, never recomputing; a
clean draft emits "findings": [] and exits 0. start is a word
offset into the normalised word stream, not a character offset or line
number; line, char_start, char_end and draft_text index the
draft as written, from the first matched word to the last, interior
punctuation included and a trailing period excluded, so draft_text
can be used as an Edit old_string. id is a digest of
(citekey, page, fragment), not of position, so it survives the repair
of another finding. --write files the same document, without
written, as
content/review/<topic>/<stem>.verbatim.json, with no timestamp; with
both flags, the written-files summary goes to stderr.
PLAGIARISM.md has every
field.
recheck reports resolved, persisting, new, and the change
in the objective count (the long and short buckets, excluding a
quoted-and-cited run and every embedding finding). Read new as well
as the delta: one finding resolved and another introduced leaves the
delta at 0. The floor comes from the baseline, never a flag. It refuses
(exit 2, naming the remedy) a baseline it cannot compare against:
another aid's payload, one written under --limit, one missing a
field, one from a different major.minor release, or one that is not
JSON. There is no --write: a comparison is stale the next time the
draft is touched. The agenda-reviser skill
(GENRE.md) is the
intended caller.
The disk cache. The first scan builds a corpus-wide index under
content/overlap/ (about 27s over a 497-document corpus); later scans
over an unchanged corpus are sub-second, and a changed document is
re-fingerprinted alone. Delete the directory and the next run rebuilds
it. scan also honours a per-host, gitignored
content/verbatim_allowlist.toml
(PLAGIARISM.md).
locate numbers pages by form feeds. Under docling, a page with no
extracted text shifts the numbering after it; where the two disagree,
believe chitragupta review provenance.
chitragupta figure syncKeeps the house figure-style block
(TIKZ-STYLE.md) current inside
every figure file. Each figure file carries its own copy between two
marker comments, so it compiles under \usepackage{tikz} alone.
chitragupta figure sync # every content/drafts/**/figures/*.tex
chitragupta figure sync content/drafts/twin # a directory: every figures/*.tex beneath it
chitragupta figure sync --check assets/tikz/*.tex # files as named; report only
A directory contributes only the *.tex files directly inside a
figures/ directory beneath it, so a draft's own .tex is never
stamped. A file named on the command line is taken as given.
| What it finds | What it does |
|---|---|
| no block | stamps one above the first \usetikzlibrary or tikzpicture line (stamped) |
| a block this project released earlier | replaces it with the installed one (refreshed) |
| the installed block | nothing (current) |
| a block that matches no release: edited, or stamped by a newer chitragupta | leaves it alone and prints the diff (modified) |
| markers unpaired or repeated | leaves it alone (malformed) |
| no picture to stamp above, a symlink, not UTF-8, read-only or unwritable | reports it and carries on (no-picture, skipped) |
Everything outside the markers is left byte for byte, and a second run changes nothing.
| Flag | Exit |
|---|---|
| (none) | 0 whatever it found; it is an aid |
--check |
writes nothing; 1 if any file is not current, else 0 |
| either | 2 on a usage error, or when the installed block or its version register cannot be read (chitragupta doctor) |
--json |
prints each file's outcome as JSON instead (Structured output); the exit codes do not change |
chitragupta draft render reports a stale or missing block as a
[figure] warning naming this command, and renders anyway. In a
developer checkout, git-hooks/pre-commit runs --check on staged
figure files without blocking the commit (HOOKS.md).
chitragupta figure checkReports every rule one figure file breaks, by rule id, and every
deliberate exception the file records. One compile, in the render's
fonts at 12pt with the figure's TikZ libraries loaded. The
figure-drawer skill runs this as its geometry step.
figure-checks/README.md has every rule, the
% cg-allow: form, and how to read the report.
chitragupta figure check content/drafts/rag/figures/flow.tex
chitragupta figure check figures/flow.tex --width 345 # a narrower target, in pt
chitragupta figure check figures/flow.tex --layout map # read sizes against another layout
chitragupta figure check figures/flow.tex --json
| Flag | Default | What it does |
|---|---|---|
--page article|book |
book for a figure under a book's drafts directory (one with a content/specs/<book>/spec.md), else article |
The page to check against. article is draft render's page, 453pt by 700.5pt; book is book-assembler's, 437.5pt by 685pt. Its text width is size-width's target, and its text height is what size-height reports a share of. The report's second line names the page and why it was chosen |
--width PT |
the page's text width | Target text width in pt for size-width, overriding the page's alone: the height stays the page's |
--layout NAME |
the figure's % cg-layout: line |
Read the advisory size reports against this layout's reference ranges. One of the layouts with a file under .claude/skills/figure-drawer/references/layouts/; any other name is a usage error |
--json |
off | The same report as JSON: width_pt, page (name, text_width_pt, text_height_pt, why), layout (or null), findings and advisory (each with rule, class, scope, target, measurement), allowed (each with the measurement it set aside), stale and unchecked (each with why), malformed, not_measured and diagnostics |
| Exit | When |
|---|---|
| 0 | after any run, whatever it found; it is an aid |
| 2 | a usage error, a path that is not a readable file, or no lualatex or tikz.sty on the host. It then checks nothing rather than report the source-only rules, whose silence would read as a clean figure (chitragupta doctor) |
chitragupta figure newStarts a figure from a layout's scaffold in assets/tikz/: copies it
to <figures-dir>/<name>.tex, copies the layout's ASCII twin to
<name>.txt, and runs figure sync on the
copy. It never overwrites: an existing <name>.tex or <name>.txt, or
a symlink at either, is refused and nothing is written. The
figure-drawer skill starts every figure with it.
chitragupta figure new content/drafts/rag/figures flow --layout zoned-spine
created content/drafts/rag/figures/flow.tex (from zoned-spine)
created content/drafts/rag/figures/flow.txt (from zoned-spine)
figure sync: 1 current
| Argument | What it is |
|---|---|
<figures-dir> |
A directory named figures, the name figure sync's walk and the render's markers look in. Created if its parent exists |
<name> |
The figure's file stem: no path, no suffix |
--layout ID |
A scaffold whose own % cg-layout: line names its file stem: branching-tree, comparison, control-loop, hub-and-spoke-network, layered-stack, map, pipeline, sequence, state-machine, timeline or zoned-spine |
| Exit | When |
|---|---|
| 0 | the figure was written |
| 2 | a refusal (a name with a path in it, a directory not named figures, an unknown layout, a file already there), or an installed scaffold or house block that cannot be read (chitragupta doctor). Nothing is written |
--json prints layout, figure, twin, twin_written and sync
(the figure sync outcome for the copy: path, action, detail)
between the envelope and notes, and writes the same two files; a
refusal is a document with exit code 2.
chitragupta figure lookShows one figure as it will print, alone on its page in the render's
fonts (the page figure check picks), for the defects no rule
measures: a badly wrapped label, an arrow through a zone title. It
writes:
| File | What it is |
|---|---|
<name>.look.pdf |
The page, cropped to the figure plus 10pt (so the soft shadow survives). A figure wider than the text width gets a red line at the text width |
<name>.look.png |
That page at 300 dpi, never scaled |
<name>.look.json |
A digest of what the look was built from, and what was measured |
<name>.page.png |
With --draft: the draft's page that holds the figure, at 300 dpi |
They go under content/rendered/, mirroring the figure's place under
content/drafts/, or into --output-dir DIR, which a figure outside
content/drafts/ requires. An unchanged figure is not recompiled.
chitragupta figure look content/drafts/rag/figures/flow.tex
chitragupta figure look content/drafts/rag/figures/flow.tex --draft content/drafts/rag/survey.md
chitragupta figure look ~/scratch/figures/flow.tex --output-dir content/scratch
wrote content/rendered/rag/survey.pdf
current content/rendered/rag/figures/flow.look.pdf (336 x 114pt; text width 453pt)
current content/rendered/rag/figures/flow.look.png (1488 x 567 px at 300 dpi)
wrote content/rendered/rag/figures/flow.page.png (page 1 of survey.pdf; 2481 x 3508 px)
With --draft it renders the draft as
draft render does and finds the
figure's page from an invisible PDF destination (cgfig:<marker base>); a .tex draft's figures get no page picture. A figure that
does not compile prints TeX's first error, and its old look files are
deleted.
| Flag | Default | What it does |
|---|---|---|
--draft DRAFT |
none | Also render this draft and write <name>.page.png |
--output-dir DIR |
mirrored | Write the look (and with --draft, the render) here instead of content/rendered/<mirrored path>; required for a figure outside content/drafts/; confined to content/ |
--json |
off | Print the look as JSON; the wrote line and a refused render's line go to stderr (Structured output) |
| Exit | When |
|---|---|
| 0 | after any look, a figure that does not compile and a draft that does not render included |
| 2 | a figure that is not a readable UTF-8 file, no lualatex, tikz.sty or pdftoppm (or pandoc, with --draft), a rendered directory or --output-dir that resolves outside the content directory, or a figure outside content/drafts/ with no --output-dir. Nothing is written (chitragupta doctor) |
chitragupta enrichOrchestrates the enrichment layer: docling -> embeddings/Chroma ->
BERTopic -> declared keywords -> seed topics -> converge -> topic
graph. Needs the venv. Each stage probes its own prerequisites and
reports ok, partial, skipped or error, so skipped on a machine
without the enrich extra is a correct answer.
| Flag | Default | What it does |
|---|---|---|
-h, --help |
-- | Show help and exit |
--target {host,docker} |
host |
Informational only: stages self-probe regardless |
--stages STAGES |
all seven, or docling alone with --for-draft |
Comma-separated subset of docling,embed,bertopic,extract-keywords,seed-topics,converge,topic-graph |
--for-draft PATH |
-- | Scope docling to the papers this draft cites. Refused with an explicit --stages embed, bertopic, extract-keywords, seed-topics, converge or topic-graph |
--json |
off | Print JSON Lines: the run's events, then its result |
Exit code, which is all a schedule can read: 1 when any stage
reports error or there is no ledger, 2 when another run holds the
lock (as for sync), 3 when --for-draft is refused, 0 otherwise,
including partial and skipped. A docling run that gave up on
documents through a repeatedly-dying worker pool reports error, so
it exits 1.
chitragupta enrich
# chitragupta enrich --stages docling
# chitragupta enrich --stages embed,bertopic
# chitragupta enrich --stages extract-keywords # writes content/keywords.toml
# chitragupta enrich --stages seed-topics # skipped with no content/seed_topics.toml
# chitragupta enrich --for-draft content/drafts/digital-twins.md
The embed stage prints one line per document (embedded,
unchanged or no text to embed) and a closing total. Ctrl+C is
safe: every chunk upserted so far is kept, and a re-run picks up from
there.
--for-draft narrows docling from the whole corpus to the papers one
draft cites, read with the citation gate's own
chitragupta.core.draft.citation_gate.extract_citekeys, so a draft resting on
twenty-three papers costs twenty-three parses:
$ chitragupta enrich --for-draft content/drafts/digital-twins.md
Target: host
Corpus: 23 of 642 doc(s) from papers/bibliography.bib -- scoped to content/drafts/digital-twins.md
=== docling ===
[ok] {
"ali_modeling_2024": "ok: content/docling/ali_modeling_2024.md",
...
}
=== Summary ===
docling ok
Follow it with chitragupta review provenance <draft>, a tier-1
command needing no venv and no lock. The other six stages refuse the
scope (exit 3) and name the two commands to run instead, because each
builds one whole-corpus artefact and a partial one is indistinguishable
from a complete one (LADDERS.md). A cited citekey the
ledger has never heard of is named, and a scope matching nothing stops.
The Docling cache is per-document, so scoped and full runs never parse
a document twice.
scripts/install_full_pipeline.shOne install path for both a bare machine and the Docker image. Takes stage names as positional arguments, not flags.
| Stage | What it does |
|---|---|
python-deps |
Default when no stage is given. Creates the venv, creates config.toml from the example if there is none, and installs the enrich extra from uv.lock. chitragupta install refuses it, naming chitragupta install enrich |
os-deps |
apt-get the system packages (TeX Live with LuaLaTeX, the render's fonts, Pandoc, poppler-utils, ripgrep (which chitragupta webapp --agent opencode needs), git/curl/unzip, OpenCV's runtime libraries (PDF-PARSER.md), and python-is-python3, which puts the hooks' python on PATH), plus STIX Two. Needs root; auto-sudo's. Opt-in. Also chitragupta install os-deps |
dev-deps |
The dev extra into the same venv, plus the pinned actionlint and core.hooksPath pointed at git-hooks/. For running the tests and committing; run python-deps first. Pip equivalent: pip install 'chitragupta-cli[dev]' |
cpu-torch |
Swaps torch to the CPU-only wheel and removes the CUDA runtime. Never part of all: it asserts a GPU is absent for good, which the script cannot infer |
gpu-torch |
Runs ensure_gpu_torch (below) against CHITRAGUPTA_PYTHON rather than the script's venv; what chitragupta install gpu-torch reaches |
actionlint |
Installs the pinned workflow linter alone, without the venv dev-deps also builds |
vale |
Installs Vale alone, without the rest of os-deps |
stix-two |
Installs the pinned STIX Two font alone, for a host whose TeX Live and Noto fonts came from somewhere else |
ripgrep |
Installs ripgrep alone, for chitragupta webapp --agent opencode, without the rest of os-deps |
frontend-deps |
On Linux and macOS, installs nvm into NVM_DIR (default ~/.nvm) if it is not there, from a pinned release whose installer is checksum-verified before it runs and which adds nvm to your shell profile. nvm then installs Node at the major version frontend/.nvmrc names and makes it the default, and the stage runs npm ci --ignore-scripts for the root manifest and for frontend/. Elsewhere it names that Node version for you to install. For building and testing frontend/ and for scripts/check_local.sh. Never part of dev-deps |
all |
os-deps + python-deps. Does not include dev-deps |
bash scripts/install_full_pipeline.sh # = python-deps
# bash scripts/install_full_pipeline.sh all
# bash scripts/install_full_pipeline.sh os-deps
# bash scripts/install_full_pipeline.sh dev-deps
# bash scripts/install_full_pipeline.sh os-deps python-deps dev-deps
# bash scripts/install_full_pipeline.sh frontend-deps
# SKIP_VENV=1 installs into the active environment instead of creating
# .venv-full/ -- what docker/Dockerfile uses for its own /opt/venv.
# SKIP_VENV=1 bash scripts/install_full_pipeline.sh python-deps
python-deps and dev-deps also run ensure_gpu_torch, which
reinstalls torch from a wheel index matching the NVIDIA driver if the
default one would silently run CPU-only. It is idempotent and prints
what it decided.
Nothing to install first. python-deps installs the pinned uv into
the venv it builds, from scripts/uv-requirements.txt, with every
wheel's hash checked, and installs the Python dependencies with it. Each
stage ends by printing the interpreter path to use afterwards.
scripts/release.pyBuilds the release archive under release/. A maintainer tool.
Takes no arguments and parses none, including -h/--help, which
it ignores while building the archive anyway:
python3 scripts/release.py
It first builds the webapp (npm --prefix frontend ci --ignore-scripts,
then npm --prefix frontend run build), so it needs Node, and it ships
that build, assets/webapp/app/, although git ignores it.
frontend/, tests/, bench/, plans/, .github/, .gitignore and
a few root-level tooling files are excluded (EXCLUDE_TOP_LEVEL). Every
prose document ships: docs/, README.md, SOUL.md, AGENTS.md,
DEVELOPER-AGENTS.md and DEVELOPER.md, plus .claude/, .agents/,
.codex/ and .opencode/.
python -m chitragupta.corpus sync is deterministic, idempotent, and
takes its own write lock (chitragupta.core.runlock), so it is safe to run
unattended. An unattended caller branches on exit codes and checks
logs/pipeline.log afterwards (rotated; see [logging] in
config.toml.example).
chitragupta enrich writes to the same file. Each line names its source
module (sync logs as chitragupta.sync whatever the command that
started it is spelled), so either layer can be narrowed back out:
grep 'chitragupta\.sync' logs/pipeline.log # just the corpus layer
grep 'chitragupta\.enrich' logs/pipeline.log # just the enrichment layer
Don't hand-roll a log redirect: the log carries the warnings, progress and summary. Only three rare messages stay terminal-only by design: a docling worker's GPU-OOM fallback, the Ctrl+C notice, and the lock refusal (the losing side of a race must not touch the winner's file).
Exit codes are the API, not the printed text:
| Exit code | Meaning | What an unattended caller should do |
|---|---|---|
0 |
Clean: everything that needed parsing, parsed | Nothing |
1 |
Documents this host could not parse: the conditions corpus sync lists under code 1, deliberately neither restated nor counted here |
Alert; logs/pipeline.log's FAILED/WARNING lines name which citekey and why |
2 |
Another run already holds the write lock | Nothing; this is expected under any schedule tight enough to overlap a slow run. The skipped cycle costs nothing; the next one picks up whatever this one would have |
3 |
Everything parsed, but the bibliography has a hole in it: a stale file path, an unreadable PDF, an export that yielded no references, or a bib file the parser read only part of (a dropped entry, an unusable or shared citekey) |
Alert, but not at the same urgency: no document was lost by this host. The remedy is in the bib file or on the disk it points at |
Running the chitragupta.sync module directly syncs nothing. It names
chitragupta corpus sync on stderr and exits 64, deliberately none
of the four codes in the table, so a caller that reads 2 as "expected,
do nothing" cannot mistake it for a skipped cycle.
# crontab -e -- runs hourly, on the hour. cd into the repo first: sync
# resolves config.toml and papers/bibliography.bib relative to it.
0 * * * * cd /path/to/chitragupta && .venv-full/bin/python -m chitragupta.corpus sync
Without MAILTO, cron mails output to the crontab's owner, which needs
a local MTA most hosts lack; logs/pipeline.log is written every run
regardless.
# /etc/systemd/system/chitragupta-sync.service
[Unit]
Description=Chitragupta corpus sync
[Service]
Type=oneshot
WorkingDirectory=/path/to/chitragupta
ExecStart=/path/to/chitragupta/.venv-full/bin/python -m chitragupta.corpus sync
# Exit 2 (another run still holds the lock) is an expected, harmless
# outcome under this schedule, not a service failure -- don't let
# systemd treat it as one.
SuccessExitStatus=2
# /etc/systemd/system/chitragupta-sync.timer
[Unit]
Description=Run chitragupta-sync.service hourly
[Timer]
OnCalendar=hourly
Persistent=true
[Install]
WantedBy=timers.target
sudo systemctl daemon-reload
sudo systemctl enable --now chitragupta-sync.timer
journalctl -u chitragupta-sync.service # systemd's own transcript,
# alongside logs/pipeline.log
Both assume .venv-full/ is already built
(scripts/install_full_pipeline.sh);
scheduling installs nothing.
Every config.toml setting has a matching environment variable that
overrides it for one run; CONFIG.md has the
full list. The ones that most often appear on a command line:
# Point at a different bibliography or output directory for one run
# BIB_FILE=/path/to/other.bib .venv-full/bin/python -m chitragupta.corpus sync
# CONTENT_DIR=/tmp/scratch-content .venv-full/bin/python -m chitragupta.corpus sync
# Keep config.toml somewhere else entirely
# CONFIG_PATH=/etc/research/config.toml .venv-full/bin/python -m chitragupta.corpus sync
# Try the higher-fidelity parser with some parallelism, without editing the file
# PARSER=docling PARSER_WORKERS=auto .venv-full/bin/python -m chitragupta.corpus sync
# Confine a docling run to one GPU (no config setting for this, by design)
# CUDA_VISIBLE_DEVICES=0 .venv-full/bin/python -m chitragupta.corpus sync