# Project export: MortalOS: Evidence That Software Can Die

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: OpenAI Build Week
- Tagline: Create once. Continue elsewhere—cryptographically verified digital life across browser loss.
- Devpost: https://devpost.com/software/mortalos
- GitHub: https://github.com/YongHwan2161/mortalos
- Demo: https://mortal-os.com/
- Video: https://www.youtube.com/embed/AWNXIem-JPM?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 1 GitHub contributor(s) — YongHwan2161 (76 commits)

## Devpost submission (written by the team)

### Overview

Try the 90-second proof English: https://mortal-os.com/ 한국어: https://mortal-os.com/ko/ No account, API key, model call, or local build is required. Open the site in Browser A and choose Create in Browser A. Open the generated private link or QR in a clean Browser B. Authorize the handoff in both browsers, close A, then choose Continue in Browser B. The same organism_id advances from sequence 1 to sequence 2 even though neither private key ever moved.

### Inspiration

Long-running software can outlive tabs, devices, keys, and operators. Persistence alone cannot answer the harder question: is a successor still the same digital entity, was continuation authorized, and what evidence would justify saying that it died? MortalOS turns those questions into a falsifiable protocol and a live browser proof.

### What it does

MortalOS creates one state-bearing digital organism whose custody can move from Browser A to Browser B. Each browser generates its own non-extractable key. A and B authorize one canonical custody handoff. A can then disappear while B continues the same identity and advances its state. If A disappears before the handoff is complete, the organism stalls instead of silently inventing authority. The advanced evidence workbench also demonstrates: replay and resurrection rejection; signed fork and equivocation detection; every complementary two-of-three endpoint loss and deterministic repair; canonical evidence export and replay; and JavaScript/Python byte-identical state and R1 operation records. The authority boundary The UI, browser storage, relay, Cloudflare, event order, and GPT never decide validity. They may store, transport, display, or challenge evidence. The deterministic kernel alone validates canonical bytes, signatures, recognized lineage, custody, state transitions, forks, mortality completeness, and resource ceilings. Importing evidence grants observation, not signing authority. Private keys never leave their browser profiles. This produces four honest evidence layers: L1 — deterministic protocol: canonical bytes and local verdicts; L2 — isolated browser continuity: A creates, B joins, A closes, B continues; L3 — hosted relay and failure tests: relay availability without relay authority; L4 — independent physical or administrative domains: future work, not claimed here. Why GPT-5.6 is optional The main proof makes zero model calls. Production GPT scenarios are intentionally disabled for cost safety and require no OpenAI or Turnstile secret. GPT-5.6 was used as a bounded adversarial witness in a 25-case evaluation and remains available as an advanced development path. It can propose an attack and predict an outcome, but it cannot provide a key, signature, accepted context, recognized head, or verdict. In the fixed evaluation, schema and mutation selection succeeded 25/25 while exact status/rejection-code prediction matched the deterministic kernel 0/25. That contrast is the lesson: a strong model can help attack consensus logic, but it must not become consensus.

### How we built it

The portable JavaScript core uses duplicate-aware UTF-8/I-JSON parsing, RFC 8785 canonicalization, SHA-256 domain separation, and strict RFC 8032 Ed25519 verification. R1 defines canonical operation/result bytes shared with Python. A deterministic state engine binds transitions to identity and lineage. The browser participant uses non-extractable Web Crypto keys and consent-gated storage. A Cloudflare Durable Object relay stores and forwards public canonical messages, applies one shared rate policy, expires idle rooms, and never emits a validity verdict. The release pipeline is fail-closed: immutable independent review, exact-head Policy and Verify, expected-head merge, exact-main source verification, relay migration, Pages upload, per-file digest/MIME/security-header checks, and live English/Korean multi-browser acceptance. Validation 20/20 persistent two-profile A→B handoffs with A's browser process closed each time; B-only continuation of the same identity from sequence 1 to 2; 38–39 relay operations in a measured 12-second two-browser window with zero local 429 responses; exact 300th-request acceptance and canonical 301st-request 429 boundary; every complementary two-of-three endpoint loss and repair; 10,000 fixed property cases and 10,000 serialized adversarial rejections; actual Chromium parity with the committed portable corpus; JavaScript/Python byte equality for state and R1 records; core coverage 94.70% line, 92.31% branch, 95.22% function; dependency audit with zero vulnerabilities; English and Korean public paths; and exact-main Verify and Deploy PASS at 03fc3ab07ea086642027deebe282a90d804c4991. How Codex and GPT-5.6 were used Codex helped turn the original “software can live and die” idea into explicit protocol invariants, implement the kernel and browser experience, red-team false-death and rate-limit cases, automate two-profile Chromium acceptance, and build immutable review and exact-source deployment evidence. GPT-5.6 helped generate bounded adversarial mutations and expose why fluent model output is unsafe as a validity oracle. The human retained the North Star, threat assumptions, honest non-claims, cost boundary, and final release decisions. Challenges and lessons The hardest problem was preventing false certainty. A closed browser is not global death. Three logical keys in one process are not three physical failure domains. A relay sequence is not consensus. A model explanation is not proof. The release pipeline caught those mistakes in practice: browser installation order, source-versus-public environment leakage, insufficient Cloudflare token scope, a Workers-only Pages config key, and Cloudflare's canonical localized-index redirect all failed closed before final acceptance. Honest scope and next step MortalOS is not yet an ownerless operating system, a globally decentralized network, or proof of physical erasure. It is a small, reproducible lifecycle and state kernel with a real cross-browser custody transfer. Next: run the same protocol across independently operated native endpoints and administrative domains, without changing who decides validity.

