Metadata-Version: 2.4
Name: papersmith-ai
Version: 0.83.0
Summary: CLI workspace orchestrator for the papersmith-ai scientific paper engineering framework
Author-email: Laboratorio de Inteligencia Artificial UNAL <amalvarezme@unal.edu.co>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/LIAUNAL/papersmith-ai
Project-URL: Repository, https://github.com/LIAUNAL/papersmith-ai
Project-URL: Changelog, https://github.com/LIAUNAL/papersmith-ai/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/LIAUNAL/papersmith-ai/issues
Keywords: research,academic-writing,latex,literature-review,agents,llm
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Text Processing :: Markup :: LaTeX
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# papersmith-ai

> **A paper forge**: turns reference PDFs into high-fidelity Markdown that an agent can read (equations in LaTeX, tables as tables, figures as files), and drives the formal deliberation —mathematics and experimental design— through to the code that tests itself and the compiled paper.

[![CI](https://github.com/LIAUNAL/papersmith-ai/actions/workflows/test.yml/badge.svg)](https://github.com/LIAUNAL/papersmith-ai/actions/workflows/test.yml)
[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D21%20(Caztor%3A%2026)-green.svg)](https://nodejs.org/)
[![Python](https://img.shields.io/badge/Python-%3E%3D3.11-blue.svg)](https://www.python.org/)

<p align="center">
  <img src="docs/assets/agent-smith-anime.jpg" alt="Agent Smith in anime style, with a holographic paper and AI agents orbiting around him" width="560">
</p>

This README is the **way in**: what papersmith is, how to install it, the order of
the work, the workspace from the inside, development and troubleshooting. The
reference pages live under [docs/](docs/README.md): every skill in
[docs/skills.md](docs/skills.md) and every `smith` command in [docs/cli.md](docs/cli.md).

## Contents

1. [If this is your first time](#if-this-is-your-first-time)
2. [Use flow — the short path](#use-flow--the-short-path)
3. [Getting started](#getting-started)
4. [How it works — the order](#how-it-works--the-order)
5. [Inside the workspace](#inside-the-workspace)
6. [Harnesses and skill projection](#harnesses-and-skill-projection)
7. [The agents](#the-agents)
8. [Anatomy of each skill](docs/skills.md#anatomy-of-each-skill)
9. [The CLI commands](docs/cli.md#the-cli-commands)
10. [Remote compute, carefully](#remote-compute-carefully)
11. [Architecture](#architecture)
12. [Development and testing](#development-and-testing)
13. [Troubleshooting](#troubleshooting)
14. [Related documentation](#related-documentation)
15. [License](#license)

## If this is your first time

Welcome. This forge is built to take a PDF to a compiled paper
without guessing the order. The minimum path:

1. **Install the CLI and set up the environment** — see [Getting started](#getting-started).
2. **Create your workspace** — `smith init ~/papers/my-paper --title "…" --topic "…"`.
   What it leaves inside, in [Inside the workspace](#inside-the-workspace).
3. **Open the dashboard** — `cd ~/papers/my-paper && smith ui`. It works right
   after `init`: the first run installs the dashboard's own runtime once, outside
   the workspace, and then serves the eleven phases in order. Each start
   regenerates the board's own artifacts (the SOTA atlas, the manuscript graph,
   the novelty graph, the wiring health) and the **Update board** button in the
   top bar does it again on demand, then tells you which phase the project is
   in, which steps it still owes and which gates are open (`--no-refresh` keeps
   the start read-only). To use it from
   your phone or another computer at home, `smith ui --lan` (see
   [Open the dashboard from another device](#open-the-dashboard-from-another-device)).
4. **Check that the idea is plausible** — with your idea in two sentences,
   `/plausibility` tracks the SOTA and returns the constellation plus a ranked top 5.
   If you have no clear sentences yet, the dashboard's phase-2 box offers an
   optional *Ayuda temática*: type 3 to 5 keywords and it proposes the idea for you to edit.
5. **Put a reference PDF** in `guidance/reference-papers/` and run
   `smith ingest <pdf>` — or ask for `/paper-ingestion` inside your harness.
6. **Open the deliberation** with `/proposal-deliberation`: the central problem and
   its pillars first, then the hypotheses, then the mathematics, discussed with the
   agent.

Not every skill has to be used, or in this order: **each one declares what
it needs first and refuses before doing something half-done**. If an input is
missing it doesn't invent it: it exits with a rejection code that names what's missing. A
`PAPER_ABSENT` reports a missing input, not an operator error.

The full map is in [Use flow](#use-flow--the-short-path); the
detailed route, in [How it works — the order](#how-it-works--the-order). If an AI
agent is used as a copilot, the ones already defined are in
[The agents](#the-agents).

---

## Use flow — the short path

Every skill is invoked by name in Claude Code (`/paper-ingestion`) or requested in
Spanish (*"ingiere los papers"*). **Not all of them have to be used, or in this order**: each
one declares what it needs first and refuses if it's missing, so an invocation from the middle
of the flow reports which input is missing.

The full path, from a PDF to a compiled paper:

| # | You invoke | What it does | Where it leaves the result |
|---|---------|----------|-------------------------|
| 1 | `/plausibility` | Explores the idea before any ingestion, in three stretches: it tracks ~25 references through their abstracts, maps the constellation in a single HTML and discusses the plausibility of the hypothesis against that SOTA. Without clear sentences, the dashboard's optional thematic help turns 3 to 5 keywords into a proposed idea from the lab bank (`banco-lia`) that you edit and approve before it runs as this prompt | `sota-pool/` (ignored, like `guidance/`) |
| 1b | `/paper-type` (or the dashboard's *Tipo de paper* tab) | Once you accept the plausibility report: scores the idea against smith's eight paper types (a deterministic 0-100 match per type, no model call), has the `paper-type-advisor` agent relate each type to the idea and propose a type and variant, and records the type you agree. An applied-AI type keeps this flow; any other moves the workspace to its own line with `smith kind set <type> --by <name>` (see [The paper type and the eight lines](#the-paper-type-and-the-eight-lines)) | `.papersmith/plausibility.json` (the accepted idea) and `.papersmith/paper_type.json` (scores, suggestion, agreement) |
| 2 | `/paper-ingestion` | Converts the reference PDFs into readable Markdown (equations in LaTeX, tables as tables, figures as files) | `guidance/<folder>/` |
| 3 | `/proposal-deliberation` | Builds the proposal with you in one order — the central problem and its pillars, then the hypotheses, then the mathematics, each locked until the one before it exists — and publishes each agreement as a managed revision, with the SOTA constellation alongside; every idea is then justified by 2 to 5 SOTA pool citations, and the `paper-reviewer` agent classifies its contribution type | `proposals/` (the revision and its `graph.html`); the citations in `.papersmith/citations.json`; the contribution type in `.papersmith/model_spec.json` |
| 3b | `/math-tutor` | Before implementing a revision: a Socratic tutor that discusses its concept map and mathematics with you, reads the pages you draw by hand, and checks your understanding of why the novelty holds | nothing on disk but its thread (`.papersmith/math-tutor/`); used from the dashboard's Mapa Conceptual & Modelo tab |
| 4 | `/experimental-deliberation` | Discusses the experimental design that will put that mathematics to the test | `experiments/` |
| 4b | `/experiments-tutor` | Consults and iterates on each experiment decision with you — architecture, hyperparameters, ablations, significance tests, the toy set's purpose, training, upper bounds (*techos*), the methods compared and their implementation — reading the protocol, the approvals, the code and the results first; it never invents a number, and any change of decision goes back to `/experimental-deliberation` | nothing on disk but its thread (`.papersmith/experiments-tutor/`); used from the dashboard's Experimentos tab |
| 5 | `/datasets` | Gives the proof of concept and the full experiments their data: a seeded toy set always (`synth`), then an official dataset searched for (`search`) across the paper's own repository and the open dataset hosts, its source license decided (`license`), its quality measured (`qc`) and one subject-wise preparation both stages read (`prepare`); `publish` uploads it privately only with your explicit consent. Agents `dataset-scout` and `dataset-curator` | `datasets/` (registry, toy and prepared sets) |
| 6 | `/proposal-implementation` (replication) | Replicates each comparison or baseline paper through the `paper-replicator` agent: it looks for the paper's published code first and, when it exists, adopts it pinned to a commit and audits that it corresponds to the paper and is implemented correctly; only when no code exists does it reimplement the method from the ingested Markdown | the target repo, with a `REPLICATION.md` correspondence table |
| 7 | `/proposal-implementation` | Proof of concept: turns the proposal into Python that verifies itself against the document, and closes with a checked `Results/discussion.json` | `implementations/<repo>/` |
| 7b | `smith novelty approve --gate poc` (or the verification card of the Novedad & Hallazgos tab) | Not a skill but a gate before the full experiments: you verify the proof of concept's results and its contrasted hypotheses once its discussion is complete (`G-EXP-POC`); `iterate --gate poc` sends it back. The full experiments stay locked until it passes | the `poc` record of `.papersmith/novelty_gate.json` |
| 8 | `/experimental-implementation` | Turns the protocol into code, runs its measurements and closes the full experiments with their own checked `Results/discussion.json` (a verdict per hypothesis, backed by its test); it starts only after `G-EXP-POC` | the same target repo |
| 8b | `/experiment-diagrams` | When the proof of concept (`AGREED.md`) and then the full experiments (`Experimental_AGREED.md`) are approved, draws one TikZ diagram of each, stating the experiment's single claim along one reading spine, compiles it to PDF and PNG and reviews it, grayscale included | `implementations/<repo>/<Name>/diagrams/`, shown in the Experimentos panel |
| 9 | `/kaggle-accounts` | Proves that the Kaggle credentials really authenticate | `store/` (never leaves the disk) |
| 10 | `/remote-execution` | Sends work to a remote worker and keeps the record of what came back | the target repo's ledger |
| 10b | `smith novelty {status,approve,iterate,reset}` (or the dashboard's Novedad & Hallazgos tab) | Not a skill but a gate between the experiments and the paper: you contrast the discussions' hypothesis verdicts with the SOTA pool, read the reviewer-defense checklist and record whether the evidence supports the novelty (`G-NOVELTY`), with the paper-reviewer's contribution type of the findings beside the matrix, or record that the work returns to experiments, proposal or plausibility | `.papersmith/novelty_gate.json` (the decision and its history) |
| 11 | `/paper-writing` | Writes the paper block by block, with every claim tied to its evidence, stylometric burstiness analysis ($CV$), AI cliché detection and humanization under F5 invariant preservation | `paper/` |
| 11b | `/journal-finder` (or the PDF Preview tab's *Revistas sugeridas* block) | Once the paper compiles: you pick a quartile range (`Q1`, `Q2-Q3`, `Q1-Q4`) and it ranks the journals that already publish work like the paper, each with its quartile and where it came from, open-access state, APC, h-index, a review-time estimate and the similar works that justify the fit; an agent then reads each journal's aims and scope and writes the case for it. `--scope national` (the tab's International / National selector) ranks Colombian journals of the Publindex IBN 2026 list instead, only categories A1, A2 and B, with each one's measured submission-to-publication time and the languages it receives. It never submits and never contacts an editor | `paper/journal-candidates.json` and `paper/journal-candidates.md` |
| 11c | `paper-writing` `venue` verbs and the `venue-adapter` agent (the PDF Preview tab's *Revista elegida* card) | After you choose a journal: reads its author guidelines and template, measures the manuscript against them and alerts on sections to adjust, sections missing and inconsistencies with smith's base template, proposes an adjustment plan only when it is prudent, and builds the journal's own `main.tex` once you approve the plan. Text changes go only through the `write` loop | `paper/venues/<slug>/` (the canonical `paper/main.tex` is never written) |
| 11d | `paper-writing` `translate` verbs and the `translator` and `translation-style-reviewer` agents (the PDF Preview tab) | For a journal that only receives Spanish: translates the finished English manuscript into neutral academic Spanish block by block, each block passing a fidelity gate (citations, labels, math, numbers, paragraphs) before it is stored; `translate audit` scores style, flow and redundancy, and the tab compiles and previews the Spanish PDF. The English paper stays the source | `paper/translations/es/` |
| 11e | the `paper-reviewer` final judge (the PDF Preview tab's judge panel and its "Run round N of the judge" button) | Reviews the compiled paper round by round on the rubric the workspace's line chooses: `ml-conference` on the experimental line (the main-track form: overall 1-6, confidence 1-5, Quality, Clarity, Significance, Originality 1-4), `systematic-review` (review), `empirical-study` (observational-measurement, experiment-intervention), `measurement-science` (hardware, lab-simulation), `data-descriptor` (data-resource) or `qualitative-study` (qualitative-participatory); `paper_cli.py review --input <round.json>` records each round, refuses a rubric that does not serve the line and, from the second round on, records a verdict on every revision the previous one raised | `.papersmith/paper_review.json` |
| 12 | `/figure-review` | Looks at the render: rasterizes every `Figures/<id>.pdf` and measures what a raster can support (ink outside the canvas, collisions) | a visual report, never a change |
| 13 | `/skill-audit` | Audits any of the above: what the code accepts versus what its documentation promises | a report, never a change |
| 14 | `/upgrade-project` | Brings the workspace to the version of the CLI you have installed: it syncs the kit files and migrates the artifacts, delegating everything to `smith upgrade` | the workspace itself |
| 15 | `/ui-github` | Publishes a read-only copy of the dashboard on GitHub Pages (`smith ui --publish-pages`): a static snapshot, nothing runs, and the site is public; it asks before pushing, and `--no-ai-history` leaves the masked AI history out | the `gh-pages` branch of the GitHub remote, never the workspace |
| 16 | `/prompt-gate` (also applied automatically before every step above) | Measures the quality of the prompt a skill receives before it runs: a deterministic score per skill (`python -m skills._core.command_center.prompt_gate check`) plus a rubric from published prompt-engineering guidance. Under the threshold (60/100) or on a critical failure it alerts that the prompt is not clear and proposes an improved prompt for you to approve, or asks a few questions when your input is too thin, builds the prompt and launches it. It runs the same way in every agent (Claude Code, OpenCode, Pi, Antigravity), in the agent terminal, the dashboard's embedded terminal and the dashboard's phase boxes, where the alert and the suggestion appear in the box itself | nothing on disk; an approved prompt carries `[prompt-gate: approved]` |

The minimum to try the forge is step 1: with the idea in two sentences,
`/plausibility` tracks the SOTA and returns the constellation plus the top-5. Only
afterwards, if desired, a PDF can be placed in `guidance/reference-papers/` and run
through `/paper-ingestion`; the deliberation is then carried out with
`/proposal-deliberation`. Steps 4 to 10b only make sense once there's a published proposal
and a target repository to implement it in.

### The paper type and the eight lines

The table above is the **experimental line**, for an applied-AI paper (a
method measured against the state of the art). After plausibility,
`/paper-type` decides with you which kind of paper the idea becomes: it scores
the accepted idea against the catalogue in
`skills/_core/paper_types/paper_types.json`, the `paper-type-advisor` agent
relates every type to the idea, and you agree a type (and its variant, which
chooses the reporting checklist) in the conversation or in the dashboard's
*Tipo de paper* tab. The agreement lives in `.papersmith/paper_type.json`. A
workspace with no agreed type stays on its line. Each type has its own line:
its section contracts, its flow in every harness entrypoint, its line skill,
its board in `smith ui` and its final-judge rubric.

| Line (`smith init --kind`) | For | Flow |
|---|---|---|
| `experimental` (type `applied-ai`, the default) | A method compared with the SOTA: proposal, proof of concept, experiments | [How it works — the order](#how-it-works--the-order) |
| `review` | Systematic, scoping or bibliometric reviews (PRISMA 2020) | [The review line](#the-review-line-systematic-reviews) |
| `observational-measurement` | Observational studies, diagnostic validations, measurement instruments (STROBE, STARD 2015, COSMIN) | [The observational and measurement line](#the-observational-and-measurement-line) |
| `hardware` | A device, sensor or instrument built and validated (HardwareX) | [The hardware line](#the-hardware-line) |
| `lab-simulation` | Materials studies and modelling or simulation, with GUM uncertainty | [The lab-simulation line](#the-lab-simulation-line) |
| `data-resource` | A corpus, dataset or benchmark as the contribution (Datasheets for Datasets) | [The data-resource line](#the-data-resource-line) |
| `experiment-intervention` | Trials with people and field, crop or animal experiments (CONSORT 2025, ARRIVE 2.0) | [The experiment-intervention line](#the-experiment-intervention-line) |
| `qualitative-participatory` | Qualitative or mixed-methods studies, expert consensus and foresight, experience reports (SRQR, COREQ) | [The qualitative-participatory line](#the-qualitative-participatory-line) |

A new workspace picks its line with `smith init --kind <line>`. An existing
one moves with `smith kind set <type> --by <name>` once `/paper-type` has
scored the idea: it records the agreement, applies the line's contracts and
flow text through `smith upgrade`, removes the other line's files only when
unedited, and refuses once a proposal revision or `paper/main.tex` exists
(leaving an empirical line, also a study-protocol revision or its lock),
unless `--force` ([docs/cli.md](docs/cli.md#smith-kind-set-type-dir)).
The empirical lines share one machinery: `/study-protocol-deliberation` and the
operator's protocol lock, ethics and registration records, own-data
dictionaries and quality checks, an append-only analysis log that labels each
run confirmatory or exploratory, participant-flow diagrams and reporting
checklists. The assistant never generates measurements or data, and never
records ethics, consent, data collection, a sign-off or the primary outcome on
the operator's behalf.

The diagram shows the full flow: every stage in this order with
its command, its agents (with the tools each one declares in Pi), its
human gates and what it leaves on disk. The interactive version, with links to
the source of each node, is in
[`docs/diagrams/papersmith-pi-flow.html`](docs/diagrams/papersmith-pi-flow.html)
(opens in the browser; generated with [Archify](https://github.com/tt-a1i/archify),
and its source and its recipe are versioned in
[`docs/diagrams/`](docs/diagrams/README.md)). Its numbered lanes are the eleven
dashboard phases below, with the two Phase 5 gates (`G-EXP-POC` and `G-NOVELTY`)
drawn in place.

[![papersmith-ai flow in Pi: commands, skills and agents](docs/diagrams/papersmith-pi-flow.png)](docs/diagrams/papersmith-pi-flow.html)

The dashboard (`smith ui`) opens on this flow and shows the same order as
eleven phases under **Pipeline y Avance**. Below the diagram, the **Flujo Archify**
tab lists every agent the workspace ships (`/api/agents`): its role, the skill it
loads, its stretch, its tools, the phase(s) it acts in and the harnesses it is
projected to, in a table you can sort and filter. Clicking a phase opens its console:
a text box with the stage's rules as a guide that sends `/<skill> <text>` to an
agent in the support terminal (for `/plausibility`, the idea in at least two
sentences, or the optional *Ayuda temática* described under
[Step 1](#step-1--check-that-the-idea-is-plausible-plausibility)), the real
`smith` command for the phase, or a link to the panel
that owns the work: the concept map, the math tutor, the PoC board, the
sections, the PDF preview or the gates. After "Ejecutar", the drawer tracks the run
step by step until the server finds the phase's evidence on disk and marks it
verified; the next phase then unlocks and lights up. Each phase is locked until
the one before it passes (override available). A running phase also shows in a
dock at the bottom left on every tab. A click opens its tracking panel in place, with
the checkpoints, the agent's terminal and **⏹ Detener proceso**, which interrupts the
agent's turn and keeps its session. Closing the CLI, changing tabs or reloading the
page never ends the session of a running phase: a reload reattaches to it. The same eleven phases are written into
every harness entrypoint (`CLAUDE.md`, `OPENCODE.md`, `.pi/APPEND_SYSTEM.md`,
`.agents/AGENTS.md`) under "Paper construction flow".

The dashboard's tabs depend on the workspace's line; the tab names below are
the Spanish ones the dashboard shows (the interface also has an English
catalogue). *Mapa Conceptual & Modelo*, *Experimentos* and *Novedad &
Hallazgos* appear only on the experimental line, *Revisión* only on the review
line and *Estudio* only on the empirical lines. The header
carries the run selector (the short run id, such as `r07`, with the file name as
tooltip), a dark/light theme toggle (dark by default; the framed Archify and
manuscript-summary views follow it) and a text-size control (A ×1, ×1.25, ×1.5,
×2):

| Tab | What it shows |
|---|---|
| **Flujo Archify** | The interactive flow diagram above and the table of every agent the workspace ships. It is the tab the dashboard opens on |
| **Pipeline y Avance** | The eleven phases with their sub-phases, their evidence on disk, their gates and each phase's console (another line shows its own steps and gates) |
| **Revisión** | A review workspace's records: protocol and registration, search log, screening progress (conflicts, kappa), PRISMA flow, extraction, risk of bias and the PRISMA 2020 checklist |
| **Estudio** | An empirical workspace's records: the study protocol and its lock, ethics and registration, data, the analysis log, participant flow, measurement or qualitative records and the line's reporting checklist |
| **Tipo de paper** | One card per catalogue type with its score for the idea, a short description, its reporting guideline and why it fits the idea or not; the suggested and agreed types highlighted, *Discuss with the agent* (types `/paper-type` into the agent) and *Agree type* (records the agreement and says which `smith kind set` moves the workspace) |
| **Mapa Conceptual & Modelo** | The proposal built in five ordered steps: a stepper for the central problem and its pillars → the hypotheses → the mathematics → the SOTA citations → the judge-reviewer, each step locked until the one before it exists on disk and with a *Generar y deliberar* button that types its `/proposal-deliberation` into the agent (the mathematics step also offers `/math-tutor`); the judge-reviewer's contribution type right after the hypotheses, with affinity bars per contribution type; the pillar → hypothesis tree drawn with arrows; the novelty, the five-layer concept map and the paper's mathematics rendered in LaTeX with the `math-tutor` Socratic tutor beside it; each pillar, hypothesis, layer and equation with its SOTA citations (title, year, why and the quote of its abstract) or a mark that it owes them; its blocks fold |
| **Experimentos** | A stepper SOTA citations → proof of concept → verify → full experiment, one button each (the full-experiment button stays disabled until `G-EXP-POC` passes), then, in flow order and folded, the protocol, datasets, proof-of-concept and full-experiment cards, the comparison, the infrastructure and run options, and the `experiments-tutor` last. Each card opens with the stage's summary and discussion read from `Results/discussion.json` (hypothesis verdicts with their evidence and tests, novelty, performance measures, qualitative gallery, limitations, next steps), and a **PoC vs full experiments** section compares each hypothesis's verdict across the two stages |
| **Novedad & Hallazgos** | The manuscript summary diagram at the top, with its rebuild button; the proof-of-concept verification card (`G-EXP-POC`), the novelty assessment with the paper-reviewer's contribution type of the findings, and the `G-NOVELTY` gate (below) |
| **Secciones del Paper** | The canonical section structure of the manuscript: state, words and blocks of each section |
| **Atlas de Grafos** | The 3D SOTA constellation (`sota-pool/atlas.html`), the manuscript's novelty graph and the candidate matrix. A coverage notice counts the cited references the constellation does not draw, with a *Complete the constellation* button; clicking a planet or paper name opens a side panel with the paper's summary and linked papers, and a citation clicked in any panel lands on that paper in the atlas. The `smith atlas` commands are in [docs/cli.md](docs/cli.md#smith-atlas-build-dir) |
| **Previsualización PDF** | The written blocks and the compiled `paper/main.pdf` side by side, the style and redundancy panel (each section's writing style and redundancy scored from 0 to 100), and below them the journal block: *Revistas sugeridas* (the ranked journals for a quartile range you choose) and, once you pick one, *Revista elegida* (the venue state machine, the audit, the plan and its approval, and a toggle between the canonical PDF and the journal's). See [Choosing and adapting to a journal](#choosing-and-adapting-to-a-journal) |
| **Artefactos** | Explorer of the section rules, canonical contracts and the documents of the formulation cycle |
| **Historia con IA** | Each phase's gate, colour and timeline of AI interactions |
| **Telemetría** (*Telemetry and Costs* in English) | Tokens, tool uses and duration per measured phase |
| **Smith Doctor** | The same health table as `smith doctor` |

**The novelty assessment and its gates.** *Novedad & Hallazgos* sits between the
experiments and the manuscript. Once a proof of concept closes with a complete
discussion, a verification card comes first: you approve its results and
contrasted hypotheses, or send it back (`smith novelty approve|iterate --gate
poc`), and that decision is `G-EXP-POC`, which unlocks the full experiments. The
rest has four parts: a matrix of
hypotheses against the empirical evidence of both stages (metric, criterion,
observed result, test, rationale and verdict badge, read from each product's
`Results/discussion.json`); the novelty claims contrasted with the
`sota-pool/candidates.json` candidates and the baselines; a checklist for
defending the work before reviewers (leakage-free partitioning, significance
tests, empirical support, SOTA contrast), derived from what the discussions
record; and the decision gate. `G-NOVELTY` ("Novelty & Findings Gate") turns
`ACTIVE` once Phase 5 passes — which needs the verified proof of concept — and
`PASS` when you approve. You decide from the
panel's buttons or from the terminal with
`smith novelty {status,approve,iterate,reset}`: *approve* records that the
evidence supports the novelty, and *iterate* records that the work returns to
experiments, proposal or plausibility. The decision and its history go to
`.papersmith/novelty_gate.json`. Phase 6 stays locked until you approve it,
so nothing is written over an undecided novelty.

**Phase 5 gating.** The sub-phases that close the experiments read the results
discussion, not just a folder. 5.8 (proof of concept) and 5.12 (full
experiments) pass only when a product of that stage holds a complete
`Results/discussion.json` — a bare `Results/` folder reads as active. Between
them, 5.9 is the operator's verification of the proof of concept (`G-EXP-POC`),
and 5.12 stays `LOCKED` until it passes. Phase 5 passes only with the published
protocol, the discussed and verified proof of concept and a discussed full
experiment, so no later phase unlocks over an unverified one; 5.13 (code review) reads
`Results/reviewer_report.json`. Scaffold and check the discussion with
`python skills/_core/results/discussion_cli.py scaffold|check|status --product
implementations/<repo>/<Name>`. `scaffold` copies each experiment's hypotheses
and success criteria verbatim and leaves every verdict `pending`; `check`
rejects an evidence path that does not exist and, at the full stage, a decided
hypothesis that cites no significance test. The schema is in
[`skills/_core/results/README.md`](skills/_core/results/README.md).

### Choosing and adapting to a journal

Where a paper goes is a decision of its own, and it gets evidence rather than a
hunch. From the *Previsualización PDF* tab you choose a quartile range and
press *Buscar revistas* (or press *Analizar con agente*, which types
`/journal-finder <range>` into the CLI assistant). The CLI turns the paper's
title, abstract, keywords and references into a ranked shortlist of journals
that already publish work like it. Nothing is ever submitted.

- **How the fit is scored.** `fit_score = 0.45 * similar_works + 0.3 *
  cited_in_paper + 0.25 * topic_overlap`, each component divided by its maximum
  over the journals evaluated: works like the paper that the journal published
  (one OpenAlex query of quoted key phrases, last six years), references of
  `paper/refs.bib` published there, and the overlap between the paper's OpenAlex
  topics and the journal's (with the fallback chain, the paper's keywords and
  facet phrases against the journal's SJR categories and DOAJ subjects). A
  component that is zero for every journal drops out and the other weights are
  rescaled. When the title applies a method to a
  domain (the tail after `for`, `applied to`, `toward`), the search runs one
  query per facet, method and application, and a journal that shows no
  application evidence has its score halved and carries the
  `no-application-evidence` flag; it still appears, flagged. The numbers are in
  the JSON (`fit`, `facets`, `query.scoring`) and in the panel, which prints the
  formula above the table.
- **Where the journals come from.** `--source auto|asta|openalex|crossref` picks
  the chain (default `auto`; the panel's source selector sends the same choice).
  With your Asta key (Ai2's Semantic Scholar corpus; save it in the dashboard's
  Doctor → API keys or with `smith keys set asta`), Asta's relevance search picks
  the works like the paper first and OpenAlex describes the journals that
  published them; without the key nothing changes. OpenAlex answers first. When it cannot (no key and the keyless demo allowance
  is spent, a `429`, a `401`/`403`, a 5xx or a network error) `auto` does not
  refuse: it continues with free sources and says so in the output
  (`fallback: {used, code, reason}`, a note and, in the panel, a banner). The
  fallback chain is Crossref works search for works like the paper (the polite
  pool: set `PAPERSMITH_CONTACT_EMAIL` and it travels as `mailto`), Europe PMC
  for biomedical papers (a keyword or an application phrase such as EEG,
  clinical or brain triggers it), DOAJ for open-access state, APC and review
  process, and Semantic Scholar only when `SEMANTIC_SCHOLAR_API_KEY` is set.
  Works are aggregated per journal by ISSN, else by title. `--source openalex`
  keeps the old behaviour and refuses when OpenAlex is unavailable;
  `--source crossref` skips OpenAlex. The JSON names who answered
  (`providers`, and `sources` on every candidate), so a fallback result is
  never passed off as an OpenAlex one. The fallback has less to go on: no
  OpenAlex topics, no citedness and no proxy quartile.
- **Where the quartile comes from.** The SJR quartile comes from a SCImago CSV.
  Every workspace ships a snapshot (`skills/journal-finder/data/scimagojr-2025.csv.gz`,
  copied by `smith init` and refreshed by `smith upgrade`), so quartiles work
  out of the box; data © SCImago Journal & Country Rank (Scopus data),
  <https://www.scimagojr.com>. For a newer year, download the CSV from
  <https://www.scimagojr.com/journalrank.php> ("Download data") and import (`python3 skills/journal-finder/scripts/journal_cli.py sjr-import --file <csv>`,
  or the panel's upload, which sends the file as the raw body of
  `POST /api/journals/sjr`, up to 16 MiB); scimagojr.com answers automated
  downloads with a browser challenge, so the forge never scrapes it. When
  OpenAlex answered, a journal without an SJR row gets an OpenAlex proxy (the
  share of journals of the same field with a higher 2-year mean citedness),
  always labelled `openalex-proxy`, in the JSON, in the panel and in the
  agent's markdown: it approximates a citation percentile and is not an SJR
  quartile. No free source besides SJR and that proxy gives a quartile, so
  without OpenAlex the quartile is SJR or it is unknown (`quartile: null`,
  `quartile_source: "unknown"`). Journals of unknown quartile are excluded from
  a quartile range by default and counted in `excluded_reasons.quartile_unknown`;
  `--include-unknown-quartile` (the panel's toggle) keeps them, flagged
  `quartile-unknown`. Import the SJR file or get an OpenAlex key and the
  question goes away.
- **The review-time estimate.** Per journal, the median and interquartile range
  of the days between *received* and *accepted* over its latest 40 research
  articles of the last three years, read from Crossref first, then PubMed, else
  none (fewer than five dated articles reads as none). It is an estimate of
  submission-to-acceptance, revision rounds included; it is not the time to
  first decision.
- **The OpenAlex key, its budget and the response cache.** OpenAlex now
  requires a free API key for real use; keyless calls are a small demo
  allowance (USD 0.10 per day, shared by everyone behind one IP). A free key
  takes an account at <https://openalex.org/signup> with a verified email, then
  the key from <https://openalex.org/settings/api-key>. Save it once in the
  dashboard's **Doctor → API keys** panel or with `smith keys set openalex`
  (stored per user, mode `0600`, outside every workspace; an exported
  `OPENALEX_API_KEY` still wins). The CLI sends it only to OpenAlex and only
  when set, and never requests a key on your behalf. It gives USD 1 per day of usage, ten times the keyless
  budget. By OpenAlex's price list (checked 2026-10-31), fetching a record by
  id is free, a list with a filter costs USD 0.10 per 1,000 requests and a
  search USD 1 per 1,000, so a day's budget is about 1,000 searches or 10,000
  filtered lists. The rate limit is 30 requests per second with a key (10
  without) and 5 per second for searches with more than 5 boolean operators;
  the budget resets at midnight UTC, a refused request costs nothing, and the
  data is CC0. The finder's own cost is an estimate from its call pattern, not
  a measurement: a search makes two or so search-priced calls for similar works,
  up to 15 more when references name journals without a DOI, up to 4
  DOI-batch lists, and, for each journal without an SJR row, two filtered lists
  for the proxy quartile (up to about 130). That is roughly USD 0.01 to 0.04
  per search, fewer with an imported SJR file; `api_calls.budget` reports what
  OpenAlex says is left. The CLI keeps successful answers (of every
  service) in `~/.cache/papersmith/journal-finder/http/`
  (`PAPERSMITH_JOURNAL_CACHE_DIR` moves it): a search is reused for one day, any
  other lookup for seven, and an error is never stored. The panel's
  forced-refresh option, or `--no-cache`, skips the cache for one search. The
  result's `api_calls` reports the calls made and served from the cache per
  service and the budget state, and the panel shows it. When OpenAlex answers
  `429` asking for a wait of more than a minute the quota is spent and the CLI
  does not retry: with `auto` the search continues with the fallback chain and
  a note says how to get the key; with `--source openalex` the refusal is
  `NETWORK_UNAVAILABLE` and its message names `OPENALEX_API_KEY`; later in a
  search that step degrades with a note and the budget reads `exhausted`.
- **From a journal to its template.** *Elegir esta revista* runs
  `venue select` and opens `paper/venues/<slug>/`. The state machine is
  `selected → requirements → template → audited → planned → approved → built
  (→ compiled)`; `planned` and `approved` are owed only while the audit holds a
  `blocker` finding. The `venue-adapter` agent reads the author guidelines
  (every requirement it records carries the quote and the url it came from),
  `venue diff` measures the manuscript against them, and the agent proposes an
  adjustment plan only when one is prudent.
- **The operator approval gate.** The plan is approved by you, with your own
  words, bound to the plan's sha256: `venue approve --statement "..." --plan-sha256 <hex>`
  or the panel's *Aprobar plan* button. The button's route,
  `POST /api/venues/<slug>/approve`, refuses a request with no `Origin` header
  (curl, an agent's shell) as well as a foreign one, so an approval recorded
  `via: dashboard` always came from the page; from the terminal you give your
  words to `venue approve`. A revised plan voids the approval, and
  `venue build` refuses while a blocker finding has no approved plan. The
  approved text changes are applied one block at a time through the existing
  `write` loop, never by the agent that proposed them.
- **The canonical manuscript is never overwritten.** Everything for one journal
  lives under `paper/venues/<slug>/` (`venue.json`, `requirements.json`,
  `audit.json`, `plan.md`, `approval.json`, `main.tex`). `paper/main.tex` and
  `sections/` are never written by any venue verb, and the journal's `main.tex`
  carries the canonical blocks byte for byte. The panel compiles it in its own
  directory and previews its PDF beside the canonical one.

The skill's contract is [`skills/journal-finder/SKILL.md`](skills/journal-finder/SKILL.md),
the venue verbs' is the "Venue adaptation" section of
[`skills/paper-writing/SKILL.md`](skills/paper-writing/SKILL.md), and the guided
tour is in [docs/skills.md](docs/skills.md#19-journal-finder--a-journal-chosen-on-evidence-a-template-adapted-on-approval).

1. **Nothing produced gets uploaded.** `proposals/`, `experiments/`, `paper/`,
   `implementations/` and `sota-pool/` travel to GitHub **as empty folders** and nothing more; `guidance/`
   versions its folders and never the PDFs or the Markdown inside. The scaffolding gets
   versioned, the content doesn't. A half-written paper is research material, and
   publishing it by accident is a leak.
2. **Each skill refuses before doing something half-done.** If an input is missing, it
   doesn't invent it or skip it: it exits with a rejection code that names what's missing. A
   `PAPER_ABSENT` or a `SECTION_CONTRACTS_UNREADABLE` names what the skill is missing, not an
   operator error.
3. **The operator closes the deliberation.** The two deliberation skills propose, discuss and
   prepare the edit, but neither publishes without the operator's acceptance. It is part of
   each one's contract, and the engine enforces it.

---

## Getting started

None of this requires keys or external services: the forge runs locally.

### 0. What your machine needs to have

Two runtimes, and both are mandatory: the forge uses Python for the CLI and Node
for the deliberation engine, and without the second one half the framework won't
start.

| Runtime | Version | What for | If it's missing |
| --- | --- | --- | --- |
| **Python** | ≥ 3.11 (CI: 3.11, 3.12) | the `smith` CLI and all the Python skills | there's no possible installation |
| **Node.js** | ≥ 21 (CI: 24; local check: 26.13.0) | the deliberation engine (`jiti`, `typebox`) and the dashboard | `init` warns and `deliberate` refuses |
| `npm` | compatible with the selected Node (local check: 12.2.2 with Node 26.13.0) | installing those two dependencies in the workspace | same as above |
| **Node.js 26** and `tectonic` | Node ≥ 26 (CI: 26, Caztor's own job) | Caztor, the LaTeX editor of the dashboard's PDF tab, which comes with the install and compiles with Tectonic | downloaded once, checked against pinned SHA-256, into `~/.cache/papersmith/tools/` the first time the PDF tab opens (`PAPERSMITH_NO_TOOL_DOWNLOAD=1` turns that off) |

Both are checked at once:

```bash
python3 --version && node --version && npm --version
```

If Node is missing, `smith init` doesn't fail: it warns with
`npm was not found; deliberate requires npm install for jiti/typebox` and moves
on, because the rest of the workspace can be created. But `proposal-deliberation`
and `experimental-deliberation` —the two skills that propose and discuss before
writing— don't run without those dependencies. To create the workspace without
them, `init --no-npm` does so explicitly.

The ingestion runtime from step 2 is separate and **is optional**: it's only
needed to extract PDFs with OCR.

### 1. Install the CLI and set up the environment

```bash
# 1a. The CLI, from the latest version published on PyPI
pipx install papersmith-ai
#     the same with pip, for setups without pipx
pip install papersmith-ai
#     or the tip of `main`, without waiting for a release
pipx install git+https://github.com/LIAUNAL/papersmith-ai.git

# 1b. Or from a clone of `main` (for framework development)
git clone https://github.com/LIAUNAL/papersmith-ai.git && cd papersmith-ai
pipx install .            # with pip: pip install .

# 1c. Update the CLI when a new release comes out
pipx upgrade papersmith-ai
#     `upgrade` doesn't see a git-URL install: reinstall
pipx install --force git+https://github.com/LIAUNAL/papersmith-ai.git
#     with pip, `--upgrade` over a git URL doesn't always re-clone
pip install --upgrade --force-reinstall "papersmith-ai @ git+https://github.com/LIAUNAL/papersmith-ai.git"

# 1d. Bring existing workspaces up to that version
smith upgrade --plan-migrations ~/papers/sparse-ae  # which artifacts are missing, without writing anything
smith upgrade ~/papers/sparse-ae                    # syncs the files and migrates the artifacts
smith status ~/papers/sparse-ae                     # drift and pending migrations

# 2–3. Only inside a repository clone, for framework development:
# Isolated runtime from the locked env/ specification (micromamba: Python 3.12, PyTorch, llama-server, docling)
python3 scripts/setup_env.py install
# Node dependencies and projection of skills to the harnesses
npm ci
npm run setup:harnesses
```

**The command is `smith`.** Installing `papersmith-ai` puts `smith` on `PATH`,
and every command in this README uses it (`smith init`, `smith upgrade`,
`smith status`, …). It is the only command: the older `papersmith` alias was
removed in 0.71.1, and `smith upgrade` repoints a workspace's MCP entries that
still launch it. Edit any user-level config that names it (`~/.claude.json`,
`~/.gemini/config/mcp_config.json`) by hand; if `papersmith` lingers on `PATH`
after `pipx upgrade`, run `pipx reinstall papersmith-ai`.

**The package is published on PyPI.** `pipx install papersmith-ai` brings the
latest release, which `pipx upgrade papersmith-ai` in **1c** updates. The git URL
in **1a** brings the tip of `main`, for framework development. The neighbouring
name `papersmith` —without the `-ai`— is also on PyPI, but it's **another
project** (Word document generation), so `pip install papersmith` doesn't install
this forge.

`main` is the only branch that's maintained, and each release also gets its tag,
so an exact build is frozen by pinning it in the URL — for example
`pipx install --force "git+https://github.com/LIAUNAL/papersmith-ai@v0.83.0"`.
**1b** takes the clone as it is, including uncommitted changes; a reproducible
build comes from **1a** or a tag. The changelog is in [CHANGELOG.md](CHANGELOG.md).

Updating is two steps and they're two different objects. **1c** reinstalls the
CLI from `main`; `smith --version` confirms the installed version. **1d**
moves each **workspace** that already exists, and it isn't optional: a release
can change the shape of an artifact a workspace has already produced —the graph
pool's `atlas.html`, for example—, so syncing the framework files without
migrating the artifacts leaves the new scaffolding reading old state.

`smith upgrade` syncs the workspace with the installed version and applies
that version's artifact migrations. The version the workspace records doesn't
advance until those migrations are done, so `smith status` may report that
it hasn't yet reached the release just installed. `--plan-migrations` reports
what's pending and finishes without writing anything; it isn't called
`--dry-run`, because it doesn't preview the kit copy. `--no-migrate`
syncs the files and leaves the artifacts as they are, with the version marker
where it was.

**Which workspaces can be upgraded.** Re-initializing a live workspace is never
the answer: `smith init` in a fresh directory leaves behind every ledger,
receipt, seal, managed revision and lock the paper has accumulated. Workspaces
recorded at 0.12.0 or later are supported, and since 0.14.0 every release that
changes the shape of something a workspace already has ships its migration in
the same release (or a compatible read that keeps reading the old shape). A
workspace older than 0.12.0 also upgrades —the files are synced and the
convergence migrations run—, but shape changes from before 0.12.0 shipped no
migration and leftovers may remain (the `.antigravity/` folders of 0.8.0 are not
removed). With no recorded version, the version-gated migrations stay
`undetermined` and are not applied; a version that cannot be ordered, or one
newer than the kit, is refused unless you pass `--allow-downgrade`. The
maintainer-side policy is in
[`docs/releasing.md`](docs/releasing.md#workspace-support-policy).

The two `upgrade`s are separate: neither one touches the other.
`smith upgrade` refuses to take a workspace to a version older than the one
it records, unless `--allow-downgrade` is passed.

`scripts/setup_env.py install` provisions **the whole** forge and ingestion
stack in a separate micromamba environment, including the `llama-server` binary
that the OCR needs — it is **not** Ollama nor a Homebrew installation. It builds
that environment from a lock: `env/environment.yml` is the one dependency
source, and `env/cpu.conda-lock.yml`, `env/cuda.conda-lock.yml` and
`env/rocm.conda-lock.yml` are conda-lock's solution of it for linux-64, osx-64,
osx-arm64 and win-64 (CUDA: linux-64 and win-64; ROCm: linux-64), so every
machine of a platform gets the same packages. It picks the CPU, CUDA or ROCm
lock from the hardware it detects; on ROCm it then adds AMD's pinned torch
wheels, and without `--no-ingestion` the pinned pip layer in
`env/ingestion.txt` (docling). A platform no lock covers (linux-aarch64,
win-arm64) is solved live from the same files, with a warning.
`requirements.txt` is generated from the same source and installs nothing;
refreshing the locks is in [`docs/releasing.md`](docs/releasing.md#refreshing-the-dependency-locks).
The micromamba it bootstraps is a pinned release
whose SHA-256 is checked before it runs; the comment above `MICROMAMBA_VERSION`
in `scripts/setup_env.py` is the procedure for moving the pin.
The locally verified Node/npm pair (26.13.0/12.2.2) is a workstation setup,
not a new minimum for workspaces: CI tests the forge on Node 24 and Caztor on
Node 26. If a shell picks an
older `node` or `npm`, check `command -v node` and `command -v npm` before
changing the project's manifests. Keep account credentials in the harness's
user configuration, never in `.pi/settings.json` or committed files.

`npm run setup:harnesses` symlinks the canonical
`skills/` tree into `.claude/skills`, `.pi/skills`, `.opencode/skills`
and `.agents/skills`, with relative, idempotent symlinks (see
[Harnesses and skill projection](#harnesses-and-skill-projection)). The first
run of `smith ingest` downloads ~1.5 GB of Surya weights if the
environment wasn't pre-provisioned.

### 2. Create a workspace

```bash
smith init ~/papers/sparse-ae \
  --title "Sparse Autoencoder Audit" \
  --topic "mechanistic interpretability" \
  --remote kaggle

cd ~/papers/sparse-ae
smith ui                     # the dashboard; works right after init
smith ui --lan               # the same, reachable from your other devices (LAN, Tailscale)
smith ui --publish-pages     # publish a read-only copy with /ui-github (public site)
smith status
smith status --json          # machine-readable snapshot
```

`smith ui` needs nothing else after `init`: when the workspace has no Python
environment yet, its first run installs the dashboard's own runtime (`fastapi`,
`uvicorn`, `watchfiles`, `PyYAML`) once into
`$XDG_CACHE_HOME/papersmith/ui-env-py<version>`, outside every workspace, and
serves from it ([docs/cli.md](docs/cli.md#smith-ui-dir)).

The workspace stays decoupled from the framework checkout: the scaffolding is
synced with `smith upgrade`, and the research artifacts are protected by
contract. What `init` creates exactly —and what gets versioned— in
[Inside the workspace](#inside-the-workspace).

### The review line (systematic reviews)

A review paper needs no experiments, but it does need an accepted method. The
review line is a second, separate path that follows the PRISMA 2020 statement
(Page et al., 2021, doi:10.1136/bmj.n71); the experimental line above is
unchanged.

```bash
smith init ~/papers/gnn-drug-review --kind review \
  --title "Graph neural networks in drug discovery: a systematic review"
```

An existing workspace whose idea turns out to be a review after plausibility
moves to this line with `smith kind set review --by "<operator>"` once
`/paper-type` has scored the idea: it records the agreed type, applies the
review contracts and flow text, removes the experimental contracts the
workspace did not edit and keeps (and reports) the ones it did. It refuses once
a proposal revision or `paper/main.tex` exists, unless `--force`.

A review workspace has `review/` instead of `proposals/`, `experiments/`,
`implementations/` and `kaggle-inbox/`; its `sections/` hold the review
contracts (title, PRISMA 2020 for Abstracts, introduction, background, methods,
results as a comparative thematic synthesis, discussion, limitations,
conclusions, and the shared back matter); and its
`CLAUDE.md` (and every other harness entrypoint) states the review flow:

1. **Scoping**: `/systematic-review scope` finds existing reviews on the topic.
2. **Protocol**: research questions (PICOC), criteria, one query per source,
   dates, appraisal checklist and extraction fields in `review/protocol.json`,
   approved by the operator (G-PROTOCOL) before any search; later changes are
   logged amendments.
3. **Identification**: searches on OpenAlex, Crossref and Europe PMC, and
   RIS/BibTeX exports from Scopus, Web of Science, IEEE Xplore or ACM, each
   logged with its date, query and count; duplicates removed by DOI and title.
4. **Screening**: title/abstract, then full text, by two reviewers (the agent
   can be one, the operator is always the other), with conflicts settled by
   the operator and Cohen's kappa reported. The review cites 100 to 200
   references: when more studies pass, `review_cli.py prioritize` ranks them by
   topical relation and journal quartile (SJR) and records the excess as a
   full-text exclusion with its own criterion.
5. **Appraisal and extraction**, every value with the quote that holds it.
6. **Synthesis**: the PRISMA flow counts and diagram
   (`paper/Figures/prisma-flow.svg`), bibliometrics, taxonomy and the answer
   to each research question.
7. **Writing** with `/paper-writing`, and the 27-item PRISMA 2020 checklist
   (`review_cli.py checklist`) for submission.

In `smith ui` the line has its own board: the Pipeline shows the review steps
and their gates, the *Revisión* tab the records above, the Archify tab the
review flow diagram and the final judge the `systematic-review` rubric. Details in
[skills/systematic-review/SKILL.md](skills/systematic-review/SKILL.md).

### The observational and measurement line

A study of data the operator collects or holds, without assigning an
intervention, is the first empirical line: observational studies (STROBE),
diagnostic or clinical validations (STARD 2015) and measurement instruments
such as indices, scales or questionnaires (COSMIN). The variant the operator
agrees with `/paper-type` chooses the reporting checklist.

```bash
smith init ~/papers/rural-youth --kind observational-measurement \
  --title "Migration intentions of rural youth: a cross-sectional survey"
```

An existing workspace moves to it with `smith kind set
observational-measurement --by "<operator>"` once `/paper-type` has scored the
idea, as for the review line. The workspace has `protocol/`, `study/`,
`analysis/` and `datasets/` instead of the experimental folders, the study's
section contracts in `sections/`, the `/observational-measurement` skill, and
its `CLAUDE.md` states the line's flow:

1. **Study protocol** with `/study-protocol-deliberation` (exactly one primary
   outcome, design, eligibility, sample size and analysis plan), approved and
   locked by the operator (G-STUDY-PROTOCOL); later changes are amendments.
2. **Ethics and registration**, recorded by the operator (or recorded as not
   applicable, with the reason).
3. **Data** the operator collects: registered as own data with its data-use
   statement, a data dictionary, quality checks and a de-identification record.
4. **Analysis** through an append-only log that labels each run confirmatory
   or exploratory against the locked protocol.
5. **Participant flow** (STROBE or STARD 2015): counts entered by the
   operator, checked, drawn and signed off.
6. **Writing** with `/paper-writing` from those records, the reporting
   checklist of the variant (`checklist_cli.py check`) and the final judge on
   the empirical-study rubric.

The assistant never generates measurements or data, and never records ethics,
consent, data collection, sign-offs or the primary outcome on the operator's
behalf. `/observational-measurement status` reports where the study stands.
Details in
[skills/observational-measurement/SKILL.md](skills/observational-measurement/SKILL.md).

### The hardware line

A device, sensor or instrument the operator designs, builds and validates
against a reference device is the hardware line, written in the HardwareX
article template and checked against the `hardwarex` and `gum-reporting`
checklists.

```bash
smith init ~/papers/soil-sensor --kind hardware \
  --title "A low-cost open soil moisture sensor for field monitoring"
```

An existing workspace moves to it with `smith kind set hardware --by
"<operator>"` once `/paper-type` has scored the idea. The workspace has the
empirical folders (`protocol/`, `study/`, `analysis/`, `datasets/`), the
HardwareX section contracts in `sections/`, the `/hardware` skill, and its
`CLAUDE.md` states the line's flow:

1. **Requirements and specifications** with `/study-protocol-deliberation`,
   signed by the operator when the protocol is approved and locked (G-SPEC).
2. **Design files and bill of materials** in an open repository with a DOI,
   and the **build**, both by the operator.
3. **Calibration and uncertainty** (G-CALIBRATION): the operator records the
   instruments and registers the raw files; `measure_cli.py` computes a GUM
   uncertainty budget per quantity.
4. **Agreement with a reference device** (G-AGREEMENT): Bland-Altman limits
   of agreement and ICC(2,1) from the registered paired files.
5. **Field or user validation**, with the ethics and registration records
   only when people take part.
6. **Writing** with `/paper-writing`, the two checklists and the final judge
   on the measurement-science rubric.

The assistant never generates measurements or data, and never records a
calibration, ethics, consent, data collection, sign-offs or the primary
outcome on the operator's behalf. `/hardware status` reports where the work
stands. Details in [skills/hardware/SKILL.md](skills/hardware/SKILL.md).

### The lab-simulation line

A laboratory or simulation study in the physical sciences is the lab-simulation
line, in two variants the operator agrees with `/paper-type`: `materials`
(synthesis, deposition or processing and the characterization of the samples)
and `modelling-simulation` (an analytical or numerical model, its solver and
its parameters). Both report every value with its GUM uncertainty and are
checked against the `gum-reporting` checklist (GUM, JCGM 100:2008, clause 7).

```bash
smith init ~/papers/thin-films --kind lab-simulation \
  --title "Annealing temperature and the sheet resistance of sputtered ITO films"
```

An existing workspace moves to it with `smith kind set lab-simulation --by
"<operator>"` once `/paper-type` has scored the idea. The workspace has the
empirical folders (`protocol/`, `study/`, `analysis/`, `datasets/`), the
study's section contracts in `sections/`, the `/lab-simulation` skill, and its
`CLAUDE.md` states the line's flow:

1. **Sample matrix or model definition**, decided by the operator: the samples,
   conditions and characterization techniques, or the model, solver,
   parameters and convergence criteria.
2. **Synthesis or simulation protocol** with `/study-protocol-deliberation`
   (exactly one primary observable, the replicates per condition or the
   parameter grid, the analysis plan), approved and locked by the operator
   (G-STUDY-PROTOCOL); ethics only when the samples come from people or
   animals.
3. **Characterization or observables**: the operator measures or runs the
   model and registers each raw data file by its SHA-256 with
   `measure_cli.py data register`.
4. **Calibration against known values** (G-CALIBRATION): every instrument
   recorded from its calibration certificate; a reference material, a
   standard sample, or for a simulation an analytical solution or benchmark
   case, reproduced first.
5. **Uncertainty**: `measure_cli.py uncertainty compute` writes the GUM budget
   per quantity (type A from the replicates, type B from the instruments,
   expanded uncertainty with its coverage factor), and every fit, comparison
   and sweep goes through the labelled analysis log.
6. **Open data and code** deposited by the operator.
7. **Writing** with `/paper-writing`, the `gum-reporting` checklist and the
   final judge on the measurement-science rubric.

The assistant never generates measurements or data, and never records an
instrument, a calibration, a data registration, the parameter grid or the
choice of the primary observable on the operator's behalf.
`/lab-simulation status` reports where the study stands. Details in
[skills/lab-simulation/SKILL.md](skills/lab-simulation/SKILL.md).

### The data-resource line

A corpus, dataset or benchmark the operator collects and releases is the
data-resource line, written as a data descriptor (background and summary,
methods, data records, technical validation, usage notes, code availability)
and checked against the `datasheets` checklist (Datasheets for Datasets).

```bash
smith init ~/papers/speech-corpus --kind data-resource \
  --title "A corpus of annotated Spanish speech recordings"
```

An existing workspace moves to it with `smith kind set data-resource --by
"<operator>"` once `/paper-type` has scored the idea. The workspace has the
empirical folders (`protocol/`, `study/`, `analysis/`, `datasets/`), the data
descriptor section contracts in `sections/`, the `/data-resource` skill, and
its `CLAUDE.md` states the line's flow:

1. **Collection protocol** with `/study-protocol-deliberation`, approved and
   locked by the operator (G-STUDY-PROTOCOL).
2. **Ethics, consent and licence** (G-ETHICS): the ethics record, and the
   operator's own-data statement or the source's licence decision.
3. **Curation and documentation**: the data dictionary, scaffolded from the
   files and completed by the operator.
4. **Quality checks** (G-DATA-QC) on the operator's files, with the
   de-identification statement when the data hold personal information.
5. **Baselines** in the labelled analysis log, exploratory unless the locked
   protocol names them.
6. **Deposit** (G-DEPOSIT): the operator deposits the files and records the
   repository, persistent identifier and licence with `datasets_cli.py
   deposit --by`.
7. **Writing** with `/paper-writing`, the `datasheets` checklist and the final
   judge on the data-descriptor rubric.

The assistant never generates, labels or alters data; collection, consent,
licence and deposit stay human. `/data-resource status` reports where the
resource stands. Details in
[skills/data-resource/SKILL.md](skills/data-resource/SKILL.md).

### The experiment-intervention line

A study that assigns a treatment and measures its effect against a control is
the experiment-intervention line: a trial with people, reported against
CONSORT 2025 (`consort-2025`), or a field, crop or animal experiment, reported
against ARRIVE 2.0 (`arrive-2`).

```bash
smith init ~/papers/reading-trial --kind experiment-intervention \
  --title "A reading programme versus usual teaching: a cluster randomised trial"
```

An existing workspace moves to it with `smith kind set experiment-intervention
--by "<operator>"` once `/paper-type` has scored the idea. The workspace has
the empirical folders (`protocol/`, `study/`, `analysis/`, `datasets/`), the
CONSORT 2025-shaped section contracts in `sections/` (with optional
field-experiment blocks for plots, blocks and experimental units, mixed models
and animal husbandry), the `/experiment-intervention` skill, and its
`CLAUDE.md` states the line's flow:

1. **Protocol and registration** with `/study-protocol-deliberation`,
   approved and locked by the operator (G-STUDY-PROTOCOL); a trial with
   people is registered prospectively, before its first enrolment
   (G-REGISTRATION).
2. **Ethics and consent** (G-ETHICS), recorded by the operator.
3. **Allocation, blocks and sample size** (G-ALLOCATION): the operator
   generates and conceals the sequence with their own tool and records it
   with `study_cli.py allocation record --by`, bound to the list's hash and
   the protocol lock.
4. **Intervention and follow-up** (G-DATA-QC): the operator's data, its
   dictionary, quality checks and de-identification.
5. **Pre-specified analysis** in the labelled analysis log.
6. **Flow of units** (G-FLOW, required for a trial with people): the CONSORT
   flow diagram from the operator's signed counts.
7. **Writing** with `/paper-writing`, the variant's checklist and the final
   judge on the empirical-study rubric.

The assistant never generates data and never generates, reads out or alters
the allocation sequence; ethics, consent, data collection and the choice of
primary outcome stay human. `/experiment-intervention status` reports where
the study stands. In `smith ui` the line's board shows these eleven steps and
its gates. A trial with people (or a workspace with no variant agreed yet)
fails G-REGISTRATION when the registration is retrospective (ICMJE requires it
on or before the first enrolment) and waits for the signed-off CONSORT flow
before writing; a field experiment passes with any current registration and
its flow never blocks writing. The board shows the allocation record's method,
row count and concealment, never the list. Details in
[skills/experiment-intervention/SKILL.md](skills/experiment-intervention/SKILL.md).

### The qualitative-participatory line

A study built on people's accounts and judgement is the
qualitative-participatory line: a qualitative or mixed-methods study (case
studies, interviews, focus groups, participatory research), reported against
SRQR (`srqr`, or COREQ, `coreq`, for interviews and focus groups); an expert
consensus or foresight study (Delphi, MICMAC, MACTOR, scenarios), reported
against ACCORD (`accord`); or an experience report (a teaching innovation or a
programme), which has no reporting checklist.

```bash
smith init ~/papers/panela-chain --kind qualitative-participatory \
  --title "Selling together: a qualitative case study of a panela cooperative"
```

An existing workspace moves to it with `smith kind set qualitative-participatory
--by "<operator>"` once `/paper-type` has scored the idea. The workspace has
the empirical folders (`protocol/`, `study/`, `analysis/`, `datasets/`), the
SRQR-shaped section contracts in `sections/` (with optional consensus blocks
for the panel, the pre-specified threshold, the rounds and the MICMAC map, and
optional experience-report blocks), the `/qualitative-participatory` skill,
and its `CLAUDE.md` states the line's flow:

1. **Case, panel or experience and its framework** with
   `/study-protocol-deliberation`, approved and locked by the operator
   (G-STUDY-PROTOCOL, optional for an experience report); a consensus study
   records its threshold and rounds against the locked protocol.
2. **Ethics and consent** (G-ETHICS), recorded by the operator; an experience
   report without participant data records it as not applicable.
3. **Fieldwork, rounds or implementation**: the operator registers each
   de-identified transcript or field note (`qual_cli.py transcripts add
   --by`, G-TRANSCRIPTS), or the panel and each round's responses
   (`consensus_cli.py panel add|round record --by`, G-ROUNDS).
4. **Coding, consensus or reflection** (G-ANALYSIS): the operator records each
   codebook version and signs the themes off (`qual_cli.py themes signoff
   --by`); a consensus study reads its agreement per round and may compute a
   MICMAC map from the operator's influence matrix.
5. **Integration with prior work**, then **writing** with `/paper-writing`:
   every participant quote is written `\pquote{<code>}{<text>}` and must be
   found verbatim in a registered transcript (`qual_cli.py quotes check`,
   and `paper_cli.py verify`), the variant's checklist and the final judge on
   the qualitative-study rubric.

In `smith ui` the line's board has ten steps with G-STUDY-PROTOCOL, G-ETHICS,
G-TRANSCRIPTS, G-ROUNDS (consensus-foresight only) and G-ANALYSIS, decided by the
agreed variant. A qualitative or mixed study (and any workspace with no variant
agreed) needs the protocol, the ethics record, current transcript registrations and
a current theme sign-off. A consensus study needs the protocol, the ethics record,
the consensus plan and every planned round, with any recorded MICMAC analysis
current; its transcripts are optional. An experience report keeps the protocol and
the transcripts optional, and G-ANALYSIS does not apply. Writing waits for every
gate. The board never shows a transcript's text, a response or a comment.

The assistant never generates data, never writes or edits a transcript, never
invents or polishes a quote and never enters a rating; ethics, consent, data
collection and the analytic sign-off stay human.
`/qualitative-participatory status` reports where the study stands. Details
in
[skills/qualitative-participatory/SKILL.md](skills/qualitative-participatory/SKILL.md).

### Open the dashboard from another device

`smith ui` listens on `127.0.0.1` only, so only the machine that runs it can open
it. To work from a phone, a tablet or another laptop on the same network:

```bash
smith ui --lan                         # once
export PAPERSMITH_UI_LAN=1             # in ~/.bashrc: every smith ui does it
```

`--lan` binds `0.0.0.0` and prints the addresses to open, for example
`http://192.168.1.15:8080/` and `http://<hostname>.local:8080/`. When
[Tailscale](https://tailscale.com) runs on the machine
(`sudo systemctl enable --now tailscaled && sudo tailscale up`), its MagicDNS name
`http://<hostname>.<tailnet>.ts.net:8080/` works too, from any of your Tailscale
devices, away from home included. Only this machine's own addresses and names
are accepted; any other `Host` gets `421`.

The **support terminal** (the Smith CLI Assistant, a shell with your user's
rights) and the **API-key panel** stay locked on each device until it logs in:

1. The first `--lan` start creates a secret in
   `~/.config/papersmith/terminal-token` (mode `600`) and prints it once, inside
   one login URL per address. Bookmark one on each device; it keeps working
   across restarts.
2. A device without the bookmark opens the plain dashboard, opens the terminal
   window and pastes the secret into its password box (`cat
   ~/.config/papersmith/terminal-token` on the server shows it). The browser can
   save it like a password.
3. The login lasts until the server stops: after each restart, open the
   bookmark or press **Log in** again.

Delete the token file to get a new secret. `--no-lan` turns it off for one run,
and `--no-terminal` serves the dashboard without the terminal at all.

**Only on a network you trust.** The rest of the dashboard has no login, and
plain HTTP carries the secret and every keystroke unencrypted. Never forward the
port to the Internet: `--lan` warns when the machine has a public address. From
outside, use Tailscale or an SSH tunnel
(`ssh -L 8080:127.0.0.1:8080 <server>`, then `http://127.0.0.1:8080/`). The
lower-level flags (`--host`, `--allowed-host`, `--network-terminal`,
`--terminal-token-file`) are in [docs/cli.md](docs/cli.md#smith-ui-dir) and the
terminal's rules in [docs/terminals.md](docs/terminals.md).

### 3. Ingest literature

```bash
smith ingest https://arxiv.org/abs/2309.08600    # arXiv, OpenReview or URL
smith ingest ~/Downloads/reference-paper.pdf     # local PDF
smith ingest ~/Downloads/scan.pdf --ocr       # scanned: balanced OCR mode
```

Each loose PDF ends up in its own folder, next to its Markdown (text + LaTeX +
tables, with the bibliography stripped) and the images of its figures. The
pipeline's details, in the `paper-ingestion` section of the
[Anatomy](docs/skills.md#anatomy-of-each-skill).

### 4. Deliberate, implement and run

```bash
smith deliberate . --action status                                   # state of the managed proposal
smith implement . --action verify --target implementations/my-repo   # over an already materialized repo
smith run smoke_and_invariants --dry-run                             # plans; dispatches nothing
smith novelty status                                                 # hypotheses vs evidence, G-EXP-POC and G-NOVELTY
smith novelty approve --gate poc --notes "PoC verdicts hold"         # verify the proof of concept: unlocks the full experiments
python skills/_core/results/discussion_cli.py check --product implementations/my-repo/MyPaper   # a stage's results discussion
```

`smith novelty` also takes `approve`, `iterate --stage {experiments,proposal,plausibility}`
and `reset`, each with `--gate {poc,full}` (default `full`); the discussion tool takes `scaffold`, `check` and `status`. Both are
described in [The dashboard](#use-flow--the-short-path) above and in
[docs/cli.md](docs/cli.md#smith-novelty-statusapproveiteratereset).

Inside a harness, the same capabilities are requested by skill name:
`/paper-ingestion`, `/proposal-deliberation`, `/experimental-deliberation`,
`/proposal-implementation`, `/experimental-implementation`, `/paper-writing`.
The ones that don't depend on a domain — `/kaggle-accounts`,
`/remote-execution`, `/skill-audit` — act as gatekeeper, memory and auditor of
what is sent out.

---

## How it works — the order

### Step 1 — Check that the idea is plausible (`plausibility`)

Before there is anything to ingest there is an idea, and this is the step that
tests it. It needs no PDFs, which is why it comes first: all three stretches work
from the idea and from what can be found about it.

| Stretch | Runs as | Ends at |
| --- | --- | --- |
| **Scout** | the `sota-scout` agent | the pool — 25 candidates with abstracts, in 3 to 7 families, plus the provisional plausibility note |
| **Constellation** | the `sota-grapher` agent | the single `atlas.html` beside `atlas.json`, with the checker's green run |
| **Screen** | the `novelty-screener` agent | the plausibility report — graded claims, a ranked top 5, and one closing paragraph on where the proposal stands |

Everything lands in `sota-pool/`, which is ignored like `guidance/`.
**Nothing here files into `guidance/`**: this step reads the literature, it does
not collect it. The pool it leaves behind is what `proposal-deliberation` shows
alongside the mathematics, and its ranked top 5 is what tells the ingestion step
which PDFs are worth having.

An idea stated in fewer than two sentences is refused before the search starts:
scouting an unstated idea invents its own question. A claim with no abstract
passage behind it does not become a planet — a quoteless planet is a drawing.

**Ai2's Asta, with your key.** Save an Asta key once (the dashboard's Doctor →
API keys, or `smith keys set asta`) and the scout searches Asta — the Semantic
Scholar corpus — first in Claude Code and OpenCode, and every candidate resolves
with `--resolver auto`, which asks Asta and then OpenAlex and keeps the first
record that carries an abstract: a paper OpenAlex holds without one can still
enter the pool. Without the key nothing changes. Pi and Antigravity scouts keep
searching the web (their subagents get no MCP grant that fails safe); their main
sessions can still use Asta. Ai2 licenses Asta for academic, non-commercial use
with acknowledgement.

**Thematic help, when the idea is not clear yet.** In the dashboard, the box
that opens when you click phase 2 carries an optional *Ayuda temática*. Type 3 to
5 keywords and the server asks the lab's `banco-lia` MCP (its `search_bank` tool)
for the best matches; the panel lists the ranked LIA items (projects and
articles), the topics they fall under and a proposed `/plausibility` idea,
composed from your keywords and those matches, in an editable text area.
Nothing runs until you press **Aprobar y lanzar**, which sends
`/plausibility <your edited idea>` through the same launch path as any other
phase-2 prompt, so the two-sentence rule still applies. The bank items are LIA
continuity context, never SOTA evidence. It needs `uv`/`uvx` on `PATH` and the
`banco-lia` entry of the workspace's `.mcp.json`; the first run downloads the
package and later runs work offline. If the bank cannot be reached the panel
says why and you write the idea yourself. Details and the endpoint
(`POST /api/plausibility/suggest`) are in [docs/mcp.md](docs/mcp.md#the-dashboards-thematic-help).

### Step 2 — Put each PDF in the folder according to its role

| Folder | What goes here |
|---------|------------|
| `guidance/paper-guide/` | **Guide papers** — the methodological / style references. `proposal-deliberation` loads them as context at the start of each deliberation. |
| `guidance/reference-papers/` | **Reference corpus** — supporting papers, ingested to Markdown for consultation. They aren't loaded automatically into the deliberation. |
| `guidance/data-paper/` | **Data paper — mandatory for `experimental-deliberation`.** It describes the research's database and is the **ceiling**: it bounds what can be claimed. A claim the data doesn't support isn't an experiment. Without this folder populated, `CREATE_INITIAL_REVISION` can't start. |

**All three folders travel empty.** Each one arrives in a clone with its `.gitkeep` and nothing more: `guidance/*/*` is ignored, with `!guidance/*/.gitkeep` as the only escape hatch. The scaffolding is versioned, the PDFs and their Markdown are not. `tests/test_forge_scaffolding.py` derives both halves —what the `profile.ts` declare as source against what git actually tracks— and goes red if a declared folder stops travelling.

### Step 3 — Ingest the PDFs (PDF → Markdown)

In **Claude Code**, the skill is invoked:

```
/paper-ingestion
```

(or, in Spanish: *"ingiere los papers"*). For each **loose** PDF, it creates a
folder with the paper's name, moves the PDF inside and writes a lightweight
`<name>.md` (text + LaTeX + tables, with the bibliography stripped) together
with the images of the figures:

```
guidance/reference-papers/computers-13-00176-v2-1/
├── computers-13-00176-v2-1.pdf
├── computers-13-00176-v2-1.md
└── _page_4_Figure_2.jpeg   (figures that the .md references)
```

A **loose PDF** (directly in a source root folder) is pending; a paper that's
already inside its folder is skipped. Re-ingesting means deleting the paper's
folder (leaving the PDF loose) and running the skill again. The configuration
lives in `papersmith.yaml` (`source_roots`, `mode`, `strip_references`,
`force_ocr`). If a PDF's tables come out scrambled because its text layer is
bad, `--force-ocr` (or `force_ocr: true`) rebuilds every page by OCR instead of
reading that layer.

### Step 4 — Deliberate over a proposal (`proposal-deliberation`)

In **Claude Code**, the skill is invoked:

```
/proposal-deliberation
```

On the first turn it automatically loads the Markdown from `guidance/paper-guide/`
as context and acts as a mathematics tutor. The available actions:

- describe an idea and ask for a first version,
- ask for edits to a managed proposal,
- run the lifecycle of managed revisions.

The proposal is built in one order, and the dashboard holds it: **the central
problem and its pillars**, then **the hypotheses** each pillar predicts, then
**the mathematics** in `$$ … \tag{N} $$` blocks. Each step stays locked until the
one before it exists on disk (`.papersmith/model_spec.json` or the revision's
`.sky.json` overlay, then a numbered equation in the latest revision), and the
*Mapa Conceptual & Modelo* tab shows the three with a *Generar y deliberar*
button that types the step's `/proposal-deliberation` into the agent. Once the
hypotheses are discussed and the mathematics and novelty proposed, the
`paper-reviewer` agent classifies the proposal's contribution type
(`General`, `Theory`, `Use-Inspired`, `Concept & Feasibility` or `Negative
Results`), shown right after the hypotheses. This judge-reviewer is the fifth
step: the *Lanzar el juez-revisor* button on that card launches it, and Phase 5
stays locked until it records a type.

The fourth step comes before the judge, so it reads justified ideas: every
pillar, hypothesis, concept-map layer and numbered equation names 2 to 5
references of `sota-pool/candidates.json`, each with the reason it supports the
idea, in `.papersmith/citations.json`. The same file justifies each experiment
of the latest protocol: until they are cited, `/proposal-implementation` and
`/experimental-implementation` stay locked, G-EXP-POC refuses its approval
(`SOTA_CITATIONS_OWED`) and Phase 5 cannot pass. The buttons in the stepper and
in the *Experimentos* tab ask the agent for them, and each panel shows them
beside the idea. Every conversation with an agent is kept in full in
`.papersmith/ai-history/`, tracked by git and committed by the dashboard, with common
secrets and personal data masked; review it before sharing a repository, because a
pattern cannot catch everything. The problem tree (central problem, 2 to 3 direct causes and
their effects) and the tree of pillars and hypotheses raise the bar: the problem,
each cause, each pillar and each hypothesis cite Q1 or Q2 journal articles at most
4 years old, and `python skills/_core/results/citations_cli.py rank --root .`
records each reference's SJR quartile in `sota-pool/journal-ranks.json`. Preprints
from accepted labs (Google, Google DeepMind, OpenAI, Anthropic, Microsoft, Meta,
NVIDIA, Apple, IBM, Amazon, Allen Institute for AI, Xanadu, Quantinuum, IonQ) count
too, found in OpenAlex or confirmed by the operator with `citations_cli.py lab`.
`python skills/_core/results/citations_cli.py check --root .`
prints what is owed and exits non-zero. A valid citation is in the pool, states
a reason and carries a `quote`: 20 to 300 characters of the pool record's
`abstract`, verbatim (whitespace aside) and starting and ending on word
boundaries, so a reference without an abstract cannot be cited; the panels show
the quote. `python skills/_core/results/citations_cli.py routes --root .` prints
each pool reference with the ideas it is cited for, their quotes and whether
they are `grounded`, plus the `uncited` ones. Existing workspaces lose their
Phase 4 PASS until they are cited. The step ends with `smith atlas coverage .`,
which lists the cited references the SOTA constellation does not draw yet.

Discuss the concept map and the
equations with `/math-tutor` before implementing the revision.

Proposals live in `proposals/`, one per managed revision
(`research-concept-<slug>-rNN.md`, or without the slug, such as `research-concept-r07.md`).

Each published revision travels with its own constellation: the SOTA's with the
proposal inside, in `proposals/research-concept-<slug>-rNN.graph.html`, drawn by the
same 3D viewer as the atlas and named from the revision. The deliberation's
publication stretch produces it, from the `proposals/research-concept-<slug>-rNN.sky.json`
overlay written during the discussion: there the main idea, the topics the
proposal takes from the SOTA papers, its novelty, the problem it would solve and
three to five concepts remain as nodes and edges instead of as sentences. If
that overlay doesn't exist, the stretch reports it as pending instead of drawing
relationships nobody agreed on.

### Step 5 — Design the experiments (`experimental-deliberation`)

```
/experimental-deliberation
```

Before any code, the protocol: every experiment declares the claim of the
proposal it tests, its metric and its SOTA baseline, and the deliberation
publishes it as a managed revision in `experiments/` only after you accept it.
It needs the data paper in `guidance/data-paper/` (the ceiling of what can be
claimed). `/experiments-tutor`, from the *Experimentos* tab, questions each
design decision with you; a change of decision goes back to this skill. An
experiment is any heading, of any level, carrying `[exp:<id>]`; each one is
cited from the SOTA pool like the ideas of Step 4, and the step ends with
`smith atlas coverage .`.

### Step 6 — Data and the comparison methods (`datasets`, replication)

`/datasets synth` gives the proof of concept a seeded toy set, always; `search`,
`license`, `qc`, `prepare` and `publish` find, license, measure and prepare the
one official dataset the full experiments read (publishing is private and only
with your consent). `/proposal-implementation` then hands each baseline paper to
the `paper-replicator` agent, which adopts and audits the paper's published code
when it exists and reimplements the method otherwise, leaving a
`REPLICATION.md` correspondence table.

### Step 7 — Build the proof of concept (`proposal-implementation`)

In **Claude Code**, the skill is invoked:

```
/proposal-implementation
```

It takes the current revision and materializes it in a target repository, which
lives in `implementations/` with its own git and its own virtual environment. The
flow has two separate phases:

1. **Structure.** If the repo comes with content, it moves it to the layout and
   verifies —without running anything— that notebooks, paths and references
   still resolve. It doesn't audit or validate the code that was already there:
   it's what's there, tidied up.
2. **Materialization.** Only then does it implement the mathematics and subject
   it to the validation ladder.

```
<repo>/
├── <Name>/            Notebooks/  Data/  Results/  Models/
├── src/<Package>/     one implementation per mathematical object
├── tests/             smoke · invariants · synthetic · audit · remedies
└── pyproject.toml
```

The ladder has five levels, from the cheapest to the most expensive: **smoke**,
**invariants** (each claim of the proposal anchored to a test), **synthetic**
(deterministic, fixed seed), **audit** (findings about the mathematics, measured
over 200 random configurations) and **remedies** (each proposed fix validated
with the same rigour). A finding without a validated remedy isn't reported.

The proof of concept is done when its `Results/discussion.json` is complete
(`python skills/_core/results/discussion_cli.py scaffold|check --product
implementations/<repo>/<Name>`): a verdict per hypothesis backed by its test,
the novelty and the qualitative analysis. The `paper-reviewer` agent then
classifies the contribution type of those findings: launch it with the
judge button in the *Novedad & Hallazgos* tab, because `G-EXP-POC` and
`G-NOVELTY` refuse their approval until each complete discussion has its type.

### Step 8 — Verify the proof of concept (`G-EXP-POC`)

You, not an agent, verify the proof of concept's results and the hypotheses it
contrasted: in the *Novedad & Hallazgos* tab's verification card, from the
*Experimentos* stepper's *verify* step, or with
`smith novelty approve --gate poc` (`iterate --gate poc` sends it back). Until
then the full experiments stay locked: sub-phase 5.12, the
`/experimental-implementation` action and the stepper's full-experiment button.

### Step 9 — Run the full experiments (`experimental-implementation`)

`/experimental-implementation` turns the protocol into code and measures it,
after a timing probe (`Results/timing.json`) and, only when the deliberation
judged it worthwhile, a nested hyperparameter search
(`/hyperparameter-search`). `experiments-reviewer` reviews the code before any
rehearsal. A run whose local estimate exceeds 20 minutes goes to Colab or
Kaggle: `/kaggle-accounts validate`, then `/remote-execution` (rehearsal, then
the launch only you authorize). `/experiment-diagrams` draws the approved proof
of concept and experiments, and you validate each drawing. The run closes with
its own complete `Results/discussion.json`.

### Step 10 — Decide on the findings (`G-NOVELTY`)

*Novedad & Hallazgos* contrasts every hypothesis verdict with the SOTA pool,
shows the findings' contribution type and the reviewer-defense
checklist, and records your decision with `smith novelty approve` or `iterate`
(back to experiments, proposal or plausibility). It opens once Phase 5 has
passed.

### Step 11 — Write the paper (`paper-writing`)

`/paper-writing` opens the `paper/` tree and its section contracts
(scaffolding), records each decision of the paper with `mark` (declarations)
and then writes one named block at a time; every claim needs a source that
holds it. `/figure-review <figure id>` checks each compiled figure. After the
citations change, `smith atlas coverage .` lists the cited papers the SOTA
constellation draws only as placeholders.

### Step 12 — Compile, review and choose a journal

The *Previsualización PDF* tab compiles `paper/main.tex` to `paper/main.pdf`,
scores each section's style and redundancy from 0 to 100, shows the final
judge's verdict per round (`.papersmith/paper_review.json`), ranks
international journals for a quartile range you choose or Colombian Publindex
journals (A1, A2, B) by review time, and compiles the Spanish translation when
the chosen journal only receives Spanish
([Choosing and adapting to a journal](#choosing-and-adapting-to-a-journal)).
The final judge's panel has a "Run round N of the judge" button that types the
next round's request into the agent.

**Caztor, the LaTeX editor in the PDF tab.** The tab's toolbar switches between
the PDF viewer and Caztor, a LaTeX editor that comes with the install: files,
editor, the PDF it compiles with Tectonic (into `.caztor/build`, never
`paper/main.pdf`) and an assistant chat that can run opencode, Claude Code, Pi
or Antigravity with the workspace's tutors and reviewers as switches. Caztor
starts when the tab opens with the **LaTeX editor** switch on, bound to
loopback and framed only by the dashboard; switching it off shows the viewer
and stops Caztor, and it also stops with `smith ui`. It needs
Node.js 26 and `tectonic`; when either is missing, smith downloads it once
into `~/.cache/papersmith/tools/` and checks it against a pinned SHA-256
(`PAPERSMITH_NO_TOOL_DOWNLOAD=1` turns that off). The editor opens only in a
browser holding the terminal login: the access link `smith ui` prints (or the
browser it opens), the same one the CLI assistant needs; without it the tab
says so, offers **Activate** and shows the viewer. The toolbar also holds
Style & redundancy, open in a new tab and the Change Control toggle, whose
panel folds to a narrow handle. Details in
[docs/cli.md](docs/cli.md#smith-ui-dir).

`smith audit .` and `/skill-audit` report across every phase; they never
repair.

That is all that is needed to use the forge. **What goes on inside** each
skill —its steps, its pieces, how they connect to each other and what
limitations each one has— is detailed in [Anatomy of each
skill](docs/skills.md#anatomy-of-each-skill). For the literal contract, each one's
`SKILL.md`.

---

## Inside the workspace

`smith init` creates a self-contained directory —with no git initialized and
without touching the framework checkout— with this shape:

```
my-paper/
├── .papersmith/                 # workspace state (config, manifest, ledger)
│   ├── config.json              #   active target and profile, ledger paths
│   ├── manifest.json            #   hashes of everything the framework generated
│   ├── runs_ledger.jsonl        #   every dispatched run, in order
│   └── version                  #   framework version that created it
├── .claude/agents/              # the thirty-three subagents (single source of truth)
├── skills/                      # the kit copy: the skills + _core
│   └── _core/                   #   the two shared engines (deliberation, implementation)
├── sections/                    # the ten section contracts (they travel WITH content, like skills/)
├── guidance/
│   ├── reference-papers/        # drop-zone: reference PDFs go here
│   ├── paper-guide/             # guiding papers for method and style (optional but recommended)
│   └── data-paper/              # data paper (mandatory for experimental-deliberation)
├── proposals/                   # managed revisions, flat: research-concept-[<slug>-]rNN.md
├── paper/                       # the paper's LaTeX (paper-writing writes it here)
├── experiments/                 # the managed experimental protocol
├── implementations/             # destination repos; each one with its own git
├── kaggle-inbox/                # what comes back from the remote workers
├── CLAUDE.md / OPENCODE.md / .agents/AGENTS.md   # harness routing
├── .pi/APPEND_SYSTEM.md         # harness routing (Pi appends it to the system prompt)
├── papersmith.yaml              # workspace configuration (editable)
├── package.json                 # workspace Node dependencies (jiti, typebox), editable
├── requirements.txt
├── scripts/setup_env.py         # ingestion runtime provisioning
└── README.md                    # brief description of the workspace
```

Every research folder (`guidance/*/`, `proposals/`, `paper/`, `experiments/`,
`implementations/`) arrives empty, with its own `.gitkeep`: the workspace's
`.gitignore` applies the same rule this repository applies to itself —the
folder is versioned, the content never is. The tutors' threads and the pages
you upload to them (`.papersmith/math-tutor/`, `.papersmith/experiments-tutor/`)
are ignored too: they are yours.

### `papersmith.yaml` — the configuration you will actually touch

The file comes with three example targets and three execution profiles. The
targets declare **where** the work runs; the profiles, **what** runs and how
it is split up:

```yaml
compute_targets:
  default: "kaggle-gpu-pool"
  targets:
    local-workstation: { provider: "local", device: "cuda:0" }
    kaggle-gpu-pool:   { provider: "kaggle", accelerator: "GPU_T4_X2", ... }
    slurm-cluster:     { provider: "remote-ssh", host: "hpc.university.edu", ... }

execution_profiles:
  smoke_and_invariants:  { target: "local-workstation", entrypoint: "{target_python} -m pytest {target}/tests/test_invariants.py" }
  sweep_training:        { target: "kaggle-gpu-pool", sharding: { … }, artifacts: { … } }
  benchmark_evaluation:  { target: "kaggle-gpu-pool", entrypoint: "papermill …/benchmark.ipynb" }

paper_ingestion:
  engine: auto          # route each page: pypdfium2 fast path, Docling only where needed
  mode: fast            # fast (route pages) | balanced (every page through Docling)
  strip_references: true
  source_base: guidance
```

The active target and profile live in `.papersmith/config.json`; `smith
target set` changes them. The `paper_ingestion` block is owned by the ingestion
skill and the orchestrator treats it as opaque (it is edited with the skill, not
by hand).

### What is versioned and what is not

`smith upgrade`'s preservation contract is explicit: it never touches
`guidance/`, `proposals/`, `paper/`, `experiments/`, `implementations/`,
`kaggle-inbox/`, `papersmith.yaml`, `package.json`, `README.md`
nor the `.env*` files. Everything else is framework scaffolding and `upgrade`
syncs it —with `--force` if needed— leaving the artifacts intact.

In this repository the same rule holds for Git: the scaffolding is versioned,
the content is not. Research folders travel with their `.gitkeep` and nothing
else; `guidance/` versions the folders and never the PDFs nor the ingested
Markdown. `sota-pool/` follows the same contract: the folder travels, and
`candidates.json`, `atlas.json` and `atlas.html` —which inlines the full 3D
viewer— stay on the machine that produced them.

Preserving is not migrating. Not touching an artifact protects it while
its shape does not change; the day a release changes that shape, something is
needed to carry it up to it. That is the job of [artifact
migrations](docs/cli.md#artifact-migrations), and it is also the reason
`.papersmith/version` stopped advancing just because files had been copied.

### The state: `.papersmith/`

- **`manifest.json`** stores the hash of every generated file. `smith
  audit --check-drift` compares against the disk and names what drifted; the
  repair is `smith upgrade`, never a hand edit.
- **`runs_ledger.jsonl`** is append-only: every `smith run` that gets
  dispatched is recorded with its target, its profile and its result.
- **`config.json`** stores the active target, the active profile and the ledger's
  configuration paths.
- **`migrations.json`** records which version-tied artifact migrations have
  already been applied, so that `upgrade` does not repeat them. Convergence
  ones are never recorded: they never end. If the file gets damaged,
  `upgrade` refuses and `status` reports it; it must not be edited by hand.
- **`version`** is the version the workspace declares for its **artifacts**,
  not for its files. Of the two markers it is the one that lags behind when
  a migration fails, and that is why `status` can say the workspace has not
  yet reached the installed release.

---

## Harnesses and skill projection

`skills/` at the repository root is the **single source of truth**. Each
harness reads skills from its own folder, so the projection script symlinks
the canonical tree into each one with **relative** and idempotent symlinks:
running it again converges to the same layout and the checkout stays
relocatable.

```bash
npm run setup:harnesses      # = bash scripts/setup-harnesses.sh
```

| Harness | Where it reads skills from | Routing document (workspace) |
|---------|----------------------------|-------------------------------|
| Claude Code | `.claude/skills/` | `CLAUDE.md` |
| Pi | `.pi/skills/` | `.pi/APPEND_SYSTEM.md` |
| OpenCode | `.opencode/skills/` | `OPENCODE.md` |
| Google Antigravity | `.agents/skills/` | `.agents/AGENTS.md` |

### What each harness wires

`smith init` and `smith upgrade` generate, for each harness the
workspace declares, what this table shows. It is the same matrix as
`HARNESS_CAPABILITIES` in `src/papersmith/generators.py`, and a test
(`tests/test_harness_parity.py`) verifies that both match. `wired` is what
gets generated; `unsupported` is what does not get generated; `opt-in` is
only documented, and it is enabled manually.

<!-- harness-capabilities:start -->
| Harness | Skills | Commands | Agents | Plugins / guards |
|---------|--------|----------|---------|------------------|
| Claude Code | wired | wired (`.claude/commands`) | wired (`.claude/agents`) | opt-in (see [guard-hooks](docs/guard-hooks.md)) |
| OpenCode | wired | wired (`.opencode/commands`) | wired (`.opencode/agents`) | wired (`.opencode/plugins/refuse-offpath-push.js`) |
| Pi | wired | wired (`.pi/prompts`) | wired (`.pi/agents`) | wired (`.pi/extensions/refuse-offpath-push.js`) |
| Google Antigravity | wired | unsupported — via skills (workflows deprecated) | wired (`.agents/agents`) | unsupported |
<!-- harness-capabilities:end -->

When it finishes, `init` and `upgrade` print one line per active harness with
the state of each capability (`wired`, `unsupported`, `failed` or `blocked`) and
add the `wiring` key to its result. If a skill symlink could not be created, or
there is a real directory where the symlink would go, they report it as a warning
(`failed` / `blocked`) instead of silently omitting it.

Pi's agents use the web tools `web_search` and `fetch_content` from the
[`pi-web-access`](https://www.npmjs.com/package/pi-web-access) package. The
workspace declares it in `.pi/settings.json`, which Pi reads once you trust the
project and installs from there; nothing needs installing by hand. `init` writes
that file, `upgrade` adds it to an older workspace that lacks it, and neither
touches an existing one (add packages to it with `pi install -l <source>`).

What the table does not promise:

- **Pi and Gentle Shell:** the agents in `.pi/agents` are only read by the
  third-party package `pi-subagents`; Pi core has no subagents. Gentle Shell's
  own orchestrator and subagents are user-level features, not installed or
  configured by this repository. The generated Pi persona belongs to an
  initialized workspace, not to this source checkout. Without a subagent
  package, the projected agent files exist but remain unused.
- **Claude Code:** the guard is opt-in. Papersmith never writes or merges
  `.claude/settings.json`; the snippet to enable it is in
  [`docs/guard-hooks.md`](docs/guard-hooks.md).
- **Antigravity:** there is no guard until its hooks' input schema is obtained
  (`.agents/hooks.json`).
- **Antigravity, commands:** no command files are generated. Its only
  slash-command mechanism, workflows, is deprecated in favor of skills
  (retirement 2026-11-01) and the workflows' workspace path is not verified
  (`.agents/workflows` is an assumption). Skills already work as
  `/<skill-name>` through `.agents/skills`, so all of them stay invocable
  as commands.
- **Antigravity, documented locations only:** `.antigravity/rules.md` and
  `.antigravity/skills` are no longer generated. Antigravity uses `.agents/skills`,
  `.agents/agents/` and `.agents/AGENTS.md` (plain text, no frontmatter). Existing
  workspaces are not migrated: `smith init` must be run in a new workspace.

#### Verified support matrix

Summary of [`docs/harness-support-matrix.md`](docs/harness-support-matrix.md),
read against each tool's documentation on 2026-10-02. It is what the
tool documents, not what Papersmith generates (that is the table above).
`unverified` means no primary source was read.

| Harness | Skills | Commands | Agents | Plugins / hooks | MCP / config | Sources (2026-10-02) |
|---------|--------|----------|--------|-----------------|--------------|----------------------|
| OpenCode | supported: `.opencode/skills` | supported: `.opencode/commands` | supported: `.opencode/agents` | supported: `.opencode/plugins/` | supported: `opencode.json` | <https://opencode.ai/docs/skills/>, <https://opencode.ai/docs/commands/>, <https://opencode.ai/docs/agents/>, <https://opencode.ai/docs/plugins/>, <https://opencode.ai/docs/config/> |
| Pi | supported: `.pi/skills`, `.agents/skills` | supported: `.pi/prompts/*.md` | unsupported in the core; third-party only (`.pi/agents`, `pi-subagents`) | supported: `.pi/extensions/` | supported: `.pi/mcp.json` | <https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/configuration.md>, <https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/prompt-templates.md>, <https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/extensions.md>, <https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/mcp.md>, <https://github.com/nicobailon/pi-subagents/blob/main/docs/agents.md> |
| Google Antigravity | supported: `.agents/skills` | supported but deprecated (workflows); path `.agents/workflows` unverified | supported: `.agents/agents` | supported: `.agents/hooks.json` (input schema unverified) | supported: `.agents/mcp_config.json` | <https://antigravity.google/docs/skills>, <https://antigravity.google/docs/ide/workflows>, <https://antigravity.google/docs/subagents>, <https://antigravity.google/docs/hooks>, <https://antigravity.google/docs/mcp> |
| Claude Code | supported: `.claude/skills` | supported (legacy format): `.claude/commands` | supported: `.claude/agents` | supported: `.claude/settings.json` (Papersmith never writes it) | supported: `.mcp.json` (Papersmith registers only the servers it manages: the lab's `banco-lia`, Kaggle's official `kaggle`, Google Colab's `colab` and Ai2's `asta`) | <https://code.claude.com/docs/en/skills>, <https://code.claude.com/docs/en/sub-agents>, <https://code.claude.com/docs/en/hooks>, <https://code.claude.com/docs/en/mcp> |

- `.antigravity/skills` and `.antigravity/rules.md`: unsupported (no source found)
  and no longer generated; Antigravity uses `.agents/skills`, `.agents/agents/` and
  `.agents/AGENTS.md`.
- Antigravity deprecated workflows in favor of skills (2026-11-01, source:
  <https://antigravity.google/docs/ide/workflows>).
- Pi: the tool names `mcp` and `mcpScript` have no source
  (unsupported, no source found).
- The docs of these tools change fast; a cell should be re-verified before
  being relied on after that date.

The sources of each cell are in
[`docs/harness-support-matrix.md`](docs/harness-support-matrix.md).

Inside a generated **workspace**, the behavior is slightly different:
the workspace ships the full `skills/` tree and the agent
tree (`.claude/agents/`), and its routing docs point at the canonical tree
`skills/*/SKILL.md`. The routing documents are generated projections: the
real source of each agent is `.claude/agents/*.md` and the source of each skill is its
`SKILL.md`. The projections must not be edited by hand; they regenerate (and
`smith audit --check-drift` warns if one drifted). `init` and `upgrade` generate one slash command per skill
in `.claude/commands/`, `.opencode/commands/` and `.pi/prompts/`; Antigravity does not
receive command files and reads skills through its symlinks. Agents are
projected from `.claude/agents/` to `.opencode/agents/`, `.pi/agents/` and
`.agents/agents/`. For a harness to
list the skills as `/` commands, `npm run setup:harnesses` must be run inside
the workspace: it symlinks the shipped tree into `.claude/skills`,
`.pi/skills`, `.opencode/skills` and `.agents/skills`, just as relative and
idempotent as in the checkout. In this checkout, the slash command projections
(`.claude/commands/`, `.opencode/commands/`, `.pi/prompts/`), the agent projections
(`.opencode/agents/`, `.pi/agents/`, `.agents/agents/`) and the OpenCode and Pi guards
are synced with `python scripts/sync-repo-harness.py` (`--check` for CI; it
has no script in `package.json` because the kit ships it and the script is
repo-only).

---

## The agents

A workspace ships **thirty-three subagents** in `.claude/agents/`. They are short
bursts of work that a harness launches (for example, with the Task tool) on
request, not replacements for the CLI. The shape is always the
same — **one burst between two operator gates**: the agent decides
nothing, asks nothing, and ends up reporting what it found and how much it cost
to establish it. The operator opens and closes the gates.

| Agent | What it is for | Skill it loads |
|-------|----------------|----------------|
| `implementation-build` | From the approved object→module map to the findings report: materializes the scaffolding, writes one module per object with its provenance and its invariant tests, and validates the admitted remedies. | `proposal-implementation` |
| `implementation-walk` | Walks the declared flow act by act, in order: runs the local steps, records each product and stops at the rehearsal before launch. It has no path to submit a campaign. | `proposal-implementation` |
| `paper-replicator` | The `fidelity` stage for a comparison or baseline paper: it first searches for the paper's published code; when it exists, it adopts it pinned to a commit with its license and audits correspondence with the paper (match, deviation, unspecified) and implementation correctness; otherwise it reimplements the method from the ingested Markdown. It ends at code in the target layout, a `REPLICATION.md` table, invariant tests and a toy-set smoke run, and never launches a remote run. | `proposal-implementation` |
| `dataset-scout` | From a research question or paper to ranked dataset candidates with their source licenses decided: it searches the paper's official repository and the dataset hosts (`search`) and records a `license` decision per candidate. It never downloads what it cannot license and never uploads anything. | `datasets` |
| `dataset-curator` | From a dataset need to its arrival: the seeded toy set, a licensed source measured with `qc`, the one official subject-wise preparation (`prepare`), and `publish` run for real only with the operator's own consent tokens. | `datasets` |
| `deliberation-publish` | From the moment you accept a change until the successor revision is published and in force — the only way the mathematics travels. The deliberation itself is not here: only you close it. | `proposal-deliberation` |
| `experimental-publish` | The same as `deliberation-publish`, over the experiments document. | `experimental-deliberation` |
| `experimental-validation` | The `validated` stage: it looks for the area's evaluation protocol —metrics, baselines, dataset, seeds, significance test—, verifies each baseline against its repo and its venue, and dates every URL it uses. | `experimental-deliberation` |
| `experiments-build` | From the approved map of protocol steps to executable commands: materializes whatever is needed, wires each step and instruments each measurement so that it can be run and read. | `experimental-implementation` |
| `experiments-walk` | The walk of the protocol, with the same gates and the same stop at the rehearsal. | `experimental-implementation` |
| `experiments-tutor` | One turn of the experiments tutor from the dashboard's Experimentos tab: reads the protocol, approvals, code and results a question touches, gives one hint, asks one question, rates the design with quoted evidence and lists the risks, and drafts any change of decision for `/experimental-deliberation`. It never writes the workspace and never invents a measured number. | `experiments-tutor` |
| `experiments-reviewer` | From an instrumented implementation to a findings report read before any rehearsal or launch: reviews the code against the experiments protocol for code quality, the simulation and data path, remote GPU use and the declared statistical tests. It runs only the target's own tests and linters; it never repairs nor launches. | `experimental-implementation` |
| `math-tutor` | One turn of the Socratic tutor from the dashboard's math panel: reads the hand-drawn page back as LaTeX, gives one hint, asks one question and assesses understanding quoted from your own words, always tied to why the novelty holds. It never writes the workspace. | `math-tutor` |
| `paper-ingestion` | Turns a paper into the form in which it can really be used: LaTeX equations, tables as tables, figures as files. Stages: `filed`, `extracted`, `readable`. It asks nobody anything. | `paper-ingestion` |
| `contract-auditor` | Reads the `## Disqualifiers` of a contract, literally, and judges a draft block against each one: `fires`/`clear`/`undecidable`, with the passage quoted in each `fires`. | `paper-writing` |
| `redactor` | Writes the LaTeX of a block from exactly five inputs (the contract's prose, its evidence set, its mode, its style set and its own bound source sections) and returns a binding map: where each sentence comes from. | `paper-writing` |
| `style-sampler` | Resolves the equivalent block, complete, in each style folder of `guidance/` and returns it verbatim, never trimmed. It is the only material an overlap check can compare. | `paper-writing` |
| `diagram-author` | Writes a standalone TikZ diagram (`<id>.tex` + `<id>.diagram.json`) and compiles it in its own loop, up to the repair budget. It never draws a chart from measured numbers — that is the `place` verb. | `paper-writing` |
| `figure-auditor` | Compares the components declared in the manifest against the section's prose and the pipeline steps; reports a structured verdict. | `paper-writing` |
| `figure-visual-reviewer` | One visual pass over one rendered diagram whose mechanical audit already passed: reads a preview of at most 1400 px once and judges legibility at print scale, balance, overlaps and whether labels and arrows read correctly. Returns PASS, or FAIL with concrete fixes; it never edits a file. | `paper-writing`, `experiment-diagrams` |
| `paper-reviewer` | Reviews the compiled paper on the rubric the workspace's line chooses (`ml-conference`, the main-track review form, on the experimental line; `systematic-review`, `empirical-study`, `measurement-science`, `data-descriptor` or `qualitative-study` on the others); grounds pertinence, novelty and coherence in quoted evidence. It is also the judge-reviewer that scores the proposal's and the findings' contribution type, with an affinity per type. | `paper-writing` |
| `section-grounding-auditor` | Reads a block's own bound source section, verbatim, and judges each subject sentence against it: `supported` — with the quoted span that carries it —, `unsupported` or `undecidable`. No code path invokes it, and `write` re-derives both sides independently rather than trusting its account. | `paper-writing` |
| `insumos-observer` | Reads the paper's four declared input sources —`proposals/`, `experiments/`, the destination repo's code and its own run outputs— and reports, for each observable fact, whether it holds and with what evidence. It never decides a value nor runs `declare`. | `paper-writing` |
| `ai-auditor` | Measures writing quality (sentence-cadence variation $CV$, overused academic phrasing, formulaic transitions, lexical diversity) and revises written blocks for clarity under the strict F5 invariant preservation contract (citations, numbers, math inviolable). It never hides AI use: the AI-use declaration stays mandatory. | `paper-writing` |
| `novelty-screener` | Discusses the hypothesis against the pool's abstracts, grades novelty and plausibility with an exact citation —all provisional— and ranks the top-5 for later ingestion, closing with a plausibility paragraph. Dialogue with a report at the end; it does not publish, does not write, does not ingest, does not deliberate. | `plausibility` |
| `sota-scout` | Tracks the idea across the open literature —25 references with abstracts, each in its family (3 to 7 in the pool)— as `sota-pool/candidates.json`. It ends in the pool; it does not ingest nor finally grade anything. | `plausibility` |
| `paper-type-advisor` | One paper-type reading after plausibility: from the accepted idea, its deterministic scores against the paper-type catalogue and what plausibility found, it relates every type to the idea and proposes a type and variant for the operator to agree. It reads only; it never writes the workspace nor records an agreement. | `paper-type` |
| `sota-grapher` | Maps the pool to its constellation —one solar system per paper grouped by family, 20 planets maximum, edges between sibling systems— as `atlas.json` plus the single `atlas.html`, running checker and renderer until green. | `plausibility` |
| `translator` | Translates one block (or one fragment outside the blocks: title, heading, caption) of the finished, verified English manuscript into neutral academic Spanish, from the English text, the paper's glossary of protected terms and the block's last style findings; keeps every citation key, label, formula, number and paragraph. It hands the Spanish body to `paper_cli.py translate store`, which judges it, and never edits `paper/main.tex`. | `paper-writing` |
| `translation-style-reviewer` | Reads `translate audit` (style, flow, redundancy, cross-block repetition, per-block fidelity) and the stored Spanish blocks against their English, judges what the script cannot see (a restated idea, a sentence that drifted, a calque) and proposes a fix per finding with each location quoted. It never edits a file nor assigns a score. | `paper-writing` |
| `venue-adapter` | Reads a chosen journal's author guidelines and template and measures the manuscript against them: requirements (each one a quote and a url), sections to adjust, sections missing and inconsistencies with smith's base template; proposes an adjustment plan only when prudent and iterates it with the operator until they approve its exact text. It writes nothing and never submits. | `paper-writing` |
| `prompt-reviewer` | One prompt review for a phase prompt that failed the deterministic prompt gate: returns an improved prompt that keeps every requirement of the original, or the clarifying questions that make one possible. It reads only; it never writes the workspace nor launches the skill. | `prompt-gate` |
| `audit-report` | Audits a subject that enumerates a closed set —operations, subcommands, codes, assets— looking for the gap between what its code accepts and what its documentation promises. It reports; it never repairs. | `skill-audit` |

Three rules that order everything else:

- **The source of truth is `.claude/agents/`.** Each harness's routing docs
  (`CLAUDE.md`, `.pi/APPEND_SYSTEM.md`, `OPENCODE.md`,
  `.agents/AGENTS.md`) list
  all thirty-three, and they are generated: an agent is changed
  there, not in the projection.
- **Each agent declares the skill it loads** (`skills/<name>/SKILL.md`), and that
  binding is verified: an agent that points at a skill the workspace does not
  ship does not get there.
- **Some agents are not invoked by any code path**
  (`contract-auditor`, `redactor`, `style-sampler`): they are launched manually, and
  it is the `write` verb that judges what they return — it never trusts the
  operator's account nor the draft on their own.

**Which model runs each agent.** An agent with no `model:` line runs on the
session's model. Three of the agents that only read (`Read`, `Glob`, `Grep`)
and hold no gate — `math-tutor`, `insumos-observer` and `style-sampler` — carry
`model: sonnet`. Claude Code reads that line straight from `.claude/agents/`,
because the workspace copies that directory rather than rendering it. The
projections for the other harnesses drop the line. Pi has no cited per-agent
model field; OpenCode (`provider/model`) and Antigravity (`inherit`, `flash`,
`pro`) have one, but nothing cited says which of their values matches
`sonnet`, so writing one would be a guess. On those three harnesses every
agent runs on the session's model.

**Agents read only the stage they are in.** `proposal-implementation` keeps
each `probe` state's section in its own file,
`skills/proposal-implementation/references/next-step-<nextStep>.md`, and its
`SKILL.md` leaves a `Stage reference:` line where the section stood.
`implementation-build`, `implementation-walk` and `paper-replicator` read
`SKILL.md`, then only the reference for the `nextStep` that `probe` reports.

---

## Anatomy of each skill

The guided tour of every skill, with its flow diagram, is in [docs/skills.md](docs/skills.md). The workspace ships twenty-two skills; each one's `SKILL.md` is its source of truth:

- [`datasets`](skills/datasets/SKILL.md)
- [`experiment-diagrams`](skills/experiment-diagrams/SKILL.md)
- [`experimental-deliberation`](skills/experimental-deliberation/SKILL.md)
- [`experimental-implementation`](skills/experimental-implementation/SKILL.md)
- [`experiments-tutor`](skills/experiments-tutor/SKILL.md)
- [`figure-review`](skills/figure-review/SKILL.md)
- [`hyperparameter-search`](skills/hyperparameter-search/SKILL.md)
- [`journal-finder`](skills/journal-finder/SKILL.md)
- [`kaggle-accounts`](skills/kaggle-accounts/SKILL.md)
- [`math-tutor`](skills/math-tutor/SKILL.md)
- [`paper-ingestion`](skills/paper-ingestion/SKILL.md)
- [`paper-writing`](skills/paper-writing/SKILL.md)
- [`pixelrag`](skills/pixelrag/SKILL.md)
- [`plausibility`](skills/plausibility/SKILL.md)
- [`proposal-deliberation`](skills/proposal-deliberation/SKILL.md)
- [`proposal-implementation`](skills/proposal-implementation/SKILL.md)
- [`remote-execution`](skills/remote-execution/SKILL.md)
- [`remote-parallelism`](skills/remote-parallelism/SKILL.md)
- [`skill-audit`](skills/skill-audit/SKILL.md)
- [`systematic-review`](skills/systematic-review/SKILL.md)
- [`ui-github`](skills/ui-github/SKILL.md)
- [`upgrade-project`](skills/upgrade-project/SKILL.md)

## The CLI commands

Every `smith` command, with its options and examples, is in [docs/cli.md](docs/cli.md); `smith <command> --help` is the source of truth.

## Remote compute, carefully

Before a job touches a real worker, the forge offers a ladder of cheap
rehearsals, worked down in order and not skipped:

1. `smith target list` — which targets exist and which one is active.
2. `smith target check [<name>]` — does that target answer?
3. `smith run <profile> --dry-run` — plans and records the command in the
   ledger; **dispatches nothing**.
4. `smith remote … --smoke` — a real rehearsal against the backend, without
   spending a campaign.
5. Only then, the real run (`--consent <token>` where applicable).

The targets and profiles are those of the workspace's `papersmith.yaml` (see
[Inside the workspace](#inside-the-workspace)). The ledger
`.papersmith/runs_ledger.jsonl` is append-only: every dispatched run is recorded
with its target, its profile and its outcome. And `smith remote status` /
`pull` is the memory of what was sent out and what came back — the detail of that
contract lives in the `remote-execution` section of the
[Anatomy](docs/skills.md#anatomy-of-each-skill).

**Credentials and backends.** `remote-execution` supports several backends (`kaggle`, `colab`):
- **Kaggle**: runs against the configured worker pool. Its credentials live in the `kaggle-accounts` store (`skills/kaggle-accounts/store/accounts.json`), never leave the disk and are never printed: `materialize` writes a worker's token to a text file and reports **where**, never **what**. `/kaggle-accounts` validates or removes accounts, and `smith target check kaggle` tests them from the side. A `smith accounts` subcommand does not exist yet (recorded follow-up): it is invoked as `python3 skills/kaggle-accounts/scripts/accounts_cli.py {list,discover,validate,remove,materialize}`; `validate --account <username> --json` re-checks one stored account and writes nothing, which is how `preflight` checks each worker.
- **Colab**: runs against sessions managed by `google-colab-cli` (`smith remote push --backend colab ...`). It is not a workspace target (it is not passed to `init --remote` or to `target check`), but a direct backend of `remote-execution`. It requires `google-colab-cli` on `PATH` and the token resolved in `~/.config/colab-cli/token.json`.

**Jobs checked before they run.** `remote_cli.py generate-jobs` writes one job
folder per remote step a product declares in `__steps__` (`generate-job
--dataset <slug>` and `generate-jobs --dataset` declare a workspace dataset as
the job's input, uploading nothing), and `remote_cli.py preflight` checks every
generated job locally before its first remote rehearsal: pin, diagrams,
interpreter, code reachability, inputs, a local rehearsal of the smoke, each
account, the accelerator and session fit, one `pass`/`warn`/`fail` row each. It
never submits.

**Placement by measurement.** Before a proof of concept or a full experiment
runs, `remote-parallelism`'s timing probe measures each candidate way to run
it (local CPU with N processes, a local accelerator, each account's machine,
a CPU-only remote session, batch and loader settings), and `plan` recommends
the fastest affordable one with its reason. A GPU is never the default: it is
chosen only when measured faster, and `generate-job --accelerator-kind cpu`
writes a CPU-only remote job when the plan says so.

**Runs longer than one session.** A run whose estimate exceeds a service's
continuous session is planned as a chain of sessions that checkpoint every
epoch or trial and resume: `plan --resumable` and `schedule` cost the chain,
with the setup paid again in every session and the wait for each weekly quota
reset counted (`quotaWeeks`). `preflight --unit <id> ...` rehearses it locally
before the first remote rehearsal: the job must stop at a deadline that has
already arrived, leave `partial.json` and its checkpoints, and finish only the
remaining units in a second session. `submit --unit` then carries the declared
checkpoints to each continuation on the same account (Kaggle mounts the earlier
output; Colab uploads it into the new session). The rule lives in
`remote-execution`'s "The session-chain rule".

**Campaigns larger than the pool.** `distribute` and campaign `submit` place
every unit: past the granted slots, units join per-slot queues that each job
runs in order, cut into chained sessions on the same account when a timing
record says so, and `schedule` and `plan` report the same `queues`. Units
already returned complete (`done`) or still running (`inFlight`) are never
placed again, so the campaign's full unit list can be passed every time, and
`remaining` names the units still owed.

**Real quota.** A real submission spends quota and GPU hours. The house rule is
simple: everything that can be rehearsed with `--dry-run` and `--smoke` is
rehearsed; what is left after that is a decision for the operator.

---

## Architecture

```
papersmith-ai/
├── docs/                       # supporting documentation (MCP server)
├── src/papersmith/             # the orchestrator CLI (Python) and its runtime bridges
│   ├── core/                   # init, status, ingest, upgrade, executor, ledger
│   ├── bridges/                # Node, Python, deliberation, remote execution
│   └── mcp/                    # stdio Model Context Protocol server
├── skills/                     # canonical skill tree, projected to the harnesses
│   ├── _core/                  # shared deliberation and implementation engines
│   ├── paper-ingestion/        # Marker + Surya OCR + llama-server
│   ├── proposal-deliberation/  # TypeScript engine: AST verification and state machine
│   ├── proposal-implementation/# reproducible code generation and its tests
│   ├── experimental-deliberation/   # second domain; same engine, a different aim
│   ├── experimental-implementation/ # second implementation host; two documents, one engine
│   ├── paper-writing/          # section contracts → PDF, assuming nothing
│   ├── remote-execution/       # dispatch to distributed compute (Kaggle T4/P100 / local)
│   ├── kaggle-accounts/        # credentials gatekeeper: identities, never values
│   └── skill-audit/            # meta-auditor of surfaces and promises
├── guidance/                   # reference papers and domain guidelines
├── tests/                      # Node.js + pytest suites (meta-audits included)
└── scripts/                    # environment provisioning and harness setup
```


### `smith team {list,add,remove}` and `smith colab {login,status}`

```bash
smith team add --owner ana --name "Ana" --kaggle-username ana_k --colab --colab-tier pro --attest
smith team list
smith colab login --owner ana
smith colab status
```

Several remote accounts are supported as a **team**: multiple accounts per service are accepted provided each account is associated with a distinct email address. `team add` records an owner in `.papersmith/team.json` (git-ignored, no secrets, with optional `--email <email>`) and refuses without `--attest`, the confirmation that each account is operated under a distinct registered email, and refuses duplicate accounts sharing an email under the same service. Google's Colab FAQ disallows "using multiple accounts to work around access or resource usage restrictions", and on free runtimes without compute units "running distributed computing workers". A Colab owner on the `free` tier may run interactive or proof-of-concept work in one session, never a worker of a split campaign.

`colab login --owner <slug>` runs the official `google-colab-cli` (pinned `0.8.0`) consent for that owner under a private `HOME` of its own (`~/.config/papersmith/colab/<owner>/`, mode `0700`): the CLI keeps its sign-in under `HOME` (a keyring file since 0.8.0), so a private `HOME` is what isolates one person's account from another's, and papersmith never opens a file inside it. `colab status` reports, per owner, the CLI version, whether the sign-in still answers, the tier and whether the owner may take part in a split campaign. `smith init` and `smith upgrade` also register Google's official Colab MCP server (`colab`), which drives a notebook the person has open in the browser.

### Engineering guarantees

- **AST invariants and boundaries**: equations and sections are tracked by stable
  IDs and immutable revision chains. There are no unauthorized deletions,
  relocations or boundary merges.
- **Keyless and local-first**: ingestion runs fully offline and locally, with
  Marker and `llama.cpp`.
- **Harness-agnostic projection**: the canonical `skills/` tree is projected to
  `.claude/skills`, `.pi/skills`, `.opencode/skills` and
  `.agents/skills`.

---

## Development and testing

There are **two suites**, not one. Running a single one and giving a verdict is a
mistake this repository has already made, so both are here with their exact
invocation:

```bash
npm test                                  # shared deliberation engine
.venv/bin/python -m pytest                # everything else
npm run test:all                          # both, in order
```

**A fast loop, not a gate.** `npm run test:fast` (`python3 scripts/fast_tests.py`)
runs the tests that touch the uncommitted work (staged, unstaged and untracked;
non-code files such as `.md` or `.json` select nothing) plus a fixed set of
guards. The guards alone take about 40 seconds and the selection adds to that.
Three measured slow tests are deselected by default (`--with-slow` includes them;
the full gate always runs them). `--since REF` adds what is already committed
since REF, `--list` shows the selection, its base and why, and `--guards-only`
runs the guards alone. It is a textual heuristic that can miss tests exercising a
module indirectly: it does **not replace** `npm run test:all`, which remains what
is run before integrating.

**Python in parallel.** `npm run test:py:par` runs the same suite with
`pytest -n 8 --dist loadfile` (it needs `pytest-xdist`, which `setup_env.py`
already provisions). Measured on 2026-10-01: **5455 passed** in 5 min 9 s against
10 min 17 s in series. Only `loadfile` is safe: `load` and `loadscope` compete for
the shared `implementations/` directory. A single test (waiting for a killed
process, 120 s) sets the time floor.

`npm run typecheck` runs `tsc` over the deliberation engine and comes out clean.

**Two traps that look like repository defects and are not.**

*The npm script sets the domain profile.* `npm test` exports
`DELIBERATION_DOMAIN_PROFILE` before invoking `node --test`. Calling bare `node
--test` fails closed, because the engine serves no domain of its own and refuses
to start without one. It is the invocation that is wrong, not the engine. The same
holds on the Python side: the implementation engines require
`IMPLEMENTATION_DOMAIN_PROFILE`, which is why the CLI that launches them sets it —
and why `tests/domain_profile.py` seeds and restores it by import.

*`tests/` has no `__init__.py`.* The form one would write from memory,
`discover -s tests -t .`, dies with `ImportError: Start directory is not
importable`. The form that works is the one above, without `-t .`.

**What tests what.** `tests/` covers **the forge's tooling**: the two shared
engines, every skill's `SKILL.md` and its scripts, the tie between each skill
and its agents in both directions, and a *from-scratch* series that generates a
workspace with the CLI and walks every command, every embedded skill and every
subagent inside it (`tests/test_workspace_{commands,skills,agents}_e2e.py`).
The tests of a materialized implementation live in its destination repository and
nowhere else; deleting it deletes its tests.

**One live rehearsal, opt-in.** Everything above is hermetic. To exercise the real
engines — `npm install`, environment provisioning, an ingestion and an agent —
there is `scripts/cli-paper-live-smoke.sh`, which refuses to run without
`PAPERSMITH_LIVE=1` (and accepts `PAPERSMITH_LIVE_INGEST=<pdf>` and
`PAPERSMITH_LIVE_AGENT=<name>` to extend the walk).

**Two sealed corpora.** `tests/seal/` and `tests/experiments_seal/` keep the exact
output of a battery of commands as golden digests. They are not unit tests: they
exist so that a change in the shared engine cannot silently alter what each host
produces. They are worth what they cost — during the last fix, four digests moved
and said the correction was wrong, in a direction no unit test was seeing.

`proposal-implementation` was also validated with its own scenario harness — the
situations a clone can fall into, plus the full cycle up to publishing the
revision that produces a finding — built to close v1.5 and retired when it closed.
It was scaffolding, not part of the forge. It stays in the history: the commit
that removes it says so, and `git revert` brings it back if it ever has to run
again.

---

## Troubleshooting

**"The skill refused to start."** That is the expected behaviour: each skill
declares what it needs first and exits with a refusal code that names what is
missing, rather than inventing it or skipping it. The code reads as a to-do list —
it says exactly which input is missing. It is not a mistake on the reader's part.

**"Bare `node --test` fails."** By design: the deliberation engine refuses to
serve without a domain profile. `npm test` sets it, and so does the skill's CLI.
The same holds for the implementation engines:
`IMPLEMENTATION_DOMAIN_PROFILE_REQUIRED` means they are being invoked directly
instead of through `implementation_cli.py`, which is what starts them with their
profile. If you invoke them directly on purpose, set the variable to an
**absolute** path: a relative one is refused with
`IMPLEMENTATION_DOMAIN_PROFILE_NOT_ABSOLUTE`.

**"The workspace has no `.claude/skills`."** That is the default state: a
workspace ships the whole `skills/` tree and `.claude/agents/`, and its routing
documents point at the canonical `skills/*/SKILL.md` tree; the agents read the
skills from there. For a harness to list them as `/` commands, run
`npm run setup:harnesses` inside the workspace: it creates the projections of the
four harnesses, relative and idempotent.

**"`smith audit` reports drift."** Some generated file changed with respect
to the manifest. It is not edited by hand: run `smith upgrade` (and `--force`
if needed) to return to the framework's version.

**"The terminal window is blank on my phone" or "Could not open a browser
here".** That device has not logged in to the terminal yet. On a `--lan`
server, open the terminal window and paste the secret from
`~/.config/papersmith/terminal-token` into its password box, or open your
bookmarked login URL. A workspace upgraded before 0.74.0 shows no password box:
run `smith upgrade` in it and restart `smith ui`. See
[Open the dashboard from another device](#open-the-dashboard-from-another-device).

**"`smith accounts` cannot be run."** It does not exist yet (recorded
follow-up). Use
`python3 skills/kaggle-accounts/scripts/accounts_cli.py {list,discover,validate,remove,materialize}`.

**"`status` exits 0 even when there is drift."** A known, recorded gap: the exit
code is not strict today. For a CI gate, read the JSON (`--json`) rather than the
exit code.

**"The first ingestion downloads ~1.5 GB."** Those are the Surya weights when the
environment was not pre-provisioned. `smith init` already provisions the
environment unless `--no-env` was passed; in that case, run
`python3 scripts/setup_env.py install` before the first ingestion.

---

## Related documentation

- **Documentation index, and where history lives**: [docs/README.md](docs/README.md).
- **Every skill, guided**: [docs/skills.md](docs/skills.md). **Every command**:
  [docs/cli.md](docs/cli.md).
- **Each skill, its literal contract**: `skills/<name>/SKILL.md` — the source of
  truth for what a skill accepts and promises.
- **Project context for agents**: `openspec/project-context.md`.
- **Domain guidelines**: `guidance/paper-guide/` — the drop-zone that
  `proposal-deliberation` loads as context at the start of each deliberation.
- **Environment and harness provisioning**: `scripts/setup_env.py` and
  `scripts/setup-harnesses.sh`.
- **Suites and gates**: `tests/` and the `package.json` scripts (`test`,
  `test:all`, `typecheck`).
- **MCP server and tool catalogue**: [docs/mcp.md](docs/mcp.md).
- **Flow diagram (commands, skills and agents in Pi)**:
  [docs/diagrams/papersmith-pi-flow.html](docs/diagrams/papersmith-pi-flow.html).

---

## License

Apache-2.0 — the full text is in [`LICENSE`](LICENSE).
