Litplan turns a research paper into structured document data, a checked and versioned PipelineSpec, optional approval records, and either a reference execution path or workflow files for your own runtime. It is the governed-plan layer, not a replacement for Snakemake, Nextflow, Airflow, or your HPC stack.
- Python 3.11+
- uv
- Docker, only if you want live PDF ingest via GROBID
- An LLM API key, only if you want live goal-driven planning
Run these commands from the repository root:
uv sync
cp .env.example .env
uv run litplan environment
uv run litplan ingest fixtures/tei/structural_minimal.tei.xml \
--parser-route tei_fixture_replay \
--document-irWhat to expect:
uv syncinstalls the package and CLI fromuv.lock.cp .env.example .envgives you a local config file; it defaults toLITPLAN_LLM_PROVIDER=stub, so this path stays offline.uv run litplan environmentprints JSON hints about paths and config resolution.- The offline
ingestcommand should return JSON with"ok": trueand inlineDocumentIRoutput.
| Path | Use it when | Needs | First step |
|---|---|---|---|
| Offline demo | You want a first successful run with no external services | uv |
Run the tei_fixture_replay ingest command above |
| Live PDF ingest | You want to parse a real PDF through GROBID | Docker + GROBID | docker compose -f docker-compose.grobid.yml up -d |
| LLM planning | You want plan-compile to draft a pipeline from a goal |
A real provider in .env plus a matching API key |
Set LITPLAN_LLM_PROVIDER and provider key in .env |
| Workflow export | You want Snakemake, Nextflow, or Airflow files from a stored run | A persisted run in the local DB | Compile with --create-run, then approve, then export-workflow |
This is the fastest self-contained path and works in a fresh checkout after uv sync.
uv run litplan ingest fixtures/tei/structural_minimal.tei.xml \
--parser-route tei_fixture_replay \
--document-irExpected outcome:
- You should get JSON output with
"ok": true. - You should get inline
DocumentIRJSON. - No Docker, database, or API key is required.
Use this when you want approvals, execution, status, or export commands to work against the local SQLite store.
export LITPLAN_HOME="$(pwd)/.litplan-home"
uv run alembic upgrade head
RUN_ID="examples-linear-chain-run-$(date +%s)"
uv run litplan compile fixtures/workflowgen/pipeline_specs/linear_chain.json \
--pipeline-id examples.linear_chain \
--lockfile uv.lock \
--run-id "$RUN_ID" \
--create-runExpected outcome:
- This creates
.litplan-home/and initializes the SQLite schema there. - The compile command should return
"ok": true. - The run and compiled revision are now persisted for later
approve,run-status,execute, and export commands.
If PDF ingest is the feature you care about, this is the shortest working setup.
Start GROBID:
docker compose -f docker-compose.grobid.yml up -d
curl -fsSL http://127.0.0.1:8070/api/isaliveThen set LITPLAN_GROBID_URL=http://127.0.0.1:8070 in .env and run:
uv run litplan ingest \
fixtures/papers/pdf/batatia-2022-mace-force-fields-arxiv-2206.07697v2.pdf \
--document-irExpected outcome:
- The health check should print an
aliveresponse from GROBID. - The ingest command should return
"ok": true. - You should get parsed document metadata and, with
--document-ir, inlineDocumentIRJSON for the PDF.
For this path, change .env from the default stub provider to a real provider and add its key. Example:
LITPLAN_LLM_PROVIDER=gemini
GOOGLE_API_KEY=your-real-keyThen run:
uv run litplan plan-compile "build linear noop pipeline" \
--pipeline-id examples.goal_demo \
--lockfile uv.lock \
--expanded-specExpected outcome:
- The command should return
"ok": truewhen the provider is configured correctly. - You should get a compiled pipeline result and expanded spec JSON.
- Use
compileinstead ofplan-compilewhen you already have fullPipelineSpecJSON and do not want an LLM involved.
Once you have a persisted run, you can approve it and generate engine-native workflow files.
uv run litplan approve "$RUN_ID"
uv run litplan export-workflow "$RUN_ID" snakemake ./tmp/workflow-outExpected outcome:
approverecords a non-pending run status forRUN_ID.export-workflowwrites files under./tmp/workflow-out.- You can switch
snakemaketonextfloworairflow.
| Command | What it does |
|---|---|
litplan ingest |
Parse a PDF or TEI file into DocumentIR; can include inline JSON output |
litplan compile |
Validate and compile a PipelineSpec JSON input |
litplan plan-compile |
Use a goal-driven planner, then run the same compiler |
litplan approve |
Record approval or other status transitions for a run |
litplan execute |
Execute a persisted approved run through the reference Prefect path |
litplan run-status |
Show unified run, planning, and execution status |
litplan export-audit-bundle |
Write a reproducibility-oriented bundle for a run |
litplan export-workflow |
Generate Snakemake, Nextflow, or Airflow files from a stored revision |
litplan environment |
Print non-secret environment and path hints |
Run uv run litplan --help for the full CLI and option details.
- CLI:
uv run litplan - MCP server:
uv run litplan-mcp - Python library:
import litplan - Streamlit UI (optional):
uv run streamlit run src/litplan/ui/plan_draft_app.py
The CLI and MCP server call the same shared JSON tool layer, so they expose the same core operations.
The optional Streamlit app is a browser UI on top of the same SQLite project database. You can edit PlanDraft text and compare it to a prior draft, append approval records, append hallucination flags with chunk provenance, and load unified run status (LangGraph checkpoints, run timeline, execute-phase node checkpoints, OpenTelemetry hints). Ingest, compile, plan-compile, approve, execute, export, and other pipeline steps still run from the CLI or MCP; the UI does not replace those tools.
From the repository root, after uv sync and uv run alembic upgrade head for your chosen LITPLAN_HOME:
export LITPLAN_HOME="$(pwd)/.litplan-home"
uv run streamlit run src/litplan/ui/plan_draft_app.pyFor a full step-by-step (including diff panels, approvals, flags, and run explorer), see Part 3 in MANUAL_CLI_MCP_UI_WORKFLOW.md.
Library-first examples live in examples/:
examples/paper_repro_sketch_tei.py: saved TEI ->DocumentIR-> chunking -> hand-authoredPipelineSpec-> compileexamples/paper_repro_sketch_pdf.py: PDF path -> live GROBID ingest -> the same chunk/plan/compile flow
Run them from the repository root:
uv run python examples/paper_repro_sketch_tei.py
uv run python examples/paper_repro_sketch_pdf.py \
fixtures/papers/pdf/batatia-2022-mace-force-fields-arxiv-2206.07697v2.pdf- The package version is 0.0.1 (see
pyproject.toml); pre-1.0 semver releases may still evolve public APIs. - Offline and stub-backed flows remain supported for local development and tests.
- The bundled
executepath demonstrates orchestration, retries, checkpoints, and bookkeeping; use your own workflow engine or cluster stack for production-scale execution.
