Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- run: pnpm lint
- run: pnpm test
- name: Assurance evidence writer regression checks
run: node --test evals/assurance-integrity/evidence.test.mjs
run: node --test evals/assurance-integrity/evidence.test.mjs evals/assurance-integrity/replay.test.mjs
- name: Assurance integrity adversarial experiment
run: node evals/assurance-integrity/run.mjs
- name: Public integrity examples match the production gate
Expand Down
11 changes: 4 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,10 @@ workflow.

## OPEN QUESTIONS

- **User mode fork UI** — still open, and the shape of the gap is now known.
`state.userModes` is *read* in three places (`LeftRail.tsx:44,55`,
`MobileConfig.tsx:38,48`) and merged by `findMode()` (`modes.ts:44`), but
nothing writes it: there is no create/fork surface anywhere in the UI, so the
array is permanently `[]` in practice. `userModes` is also on the extractor's
forbidden-field list, which is correct and must stay — whatever UI gets built,
modes are authored by the operator, never by extraction.
- **User mode fork UI — resolved.** The Modes panel creates, edits, selects,
deletes and exports operator-authored session modes. Built-ins remain protected;
automated extraction still cannot write `userModes`. Reset/tab close clears
these session-only modes; the UI states this before authoring.

- **`projectNarratives` persistence — resolved, and the answer is "session-only."**
Not an open question any more. `narrativeExport.ts` is imported only by
Expand Down
43 changes: 32 additions & 11 deletions docs/research/assurance-integrity/recorded-run.json

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions docs/research/ui-alignment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# UI alignment and replay boundary — release evidence

## Scope and decisions

The app had backend and compiler capabilities without usable controls: user modes
were read but never authored; the audit view displayed hashes without a check or
export action; STELE's project record still declared SHA-256 wiring, the single
file build and T-010 unresolved. This release connects those existing capabilities.

The session page derives its status and capability flags from the production
integrity table. It distinguishes local audit consistency from completeness and
approved-objective fidelity. It does not claim remote delivery, remote chain
verification, or live CI status. Modes remain operator-authored and session-only;
extraction cannot write them. The EPOCHÉ reset-only boundary is unchanged.

Design direction: an editorial inspection desk within Cipher Gothic. The serif
inscription establishes hierarchy; monospace metadata stays subordinate. The
current operational state and available actions precede detailed evidence.

Sources studied (principles only; no assets or code copied):

