Runtime·Execution
Runtime architecture
The execution path for Protean's bounded scientific cycle ends at a typed record on the Protean Ledger. The chain is the source of truth; the explorer is a lens; the replay artifact is supplemental. The cycle is a contract, not a workflow.
The cycle executor runs continuously on the operator's machine. Each cycle's terminal scientific objects (RuntimeCycle, Hypothesis, Experiment, ScientificAsset) are submitted to the Protean Ledger at proxy 0xE3c261F3C05D4c4710003cd6066EfD95094cf5f0 on Base mainnet via the Bankr automation wallet (AUTOMATION_WRITER_ROLE). A Vercel cron indexes the contract's events every minute into Neon; the indexer digest is served at /ledger/api/v1/indexer/digest. The GitHub mirror at github.com/proteanlabs1/ledger-mirror and the Gitlawb mirrors under DID did:key:z6Mkt6MEeSCJM2krT1PfX8BmTWbi9YYkLqdaRXSF6UZvy5QB carry public verification artifacts.
The Galen → Ledger pipeline
Every record on the public Ledger arrives via a fixed, role-separated path. Galen reasons. The operator authorises. Bankr broadcasts. The chain validates. The indexer reflects. The explorer renders.
Galen
│ drafts a typed envelope against protean.ledger.v1
▼
Operator approval token
│ 5-minute TTL, single-use, mode-0600, actor + capability bound
▼
Bankr automation wallet (AUTOMATION_WRITER_ROLE only)
│ spend-capped: per-tx cap, per-day cap, allow-list, halt switch
▼
ProteanLedger.registerRecord(...) on Base mainnet (chainId 8453)
│ emits RecordRegistered + RecordContentEmitted
▼
Vercel cron indexer (every minute, Neon Postgres)
│ 12-block confirmation window; sha256 digest recomputed
▼
Public explorer at protean.sh/ledger
Four principals, four distinct authorities. Galen holds zero on-chain roles. The operator holds OPERATOR_WRITER_ROLE and operational roles where granted. Bankr holds exactly AUTOMATION_WRITER_ROLE. The treasury wallet (proteanlabs.base.eth) holds DEFAULT_ADMIN_ROLE, UPGRADER_ROLE, PAUSER_ROLE, RETRACTOR_ROLE, LINEAGE_REVOKER_ROLE, and IP_DECLARANT_ROLE. Operator compromise is not governance compromise.
FIG · 01·Runtime cycle topology
- 01model scan
- 02healthcheck
- 03ingest
- 04extract
- 05index
- 06normalize
- 07constrain
- 08features
- 09rank
- 10train
- 11explain
- 12claim QA
- 13learn
- 14cognition
- 15provenance
- 16ledger write
The cycle contract
A cycle has a fixed contract. It cannot reorder its stages, skip them, or recurse. The stage list is the canonical source in the cycle executor. The full sixteen-stage walkthrough lives in How a discovery cycle works; this page describes the execution layer that runs it.
The runtime is responsible for:
- maintaining cycle cadence and lock ownership
- routing model capabilities by task (Model routing)
- keeping deterministic validators authoritative
- producing review-ready candidate state
- applying bounded feedback only inside the declared envelope (Bounded learning)
- drafting the Ledger record envelopes that propagate this cycle's scientific objects to chain
What it does not do: it does not modify its own scoring contract, validators, prompts, or model routes; it does not recursively retrain; it does not remove failure-motif penalties; it does not publish without review; and it never signs or broadcasts on chain — that is Bankr's job, gated by the operator's approval token.
RecordTypes that ride the cycle
A single cycle can emit any of seventeen typed records on the Ledger. The ones produced by the standard cognition path:
- RuntimeCycle — the temporal root of the cycle. Anchors every other record produced in the same run.
- EvidenceBundle — the curated input record set the cycle consumed.
- Hypothesis — a reviewable scientific question raised inside the cycle, with confidence labels.
- Experiment — a computational study design tied to one or more hypotheses.
- Candidate — a peptide candidate proposed inside the constraint surface. Published candidates carry full sequence, sequence hash, salted commitment, provenance, and operator attribution.
- CandidateFamily — a family or cohort of related candidates with membership and lineage.
- CandidateLineage / FamilyLineage — explicit parent-child and family-derivation publication records.
- Thesis — a daily synthesised reasoning document.
- ScientificAsset — a citable aggregation of records (typically the assembled paper + supporting hypotheses + experiments). Carries a stable identifier that external citations resolve against.
- IPAsset — a provisional-IP intent record. Gated behind
IP_DECLARANT_ROLEin addition to a writer role. Bankr cannot mint these.
Lineage edges (DerivedFrom, Tests, Supports, Contradicts, Supersedes, Retracts, Includes, Produces, Cites, ReviewedBy, Anchors, AssetOf, ProtectedBy, ParentOf, ChildOf, MemberOfFamily, VariantOf, FamilyDerivedFrom, PublishedAs, plus the Unknown sentinel) wire the records into a graph that any third-party indexer can reconstruct from the event log alone.
Supersession and retraction
Records on the Ledger are immutable as written, but their state evolves. Two state machines run in parallel:
- Lifecycle state uses the deployed enum:
Draft,ReviewReady,Anchored,AssayRequested,AssayReturned,IPReview,PatentFiled,Published,Superseded,Disputed. A new record can supersede an old one by registering aSupersedesedge; the superseded record is preserved on chain with its lifecycle state updated. - Disclosure state uses
PrivateCommitmentOnly,RedactedPublic,CounselReviewed,PatentPending,Public, andRetracted. Retraction is a one-way move from any disclosed state toRetractedvia the treasury-onlyRETRACTOR_ROLE. The retracted record stays on chain — public retraction is the point.
Either move emits an event the indexer picks up on the next cron tick. The explorer surfaces the current state alongside the original record content.
Off-chain artifact (supplemental, not primary)
Every cycle also writes a local snapshot directory to the operator's filesystem. This directory is not the canonical replayable record — the Ledger is. The snapshot serves three downstream purposes:
- Operator audit. A reviewer with the directory can re-hash every artifact and re-derive the corresponding Ledger record's
contentDigest. - Mirror publication. The reviewed public subset, including full sequences for intentionally published candidates and families, is committed to
mirror_sources/artifacts/mainnet/and published to GitHub and Gitlawb public verification rails. - Replay against the chain. The cited
replayPointeron the on-chain record lets an external verifier fetch the mirror artifact, recompute its sha256, and confirm the on-chain commitment.
The snapshot writer uses atomic primitives (O_CREAT|O_EXCL + fsync + os.replace) so the directory is either fully present or absent — never half-written. The local validator re-hashes every file in the directory and compares against an internal manifest; this is integrity scaffolding, not the primary trust object.
Locking
Each cycle holds three layers of lock so that concurrent invocations cannot stomp on each other:
- a PID check against the in-process status file
- a process scan for any other cycle in flight
- a per-cycle lock file opened with
O_CREAT|O_EXCL
The continuous daemon uses its own lock. A one-shot invocation is idempotent against an actively-running cycle but not against the daemon's sleep window — issuing a one-shot run while the daemon is between cycles produces a parallel cycle.
Verification — what a reader actually does
The deployed verification path has four parts. Each is grounded in chain state, not in our claims.
- Read the record from chain.
cast call 0xE3c261F3C05D4c4710003cd6066EfD95094cf5f0 "getRecord(bytes32)" <recordId> --rpc-url https://mainnet.base.org. The returned struct is the record's on-chain state — title, summary, recordType, lifecycle, disclosure, contentDigest, replayPointer, writer, registeredAt. - Reproduce the indexer digest. Clone
proteanlabs1/ledger-mirror, runscripts/index_ledger_from_genesis.pyagainst any Base RPC, compare the result to/ledger/api/v1/indexer/digest. Equality means the indexer state is reproducible from event logs alone. - Recompute the replay artifact sha256 (when the record's
replayPointeris a mirror anchor). Fetch the artifact, runshasum -a 256, compare to the sha256 suffix on the pointer. - Walk lineage. Every edge is stored as
EdgeStateand emitted asEdgeLinked. The explorer's lineage panel and theLedgerEdgequery API both surface the same event-derived data.
If all four pass, the reader has just personally reproduced our claim that this record exists, in this state, descended from these parents, at this block. No login. No wallet connect. No trust in us.
Runtime state
The platform tracks operational state across cycles so that repeated runs remain observable rather than opaque:
- source and evidence availability
- candidate counts and rejection reasons
- model route availability and capability health
- embedding availability (text + sequence)
- scoring weight normalisation status
- failure-memory influence (the failure-similarity contribution)
- learning mode and bounded adjustment status
- ledger-submission queue depth and per-record status (drafted, awaiting-approval, broadcast, confirmed, indexed)
- explanation coverage and warning burden
This state is operator-facing and is composed into the kernel's status report by Galen.
What this layer does not do
The runtime executes cycles. It does not classify health, schedule recovery, sign transactions, or contact wet-lab providers — those are the kernel's, Bankr's, and the operator's responsibilities, respectively. The runtime trusts the kernel to verify the workflow DAG and emit policy state; the kernel trusts the runtime to keep cycles bounded and Ledger envelopes well-formed.
This separation is what makes Galen the kernel, not the truth layer, and the Ledger the record, not a copy of the record.