## README (from the GitHub repository)

# MortalOS

> **Create once. Continue elsewhere.**

MortalOS is an endpoint-neutral lifecycle protocol and falsification Lab for digital
resources that must survive process and key rotation without trusting a browser,
relay, host, UI, or model as the source of truth.

- Live protocol Lab: [mortal-os.com](https://mortal-os.com/)
- Korean experience: [mortal-os.com/ko/](https://mortal-os.com/ko/)
- Source: [YongHwan2161/mortalos](https://github.com/YongHwan2161/mortalos)
- Current North Star and execution plan: [implementation SSOT](docs/IMPLEMENTATION_PLAN.md)

Main contains the unified Participant Core, crash-safe durable quorum, exact S3
recovery over real relay fragments, confidential S4 state, an authority-free
verification SDK plus an explicit continuity capability subpath, Continuity Capsules,
and a replicated counter-authority model. The revised
S2/S4 claims remain deliberately narrower than their merged implementation until
new stage receipts promote them. The
[claim matrix](docs/CLAIM_MATRIX.md) distinguishes
implemented, exact-head verified, physically verified, promoted, and explicitly
unclaimed behavior.

Source documents do not self-promote the revision that contains them. Governance
and deployment status are exact-SHA external facts read from the PR, required
checks, merge record, post-merge workflows, and deployed asset manifest.

## Current development focus

The real-file product vertical now exists in one core path: endpoint A selects a
bounded runtime file, endpoint B accepts custody with a distinct key, A exits, and B
recovers exact bytes from two of three current-custodian-signed copy envelopes before committing the next
transition. Node uses separate endpoint processes, Chromium uses separate persistent
browser endpoints and the built Lab, and a clean `npm pack` consumer runs the matching
CLI without repository-relative imports.

MortalOS includes a portable
[signed bounded resource contract](docs/RESOURCE_CONTRACT.md): a strict provider
offer defines finite storage, bandwidth, compute, and time; provider and consumer
mutually sign one contained lease; the offer's declared Byzantine witness quorum
must gossip that exact consumption before activation; both parties sign chained
cumulative usage; either lease party can revoke. One offer is single-use, so two
different valid leases or one witness double-sign halt as equivocation instead of
silently overcommitting capacity. Lease-bound
challenge/receipt chains now prove bounded storage, bandwidth, and deterministic
compute execution by the leased participant; they do not by themselves prove
honest metering, physical provider/witness independence, or independent
administration.

This source revision composes those contracts with a real direct participant data
plane. An actual runtime-selected file and every offer/lease/challenge/receipt
artifact cross ordered WebRTC DataChannels after origin and relay access are cut.
Each peer retains one combined inbound/outbound transcript with the generated
ceilings of 512 unique canonical messages and 8,388,608 decoded raw message bytes.
Exact duplicates consume neither limit. Outbound overflow rejects before native
send, and successful outbound state commits only after `DataChannel.send()` returns;
inbound overflow commits no transcript/dedupe entry or subscriber delivery before
terminal cleanup clears subscriptions and closes the channel and peer. The virtual transport
applies the same exact decoded-byte ceiling. The relay edge uses a conservative
base64-size estimate and can reject slightly earlier, so only the common upper bound
and fail-closed behavior—not byte-identical edge accounting—are claimed.
Only exact active storage execution receipts count as placement. One provider
process loss degrades three copies to two; a distinct provider/new lease repairs the
target, and after consumer A exits, B recovers exact bytes from two valid peer copies
while rejecting one corrupt readback. The composed confidential controller encrypts
the native file as an S4 package for B, sends three distinct ciphertext shards to
providers, excludes stale receipts at max age + 1 ms, restores a public-evidence
journal fail-closed, and makes B authorize renewed placement under new operational
lease keys after A exits. Journal v2 first claims a reproof context bound to the
exact prior journal head, next generation, manifest, policy, and epoch. Every
accepted storage challenge nonce is derived from that context and its receipt-chain
predecessor. A new head requires a branded, active, distinct-provider `3/3` proof
set and carries the epoch's cumulative per-chain receipt high-waters; one no-replace
hard link per predecessor is the local durable successor CAS. Legacy v1 state is
metadata-only migration input and cannot become available until a fresh rotated-epoch
`3/3` reproof commits. Those successor-authorized operational keys are not
inferred to be, or cryptographically bound to, B's Continuity custody identity.
Placement generations now bind that evidence and repair intent into the organism's
Continuity lineage. The current descriptor's required quorum can commit a generation;
the resulting placement action plan is public, forgeable derived data rather
than authority, so an executor must reverify the original committed and current
evidence. The A→B sign-once handoff transfers no key, identical evidence converges
byte-identically, and valid siblings halt instead of selecting a winner. Raw local
unavailability no longer qualifies a lineage repair plan by itself: 3-of-4 keys
from the provider-signed offer's fixed witness roster sign one predecessor-linked,
provider-signed, consumer-accepted bounded-duration non-response
challenge with no global clock. The certificate is committed into the generation.
It is a continuity-scheduling transcript, not proof of provider death, breach,
lease termination, penalty, or settlement; agreed duration is not honest-timer or SLA-breach proof.
When a caller supplies a late verified provider receipt and its current placement
chain, the core conditionally halts the derived plan. The internal Node batch now
reads an existing bounded transport transcript between effects: it verifies canonical
frames and contributes only deduplicated `liveness-response` payload bytes to the
core verifier. The origin-cut Chromium harness now binds that same session to an actual
connected DataChannel range: one exact duplicate consumes no frame, a rewrapped copy
deduplicates by response bytes, the late response stops provider 1 and Continuity, and
a mid-batch disconnect also stops every later call. Transport metadata is never proof
authority. This is source plus local evidence; it does
not self-assert stage promotion, a globally live participant network, arbitrary
Internet reachability, Sybil resistance, or physical independence. See
[P2P placement and repair](docs/P2P_PLACEMENT_AND_REPAIR.md),
[confidential P2P placement controller](docs/CONFIDENTIAL_P2P_PLACEMENT_CONTROLLER.md),
[lineage placement convergence](docs/LINEAGE_PLACEMENT_CONVERGENCE.md),
[quorum liveness and repair certificates](docs/QUORUM_LIVENESS_AND_REPAIR_CERTIFICATES.md), and the
[implementation SSOT](docs/IMPLEMENTATION_PLAN.md).

## Guided two-browser proof

1. In Browser A, choose a native file up to 128 KiB, then choose
   **Create in Browser A**.
2. Open the locally generated join QR or copied link in a clean Browser B profile.
3. Choose **Join in Browser B**. B creates its own non-extractable key; choose
   **Approve A → B handoff** in A, then **Accept custody in B**. No private key
   crosses the relay.
4. Choose **Remove Browser A authority**, then close Browser A.
5. In Browser B, choose **Continue in Browser B** and confirm that the same
   `organism_id` advances from accepted sequence 2 to sequence 3 with a new
   deterministic state root and an exact recovered-byte download.

The page keeps one organism and one primary journey in view. GPT, the fixed reference
fixture, corpus repl

[README truncated for size]

## Detected evidence (automated analysis)

Indexed codebase: 50 recognized source files, 872 KB.
- CSS (language) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- Python (language) — detected in the code
- SQL (language) — detected in the code
- Node.js (technology) — claimed on Devpost, not found in the code
- AI coding agent: Codex — evidence: config files committed to the repository

## Codebase structure (from repository index)

### Files (120 of 298)

```
.gitattributes
.github/PULL_REQUEST_TEMPLATE.md
.github/reviewer-identity-policy.json
.github/rulesets/main.json
.github/workflows/deploy-lab.yml
.github/workflows/trusted-pr-policy.yml
.github/workflows/verify.yml
.gitignore
.npmignore
AGENTS.md
agents/codex-protocol-kernel/HANDOFF.md
agents/codex-protocol-kernel/MEMORY.md
agents/codex-protocol-kernel/README.md
agents/codex-protocol-kernel/WORKLOG.md
agents/codex-protocol-kernel/workspace/README.md
agents/README.md
agents/reviewer-merge-gate/HANDOFF.md
agents/reviewer-merge-gate/MEMORY.md
agents/reviewer-merge-gate/README.md
agents/reviewer-merge-gate/WORKLOG.md
agents/reviewer-merge-gate/workspace/README.md
cli/mortalos.mjs
cli/node-authority.mjs
CONTRIBUTING.md
docs/ACCESS_ARCHITECTURE.md
docs/AGENT_COLLABORATION.md
docs/archive/BUILD_WEEK_EVIDENCE.md
docs/archive/MULTI_BROWSER_DIGITAL_LIFE_UX_IMPLEMENTATION_PLAN.md
docs/archive/README.md
docs/archive/SINGLE_BROWSER_INCUBATOR.md
docs/BROWSER_PARTICIPANT_COMPATIBILITY.md
docs/CLAIM_MATRIX.md
docs/CONFIDENTIAL_P2P_PLACEMENT_CONTROLLER.md
docs/CONFIDENTIAL_STATE_CRYPTOGRAPHY.md
docs/DISTRIBUTED_COUNTER_AUTHORITY_ADR.md
docs/DURABLE_QUORUM.md
docs/IMPLEMENTATION_PLAN.md
docs/LINEAGE_PLACEMENT_CONVERGENCE.md
docs/P2P_PLACEMENT_AND_REPAIR.md
docs/PARTICIPANT_CORE.md
docs/PROTOCOL.md
docs/QUORUM_LIVENESS_AND_REPAIR_CERTIFICATES.md
docs/README.md
docs/REJECTION_CODES.md
docs/RESOURCE_CONTRACT.md
docs/STATE_AVAILABILITY_AND_RECOVERY.md
docs/THREAT_MODEL.md
docs/TRACEABILITY.md
evidence/baseline/s0-baseline.json
evidence/stages/s1-participant-core.json
evidence/stages/s2-durable-quorum.json
evidence/stages/s3-state-recovery.json
evidence/stages/s4-confidentiality.json
examples/schema/genesis.valid.json
examples/schema/heartbeat-payload.valid.json
examples/schema/pulse.valid.json
functions/api/scenarios.js
lab/_headers
lab/_routes.json
lab/app.mjs
lab/confidential-placement.mjs
lab/corpus-summary.mjs
lab/corpus-worker.mjs
lab/custodian-worker.mjs
lab/distributed/counter-replica-service.mjs
lab/distributed/http-counter-replica.mjs
lab/evidence-export.mjs
lab/i18n/en.mjs
lab/i18n/index.mjs
lab/i18n/ko.mjs
lab/index.html
lab/live-incubator.mjs
lab/p2p-placement.mjs
lab/participant/contracts.mjs
lab/participant/core.mjs
lab/participant/durable-participant.mjs
lab/participant/durable-quorum-endpoint.mjs
lab/participant/live-endpoint.mjs
lab/participant/model.mjs
lab/participant/protocol-objects.mjs
lab/participant/quorum-endpoint.mjs
lab/participant/webcrypto-key-store.mjs
lab/placement/confidential-controller.mjs
lab/placement/liveness-contract.mjs
lab/placement/storage-contract.mjs
lab/product-continuity.mjs
lab/r1-client.mjs
lab/reference-engine.mjs
lab/runtime-endpoints.mjs
lab/scenario-compiler.mjs
lab/scenario-contract.mjs
lab/signing-policy.mjs
lab/storage/confidential-counter-authority-store.mjs
lab/storage/durable-document.mjs
lab/storage/durable-store.mjs
lab/storage/memory-durable-store.mjs
lab/styles.css
lab/THIRD_PARTY_LICENSES.txt
lab/transport/http-relay.mjs
lab/transport/replica.mjs
lab/transport/virtual-transport.mjs
lab/transport/webrtc-peer.mjs
LICENSE
migrations/0001_scenario_rate_limits.sql
package.json
protocol/profile.v1.json
r1/javascript/corpus.mjs
r1/javascript/wire.mjs
r1/python/state_package_verify.py
r1/python/state_verify.py
r1/python/verify.py
README.md
relay/vitest.config.mjs
relay/worker.mjs
relay/wrangler.jsonc
schemas/baseline-receipt.schema.json
schemas/genesis.schema.json
schemas/pulse.schema.json
schemas/s1-participant-core-receipt.schema.json
schemas/s2-durable-quorum-receipt.schema.json
[178 more files omitted for size]
```

### Dependencies

- package.json: @cloudflare/vitest-pool-workers@^0.18.8, @noble/curves@2.2.0, @noble/hashes@2.2.0, acorn@8.18.0, acorn-walk@8.3.5, ajv@8.20.0, axe-core@4.12.1, esbuild@0.28.1, playwright@1.61.1, qrcode-generator@1.4.4, vitest@^4.1.10, wrangler@4.114.0

### Recent commits (newest first)

- Add quorum-certified lineage placement and repair (#58)
- Close resource execution promotion and audit drift (#57)
- Add signed bounded resource contracts (#56)
- feat: complete real-file continuity vertical (#53)
- docs: recenter north star on product continuity (#52)
- Harden capability graph and add S5-S8 continuity platform (#51)
- security: own the complete bounded S4 rotation basis (#50)
- docs: define S4 confidential-state cryptography (#44)
- feat: add bounded state availability and recovery (#43)
- test: verify S2 receipt after squash promotion (#42)
- feat: add crash-safe durable quorum (#41)
- fix: preserve S1 receipt verification after squash (#40)
- feat: unify participant authority in deterministic core (#39)
- docs: establish post-hackathon S0 baseline (#38)
- docs: define post-hackathon North Star plan (#28)
- fix: remediate dependency advisories (#29)
- fix(verify): use canonical localized index routes (#27)
- fix(deploy): reject unsupported Pages observability config (#26)
- fix: isolate deploy verification environment (#25)
- fix: install Chromium before deploy verification (#24)

## Key source files (fetched from GitHub, selected and truncated for size)

### THIRD_PARTY_NOTICES.md

```markdown
# Third-Party Dependency Notices

MortalOS source code is licensed under Apache-2.0. The locked npm dependency graph also contains third-party packages under their own terms.

| Package | Locked version | Use | License |
|---|---:|---|---|
| `@noble/curves` | 2.2.0 | Portable strict Ed25519 verification | MIT |
| `@noble/hashes` | 2.2.0 | Direct portable SHA-256 implementation and experimental Lab evidence digest | MIT |
| `ajv` | 8.20.0 | Development-only differential JSON Schema checks | MIT |
| `esbuild` | 0.28.1 | Development-only browser bundling for portability verification and the static Lab build | MIT |
| `playwright` / `playwright-core` | 1.61.1 | Development-only Chromium differential and Lab acceptance verification | Apache-2.0 |
| `qrcode-generator` | 1.4.4 | Local-only private join-link QR rendering | MIT |
| `wrangler` | 4.114.0 | Development-only Cloudflare Pages deployment | MIT OR Apache-2.0 |

This table records the direct runtime dependencies and material development/transitive dependencies used by the current locked build. It is not a replacement for the license files and metadata shipped by those packages. Run `npm ci` against `package-lock.json` to reconstruct the reviewed graph; review this notice again whenever the lockfile changes.

The deployable static Lab includes [`lab/THIRD_PARTY_LICENSES.txt`](lab/THIRD_PARTY_LICENSES.txt), containing the complete copyright and MIT permission text for the bundled Noble and QR generator packages.

No dataset, model weight, font, image, music, or third-party trademark asset is distributed by the current repository.

```

### CONTRIBUTING.md

```markdown
# Contributing to MortalOS

MortalOS is licensed under the [Apache License 2.0](LICENSE). Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this repository is provided under the same Apache-2.0 terms, without additional conditions.

## Before opening a change

1. Preserve the normative rules and invariants in [`docs/PROTOCOL.md`](docs/PROTOCOL.md) and [`docs/TRACEABILITY.md`](docs/TRACEABILITY.md).
2. Update [`docs/TRACEABILITY.md`](docs/TRACEABILITY.md) in the same change when modifying an invariant, message field, domain separator, validation precedence, or threat assumption.
3. Add a deterministic positive or negative conformance case for every validator behavior change.
4. Run the complete gate:

   ```bash
   npm ci
   npm test
   npm run test:coverage
   npx playwright install chromium
   npm run test:chromium
   ```

   For a focused change to direct participant placement, run the shorter gate
   while iterating, then the complete gate before publication:

   ```bash
   npm run test:p2p-placement
   npm run test:sdk
   npm run verify:sdk-package
   npm run verify:security-boundaries
   ```

5. Never commit production private keys, API keys, tokens, `.env` files, or private signing material. Conformance vectors must contain only public verification material.

## Scope discipline

The deterministic core is the authority for transition validity. Recognized-head, replay, and fork behavior must go through `createLineage`; callers may not persist or fabricate acceptance-result objects. UI, transport, storage, network observations, and AI output may propose or explain inputs but must not bypass or redefine core results.

Changes to portable consensus logic must produce identical results in every supported runtime. Platform adapters may provide bytes and cryptographic primitives, but they may not change canonicalization, validation order, rejection codes, or lineage decisions.

Direct transport is not an authority. A DataChannel, relay, signaling helper, or
provider label may carry bytes but may not make an offer, lease, receipt, placement,
or recovery valid. Placement changes must retain the signed resource-contract checks
and add corrupt, stale, future-time, wrong-workload, duplicate-provider,
duplicate-shard, provider-loss, journal-replay, custody-successor, and repair
coverage. Provider data must remain S4 ciphertext-only in the confidential path;
placement succession uses a separately generated successor-authorized operational
signer and never transfers a private consumer or custodian key. Do not infer a
cryptographic binding between that signer and the Continuity custody identity.

`deriveCommittedPlacementActionPlan` (Lab adapter:
`derivePlacementActionPlan`) returns
`mortalos-lineage-placement-action-plan/1` with `planned_repair_actions`,
`verified_placement_receipt_ids`, `non_capability: true`, and
`requires_executor_reverification: true`. It is forgeable derived JSON, not a bearer
capability
[truncated — 227 more characters]
```

### package.json

```
{
  "name": "@mortal-os/core",
  "version": "0.1.0",
  "private": false,
  "license": "Apache-2.0",
  "type": "module",
  "bin": {
    "mortalos": "./cli/mortalos.mjs"
  },
  "exports": {
    ".": "./sdk/index.mjs",
    "./continuity": "./sdk/continuity.mjs",
    "./placement": "./sdk/placement.mjs",
    "./protocol-profile": "./src/generated/protocol-profile.mjs",
    "./resource-contract": "./sdk/resource-contract.mjs"
  },
  "files": [
    "cli/",
    "sdk/",
    "src/",
    "protocol/profile.v1.json",
    "LICENSE",
    "README.md"
  ],
  "description": "An experimental portable lifecycle protocol with deterministic lineage validation.",
  "engines": {
    "node": ">=22.5"
  },
  "scripts": {
    "test": "npm run verify:license && npm run verify:spec && npm run verify:links && npm run verify:protocol-profile && npm run verify:security-boundaries && npm run verify:ruleset-policy && npm run test:reviewer-attestation && npm run test:governance && npm run test:baseline-receipt && npm run test:s1-receipt && npm run test:s2-receipt && npm run test:s3-receipt && npm run test:s4-receipt && npm run test:participant-core && npm run test:participant-core:coverage && npm run verify:participant-core && npm run test:durable-quorum && npm run test:conformance && npm run test:properties && npm run test:i18n && npm run test:state && npm run test:state-package && npm run test:confidentiality && npm run test:protocol-profile && npm run test:p2p-placement && npm run test:transport && npm run test:distributed-counter && npm run test:security-fuzz && npm run test:sdk && npm run test:continuity && npm run verify:sdk-package && npm run test:capsule && npm run test:relay && npm run test:multi-browser && npm run test:lab && npm run verify:cost-controls && npm run test:r1 && npm run build:lab && npm run verify:ux && npm run verify:portable && npm run verify:state && npm run verify:state-package && npm run verify:r1 && npm run verify:singleton && npm run verify:h2 && npm run verify:s3 && npm run verify:s4",
    "generate:protocol-profile": "node scripts/generate-protocol-profile.mjs",
    "verify:protocol-profile": "node scripts/generate-protocol-profile.mjs --check",
    "verify:license": "node scripts/verify-license.mjs",
    "verify:spec": "node scripts/verify-spec.mjs",
    "verify:links": "node scripts/verify-links.mjs",
    "test:governance": "node --test test/agent-governance.test.mjs",
    "test:baseline-receipt": "node --test test/baseline-receipt.test.mjs",
    "test:s1-receipt": "node --test test/s1-receipt.test.mjs",
    "test:s2-receipt": "node --test test/s2-receipt.test.mjs",
    "test:s3-receipt": "node --test test/s3-receipt.test.mjs",
    "test:s4-receipt": "node --test test/s4-receipt.test.mjs",
    "test:participant-core": "node --test test/participant-core.test.mjs",
    "test:participant-core:coverage": "node --test --experimental-test-coverage --test-coverage-include=lab/participant/core.mjs --test-coverage-lines=95 --test-coverage-branches=90 --test-coverage-functions=95 test/participant-core.test.mjs",
    "verify:participant-core": "node scripts/verify-participant-core.mjs",
    "test:durable-quorum": "node --test test/durable-quorum.test.mjs && node scripts/verify-durable-quorum-chromium.mjs",
    "test:governance:coverage": "node --test --experimental-test-coverage --test-coverage-include=scripts/create-agent-worktree.mjs --test-coverage-include=scripts/verify-agent-pr.mjs --test-coverage-lines=90 --test-coverage-branches=75 --test-coverage-functions=90 test/agent-governance.test.mjs",
    "verify:agent-pr": "node scripts/verify-agent-pr.mjs",
    "agent:worktree": "node scripts/create-agent-worktree.mjs",
    "test:conformance": "node --test test/bytes.test.mjs test/codec.test.mjs test/crypto.test.mjs test/schema-validation.test.mjs test/rejection-codes.test.mjs test/validator.test.mjs test/lineage.test.mjs test/mortality.test.mjs test/singleton.test.mjs test/process-determinism.test.mjs",
    "test:properties": "node --test test/properties.test.mjs",
    "test:lab": "node --test test/lab.test.mjs test/scenario-api.test.mjs",
    "test:i18n": "node --test test/i18n.test.mjs",
    "test:scenarios": "node --test test/scenario-api.test.mjs",
    "test:r1": "node --test test/r1-wire.test.mjs",
    "test:state": "node --test test/state-engine.test.mjs",
    "test:state-package": "node --test test/state-package.test.mjs",
    "test:confidentiality": "node --test test/confidential-format.test.mjs test/confidential-counter.test.mjs test/confidential-crypto-vectors.test.mjs test/confidential-package.test.mjs test/confidential-s3-recovery.test.mjs && node scripts/verify-confidential-chromium.mjs",
    "test:protocol-profile": "node --test test/protocol-profile.test.mjs test/resource-contract.test.mjs test/resource-execution.test.mjs test/resource-execution-process.test.mjs",
    "test:p2p-placement": "node --test test/placement.test.mjs test/placement-process.test.mjs test/confidential-placement.test.mjs test/confidential-journal-v2.test.mjs test/confidential-controller-v2.test.mjs test/placement-liveness.test.mjs test/lineage-placement.test.mjs test/webrtc-transport.test.mjs && node scripts/verify-p2p-placement-chromium.mjs && node scripts/verify-confidential-placement-chromium.mjs",
    "test:distributed-counter": "node --test test/distributed-counter.test.mjs && node scripts/verify-independent-counter-topology.mjs",
    "test:security-fuzz": "node --test test/security-stateful-fuzz.test.mjs",
    "verify:security-boundaries": "node --test test/security-boundary-verifier.test.mjs",
    "verify:ruleset-policy": "node scripts/verify-ruleset-policy.mjs",
    "test:reviewer-attestation": "node --test test/reviewer-attestation.test.mjs",
    "test:transport": "node --test test/transport.test.mjs",
    "test:sdk": "node --test test/sdk.test.mjs",
    "verify:sdk-package": "node scripts/verify-sdk-package.mjs",
    "test:capsule": "node --test test/capsule.test.mjs test/custody.test.mjs",
    "tes
[truncated — 2702 more characters]
```

### src/index.mjs

```
export * from "./bytes.mjs";
export * from "./codec.mjs";
export * from "./crypto.mjs";
export * from "./lineage.mjs";
export * from "./rejection-codes.mjs";
export * from "./state/engine.mjs";
export * from "./state/package.mjs";
export * from "./state/recovery.mjs";
export * from "./confidential/format.mjs";
export * from "./confidential/keys.mjs";
export * from "./confidential/counter.mjs";
export {
  aesGcmKnownAnswer,
  createConfidentialPackage,
  decryptConfidentialPackage,
  snapshotConfidentialCustodians,
  verifyConfidentialPackage
} from "./confidential/package.mjs";
export * from "./confidential/recovery.mjs";
export * from "./transport/chunk-data-plane.mjs";
export * from "./transport/protocol.mjs";
export * from "./placement/storage.mjs";
export * from "./placement/confidential.mjs";
export * from "./placement/lineage-controller.mjs";
export * from "./placement/liveness.mjs";
export * from "./capsule.mjs";
export * from "./custody.mjs";
export * from "./continuity.mjs";
export * from "./resource-contract.mjs";
export * from "./resource-execution.mjs";
export * from "./distributed/quorum-counter-store.mjs";
export {
  isValidatedAcceptance,
  isValidatedLatentSuccessor,
  validateGenesis,
  validateLatentSuccessor,
  validatePulse
} from "./validator.mjs";

```

### sdk/index.mjs

```
export {
  CONTINUITY_CAPSULE_FORMAT,
  ContinuityCapsuleError,
  createContinuityCapsule,
  verifyContinuityCapsule
} from "../src/capsule.mjs";
export {
  CONTINUITY_COPY_FORMAT,
  CUSTODY_LIMITS,
  recoverContinuityCapsuleQuorum,
  recoverContinuityCopyQuorum,
  verifyContinuityCopy
} from "../src/custody.mjs";
export { PROTOCOL_PROFILE } from "../src/generated/protocol-profile.mjs";
export {
  createStatePackage,
  createStatePackageInput,
  verifyStatePackage
} from "../src/state/package.mjs";
export {
  createLineage
} from "../src/lineage.mjs";
export {
  isValidatedAcceptance,
  validateGenesis,
  validatePulse
} from "../src/validator.mjs";
export {
  RESOURCE_CONTRACT_LIMITS,
  RESOURCE_FORMATS,
  evaluateResourceContract,
  verifyResourceConsumptionAnnouncement,
  verifyResourceConsumptionWitness,
  verifyResourceLease,
  verifyResourceOffer,
  verifyResourceRevocation,
  verifyResourceUsageReceipt,
  verifyResourceUsageReceiptChain
} from "../src/resource-contract.mjs";
export {
  RESOURCE_EXECUTION_FORMATS,
  RESOURCE_EXECUTION_LIMITS,
  createResourceContentCommitment,
  evaluateResourceExecutionContract,
  verifyResourceExecutionChallenge,
  verifyResourceExecutionReceipt
} from "../src/resource-execution.mjs";
export {
  STORAGE_PLACEMENT_STATUS,
  StoragePlacementError,
  LINEAGE_PLACEMENT_FORMATS,
  LineagePlacementError,
  PLACEMENT_LIVENESS_FORMATS,
  PLACEMENT_LIVENESS_LIMITS,
  PlacementLivenessError,
  convergeLineagePlacementCommits,
  CONFIDENTIAL_PLACEMENT_FORMATS,
  CONFIDENTIAL_PLACEMENT_JOURNAL_LIMITS,
  createConfidentialPlacementJournal,
  createConfidentialPlacementReproofContext,
  createConfidentialPlacementShardSet,
  createLineagePlacementGeneration,
  createPlacementFailureCertificate,
  deriveCommittedPlacementActionPlan,
  deriveConfidentialPlacementReproofNonce,
  evaluateConfidentialPlacementJournal,
  evaluateConfidentialPlacementReproof,
  evaluateConfidentialStoragePlacements,
  evaluateStoragePlacements,
  evaluatePlacementLivenessEvidence,
  finalizePlacementLivenessChallenge,
  finalizePlacementLivenessObservation,
  finalizePlacementLivenessResponse,
  planConfidentialStorageRepair,
  preparePlacementLivenessChallenge,
  preparePlacementLivenessObservation,
  preparePlacementLivenessResponse,
  reconstructConfidentialPackage,
  restoreConfidentialPlacementJournal,
  restoreConfidentialPlacementReproofContext,
  restoreLegacyConfidentialPlacementJournal,
  restoreLineagePlacementGeneration,
  verifyLineagePlacementCommit,
  verifyPlacementFailureCertificate,
  verifyPlacementLivenessChallenge,
  verifyPlacementLivenessObservation,
  verifyPlacementLivenessResponse
} from "./placement.mjs";

```

### lab/i18n/index.mjs

```
import * as en from "./en.mjs";
import * as ko from "./ko.mjs";

const catalogs = Object.freeze({ en, ko });

export function createTranslator(requestedLocale) {
  const selected = catalogs[requestedLocale] ?? catalogs.en;
  return function translate(key, values = {}) {
    const template = selected.messages[key];
    if (typeof template !== "string") throw new TypeError(`missing i18n message: ${key}`);
    return template.replace(/\{([a-z][a-zA-Z0-9]*)\}/g, (match, name) => (
      Object.hasOwn(values, name) ? String(values[name]) : match
    ));
  };
}

export function documentLocale(documentElement = document.documentElement) {
  return documentElement.lang === "ko" ? "ko" : "en";
}

```

### migrations/0001_scenario_rate_limits.sql

```sql
CREATE TABLE IF NOT EXISTS scenario_rate_limits (
  actor_key TEXT PRIMARY KEY NOT NULL,
  window_id INTEGER NOT NULL,
  request_count INTEGER NOT NULL CHECK (request_count >= 1)
) STRICT;

```

### .github/workflows/trusted-pr-policy.yml

```yaml
name: Agent PR Policy

on:
  pull_request_target:
    branches: [main]
    types: [opened, edited, synchronize, reopened, ready_for_review]

concurrency:
  group: agent-pr-policy-${{ github.event.pull_request.number }}
  cancel-in-progress: true

permissions:
  contents: read
  pull-requests: read

jobs:
  policy:
    name: Trusted main-base policy
    runs-on: ubuntu-latest
    timeout-minutes: 2
    steps:
      - name: Check out trusted PR base
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          ref: ${{ github.event.pull_request.base.sha }}
          fetch-depth: 1
          persist-credentials: false

      - name: Set up Node.js
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version: 22

      - name: Validate PR metadata with trusted policy code
        run: node scripts/verify-agent-pr.mjs
        env:
          GITHUB_TOKEN: ${{ github.token }}

```

### lab/styles.css

```css
:root {
  color-scheme: dark;
  --ink: #f4f5f0;
  --muted: #a7aca4;
  --faint: #8b918a;
  --surface: #111411;
  --surface-2: #171b17;
  --line: #303630;
  --acid: #c8ff5c;
  --cyan: #64f0d0;
  --amber: #ffcf70;
  --danger: #ff8f87;
  --max: 1180px;
}

* { box-sizing: border-box; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 280px;
  background:
    radial-gradient(circle at 12% -8%, rgba(100, 240, 208, 0.12), transparent 32rem),
    radial-gradient(circle at 90% 12%, rgba(200, 255, 92, 0.09), transparent 28rem),
    #090b09;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  line-height: 1.55;
}

button, code, select, textarea { font: inherit; }

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  transform: translateY(-180%);
  padding: 0.65rem 0.9rem;
  background: var(--acid);
  color: #080a08;
}

.skip-link:focus { transform: translateY(0); }

.hero, main, footer {
  width: min(calc(100% - 2rem), var(--max));
  margin-inline: auto;
}

.hero { position: relative; padding: clamp(3.5rem, 6vw, 4.8rem) 0 1.5rem; }

.language-nav { position: absolute; top: 1rem; right: 0; }
.language-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  color: var(--ink);
  text-decoration: none;
}
.language-switch:hover { border-color: var(--cyan); }
.language-switch:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.eyebrow, .section-number {
  color: var(--cyan);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pulse-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.65rem;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 1rem rgba(200, 255, 92, 0.8);
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 900px;
  margin: 1rem 0;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(2.35rem, 6.5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

h2 {
  margin-bottom: 0.4rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(1.65rem, 4vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

h3 { font-size: 0.95rem; }

.lede {
  max-width: 780px;
  color: #c4c8c1;
  font-size: clamp(1rem, 2.1vw, 1.28rem);
}

.hero-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hero-cta { display: inline-flex; align-items: center; margin: 0.5rem 0 0.7rem; text-decoration: none; }

.hero-life-card {
  display: grid;
  gap: 0.5rem;
  max-width: 780px;
  margin-top: 1rem;
  border: 1px solid rgba(200, 255, 92, 0.45);
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(120deg, rgba(200, 255, 92, 0.075), rgba(100, 240, 208, 0.035));
}
.hero-life-card > div { display: flex; align-items: center; flex-wrap: wrap; gap: 0.7rem; }
.hero-life-card > strong { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 1.2rem; }
.hero-life-card p { margin: 0; color: var(--muted); font-size: 0.82rem; }

.hero-chips span, .status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  color: var(--muted);
  font-size: 0.72rem;
}

main { display: grid; gap: 1rem; }

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: clamp(1.1rem, 3vw, 2rem);
  background: rgba(17, 20, 17, 0.92);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.18);
}

.boundary { display: grid; grid-template-columns: minmax(180px, 0.65fr) 1.6fr; gap: 1rem 2rem; }
.boundary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.boundary-grid article, .verdict-card, .metric, .retirement, .export-row {
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface-2);
}
.boundary-grid article { padding: 1rem; }
.boundary-grid p, .section-copy, .verdict-card p, .retirement p, .export-row p { color: var(--muted); }
.warning {
  grid-column: 1 / -1;
  margin: 0;
  border-left: 3px solid var(--amber);
  padding: 0.75rem 1rem;
  background: rgba(255, 207, 112, 0.07);
  color: #e9dec2;
}

.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.section-number { margin-bottom: 0.5rem; }
.section-copy { max-width: 800px; }

.status { white-space: nowrap; }
.status.accept { border-color: rgba(200, 255, 92, 0.55); color: var(--acid); }
.status.reject { border-color: rgba(255, 143, 135, 0.55); color: var(--danger); }
.status.busy { border-color: rgba(100, 240, 208, 0.55); color: var(--cyan); }

.guided-panel { border-color: rgba(200, 255, 92, 0.45); }
.guided-steps { display: grid; gap: 0.75rem; margin: 1.5rem 0; padding: 0; list-style: none; }
.guided-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 1rem;
  background: linear-gradient(145deg, rgba(200, 255, 92, 0.035), transparent), var(--surface-2);
}
.guided-step h3 { margin-bottom: 0.3rem; color: var(--ink); }
.guided-step p { margin-bottom: 0.8rem; color: var(--muted); }
.step-marker {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--acid);
  border-radius: 50%;
  color: var(--acid);
  font-weight: 800;
}
.step-result { display: block; margin-top: 0.75rem; color: var(--cyan); overflow-wrap: anywhere; }
.scenario-inputs { display: grid; grid-template-columns: minmax(190px, 0.55fr) 1.45fr; gap: 0.75rem; margin-bottom: 0.75rem; }
.scenario-inputs label { display: grid; gap: 0.3rem; color: var(--faint); font-size: 0.72rem; text-transform: uppercase; }
.scenario-inputs select, .scenario-inputs textarea {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid #4c554c;
  border-radius: 0.55rem;
  
[truncated — 15842 more characters]
```

### .github/workflows/deploy-lab.yml

```yaml
name: Deploy MortalOS Lab

on:
  push:
    branches: [main]
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: mortalos-lab-production
  cancel-in-progress: false

jobs:
  deploy:
    name: Deploy reviewed Lab
    runs-on: ubuntu-latest
    timeout-minutes: 240
    env:
      MORTALOS_SOURCE_COMMIT: ${{ github.sha }}
    steps:
      - name: Check out reviewed main
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
        with:
          fetch-depth: 0
          persist-credentials: false

      - name: Set up Node.js
        uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
        with:
          node-version: 22
          cache: npm

      - name: Require exact main revision
        run: |
          test "$GITHUB_REF" = "refs/heads/main"
          test "$(git rev-parse HEAD)" = "$GITHUB_SHA"

      - name: Require deployment credentials
        env:
          CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
        run: test -n "$CLOUDFLARE_ACCOUNT_ID" && test -n "$CLOUDFLARE_API_TOKEN"

      - name: Install locked dependencies
        run: npm ci

      - name: Install Chromium for source and public verification
        run: npx playwright install --with-deps chromium

      - name: Verify exact source before deployment
        run: npm test

      - name: Verify promoted S0 through S4 receipts
        run: |
          npm run verify:baseline
          npm run verify:s1
          npm run verify:s2
          npm run verify:s3
          npm run verify:s4

      - name: Deploy exact relay artifact and Durable Object migration
        env:
          CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
        run: npx wrangler deploy --config relay/wrangler.jsonc

      - name: Deploy exact static artifact
        env:
          CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
        run: npm run deploy:lab

      - name: Verify public artifact, relay, and bilingual judge path
        env:
          MORTALOS_EXPECTED_COMMIT: ${{ github.sha }}
          MORTALOS_LAB_URL: https://mortal-os.com
          MORTALOS_DEPLOY_VERIFY_ATTEMPTS: 12
          MORTALOS_DEPLOY_VERIFY_DELAY_MS: 5000
        run: npm run verify:release

```

[31 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]