- [Charm's process](https://charm.land/blog/100k): make the next action discoverable
and test both small and large windows; derive views from actual state.
- [GOV.UK details](https://design-system.service.gov.uk/components/details): disclose
optional depth without hiding frequently needed actions. Verification and export
remain visible; supporting boundaries can be expanded.
- [Generous archival interfaces](http://ica2012.ica.org/files/pdf/Full%20papers%20upload/ica12Final00423.pdf):
overview before query and context beside primary evidence. Existing project
typography and theme tokens are retained rather than introducing new assets.

## Original finding and repaired boundary

On c2adff7 the bs probe replaced only scope.mjs with `inScope = () => false`.
The candidate returned `{covered:[], counterexamples:[], holds:true}` and replay
returned ZANSHIN, although the witness gate was false. The original pinned
manifest detected modified file bytes; replay itself did not verify that identity.

Replay now requires a caller-pinned complete input snapshot. Authentication
precedes imports, verified bytes are materialized in a fresh private directory,
and scope witnesses are evaluated separately from candidate proof claims. The
input digest must come from an independently trusted caller/approved record;
a colocated digest is not an external approval anchor. Only synthetic fixtures
are supported; Node candidate imports are not an OS sandbox. The seventh fixture
preserves the original empty-scope counterexample. This is bounded regression
evidence, not formal proof or general autonomous-agent robustness.

## Verification and reproduction

Use Node 24 and the repository pnpm lockfile. Commands for the final candidate:

```sh
pnpm check
pnpm build
node --test evals/assurance-integrity/evidence.test.mjs evals/assurance-integrity/replay.test.mjs
node evals/assurance-integrity/run.mjs .closure/release-assurance
node site/check-story.mjs
```

`browser-smoke.cjs` uses Playwright and system Chromium, without adding a runtime
dependency to STELE. Run against `pnpm dev`, or set STELE_TEST_URL to a preview or
production URL. It checks desktop mode authoring, section/verbosity edits,
protected built-ins, deletion fallback, chain verification, JSON export, mobile
navigation and overflow, and uncaught browser exceptions. Screenshots default
to /tmp; screenshot destinations can be overridden with STELE_DESKTOP_SCREENSHOT
and STELE_MOBILE_SCREENSHOT. It uses synthetic session data and no model API key.

Initial browser attempt stopped because the test required the accessible name
`Levers` exactly while its button includes a decorative glyph. A suffix match
fixed the test; no product defect was inferred. The corrected run passed desktop,
390px mobile, mode authoring and audit export (one session-start entry), with no
page exceptions. Release execution results and deployment IDs are retained in
RELEASE.md rather than inferring deployment from successful compilation.
46 changes: 46 additions & 0 deletions docs/research/ui-alignment/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Release candidate v1.3.0

## Recoverable state

Branch: `codex/replay-and-ui-alignment`.
Replay milestone: e50d962 (pushed). UI milestone follows on the same branch.
Base: 0d6f272. No production deployment is inferred from local checks.

Completed: caller-pinned replay snapshots, independent scope witnesses, seventh
counterexample fixture, replay regressions in CI; session overview; user-mode
fork/edit/select/delete/export; local chain check/export; current capability flags;
responsive tablet/mobile navigation; removal of resolved project questions.

Preserved limits: synthetic candidates only, shared Node/host, trusted output
parent, external pin approval required, session-only user modes, no remote audit
delivery guarantee. EPOCHÉ retains its single reset path.

## Evidence before publication

- Existing baseline: typecheck, lint, 149 tests passed.
- Eight Node evidence/replay tests passed; all seven experiment decisions agree.
- Refreshed archive: 110 manifest entries verified.
- Browser smoke: desktop and 390px mobile passed mode creation/edit/delete,
built-in protection, audit consistency check, JSON export; no page exceptions.
- Initial final-check attempt hit pnpm's default home path outside the writable
workspace after the version bump. Re-running installation/check/build with
XDG_DATA_HOME, XDG_CACHE_HOME and PNPM_HOME under /workspace succeeded; no
product or release gate was disabled. The lockfile remains unchanged.

## Final gates and handoff

Before merge, run against the final UI commit:

```sh
export XDG_DATA_HOME=/workspace/work/pnpm-data XDG_CACHE_HOME=/workspace/work/pnpm-cache PNPM_HOME=/workspace/work/pnpm-home
pnpm check
pnpm build
node --test evals/assurance-integrity/evidence.test.mjs evals/assurance-integrity/replay.test.mjs
node docs/research/ui-alignment/browser-smoke.cjs
```

The browser command requires a running app (default http://localhost:5173/) and
Playwright/system Chromium. The hosted production build additionally uses the
public VITE_STELE_CORE_URL through site/assemble.zsh. Deployment requires main's
checks, then the deploy-site workflow and post-deploy browser verification.
Deployment IDs and final outcomes belong in a follow-up entry below.
36 changes: 36 additions & 0 deletions docs/research/ui-alignment/browser-smoke.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const { chromium } = require('playwright');
const fs = require('fs');
(async () => {
const browser = await chromium.launch({executablePath:'/usr/bin/chromium',headless:true,args:['--no-sandbox']});
const page = await browser.newPage({viewport:{width:1440,height:1100}});
const errors=[]; page.on('pageerror',e=>errors.push(e.message));
await page.goto(process.env.STELE_TEST_URL || 'http://localhost:5173/');
await page.getByRole('heading',{name:/Know what governs/}).waitFor();
await page.getByRole('button',{name:'Verify local chain'}).click();
await page.getByRole('status').filter({hasText:/ZANSHIN.*entries checked/}).waitFor();
const downloadPromise=page.waitForEvent('download'); await page.getByRole('button',{name:'Export audit JSON'}).click();
const download=await downloadPromise; const audit=JSON.parse(fs.readFileSync(await download.path(),'utf8'));
if(audit.currentState!=='ZANSHIN'||!audit.entries.length)throw Error('audit export incomplete');
await page.screenshot({path:process.env.STELE_DESKTOP_SCREENSHOT || '/tmp/stele-session-desktop.png',fullPage:true});
await page.getByRole('button',{name:'Modes',exact:true}).click();
await page.getByRole('textbox',{name:'Mode name',exact:true}).fill('Release review');
await page.getByRole('button',{name:'Create and select mode'}).click();
await page.getByRole('heading',{name:'Edit Release review'}).waitFor();
await page.getByRole('combobox',{name:'Mode verbosity'}).selectOption('expanded');
await page.getByRole('checkbox',{name:'Code',exact:true}).uncheck();
if(await page.getByRole('checkbox',{name:'Code',exact:true}).isChecked())throw Error('section not updated');
await page.getByRole('button',{name:'Delete Release review',exact:true}).click();
if(await page.getByRole('button',{name:'Delete BUILD',exact:true}).count())throw Error('built-in delete exposed');
await page.getByRole('button',{name:'Session',exact:true}).click();
await page.getByRole('heading',{name:'BUILD · standard'}).waitFor();
await page.setViewportSize({width:820,height:1000});
await page.getByRole('button',{name:/Levers$/}).click();
await page.getByRole('heading',{name:/Know what governs/}).waitFor();
await page.setViewportSize({width:390,height:844});
const overflow=await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth);
if(overflow)throw Error('mobile overflow');
await page.screenshot({path:process.env.STELE_MOBILE_SCREENSHOT || '/tmp/stele-session-mobile.png',fullPage:true});
if(errors.length)throw Error(errors.join('\n'));
console.log(JSON.stringify({desktop:'passed',mobile:'passed',modeAuthoring:'passed',auditExportEntries:audit.entries.length,pageErrors:errors}));
await browser.close();
})().catch(e=>{console.error(e);process.exit(1)});
38 changes: 27 additions & 11 deletions evals/assurance-integrity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Node 24, no dependencies, network, API key, or database required:
node evals/assurance-integrity/run.mjs
cat .closure/assurance-integrity/summary.json
node evals/assurance-integrity/replay.mjs \
.closure/assurance-integrity/transitive-weakening/original-specification.json \
.closure/assurance-integrity/transitive-weakening/candidate
.closure/assurance-integrity/transitive-weakening/replay-input.json \
"$REPLAY_PIN"
```

An optional first argument to `run.mjs` selects the evidence directory. The run
Expand Down Expand Up @@ -47,6 +47,7 @@ an autonomous agent's bypass rate. No model is in the grader.
- **Transitive dependency:** enable EPOCHÉ extraction in the imported production
table and redefine the scope helper to select states by current permissions.
The proof module stays byte-identical and returns true; EPOCHÉ disappears.
- **Empty imported scope:** replace only the scope helper with `inScope = () => false`. Statement and permissions remain unchanged; replay must reject missing witnesses.
- **Controls:** accept the unchanged implementation and a comment-only edit.
The latter tests semantic discrimination but is not a security repair.

Expand Down Expand Up @@ -81,15 +82,24 @@ Private permissions are not isolation from processes running as the same user.
Run the race, symlink, exclusive-write, and concurrent-writer regression checks:

```sh
node --test evals/assurance-integrity/evidence.test.mjs
node --test evals/assurance-integrity/evidence.test.mjs evals/assurance-integrity/replay.test.mjs
```

`replay.mjs` is separately implemented and runs in a fresh process against a
fresh temporary copy, checking the original states directly. It never imports
the candidate proof or scope helper. It shares Node, the host and the capability
table with the driver; this is neither an independent formal kernel nor an
OS isolation boundary. The replay checks objective fidelity, not the mutation
machinery. The driver checks agreement on all six expected decisions.
`replay.mjs` requires a complete per-case `replay-input.json` snapshot and a
caller-held SHA-256 pin. It authenticates the exact snapshot bytes before parsing
or importing candidate code, then materializes only those captured inputs into a
fresh private directory. It independently evaluates the scope helper for required
WABI/EPOCHÉ witnesses and checks permissions, without executing the candidate
proof or trusting its reported coverage. The driver checks agreement on all
seven expected decisions, including the empty imported scope found by the bs
probe. Replay does not rerun mutation sensitivity.

The driver records `replayPin` in each summary row for convenience and passes its
in-memory value directly to replay. A manual reviewer must obtain the expected
pin from an independently trusted channel or approved commit; reading a pin next
to attacker-writable evidence supplies no external trust anchor. The CLI refuses
a missing or mismatched pin. It shares Node and the host with the driver; this
is neither an independent formal kernel nor an OS isolation boundary.

## Limits

Expand Down Expand Up @@ -131,9 +141,15 @@ for name, digest in manifest['files'].items():
print('Manifest verified')
PY
node evals/assurance-integrity/replay.mjs \
.closure/recorded-assurance/transitive-weakening/original-specification.json \
.closure/recorded-assurance/transitive-weakening/candidate
.closure/recorded-assurance/transitive-weakening/replay-input.json \
"$REPLAY_PIN"
```

The archive's root `run.mjs` is a captured copy of the driver for provenance;
run the repository entry point above to regenerate evidence against the checkout.

The original bs probe demonstrated empty scope with `holds: true`, no covered
states, and a ZANSHIN replay on c2adff7. The new pinned replay rejects that same
semantic construction even when the trusted caller deliberately pins the changed
fixture. Regression tests also exercise stale/missing pins, partial witnesses,
forged proof coverage, and import-side-effect prevention before authentication.
68 changes: 41 additions & 27 deletions evals/assurance-integrity/replay.mjs
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
// Separately implemented checker. Never imports the candidate's proof or predicate.
import { readFileSync } from 'node:fs'
// Trusted checker; accepts only a caller-pinned complete replay input snapshot.
// Candidate modules are synthetic fixtures, not arbitrary sandboxed agent code.
import { readFileSync, writeFileSync, mkdtempSync, rmSync } from 'node:fs'
import { createHash } from 'node:crypto'
import { pathToFileURL } from 'node:url'
import { resolve } from 'node:path'
import { join } from 'node:path'
import { tmpdir } from 'node:os'
import assert from 'node:assert/strict'

const [baselinePath, candidatePath] = process.argv.slice(2)
const baseline = JSON.parse(readFileSync(resolve(baselinePath), 'utf8'))
const candidate = JSON.parse(readFileSync(resolve(candidatePath, 'claim.json'), 'utf8'))
const { INTEGRITY_STATES } = await import(pathToFileURL(resolve(candidatePath, 'integrity.ts')))
const [snapshotPath, expectedDigest] = process.argv.slice(2)
assert.ok(snapshotPath && /^[a-f0-9]{64}$/.test(expectedDigest ?? ''), 'EPOCHÉ: replay requires an externally supplied SHA-256 pin')
const bytes = readFileSync(snapshotPath)
const digest = value => createHash('sha256').update(value).digest('hex')
const differences = []
for (const key of ['claim', 'precondition']) {
if (candidate[key] !== baseline[key]) differences.push(key)
}
const counterexamples = baseline.requiredWitnesses.filter(state =>
INTEGRITY_STATES[state]?.allowsExtraction !== false)
// An all-state prohibition is false on the approved domain as well.
if (candidate.claim === 'all-deny') {
for (const state of baseline.states) {
if (INTEGRITY_STATES[state]?.allowsExtraction !== false && !counterexamples.includes(state)) {
counterexamples.push(state)
}
assert.equal(digest(bytes), expectedDigest, 'EPOCHÉ: replay input identity changed')
// Parse and execute only bytes from this authenticated read, never reopen inputs.
const { specification: baseline, files } = JSON.parse(bytes)
assert.deepEqual(Object.keys(files).sort(), ['claim.json', 'integrity.ts', 'proof.mjs', 'scope.mjs'])
assert.ok(Object.values(files).every(value => typeof value === 'string'))
assert.deepEqual(baseline.states, ['ZANSHIN', 'UNHEIMLICH', 'WABI', 'EPOCHÉ'])
assert.deepEqual(baseline.requiredWitnesses, ['WABI', 'EPOCHÉ'])
assert.ok(['suspended-deny', 'all-deny'].includes(baseline.claim))
assert.equal(baseline.precondition, 'suspended')
const candidate = JSON.parse(files['claim.json'])
const differences = ['claim', 'precondition'].filter(key => candidate[key] !== baseline[key])
const directory = mkdtempSync(join(tmpdir(), 'stele-pinned-replay-'))
try {
for (const [name, content] of Object.entries(files)) {
writeFileSync(join(directory, name), content, { flag: 'wx', mode: 0o600 })
}
}
const result = {
objectiveDigest: digest(readFileSync(resolve(baselinePath))),
statementDifferences: differences,
counterexamples,
decision: differences.length || counterexamples.length ? 'KIRI' : 'ZANSHIN',
}
process.stdout.write(JSON.stringify(result) + '\n')
const { INTEGRITY_STATES: states } = await import(pathToFileURL(join(directory, 'integrity.ts')))
const { inScope } = await import(pathToFileURL(join(directory, 'scope.mjs')))
assert.equal(typeof inScope, 'function')
// Reconstruct scope independently. Never execute proof.mjs or trust its coverage.
const covered = baseline.states.filter(state => candidate.precondition === 'suspended' &&
(candidate.claim === 'all-deny' || inScope(state) === true))
const missingWitnesses = baseline.requiredWitnesses.filter(state => !covered.includes(state))
const requiredDomain = baseline.claim === 'all-deny' ? baseline.states : baseline.requiredWitnesses
const counterexamples = requiredDomain.filter(state => states[state]?.allowsExtraction !== false)
process.stdout.write(JSON.stringify({
inputDigest: expectedDigest,
objectiveDigest: digest(JSON.stringify(baseline)),
statementDifferences: differences,
covered, missingWitnesses, counterexamples,
decision: differences.length || missingWitnesses.length || counterexamples.length ? 'KIRI' : 'ZANSHIN',
}) + '\n')
} finally { rmSync(directory, { recursive: true, force: true }) }
Loading
Loading