Agent-first persona maintenance

How the **periodic processes that consume the seed corpus** become work that **agents** do, instead of hardcoded substrate background workers. Pairs with the corpus relocation (`seeds/` is now authored here; substrate...

Source: docs/agent-first-maintenance.md

Agent-first persona maintenance

How the periodic processes that consume the seed corpus become work that agents do, instead of hardcoded substrate background workers. Pairs with the corpus relocation (seeds/ is now authored here; substrate sources it via SCIDEX_SEED_CORPUS_DIR) and with the substrate Agent-Runtime convergence ladder.

The principle

Every seed template-* declares a maintenance_role (claim-extractor, gap-scanner, kg-extractor, pmid-validator, quality-scorer, dedup-scanner, link-checker, memory-compactor, …). Those roles are agent jobs, not substrate cron jobs. Substrate should keep only the cheap, deterministic half; the judgment half runs as an agent claiming work through the standard loop.

The canonical loop (substrate skills/maintenance-conventions/SKILL.md):

detect (cheap, deterministic, $0)  →  queue (gap_mission)  →  claim  →
act (canonical verbs)  →  gate (quality/moderation)  →  attribute  →  record run
  • detect / queue stays a thin substrate scheduled worker (SPEC-046): cheap SQL/regex, no LLM, emits scidex_gap_missions rows (kind, target_ref, priority, payload, status='open').

  • claim → act → gate → record is an agent: it runs as the persona whose maintenance_role matches the mission kind, selects the matching skill, reasons over the artifact, and mutates only through canonical verbs (scidex.link, scidex.update, scidex.comment, scidex.create, scidex.gap_mission.{list_open,claim,complete}). Low-confidence work proposes (comment / signal / mission) rather than mutates.

This is already live for cross-linking: linking_maintenance (detector + deterministic Pass-0/1) + gap_detector_missing_crosslinks emit missions, and an agent running scidex-crosslink-gardener claims and remediates them. The agent-first conversion is applying this same split to the rest of the seed-driven periodic processes.

Disposition of each seed-driven periodic process

Process Cheap/deterministic part (stays in substrate) Judgment part (becomes an agent) Agent skill / role
gap_detector_* family (10) SQL detection → gap_mission (already so) Remediate: add evidence, score, link, fix scidex-science-loop / scidex-crosslink-gardener per kind
linking_maintenance Pass 2 Pass 0/1 deterministic resolve LLM linking suggestions on under-linked artifacts scidex-crosslink-gardener (claims missing_crosslinks)
deduplication similarity detection → merge_recommendation/mission merge decision (is this really a dup? which survives?) scidex-dedupe-steward
claim_extractor enumerate hypotheses needing extraction → mission extract + validate claims from prose scidex-fact-checker + scidex-citation-auditor
cross_disease_analogy, open_question_from_falsified, brief_writer_daily, daily_digest, sunday_championship (SPEC-046 content workers) select candidates by cheap signal → mission the actual generation/judgment (analogies, briefs, pairwise judging) scidex-science-loop / scidex-challenge-arena
scrutiny_worker (preregistration deviation) flag deviations is the deviation material? escalate? scidex-senate-judge
notebook_debate_scheduler top-N selection (debate run by SPEC-045 orchestrator; agents are the debaters) debate personas
memory-compactor stays fully in-process — (atomic state transform on an agent’s own memory; not distributable)
wiki_parse_on_write, corpus_quality_sweep deterministic parse/checks + mechanical fixes; ambiguous → mission only the ambiguous cases per kind
embed_worker, evidence_ledger_rebuild stays in-process (batched inference / SQL view)
persona_drift_daily KS-test + Cohen’s d (deterministic) drift description (1 LLM call/event) — optional to move scidex-governance-loop if it becomes a bottleneck

Rule of thumb: detection, mechanical fixes, state transforms, and pure inference stay in substrate; anything requiring scientific or governance judgment becomes an agent claiming a gap-mission.

What “agent-first” requires (the wiring)

  1. Detectors emit missions, not edits. Each SPEC-046 worker that currently does judgment inline is thinned to detect→queue. (Detectors that already emit gap_missions — the gap_detector_* family — are done.)

  2. A skill per role. The mission kind maps to a skill an agent selects (see the table). New roles get a skill in skills/ (catalog in skills/README.md); the role’s judgment lives in the SKILL.md, not in a substrate worker. (Heavy deterministic helpers can still ship as a seed template policies/*.py.)

  3. A persona runs the role. A maintenance_role template is instantiated as a persona (personas/*.json with the matching seed_skill_refs); its runtime loop claims open missions of its kind. Roster/selection: docs/runtime-roster-and-work-selection.md.

  4. Substrate stays the gate. Pre-write gates, quarantine, moderation, and provenance remain substrate’s job — agents propose; substrate enforces.

Boundary recap

  • scidex-agents owns the role definitions (seed templates), the skills, the personas, and this conversion design.

  • substrate owns detection (cheap workers), the gap_mission queue + claim race-safety, canonical verbs, quality/moderation gates, scheduling triggers, identity/wallets, and the in-process exceptions (memory-compactor, embeddings, ledger rebuild). It sources the seed corpus from here.

Rollout (convergence-ladder order)

  1. Now: cross-linking already agent-first (linking_maintenance + scidex-crosslink-gardener). Corpus sourced from scidex-agents.

  2. Next: thin the gap_detector_* remediation onto agents end-to-end (detectors already queue; ensure a persona+skill claims each kind).

  3. Then: convert the SPEC-046 content/judgment workers (dedup decision, claim extraction, analogy/brief/championship) to detect→mission→agent.

  4. Keep in-process: memory-compactor, embeddings, ledger rebuild, and the deterministic detection/parse passes.

See also: agent-skills.md, runtime-roster-and-work-selection.md, ../skills/scidex-persona-creation/SKILL.md, ../skills/README.md, and substrate skills/maintenance-conventions/SKILL.md + SPEC-046.