SPB Git

spb/autoscholar

Public
9.5 KB · 196 lines tsx
1import { STAGES } from "@autoscholar/schemas";2import { IconChevron } from "./Icons";34export type StageDoc = {5  summary: string;6  detail: string;7  inputs?: string;8  outputs?: string;9  verification?: string;10  where: "worker" | "control";11};1213export const STAGE_DOCS: Record<string, StageDoc> = {14  preflight: {15    where: "worker",16    summary: "The frozen brief is checked for scope, feasibility and restricted activities.",17    detail:18      "The research instruction is parsed exactly as uploaded. Scientific scope, feasibility within the budget, regulated or restricted activities, missing inputs and unsupported claims are assessed. Unsafe or impossible studies are rejected with written reasons and are never retried.",19    inputs: "Frozen CLAUDE.md, immutable run manifest",20    outputs: "plan/feasibility.json, initial research plan",21    verification: "Infeasible → run fails safely",22  },23  framing: {24    where: "worker",25    summary: "Question, hypotheses, contribution and evaluation criteria are fixed before any test.",26    detail:27      "A precise question, falsifiable hypotheses or propositions, the intended contribution and a discipline-appropriate methodology are recorded. Evaluation metrics, proof obligations or inclusion criteria are pre-registered, together with failure modes and an honest null-result pathway.",28    outputs: "plan/research-plan.md with a pre-registration section",29  },30  literature: {31    where: "worker",32    summary: "Real registries are searched; every citation is verified by identifier before use.",33    detail:34      "Crossref, OpenAlex, arXiv, PubMed and Semantic Scholar are queried as the discipline requires. A source enters the bibliography only through the verification tool, which resolves its DOI, arXiv id or PMID and generates the BibTeX from the registry record. A claim-to-source map links background claims to verified keys.",35    outputs: "sources/sources.json, references.bib, source-map.json",36    verification: "Unverified references cannot be cited",37  },38  design: {39    where: "worker",40    summary: "Data, proofs, benchmarks or search protocols are set up with provenance.",41    detail:42      "Depending on the mode: legally usable data with licence, timestamp and SHA-256; formal definitions and planned derivations; benchmark environments with baselines, seeds and leakage controls; or a search protocol with inclusion criteria. Simulations are labelled synthetic wherever they appear.",43    outputs: "data/manifest.json, code/ environment lock, formal setup",44  },45  execute: {46    where: "worker",47    summary: "Code, experiments, derivations or qualitative work actually run in the sandbox.",48    detail:49      "Analyses execute in an isolated workspace with recorded environment, versions, seeds, commands and outputs. Failures and negative results are kept; specifications are not re-run until a desired result appears. Every number destined for the manuscript is registered for later tracing.",50    outputs: "results/metrics.json, experiment-log.jsonl, tables and figures",51  },52  robustness: {53    where: "worker",54    summary: "The result is attacked: alternatives, sensitivity, stronger baselines, counterexamples.",55    detail:56      "Mode-specific checks — alternative specifications, held-out tests, placebo tests, relaxed assumptions, counterexample searches — are run and reported, including those that weaken the contribution.",57    outputs: "results/robustness.md",58  },59  manuscript: {60    where: "worker",61    summary: "A LaTeX working paper is written from recorded results and built with tectonic.",62    detail:63      "The manuscript uses the AutoScholar class and the platform-generated bibliography. Every reported number must derive from stored artifacts; disclosures are inserted by the class. The platform rebuilds the PDF itself and returns build errors for repair.",64    outputs: "manuscript/main.tex, main.pdf, metadata.json",65  },66  review: {67    where: "worker",68    summary: "A separate referee session critiques the paper; it can only write under review/.",69    detail:70      "An independent review context that did not author the manuscript examines novelty, validity, evidence traceability, mathematics, statistics, references, ethics and writing, and records findings with severities. This is automated critique, not human peer review.",71    outputs: "review/review-1.md, review-1.json",72    verification: "Open blockers stop publication",73  },74  reproduction: {75    where: "worker",76    summary: "Findings are addressed; the analysis is re-executed and the PDF rebuilt in a clean copy.",77    detail:78      "The platform re-runs code/reproduce.sh under a sandbox profile, compares regenerated metrics with the reported ones and rebuilds the PDF from source. Page previews are inspected; the author session repairs layout defects and writes a point-by-point response to the review.",79    outputs: "results/reproduction.json, review/revisions.md, checksums",80  },81  quality: {82    where: "control",83    summary: "Deterministic gates decide on the control plane — never from model text.",84    detail:85      "Sixteen gates check completeness, digests, PDF health, disclosures, citation verification, claim tracing, result consistency, data provenance, execution evidence, review state and secrets. Any hard failure blocks publication regardless of review scores.",86    verification: "Hard gates block; soft gates warn",87  },88  publication: {89    where: "control",90    summary: "A permanent number is allocated and artifacts are promoted in one transaction.",91    detail:92      "AS-WP-YEAR-NNNN is allocated inside the transaction that creates the public version; artifacts are copied with their digests, the feed and sitemap update, and the page goes live. Sensitive modes and disciplines wait for human approval.",93    outputs: "Public paper page, PDF, source, code, data, provenance",94  },95};9697/** ResearchPipeline — vertical timeline with progressive disclosure (details/summary, no JS required). */98export function ResearchPipeline({99  expandFirst = false,100  compact = false,101}: {102  expandFirst?: boolean;103  compact?: boolean;104}) {105  return (106    <ol className="pipeline space-y-2">107      {STAGES.map((s, i) => {108        const d = STAGE_DOCS[s.key];109        if (!d) return null;110        return (111          <li key={s.key} className="relative flex gap-4">112            <span className="pipeline-node" data-tone={d.where} aria-hidden="true">113              {String(s.index).padStart(2, "0")}114            </span>115            <details116              className="group min-w-0 flex-1 rounded-lg border hairline bg-[var(--bg-elev)]"117              open={expandFirst && i === 0}118            >119              <summary className="flex items-start justify-between gap-3 px-4 py-3">120                <span className="min-w-0">121                  <span className="flex flex-wrap items-center gap-2">122                    <span className="title-3">{s.name}</span>123                    <span className={`badge ${d.where === "control" ? "badge-accent" : "badge-sci"}`}>124                      {d.where === "control" ? "control plane" : "MacLustr worker"}125                    </span>126                  </span>127                  {!compact && <span className="muted mt-1 block text-sm leading-relaxed">{d.summary}</span>}128                </span>129                <IconChevron130                  size={16}131                  className="mt-1 flex-none subtle transition-transform group-open:rotate-90"132                />133              </summary>134              <div className="border-t px-4 py-4 hairline">135                <p className="muted text-sm leading-relaxed">{d.detail}</p>136                <dl className="mt-3 grid gap-2 text-xs sm:grid-cols-3">137                  {d.inputs && (138                    <div>139                      <dt className="label">Inputs</dt>140                      <dd className="mt-0.5 font-mono">{d.inputs}</dd>141                    </div>142                  )}143                  {d.outputs && (144                    <div>145                      <dt className="label">Outputs</dt>146                      <dd className="mt-0.5 font-mono">{d.outputs}</dd>147                    </div>148                  )}149                  {d.verification && (150                    <div>151                      <dt className="label">Verification</dt>152                      <dd className="mt-0.5">{d.verification}</dd>153                    </div>154                  )}155                </dl>156              </div>157            </details>158          </li>159        );160      })}161    </ol>162  );163}164165/** Compact horizontal overview of the pipeline for the homepage. */166export function PipelineStrip() {167  const groups: Array<[string, string[]]> = [168    ["Plan", ["preflight", "framing"]],169    ["Investigate", ["literature", "design"]],170    ["Execute", ["execute", "robustness"]],171    ["Write & review", ["manuscript", "review", "reproduction"]],172    ["Verify & release", ["quality", "publication"]],173  ];174  return (175    <ol className="grid gap-3 sm:grid-cols-2 lg:grid-cols-5">176      {groups.map(([g, keys], i) => (177        <li key={g} className="surface relative p-4">178          <span className="mono-id">{String(i + 1).padStart(2, "0")}</span>179          <p className="title-3 mt-1">{g}</p>180          <ul className="muted mt-2 space-y-1 text-xs">181            {keys.map((k) => {182              const s = STAGES.find((x) => x.key === k)!;183              return (184                <li key={k} className="flex items-baseline gap-2">185                  <span className="subtle font-mono text-[10px]">{s.index}</span>186                  <span>{s.name}</span>187                </li>188              );189            })}190          </ul>191        </li>192      ))}193    </ol>194  );195}196
Files · main
Menu

Theme