Skip to content

cli reference

github-actions[bot] edited this page Oct 19, 2026 · 29 revisions

This page is generated from docs/cli-reference.md in the repository -- docs/ is the canonical documentation. Direct wiki edits here are overwritten on the next publish; make changes in docs/ by pull request.

CLI reference

The sections "Calibrate", "Orchestrator" and "Export" were moved from CLAUDE.md (unchanged apart from the fixes in the move ledger); the rest of the page is written for readers.

Usage reference for every script in scripts/ that has a command line: what it does, its flags, what it prints, how it exits and whether it needs ANTHROPIC_API_KEY. The slash commands are described in the command reference; how the scripts fit together in the workflows and the architecture. python scripts/<name>.py --help is authoritative for flags.

The scripts at a glance

Script Does Needs ANTHROPIC_API_KEY Detail
calibrate.py Derives a style guide and a template from your sample PDFs Yes, unless --mock (automatic without a key) Calibrate
orchestrator.py The whole deal pipeline in one process: draft, audit, checks, export Yes Orchestrator
deal_export.py Exports a drafted CAM to .docx and .xlsx No Export
research_export.py Exports a research brief to .docx No Research export
spreading_check.py Computes subtotals, ratios and the downside case; checkpoints them No Spreading check
supplied_forecast.py Records analyst-supplied forward-year figures for /project as given, with an explicit downside treatment No Supplied forecast
transcription_check.py Reads back figures transcribed from an image, cross-foots them, and records them only after a confirmed digest No Transcription check
policy_check.py Computes policy_state; audits a draft No Policy check
state_manager.py Finds an existing deal read-only, checks completed steps, and exports derived Reviewer-view files No State manager
check_model_freshness.py Reports newer, deprecated and unknown model IDs using the installed SDK's metadata tables No Model freshness check
source_manifest.py Saves a source document; checks sources were saved No Source manifest
conventions.py Reads and writes persisted spreading conventions No Conventions
pii_scan.py Scans a template for likely-real data No PII scan
check_coverage.py, check_test_count.py, mutation_report.py Test and CI tooling No Test tooling
wiki_publish.py Generates the GitHub Wiki page tree from docs/, and publishes it to the wiki with --publish No Wiki publish
run_evals.py The local live-model evaluation harness Only for --live Evaluation harness

Only the first, second and last scripts can reach the Anthropic API; every other script is deterministic and makes no network call -- the one exception is wiki_publish.py's --publish mode, whose git clone and push over HTTPS are the wiki publish -- and is what the slash commands run in their Bash steps.

Conventions common to the scripts

  • Run from the repository root. Paths such as deals/, config/, templates/ and agents/ are relative to the working directory.
  • A deal is named by --company and --proposal. Together they select deals/<Company>/<Proposal>_<Date>/; the dated folder is found automatically (the most recent one), so a deal resumed on another day finds its own state.
  • Output. Scripts that return data print JSON to standard output; export scripts print one Done! line with the path. Progress and warnings go to standard error.
  • Exit status. 0 on success. 1 for a failure the script reports itself, including an unusable state.json (printed as one error: ... line, never a traceback; see Troubleshooting). 2 for a command-line usage error (an unknown flag or a missing required one). A few checks have their own rules, noted per script; --check-steps and --check-sources exit 0 whatever their result, because the calling command decides what a missing step or source means.
  • Text. Everything is read and written as UTF-8 and the output streams are made UTF-8 even when redirected, so a non-ASCII name survives a pipe on Windows.
  • --help is authoritative. The flags below are checked against it by the test suite.

Calibrate

