groundwork
v0.4.1Deployment-readiness checks for document-QA and extraction AI: grounding, extraction, CI gate.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
check_answer_grounding Check one answer's grounding
Deterministically check a single answer against the context it should be grounded in: required facts (anchors) present, every number traceable to the context, abstention when the question is unanswerable. Same logic as the CI gate — no model, no network. Returns pass/fail with named issues.
| Parameter | Type | Description |
|---|---|---|
answer * | string | The answer to check |
context * | string | The retrieved passage(s) the answer must be grounded in |
question * | string | The question that was asked |
abstain_markers | array | Phrases that count as a valid refusal (defaults cover common forms) |
allowed_new_numbers | array | Numbers legitimately absent from the context (e.g. computed totals) |
answer_anchors | array | Facts a correct answer MUST contain (with acceptable rephrasings) |
answerable | boolean | false → the context cannot answer this; the only correct behaviour is abstention |
check_extraction Check one extracted record
Deterministically check a structured extraction against its hand-labelled gold record: schema validity (nullable fields are the abstention contract), field accuracy with per-field normalisers (dates → ISO, money → minor units) and aliases, and fabrication — a non-null value in a field whose gold is null (a guessed date of birth the document never stated). Same logic as the CI gate — no model, no network. Returns pass/fail with named issues and a per-field verdict.
| Parameter | Type | Description |
|---|---|---|
gold * | object | The hand-labelled gold record; null means THE DOCUMENT DOES NOT STATE IT — gold's keys define which fields are compared |
record * | object | The record the system extracted ({ field: value | null }) |
aliases | object | Per-field acceptable alternative gold values (matched after normalisation) |
normalize | object | Per-field normaliser applied to both sides before comparing |
schema | object | The JSON Schema the record must validate against (type a must-find field non-nullable, a may-be-absent field nullable) |
check_readiness Run the readiness gate on a repo
Run `groundwork check` in a repo that has a scaffolded harness: redaction self-test, then the archetype's eval (grounding for document-qa, extraction for extraction) against the repo's own gold set. Returns the exit code, the main scorer's metrics, and any named failures — exactly what CI would report.
| Parameter | Type | Description |
|---|---|---|
dir * | string | Absolute path to the repo root (the directory containing groundwork/) |
baseline | boolean | Freeze this run as the regression floor |
ci | boolean | Also compare against the committed baseline and fail on regression |
scaffold_harness Scaffold the readiness harness into a repo
Run `groundwork init [archetype]` in a repo: writes the adapter boundary, redaction config, gold-set templates, GitHub Action, and playbook for a deployment pattern — document-qa (documents → grounded answers) or extraction (documents → structured fields). Never overwrites existing files. After scaffolding, the human wires groundwork/adapter.mjs and replaces the example gold cases with real ones.
| Parameter | Type | Description |
|---|---|---|
dir * | string | Absolute path to the repo root to scaffold into |
archetype | string | Deployment pattern to scaffold (default: document-qa) |
cost_summary Summarise measured token costs
Run `groundwork cost` in a repo: measured token usage from eval runs, with savings recommendations in leverage order (prompt caching, batching, context trimming, model routing last).
| Parameter | Type | Description |
|---|---|---|
dir * | string | Absolute path to the repo root |