โจ Command reference¶
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.
๐ง Installing¶
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:
1 2 3 4 | |
or, from a git checkout (for working on the pipeline itself; see
DEVELOPER-AGENTS.md):
1 2 3 | |
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). Add --agent codex or --agent opencode, repeatable, to
write that harness's folders too (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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
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).
โ Which interpreter¶
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 |
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.
๐ The full first run, step by step¶
Every command appears below at least once, in the order a first run reaches it; Every command and flag is the exhaustive reference.
โจ As the chitragupta command¶
With .venv-full/bin/activate sourced (see Installing):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
Two commands are for working on this repository, so only their checkout form exists:
1 2 3 4 | |
๐ As the module form (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.
๐ฆ Checkout and pip install side by side¶
A 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).
๐งฑ Structured output (--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. 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 produced it, as python -m chitragupta.<layer> .... Outside the review aids: the positionals as given, then the options in the order --help lists them, a default left out, and --json last |
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 |
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:
- The filed
.jsonsibling: the opening fields, the findings,notes. It is what a later--baselinerun reads. - What
--jsonprints: the same document with this run's own keys between the findings andnotes:writtenon every filing aid, andaccepted_nowon the agenda's worklist (see the agenda).
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. Three have more to say:
corpus discoveropens its own keys withview, which names the shape:list,topic,search,paper,why,groups,hops,clusters,path,compare, orwrittenfor--htmland--app.draft dossier versionsholds its snapshots indossier_versions; until 7.4.4 it printed them as a bare array.draft diffprints the report it files as<stem>.diff.json, byte for byte, so itsnotesare those written before the report was filed; a redline's notes come after.
โจ Every command and flag¶
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 init¶
Scaffolds a project directory: config.toml (from
config.toml.example), .claude/, papers/,
content/{drafts,dossiers,specs,review,rendered}/, assets/ and the
prose docs. 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 |
--agent {claude,codex,opencode} |
claude |
Harness to set up; repeat for several (LLM-AGENTS.md) |
๐ฉบ chitragupta doctor¶
Probes 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
no flags, installs nothing and always exits 0.
๐ง chitragupta install¶
Runs 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 sync¶
Bibliography -> 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 |
1 2 3 4 5 6 7 8 | |
The exit code is the whole API an unattended caller has. The two nonzero completion codes split by remedy:
- 1: this host could not produce documents it was asked for: a parse failure in this run, a deterministic one left by a previous run (not retried, so it stays nonzero until you deal with it), or the parse backend being unavailable. The remedy is on this machine.
- 3: everything asked for was parsed, but the bibliography promises something that is not there: the bib file yielded no references against a non-empty ledger, a PDF it points at is missing or unreadable, two entries share one citekey, the BibTeX parser dropped an entry (usually unbalanced braces), or a citekey was skipped because it cannot be a filename. The remedy is in the bib file or on the disk it points at.
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.
๐ Why an attachment has to live beside the bib file¶
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).
๐งพ What else still references a citekey you are about to remove¶
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 |
1 2 3 4 5 6 7 8 | |
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.
๐ When a citekey is renamed¶
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:
1 | |
sync writes two things to the ledger, and nothing else:
renames: eachold -> new, recorded before--remove-stalecan 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).
โป When sync re-parses a document it already parsed¶
A 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 ledger¶
Read-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 |
1 2 3 4 5 6 7 | |
Exits 0 with no ledger yet, or one that needs a sync to migrate it,
printing the instruction. 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 topics¶
Read-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 |
1 2 | |
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 discover¶
Resolve 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 |
1 2 3 4 5 6 7 | |
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 gate¶
The 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 no options: every argument is a file to check.
| Argument | What it does |
|---|---|
-h, --help |
Show usage and exit 0 |
<file> [<file> ...] |
One or more drafts to check |
1 2 3 4 5 6 7 | |
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 for existence first, inside content/ or not, before the
ledger is read. If any names no file, the gate prints
gate: no such file: <path> on stderr for each one, prints nothing on
stdout, checks nothing, and exits 2, even when the ledger could not
have been read either.
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 references¶
Append 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 | |
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 |
1 2 | |
๐งพ chitragupta draft evidence¶
Render 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/ |
1 2 3 | |
๐ chitragupta draft dossier¶
The 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 |
| 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 |
--all |
status |
Report every dossier. Mutually exclusive with a draft path |
--json |
status, versions, apply-renames |
Emit JSON, for draft-reviser rather than a terminal (Structured output) |
--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) |
--force |
restore |
Actually write, overwriting what is there |
1 2 3 4 5 6 7 8 9 | |
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).
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).
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.
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 retrieve¶
BM25 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 |
1 2 3 4 5 6 7 | |
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, one that
needs a sync to migrate, or one that cannot be read; 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 render¶
Render 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:
1 2 | |
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 |
1 2 3 4 5 6 | |
--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.
๐ Assembling a book: --fragment and --output-dir¶
1 2 | |
--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 style¶
Report 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.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 |
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.
1 2 | |
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.- The
language:line in the dossier'sscope.md. [style].languageinconfig.toml.
1 | |
With none set, no dialect rules run, and the command measures the draft both ways and proposes one:
1 2 3 | |
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 spec¶
The 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/.
1 2 3 4 5 6 7 | |
| 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 | 1 when unsigned or changed since sign-off |
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.
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).
๐งฑ chitragupta draft unit¶
One 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.
1 2 3 4 | |
| 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.
๐ chitragupta draft registry¶
Terminology, claims and cross-references over a book's accepted
units (WRITE-A-BOOK.md), written under
content/specs/<book>/registries/.
1 2 3 4 | |
| 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. Contradiction between claims
is not detected, only duplication, because a machine can decide
that.
๐ญ chitragupta draft tldr¶
A 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.
1 2 3 | |
| Command | Does | Exit |
|---|---|---|
write <citekey> |
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 |
๐ผ chitragupta draft figures¶
One 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.
1 2 | |
| 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 diff¶
What 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.
1 2 3 | |
| 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 agenda¶
One 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 |
1 2 3 4 5 6 | |
--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, not the worklist.
--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 figure¶
What 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.
๐ It measures; it never places¶
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 |
1 2 3 | |
๐ chitragupta review coverage¶
How 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 |
1 2 3 4 5 6 | |
--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 provenance¶
Reports 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 |
1 2 3 4 | |
--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 support¶
Does 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.
| 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 |
1 2 3 | |
--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 union¶
Does 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 |
1 2 3 | |
--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 synthesis¶
How 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 |
1 2 3 4 | |
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:
1 | |
1 | |
--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 uncited¶
Which 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 |
1 2 3 4 | |
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 quotation¶
Does each quoted span in a draft's dossier 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 |
1 2 3 | |
--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 digest¶
How 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 |
1 2 3 4 | |
--json: the shared envelope plus 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 resolved, persisting, new, the before and
after counts and fractions, and fell; the filed .json is always the
bare report.
๐ chitragupta review verbatim¶
Verbatim 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] |
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...] |
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.
1 2 3 4 5 6 7 8 | |
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 sync¶
Keeps 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.
1 2 3 | |
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) |
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 check¶
Reports 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.
1 2 3 4 | |
| 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 new¶
Starts 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.
1 | |
1 2 3 | |
| 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 |
๐ chitragupta figure look¶
Shows 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.
1 2 3 | |
1 2 3 4 | |
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/ |
| 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 enrich¶
Orchestrates 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 |
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.
1 2 3 4 5 6 | |
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.
๐ Enriching one draft's papers¶
--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:
1 2 3 4 5 6 7 8 9 10 11 12 | |
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.sh¶
One 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, 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 |
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 |
1 2 3 4 5 6 7 8 9 10 | |
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.py¶
Builds 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:
1 | |
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/.
โฐ Running sync on a schedule¶
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:
1 2 | |
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.
๐ฐ cron¶
1 2 3 | |
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.
๐ง systemd (service + timer)¶
1 2 3 4 5 6 7 8 9 10 11 12 | |
1 2 3 4 5 6 7 8 9 10 | |
1 2 3 4 | |
Both assume .venv-full/ is already built
(scripts/install_full_pipeline.sh);
scheduling installs nothing.
โ Environment variables¶
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:
1 2 3 4 5 6 7 8 9 10 11 12 | |