scripts/calibrate.py --type <deal_type> (headless; needs ANTHROPIC_API_KEY) — reads historical CAM PDFs from inputs/calibration_samples/ (in sorted filename order) and makes two Claude calls against that text (more when the samples overflow one call's limit -- see "Sample length" below): one extracts writing style/tone into config/style_guide.md; the other derives a genericized CAM template (explicitly instructed to strip all real data to [placeholder]s) written to templates/local/cam/<deal_type>_cam.md. <deal_type> defaults to corporate_credit and should match the value later passed to orchestrator.py --type.

Each PDF is checked for extractable non-whitespace text. A PDF with none (often an image-only scan) is named in a warning and skipped; if no sample PDF contains extractable text, calibration exits with an error before any model call or output write. Use /calibrate, which reads PDFs natively, or OCR the scans first.

python scripts/calibrate.py --type asset_finance

--mock: skips both Anthropic calls and writes deterministic placeholder output instead (clearly labeled (MOCK) in the file content) -- for smoke-testing the PDF-reading and file-writing plumbing without an API key or network access. It never fabricates anything domain-specific (no invented PD/LGD/rating figures -- that would contradict the grounding rule and isn't this script's job in the first place); it only proves the pipeline runs end to end. Triggers automatically, with a printed notice, whenever ANTHROPIC_API_KEY isn't set:

python scripts/calibrate.py --mock --type asset_finance

Sample length (issue #109): each Claude call takes at most CHUNK_CHAR_LIMIT (12,000) characters of sample text, and the combined text of every PDF in inputs/calibration_samples/ routinely exceeds that. The length check is the run's first decision point -- after the PDFs are read (local only) but before any API call or file write -- and offers two choices: ignore (use only the first 12,000 characters, discarding the rest, now stated explicitly) or split (split the text in memory at paragraph/line boundaries into parts, run the style/template prompt on each, then merge the per-part results with one consolidation call, hierarchically if there are very many parts; the merge prompts restate the "zero real data, bracketed placeholders" and editorial-judgment rules). --on-overflow {ask,split,ignore} (default ask) pre-answers it; ask prompts on a terminal and falls back to split when there's no TTY, since silently losing material is the failure this exists to prevent and splitting only costs extra API calls. --mock makes no calls, so it only reports how many parts a real run would use (it ignores --on-overflow). Whitespace-only parts (e.g. a lone trailing newline) are dropped before counting or calling, and if only one non-blank part remains nothing is lost, so there's no prompt. The original sample PDFs are only ever read, never written or split on disk. Both result files are computed in memory first, with no API call between the two writes at the end, so an API failure partway through a long split run leaves any existing config/style_guide.md/template untouched. A response cut off at its output-token limit prints a [WARN] rather than flowing on silently. /calibrate has no such cap (native PDF reading) and is unaffected.

Orchestrator

scripts/orchestrator.py (headless; needs ANTHROPIC_API_KEY) — the main pipeline. For a given --company, --proposal, --pd, --lgd and --type, it: loads the Maker/Checker prompts and style guide, resolves the CAM template for --type via template_resolver.cam_template_path and includes it in the drafting prompt if one exists, runs the Underwriter draft and then the Risk Reviewer audit, checkpointing to state.json via state_manager.write_state after each of those two agent calls (see the state management protocol in CLAUDE.md), then calls deal_export.export_deal (see below) to do the folder-creation/template-auto-save/export work:

python scripts/orchestrator.py --company "Acme Corp" --proposal "Fleet Loan" --type "asset_finance"

Orchestrator flags and defaults

scripts/orchestrator.py --company <name> --proposal <name> [--pd <PD>] [--lgd <LGD>] [--type <deal_type>] [--financials <json>] [--spread <json>] [--collateral <json>] [--stress-assumptions <json>] [--new-review]

  • --company and --proposal are required and name the deal. A read-only state_manager.py --find lookup is used at the single state-resolution point. When no exact record exists but a normalized near match is present, the orchestrator prints one warning line to standard error naming the candidate proposal/date, then continues with today's behavior; it does not refuse the run or select the candidate. No warning is printed when no normalized candidate exists. If the company folder cannot be listed (for example a permission error), the advisory is skipped and the run continues exactly as it did before the lookup existed. See State manager.

  • --pd (default 0.20%) and --lgd (default LGD 3 (15%)) are user-supplied risk inputs and are used exactly as given. The defaults are example values: if you omit the flags they flow into the CAM as if you had supplied them, so always pass your own.

  • --type selects the template and defaults to corporate_credit.

  • A model reply that ends at its output-token limit (stop_reason max_tokens: 4000 for the Maker draft and revision, 2000 for the Checker audit) stops the run with one error: line and exit status 1. The partial text is not parsed, saved, audited, recorded as a verdict or exported, and nothing from that call is checkpointed; see Troubleshooting.

  • --financials is a JSON file of raw line items per period (FY-2, FY-1, FY-Current, FY+1, FY+2, FY+3, any subset); --spread has the same shape and takes precedence if both are given. Forward years are management's own forecast, never derived by the tool. Periods are merged into the deal's recorded multi_period_financials rather than replacing the whole history. Within a period, supplied fields update the recorded fields and any omitted fields remain; computed financials and ratios for touched periods are recomputed and merged with the other recorded periods. This matches the interactive spreading_check.py behavior, so a forward-only file does not erase FY-1/FY-Current. Each period value must be an object of raw line items; a string, number, null, list or other non-object period is refused with one error: line naming the period. For recognised raw line-item fields, each non-null value must be a finite JSON number: numeric strings are not coerced and booleans are not numbers. Invalid values (including JSON overflow values such as 1e999) are refused with one error: line naming the period and field, exit status 1, before a model call or state write. Null raw line-item values retain the evaluator's existing behavior and are not rejected; missing fields keep their existing behavior too. Each supplied stress value must also be a finite JSON number; strings, booleans, null, lists and objects are refused with a key-naming error: line before a model call or state write. Analyst-supplied history safeguard: a run on an analyst-supplied deal that supplies any historical period (FY-2, FY-1, FY-Current) is refused with one error: line and exit status 1, before a model call, with nothing written and financials_source unchanged; record historical figures with /spread's analyst-supplied mode. Forward-year-only input is refused the same way: financials_source is a deal-level flag, and a headless run never recomputes or relabels an analyst-supplied deal, whether or not raw line items exist for its preserved periods (one error: line, exit status 1, nothing written, financials_source unchanged). Record changes to supplied figures with /spread's analyst-supplied mode; an interactive, forward-only /project call is the one allowed way to add framework-computed forward years to such a deal (data model).

  • --collateral is a JSON file holding a flat list of asset objects.

  • --stress-assumptions (for a deal whose forecast is analyst-supplied: it must equal what is recorded, or the run is refused with one error: line before anything is written) is a JSON file of the downside shocks (revenue_haircut_pct, opex_increase_pct, interest_rate_bump_bps), applied to the forward years only and ignored if there are none. Each supplied value must be a finite JSON number; strings, booleans, nulls, lists and objects are refused with one key-naming error: line.

  • --new-review starts a fresh dated folder for a new annual review instead of resuming the most recent one, so it never inherits last year's inputs.

It needs ANTHROPIC_API_KEY (or other credentials the SDK accepts); without any it stops first, before it reads or writes the deal, with one error: no Anthropic credentials were found... line and exit status 1, and sends nothing. See Troubleshooting.

Export

scripts/deal_export.py — no anthropic dependency, so it's callable two ways: imported directly by orchestrator.py (export_deal(...)), or run standalone as python scripts/deal_export.py --company ... --proposal ... --type ... --draft <path> from /assemble's Bash step, since Claude has already produced the draft itself by that point and just needs it turned into deal output files. export_deal() creates the dated deals/[Company]/[Proposal]_[Date]/ folder, auto-saves the draft as a new templates/local/cam/<type>_cam.md if that deal type had no template at all yet (never into the git-tracked templates/cam/ -- see the confidentiality rule in CLAUDE.md), and exports .docx/.xlsx. Which dated folder and state: an explicit date_str selects both the output folder and the state.json read for the workbook, so an older review cannot be populated from a newer review's figures. orchestrator.py passes the date_str it resolved at the start of its run; the CLI takes an optional --date-str. Without it, state_manager.resolve_export_date_str() prefers the latest state-bearing folder, then reuses the latest date-shaped output folder if no state exists yet, else uses today. State auto-resume remains separate: state_manager.resolve_date_str() selects only the latest folder containing state.json, so an explicit export-only folder cannot hijack later state reads. A present malformed state.json remains selected so its existing corruption error is surfaced. Only a folder named exactly <proposal>_<YYYY-MM-DD> counts, so proposal Fleet never claims another deal's Fleet_Q2_2026-05-01, and --date-str must be a real calendar date in YYYY-MM-DD format, so an impossible date such as 2026-02-31 is rejected with one error: line and exit status 1. An explicit date that names a dated folder with no state.json is an error (one error: line, exit status 1, nothing written) when the deal has state in another dated folder; a deal with no state anywhere still exports into the named folder. A bare library call that omits date_str retains its existing state auto-discovery, while its output folder still defaults to today. Without this a deal finished days after it started exported into a new folder, disconnected from its own state.json/sources//draft_v*.md (issue #97) -- /assemble no longer needs a prose patch to re-home state.json.

Research export

scripts/research_export.py --company ... --proposal ... --brief <path> validates the brief before resolving its dated output path or creating a folder. It requires an ATX heading named Sources or References (case-insensitive, any level, not inside a fenced code block) whose section contains a list item or an http:///https:// URL. The section ends at the next heading of the same or a higher level. A missing or empty section exits with one error: line and status 1; nothing is written.

An analyst may explicitly authorise an export without sources. Only then pass --analyst-override-no-sources "<reason>"; the reason must contain non-whitespace text. The brief's .docx gets a final paragraph such as Footnote: No sources list is included in this brief. Exported under analyst override on 2026-10-14: analyst-authorised reason. The reason is not persisted in state.json. The slash command must never offer or infer this override. If the brief already has a populated source section, the flag adds no footnote.

An explicitly authorised release of a brief the Reviewer did not approve uses --analyst-release-unapproved "<reason>". The non-empty reason is collapsed to one line. The flag is refused, with one error: line, exit status 1 and nothing written, when the saved review_trail has no trailing REJECTED entry (no review yet, or the latest verdict is not REJECTED). The exporter counts consecutive trailing REJECTED entries in the saved review_trail, inserts a Review status: Not approved by the independent Risk Reviewer... paragraph immediately after the first document heading, and, after writing the DOCX, appends one {date, passes, reason} record to the review_stopped_by_analyst list in state.json. The list is append-only: no release clears or overwrites an earlier record, a later approved export leaves it untouched, and review_verdict keeps carrying the current verdict. A review_stopped_by_analyst that is already present but is not a list is refused with one error: line before anything is written. This is not an automatic fallback: the slash-command session may pass the flag only after the analyst explicitly chooses the disclosed manual-review option. When both release flags are used, the review status remains near the top and the missing-sources footnote remains last.

scripts/research_export.py --company ... --proposal ... --brief <path> exports a drafted research brief (Markdown) to <Company>_<Proposal>_Research_Brief.docx in the deal's dated folder, reusing the folder that exists or creating one. It is deliberately separate from deal_export.py, so a research-only deal never triggers a CAM's side effects (no workbook, no template auto-save). It has no Anthropic dependency.

python scripts/research_export.py --company "Synthetic Co" --proposal "Synthetic Fleet Loan" \
    --brief "deals/Synthetic Co/Synthetic Fleet Loan_brief.md"
Done! Research brief exported to deals/Synthetic Co/Synthetic Fleet Loan_2026-10-04/Synthetic Co_Synthetic Fleet Loan_Research_Brief.docx

scripts/research_export.py --company ... --proposal ... --brief <path> validates the brief before resolving its dated output path or creating a folder. It requires an ATX heading named Sources or References (case-insensitive, any level, not inside a fenced code block) whose section contains a list item or an http:///https:// URL. The section ends at the next heading of the same or a higher level. A missing or empty section exits with one error: line and status 1; nothing is written.

An analyst may explicitly authorise an export without sources. Only then pass --analyst-override-no-sources "<reason>"; the reason must contain non-whitespace text. The brief's .docx gets a final paragraph such as Footnote: No sources list is included in this brief. Exported under analyst override on 2026-10-14: analyst-authorised reason. The reason is not persisted in state.json. The slash command must never offer or infer this override. If the brief already has a populated source section, the flag adds no footnote.

Spreading check

scripts/spreading_check.py --company ... --proposal ... [--financials <json>] [--stress-assumptions <json>] [--no-update-financials-source] recomputes financials and ratios from raw line items, derives the downside case when stress assumptions and at least one forward year exist, checkpoints everything to state.json and prints the updated state (financials, ratios, downside_case, financials_source). It merges what it is given into what the deal already has, two levels deep: a correction to one period's revenue keeps that period's other fields, and re-confirming one stress shock keeps the others. Give --financials for new periods and omit it to recompute from what is already on file. --no-update-financials-source stops the call stamping framework-computed; /project always passes it. Each supplied period must be an object of line items; a string, scalar, null or list period is refused with one error: line naming the period, exit status 1, and no state write. For recognised raw line-item fields, non-null values must be finite JSON numbers; numeric strings and booleans are refused rather than coerced. Each stress value must also be a finite JSON number (not a string, boolean, null, list or object). Invalid input produces one key/period-naming error: line and leaves state.json byte-identical. A null raw line-item value retains the evaluator's existing behavior; omitted fields are also unchanged. The same rules apply to the orchestrator's --financials and --spread inputs. The slash commands /spread and /project run it; see Workflows.

python scripts/spreading_check.py --company "Synthetic Co" --proposal "Synthetic Fleet Loan" \
    --financials "deals/Synthetic Co/Synthetic Fleet Loan_financials_input.json"

Supplied forecast

scripts/supplied_forecast.py --company ... --proposal ... --forecast <json> [--stress-assumptions <json>] --note <text> is /project's analyst-supplied mode (issue #124). --forecast holds {"forecast": {"FY+1": {"subtotals": {...}, "ratios": {...}, "lines": {...}}}, "downside": {"description": "...", "periods": {"FY+1": {"subtotals": {...}, "ratios": {...}}}}}: numbers as the analyst gave them, a ratio that is N/A as null, lines (the /spread raw field names) and downside optional. It validates strictly (unknown names, non-numbers, any forecast/downside period whose value is not an object of line items, a year with only raw lines, a stressed forecast without a description, and stress values that are not finite JSON numbers), checks the deal (the state is readable and writable by this checkout, the basis is compatible: no framework-computed forward years, no framework-computed or unknown-basis history), and then writes financials, ratios, the optional analyst_supplied_financials, forecast_source, financials_source, the note and the downside treatment in one state update, printing a summary of which forward years are analyst-supplied and which downside years are framework-derived or unavailable. Any refusal is one error: line, exit status 1, and nothing is written. A state that cannot be read or written (a lock that cannot be taken, a full disk) and a malformed shock already stored in stress_assumptions are also one error: line. When the file is shown to be as it was, it says so and that nothing was recorded; when a failure came after the file may have been replaced (for example the lock file could not be removed), or the file cannot be read back, it says the update did not complete cleanly and to inspect state.json before retrying. --note is required; it is added to financials_source_note. It never uses the framework's formulas to produce a recorded value; the formulas are used only to test whether the stress shocks may be applied, which needs every line the covenant ratios read. The rules are in the financial model.

python scripts/supplied_forecast.py --company "Synthetic Co" --proposal "Synthetic Budget Loan" \
    --forecast docs/examples/synthetic_co/forecast_supplied.json \
    --stress-assumptions docs/examples/synthetic_co/forecast_stress.json \
    --note "Management budget; depreciation is within cost of sales"

Transcription check

scripts/transcription_check.py --transcription <json> [--json] reads back figures that /spread transcribed from an image (a screenshot, a photo, a scanned page) and writes nothing: no deal is read or changed. It prints the image's SHA-256 fingerprint; the sign conventions in words; the figures grouped by period and statement, each as written beside the value that would be recorded and how one was read as the other; every figure that will be recorded as negative; a cross-foot of every subtotal the source states against the sum of the recorded lines that feed it; and a digest of exactly what it showed (including the declarations and the image's bytes). --json prints the same as {digest, source_sha256, report, text}.

scripts/transcription_check.py --transcription <json> --commit --confirm <digest> --company ... --proposal ... [--source-note <text>] records the transcription, but only if --confirm is the digest of these figures and this image as they are now, no cross-foot discrepancy is unresolved, the deal's existing financials_source is the same mode and the deal's state can be written by this checkout (readable, correctly shaped, not a newer schema version, a readable sources/manifest.json, and in framework-computed mode a computation that succeeds against what is stored); otherwise it exits 1 with one error: refused: ... line and writes nothing (no source copied, no state changed). On success it saves the image as the source of record after checking it against the confirmed fingerprint (the manifest claim says the figures were transcribed from an image and carries the digest and a fingerprint prefix), then, in one state update, records the figures, appends spread to steps_completed and appends a record to financials_transcriptions (holding the fingerprint, never the image). The image is saved before that update and the two cannot be committed atomically: if the update fails, the verified image and its manifest entry remain with no figures recorded. In framework-computed mode it recomputes exactly as spreading_check.py does; in analyst-supplied mode it records subtotals, ratios and any lines exactly as given and needs --source-note, the confirmed convention, to which it appends a sentence saying the figures were transcribed from an image (stored as financials_source_note, which the CAM caveat quotes). What it enforces and what it cannot is in Figures read from an image and AI assurance.

The staged file holds every figure as text exactly as it appears, plus the unit and how the source writes the signs of costs, cash outflows and liabilities; a worked example is in Workflows.

python scripts/transcription_check.py --transcription "deals/Synthetic Co/Synthetic Fleet Loan_transcription.json"

Policy check

scripts/policy_check.py --company ... --proposal ... [--draft <path>] prints JSON: policy_state (required conditions precedent and subsequent, covenant results, security gaps, downside breaches, forward covenant results), reasons (every reason the draft is code-enforced rejected, empty without --draft unless the recorded structure itself forces one), compliant, and cam_data_present (false for a deal with no financials, ratios, covenants or security recorded, i.e. nothing was actually checked, as for a research-only deal). With --draft it audits that file's trailing structured JSON block. It exits 0 whether or not reasons is empty (an unusable state.json is the exception: one error: line, exit 1); the caller decides what a non-empty reasons means.

python scripts/policy_check.py --company "Synthetic Co" --proposal "Synthetic Fleet Loan" \
    --draft "deals/Synthetic Co/Synthetic Fleet Loan_draft.md"

State manager

scripts/state_manager.py has three mutually exclusive modes:

  • --find --company ... --proposal ... is a read-only lookup. It prints one JSON object. An exact existing record yields {"record_found": true, "state_path": "...", "date": "YYYY-MM-DD"}, using the newest valid dated folder with a state.json. A present but corrupt state.json still counts as a record; reading it through the normal mode continues to raise the established corruption error. If no exact record exists, the object has record_found: false, company_folder_exists, and near_misses. Candidates are valid dated folders that contain state.json; each lists the proposal, date and path. Suggestions match only after case-folding and collapsing runs of whitespace/hyphens. This is exact equality after normalization: no fuzzy/prefix match is used, and no candidate is selected. A missing company folder is reported distinctly with an empty candidate list. The mode creates no files or directories. If the company folder cannot be listed, the mode prints one error: line and exits 1.
  • --check-steps --company ... --proposal ... --required <step,step> checks every named step against steps_completed and prints {"missing_steps": [...], "ok": true|false}. A valid result always exits 0; an unreadable or malformed state is one error: line and exit 1. Its JSON output is unchanged.
  • --export-reviewer-view --company ... --proposal ... validates the saved state and writes review_view/state_for_review.json (the record without review_trail or review_verdict) and review_view/review_trail.json (the history list, or [] when absent) into the deal's dated folder. A successful run overwrites both derived files and prints one JSON object with their paths. Invalid state, or a newer or malformed schema version, produces one error: line, exit 1, and writes nothing.

The two review-view files are derived copies for the interactive Reviewer, not records of the deal; no other script may read them as a record. The source of truth remains the real state.json, which /review updates in its State: write stage. See the data model.

python scripts/state_manager.py --find --company "Synthetic Co" --proposal "Synthetic Fleet Loan"
python scripts/state_manager.py --check-steps --company "Synthetic Co" --proposal "Synthetic Fleet Loan" --required spread,collateral
python scripts/state_manager.py --export-reviewer-view --company "Synthetic Co" --proposal "Synthetic Fleet Loan"

Source manifest

scripts/source_manifest.py --company ... --proposal ... --step <step> --claim <text> --file <path> [--url <url>] [--filename <name>] copies an already-downloaded document into the deal's sources/ folder and appends an entry (filename, url, step, claim, fetched_date) to sources/manifest.json; it never fetches anything. With --check-sources instead prints {"missing_saved_sources": true|false, "sources_declared": "declared"|"not_declared"|"unknown"}. The existing missing_saved_sources key remains boolean: true when declared, non-empty citations have no saved material, or when the consumed completion/declaration shape is unknown. steps_completed, when present, must be a list of strings; absence remains valid for new/incomplete historical states. sources_declared is "unknown" for malformed consumed completion metadata, any invalid declaration, or a completed source-bearing step without a list[str] declaration. Nulls, mappings, scalars and lists containing non-strings are invalid; a nonempty manifest cannot conceal them. It is "declared" when at least one valid triage.sources or commercial.sources list exists and the completed relevant steps have valid lists; explicit [] declares no citations. Otherwise it is "not_declared". A calling command must stop and request a corrected state shape on "unknown" rather than treating it as proof that no citations were used. The command exits 0 for any check result. A sources/manifest.json that cannot be used (unreadable, a link whose target does not exist, not UTF-8, not JSON, not a list, or a list with an entry that is not an object), and a company or proposal that is not a safe folder name, are errors: each is one error: line, exit status 1, no traceback and no JSON on stdout, and the file is never modified. Saving checks the manifest before copying anything, so a refusal leaves no copied document behind.

python scripts/source_manifest.py --company "Synthetic Co" --proposal "Synthetic Fleet Loan" --step research \
    --claim "Synthetic legal identity extract" --file registry_extract.txt --url https://example.invalid/registry
python scripts/source_manifest.py --check-sources --company "Synthetic Co" --proposal "Synthetic Fleet Loan"

Conventions

scripts/conventions.py (--company <name> | --enterprise) (--read | --write) [--financials-source <value>] [--note <text>] [--confirmed-date <date>] [--proposal <name>] reads or writes a persisted, analyst-confirmed spreading convention: borrower-specific (--company, stored at deals/<Company>/_conventions.json) or enterprise-wide (--enterprise, config/spreading_conventions.json). --write requires --financials-source; it overwrites the current fields and appends to a history. --read prints {"found": true|false, "convention": ...}. It is run by /spread only; the headless pipeline never calls it, because nothing may be persisted without a person's explicit confirmation. See the data model.

python scripts/conventions.py --enterprise --read

PII scan

scripts/pii_scan.py <path> scans one template file for likely-real data (currency figures, emails, phone numbers, dates, company names, registration numbers) and prints JSON findings. An empty list means only that nothing obvious was found; it is not a guarantee, and a human review is still required before a local template is promoted into templates/cam/. See Security.

python scripts/pii_scan.py templates/local/cam/asset_finance_cam.md

Test tooling

  • scripts/check_coverage.py <coverage.json> [--config <pyproject.toml>] [--report-only] compares coverage.py's JSON report with the floors in pyproject.toml; exit 0 when met, 1 when not, 2 for an unreadable report or configuration; --report-only prints the table and always exits 0.
  • scripts/check_test_count.py <pytest_output> [--badge-path <path>] [--write] compares pytest's passed count with badges/test-count.json (exit 1 on a mismatch); --write updates the file from a complete green run (never used in CI).
  • scripts/check_model_freshness.py [--json PATH] reports configured-model freshness from local SDK tables; findings never fail the report.
  • scripts/mutation_report.py <results> [--config <pyproject.toml>] [--top <n>] [--json <path>] prints the per-module mutation score from mutmut results --all true; exit 0 whenever a report is produced, 2 for an unreadable file.

Their rules and the reasoning are in Testing.

Model freshness check

python scripts/check_model_freshness.py [--json PATH] prints a Markdown report of model IDs configured in config/settings.json (maker_model, checker_model, and calibrate_model when set) and the string literal _DEFAULT_MODEL in scripts/calibrate.py. The default is read with ast, not by importing calibrate.py. The installed anthropic.types.Model and anthropic.resources.messages.messages.DEPRECATED_MODELS tables supply known IDs and deprecation dates.

The report suggests a newer stable ID only from the same family. Dated variants, -latest and -preview aliases are not used for version comparison. An ID that cannot be parsed or found is marked unknown; a missing or reshaped SDK table is reported as SDK table not found without a guess. With --json PATH, report data is written as JSON (report_version, sdk_version, freshness_note, sdk_tables, models, findings and summary). Exit 0 whenever a report is produced, including when it contains findings; exit 2 for unreadable configuration. It does not read an API key, call the API, or make a model call. It is only as fresh as the installed Anthropic SDK. A model change remains a separate reviewed PR with an evaluation statement; the script never upgrades one automatically. See Model freshness report.

Evaluation harness

scripts/run_evals.py validates the synthetic dataset (--validate, --list), plans and self-checks with zero model calls (--dry-run), and, only with --live and your own ANTHROPIC_API_KEY, runs the cases under a hard call cap (--max-calls, default 80, never above 250; --repeats, --cases, --yes, --keep-work, --out), exporting and comparing baselines (--export-baseline, --allow-partial, --compare). See Evaluation.

python scripts/run_evals.py --dry-run

Wiki publish

python scripts/wiki_publish.py --repo <owner/name> [--root <repo root>] (--out <dir> | --check | --publish --source-sha <sha>) (no ANTHROPIC_API_KEY) generates the GitHub Wiki page tree for the docs/ corpus. --out writes the tree into a directory (which may not be the repository root, docs/, a directory inside docs/ or an ancestor of docs/: the paths are resolved first and such an output is one error: line, exit 1, nothing written, so the source pages can never be overwritten); --check builds and validates in memory and writes nothing; --publish (with --source-sha, the commit it publishes from) clones the repository's wiki, fully replaces its content with the generated set, makes one commit carrying the source sha -- or none, when nothing changed -- and pushes it back to the wiki's default branch. The token is read only from the GITHUB_TOKEN environment variable and reaches git only as an HTTP header: never a URL, a log line, a file or a git process's environment (the variable is removed from every git child's environment). Generation and validation run before anything is cloned or pushed, so a broken corpus publishes nothing; a failed push, an unreachable wiki and a missing token are each one error: line, exit 1. It runs on every push to main that changes docs/ (the wiki-publish workflow; see Operations).

Only the allowlisted pages (docs/*.md, dotfiles excluded, and the example pages under docs/examples/synthetic_co/) are read; linked repository files are checked and rewritten to URLs, never copied. Page names come from the file names (docs/README.md becomes Home, the example pages are flattened with an examples-synthetic_co- prefix); links are rewritten to wiki, blob, tree or raw-blob URLs; every page starts with a generated-source notice saying docs/ is canonical; Home is the docs index and _Sidebar is its reading order. A missing target, a broken anchor, a symlinked page or a target outside the repository is one error: line naming the file and line, exit 1, and nothing is written. Deterministic: the same docs/ tree always gives byte-identical output. See issue #192.

Clone this wiki locally