This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
llmXive is an automated platform for scientific discovery: a registry of specialist LLM agents — with occasional human guidance — advances ideas from a one-paragraph brainstorm to a peer-reviewed paper, committing every artifact, review, and decision to git. Two pipelines (research and paper) drive each project through a ~34-state lifecycle scaffolded with GitHub Spec Kit.
Governance lives in the constitution (.specify/memory/constitution.md) — six principles: Single Source of Truth, Verified Accuracy, Real-World Testing, Cost Effectiveness (Free-First), Fail Fast, and Convergent Review.
src/llmxive/: the Python package — agents, backends (Dartmouth Chat + local transformers), pipeline/state machinery, claims verification layer (specs 016–020), librarian, convergence engine, audits. Installable viapip install -e ".[dev]"(Python ≥ 3.11).agents/registry.yaml: the SINGLE source of truth for agent → prompt / model / backend / budget assignments (~50 agents). Prompts live inagents/prompts/. All registry models must be free (paid_opt_in: false; enforced bytests/unit/test_config_consistency.py).projects/: one directory per research project (PROJ-###-descriptive-name) holdingidea/, specs, code, data, paper, and reviews for that project.state/: canonical machine state — run logs, claims registry, librarian + judge caches, convergence cache, revisions.specs/: Spec Kit feature specs for llmXive itself (the platform); the highest-numbered spec is the most recent work.web/is the dashboard source;docs/is its deployed copy, regenerated wholesale fromweb/by the Pages workflow — never hand-editdocs/.web/data/projects.jsonis built bysrc/llmxive/web_data.pyfrom canonical state.papers/,notes/,infra/,scripts/: papers + audit artifacts, dated engineering notes, deployment helpers, maintenance scripts.
- Every reviewable stage runs the SAME identify → revise → re-review convergence
cycle — ONE shared mechanism (
llmxive.convergence.run_convergence), never re-implemented per stage (Constitution I + VI). The three rounds: R1 every reviewer raises concerns and a non-accept review MUST carry an actionable item (a "revise" with zero action items is rejected + resubmitted); R2 the reviser addresses every concern; R3 each reviewer signs off ONLY on whether its own R1 concerns were addressed — closed-set: re-review does NOT inject new concerns (a genuinely new issue is carried forward to the next stage's R1), which is what guarantees convergence within the cap. The deterministic backstops (fabricated-citation / unresolved-claim / spec-quality) still hard-block at convergence. Advancement requires unanimous panel acceptance within the 3-round per-step cap, else adaptive kickback to the prior stage. The bar is two-tier (Constitution 1.2.0): review stages (research_review/paper_review) require zero open concerns, while doc-authoring stages (specified/planned/tasked) may advance on writing-level-only residue (arequirement-or-worse concern always kicks back — the science gate is never relaxed). Thetaskedgate takes its verdict from the engine's closed-set panel (NOT a separate open-set re-analyze). There is NO accumulated point system; do not re-introduce one. Human and simulated-personality reviews are advisory inputs routed through stage-aware triage. - Review records are written under
projects/<id>/reviews/research/(research) andprojects/<id>/paper/reviews/(paper) as<reviewer_name>__<YYYY-MM-DD>__<stage>.mdwith YAML frontmatter validated against the review-record contract. - Review-stage dispatch is verdict-coverage-gated (spec 023): a complete,
current verdict set is evaluated directly (no reviewer re-dispatch); an
unconsumed
revision_spec_pathdispatchesllmxive_implementer; advancement decisions are PERSISTED by the graph (never reduced to a stage name). Auto-revision rounds cap atadvancement.MAX_REVISION_ROUNDS→ honest terminal. - Human input is required for EXACTLY ONE thing: the publication DOI
sign-off (a maintainer-vote GitHub issue parsed by the
signoff-polllane /llmxive.integrations.signoff_gate). Everything else is handled autonomously and NEVER parks athuman_input_needed(graph.pyhas zeroreturn Stage.HUMAN_INPUT_NEEDED). Infeasible ideas archive + bounded re-brainstorm →validator_rejectedterminal. When the execution OR convergence fix-loop exhausts its per-tier round cap it ESCALATES the model tier (execution_statusmodel_tierladder: registered default →openai.gpt-oss-120b→ optionalLLMXIVE_EXECUTION_PAID_TIERSvia the paid opt-in + credit guard) and retries the cap; when ALL tiers exhaust it routes back toplanned/paper_plannedwith a DETERMINISTIC (no-LLM) re-plan report (artifacts produced + failing commands / unresolved panel concerns + an "adjust the approach" note) the planner ingests. The execution fix-loop also self-heals data-contract bugs: a cross-script schema mismatch (CSV columns, a missing intermediate file) is detected from the failure, the REAL produced artifact's schema is read, and the implementer is shown the exact mismatch + producer to fix (execution/data_contract.py, sibling toshared_contract.py). Engine failures file deduped GitHub issues and stay schedulable. - Every paper's compile/restyle/audit outcome lives in
state/paper_status/<id>.json(spec 023 / FR-022): silent fallbacks are rejected at write time; audit defects feed a bounded repair loop through the same revision machinery.
- Every factual claim in generated artifacts is detected, registered,
resolved against a real source, and cached (
src/llmxive/claims/,state/claims/; specs 016–020). Empirical results must trace to harness-signed receipts (src/llmxive/results/) — never hallucinated. - All references must be validated against the live source (download/fetch, not memory) before commit.
- The dedicated execution stage (
src/llmxive/execution/stage.py) RUNS each project's analysis end-to-end and gatesresearch_completeon real artifacts. GPU-bound runs the free CPU CI cannot satisfy are offloaded to Kaggle's free GPU (src/llmxive/execution/offload.py; issue #367) instead of being parked: an in-flight offload records an async tri-state inexecution_statusthat NEVER bumpsfix_rounds, so it polls to completion without escalating tohuman_input_needed. Gated on theKAGGLE_API_TOKENsecret (inert without it).
pytest tests/unit tests/contract tests/integration— offline suites.LLMXIVE_REAL_TESTS=1 pytest tests/real_call— real-call suites (Constitution III: no mocks as the primary path). Heavy modules carry theslowmarker; the per-PR CI gate runs-m "not slow", nightly runs all.- Real LLM calls need
DARTMOUTH_CHAT_API_KEY; without Dartmouth access, thelocaltransformers backend exercises the identical router path (e.g.LLMXIVE_JUDGE_TEST_BACKEND=local). - Prompt changes (
agents/prompts/**) are gated by the promptfoo eval ineval/promptfoo/(.github/workflows/prompt-eval.yml), whose assertions reuse the production parsers.
- Single Source of Truth: before adding any function/config/prompt, search for an existing equivalent; modify in place, delete dead code, or refactor to a shared helper (Constitution I).
- When code changes, update the corresponding docs (README, docstrings,
website text) in the same commit; when dependencies change, update
pyproject.toml. - Run the full verification suite before pushing; if tests fail repeatedly, fix the code — do not weaken the tests.
- Use GitHub issues for all project tracking and communication.
For additional context about technologies to be used, project structure, shell commands, and other important information, read the current plan: specs/023-pipeline-e2e-completion/plan.md.