Skip to content

Repository files navigation

Lanting

兰亭 (Lanting) — there is no original, only the truest copy.

After the Lantingji Xu, Wang Xizhi's 353 CE preface to a gathering of scholars composing poetry by a winding stream. The original no longer exists; every version we know is a copy. This project is built on the same premise: there is no ground truth manuscript, only the most faithful version we can produce together.


An agentic manuscript-writing graph for drafting, critique, collation, and revision.

How it works

The graph routes one section through four judges — scientific integrity, article-type fit, adversarial review, and rhetorical hierarchy — then routes their objections back into revision. Each pass around this loop feeds the next; it stops when scores stabilize or a hard trigger fires for human review.

Setup

Phase 1 target: software application note (e.g. Briefings in Bioinformatics Application Note).

  1. Fill in paper/project_config.json with your software name, protected claim, forbidden phrases, and sections. See paper/profiles/software_application_note/required_fields.json for what is required.
  2. Fill in Claude/spec.md with the paper spec, novelty threats, and figure plan.
  3. Add 3+ target-paper PDFs to paper/style_ref/. (Style corpus extraction is a Phase 2 addition — in Phase 1, populate paper/rubrics/style_metrics.json manually from the target journal guidelines.)
  4. Fill in paper/groundtruth/ground_truth_examples.md with annotated good/bad examples as the paper develops.

Usage

# Three draft/evaluation passes over one section
python -m lanting run benchmarks/whorlmap --section design_principles --loops 3

# Single-shot baseline: one pass, no revision
python -m lanting run benchmarks/whorlmap --section design_principles --max-loops 0

# Against the live API (mock is the default)
python -m lanting run benchmarks/whorlmap --section design_principles --loops 3 --run-mode live

# Keep iterating past a blocking objection instead of pausing (experiments only)
python -m lanting run benchmarks/whorlmap --section design_principles --loops 3 --on-block continue

# Compare finished runs
python -m lanting compare runs/<arm-a-run-id> runs/<arm-b-run-id>

# Emit the compiled graph topology
python -m lanting graph --format mermaid
python -m lanting graph --format ascii            # needs the `viz` extra
python -m lanting graph --format png --output g.png

# Overnight run over all sections
bash run_overnight.sh

Each run writes runs/<run_id>/ containing every draft, judge output, deterministic report, metric vector, the route log, run_manifest.json, and checkpoints.sqlite.

Engine

The loop is a compiled LangGraph StateGraph (lanting/langgraph_app.py) with a SQLite checkpointer. State carries references and compact measurements only — draft text, rubrics, and judge prose live in the run directory and are addressed by path, so checkpoints stay small and JSON-native.

--engine imperative runs the equivalent plain-Python loop in lanting/graph.py. It is the fallback when LangGraph is absent and the differential oracle for the graph: tests/test_langgraph_engine.py asserts both engines produce identical drafts, objections, metric vectors, and route logs.

Phase roadmap

  • Phase 1 (current): Software application note profile. JSON state, direct API calls, four judges, human-review triggers.
  • Phase 2 (partial): LangGraph checkpointing ✅. Style corpus extraction and metrics database still open. methods_paper profile.
  • Phase 3: Scheduled overnight runs, morning brief. Additional profiles.

Dependencies

pip install -r requirements-paper.txt

Requires ANTHROPIC_API_KEY in .env.

About

An agentic manuscript-writing loop for drafting, critique, collation, and revision: there is no original, only the truest copy.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages