Groundwork
Groundwork's MCP server provides deterministic, offline deployment-readiness checks for AI systems.
Check a single answer's grounding against context (anchors, number traceability, abstention).
Check a single extracted record against gold (schema validity, field accuracy, fabrication detection).
Run the readiness gate on a repo (redaction self-test + archetype eval, return CI-like results).
Scaffold a readiness harness into a repo for document-qa or extraction archetypes.
Summarise measured token costs with savings recommendations in leverage order.
Groundwork
Deployment-readiness harnesses for AI deployment patterns.
Redaction · evals from your real failures · a CI gate that fails fabrication
Website · Getting started · Examples · Roadmap · Contributing · Changelog
You have a prototype: your documents, a model, useful output. What you don't have is the apparatus that makes it responsible to ship — a privacy pre-step, an evaluation built from your own failures, and a gate that stops a quiet prompt tweak from deploying a system that fabricates. That apparatus usually requires an ML engineer. Groundwork scaffolds it instead.
Groundwork's units are deployment patterns, not products — think Terraform modules for trustworthy AI deployments. groundwork init <archetype> scaffolds the whole harness for a pattern:
Archetype | The pattern | Status |
| documents → retrieval → grounded answers → human review | ✅ shipped |
| documents → structured fields → schema validation → human review | ✅ shipped |
research synthesis | questions → evidence → synthesis → human review | planned — see the roadmap |
Every check is deterministic: same inputs, same result, every time — no LLM judge, and no API key for the checks themselves.
Quick start — 60 seconds, no API key
git clone https://github.com/nickjlamb/groundwork.git && cd groundwork
npm install && npm run build
npm run demo # document QA: the whole loop passes, fully offline
npm run demo:break # the system starts fabricating — watch the gate go red✗ GROUNDING demo-savings: ungrounded number "14" — not in the provided context
✗ GROUNDING demo-unanswerable-appeals: unanswerable question — the answer did not abstainThe same loop for structured extraction:
npm run demo:extraction # documents → fields, every check green
npm run demo:extraction:break # a guessed date of birth, a dropped field — red, by name✗ EXTRACTION demo-referral: SCHEMA: /referral_date must be string
✗ EXTRACTION demo-referral: FABRICATED field "date_of_birth": document does not state it (got "12 April 1988")That red build is the product: a fabricated figure, a guessed field, or a failed abstention becomes a CI failure, not a user complaint.
Ready for your own system?
npm install -D @pharmatools/groundwork
npx groundwork init # document QA
npx groundwork init extraction # structured extractionRelated MCP server: PubCrawl
How it works
You edit | Groundwork runs | The gate enforces |
| Redaction pre-step (Redacta) — identifiers become labelled tokens locally, before anything is sent |
|
| The archetype's eval (OpenGATE) — document QA: anchored facts · numbers trace to context · abstention. Extraction: schema validity · field accuracy vs gold · no fabricated fields |
|
| Cost profiling — measured token usage, savings in leverage order (caching → batching → trimming → routing) | A human still reviews high-stakes outputs — the gate is a floor, not a certification |
For extraction, one schema choice does most of the safety work: nullability is the abstention contract. A field the system must always find is non-nullable; a field the document may not state is nullable, and the system returns null for it — unknown → null, never guessed. A guessed value in a null-gold field fails by name: FABRICATED field "date_of_birth": document does not state it.
Examples
Example | What it shows | Run |
Document QA: the full loop on a tiny local system — and the gate catching fabrication by name. Zero network. |
| |
Structured extraction: schema validation, field accuracy, and the gate naming a guessed date of birth and a dropped required field. Zero network. |
| |
A real Claude-backed system: answer-from-document-only prompting, prompt caching, key-gated evals, measured usage feeding |
| |
Claude filling a schema from fictional referral letters: unknown → null in the prompt contract, the schema as the cached prefix, and the gate catching a guessed date of birth — plus a mock API for offline CI. |
|
Commands
groundwork init [archetype] scaffold the harness for a pattern (document-qa, extraction)
groundwork check redaction self-test + the archetype's eval
groundwork check --baseline freeze this run as the regression floor
groundwork check --ci exit non-zero on failure or regression vs baseline
groundwork cost measured token usage + savings, in leverage orderTwo ways to learn it: docs/GETTING-STARTED.md is the reference walkthrough (about half an hour), and the course covers the same ground as checkpoint-driven lessons — including the sabotage test, where you deliberately break your own system to prove the gate catches it, and a lesson on the extraction archetype. The scaffolded playbook (GROUNDWORK.md) lives inside your repo, where your team will actually read it.
Use from Claude
The same checks ship as an MCP server (groundwork-mcp, stdio) so Claude Code, Cowork, or Claude Desktop can run them conversationally — check_readiness on a repo, check_answer_grounding on a single answer, check_extraction on a single record (no repo needed), scaffold_harness, cost_summary:
{ "mcpServers": { "groundwork": { "command": "npx", "args": ["-y", "@pharmatools/groundwork", "mcp"] } } }There's also an Agent Skill (skills/groundwork-readiness/) that teaches an agent to run the gate and report results honestly — including refusing to present a green check as a safety certification.
What Groundwork is not
Groundwork is a strong floor, not a guarantee. Deterministic checks catch the failures that can be caught deterministically; they cannot certify an AI system safe. For high-stakes outputs — anything touching health, money, legal standing, or safety — a human must review before the output reaches the person it affects. Extraction raises the stakes quietly: the record feeds decisions, so a wrong field is a wrong decision. The scaffolded playbook says this too, on purpose.
Project
Status — two archetypes shipped (document QA, structured extraction) of a planned three. Depth before breadth: each pattern gets finished properly before the next starts. See the roadmap.
Contributing — bug reports, gold-case patterns, and examples are especially welcome: CONTRIBUTING.md.
Releases — tagged on GitHub, versions on npm, history in CHANGELOG.md.
Built on — OpenGATE (evaluation) and Redacta (privacy), both open source.
Licence
MIT. Everything init scaffolds into your repo is MIT-0 — yours, no attribution needed.
Available Tools
5 toolscheck_answer_groundingCheck one answer's groundingA
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.
Inputs: answer (required), context (required), question (required), answerable, +3 more.
check_extractionCheck one extracted recordA
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.
Inputs: gold (required), record (required), schema, aliases, +1 more.
check_readinessRun the readiness gate on a repoA
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.
Inputs: dir (required), ci, baseline.
cost_summarySummarise measured token costsA
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).
Inputs: dir (required).
scaffold_harnessScaffold the readiness harness into a repoA
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.
Inputs: dir (required), archetype.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a unique role: scaffolding, deterministic per-example checks, full CI-readiness evaluation, and cost reporting. The two check tools are cleanly separated by archetype (answer grounding vs extraction), and check_readiness is a higher-level composite rather than a duplicate.
Four tools follow a clear verb_noun snake_case pattern (check_*, scaffold_*), but cost_summary breaks the pattern by being noun_noun. The naming is still readable and predictable overall, with no mixed casing or chaotic style.
Five tools is a well-scoped set for the Groundwork CLI: scaffold, validate readiness, run archetype-specific checks, and analyze cost. Each tool earns its place with no redundancy or bloat.
The tool surface covers the full core workflow: scaffold_harness sets up a project, check_readiness runs the CI-equivalent eval, check_answer_grounding and check_extraction handle both supported archetypes, and cost_summary closes the loop on optimization. There are no obvious dead ends or missing lifecycle steps.
Maintenance
Related MCP Connectors
Enterprise AI Control Plane: governance, guardrails, spend tracking, compliance & smart routing.
AI routing, memory, guardrails, and governance. Routes across Claude, GPT, Gemini.
Hosted document tools for agents: extract, parse, classify, convert, OCR, sign, and redact.
Extract PDFs to Markdown, RAG chunks and cited tables; publish tracked Doc Links with read stats.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceCreates deterministic, auditable vector databases from any content source with deployable RAG applications. Supports multiple embedding providers and vector databases with fine-grained pipeline control or project-based workflows.7-
- AlicenseAqualityBmaintenancePubCrawl provides LLMs with access to PubMed, FDA/UK drug labeling, and ClinicalTrials.gov. It enables searching literature, retrieving abstracts and full texts, comparing US and UK drug labels, and exploring clinical trials.15716 npm15MIT
- AlicenseAqualityDmaintenanceVerifiable document intelligence for AI agents. Extract text, tables, and structured data from PDFs and URLs. Summarize, answer questions, check claims, and translate — all with cited evidence. Store tamper-evident evidence bundles with cryptographic signatures and on-chain attestation via Base L2. Cross-document semantic search and Q&A across named collections. Pay per call with USDC2212 npm1MIT
- FlicenseNot gradedqualityDmaintenanceEnables document Q&A and knowledge retrieval through hybrid semantic and keyword search, with tools for document ingestion, chunking, summarization, PII redaction, and RAGAS-based evaluation.-