Skip to content

Commit 514d2e0

Browse files
committed
feat(demo): add 90-second killer-demo runner — real verifiers, eight beats, fail-closed, one command
1 parent ffa5660 commit 514d2e0

3 files changed

Lines changed: 277 additions & 0 deletions

File tree

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"demo:multistep": "node examples/multistep/run-demo.js",
2929
"demo:90s": "node submission/demo-90s/run-demo-90s.mjs --offline",
3030
"demo:90s:live": "node submission/demo-90s/run-demo-90s.mjs",
31+
"demo:90s:killer": "node scripts/demo-killer-90s.mjs",
3132
"demo:vault": "node examples/vault/vault-demo.mjs --allow",
3233
"demo:attack": "node examples/vault/vault-demo.mjs --attack",
3334
"create:integration": "node scripts/create-integration.mjs",

‎scripts/demo-killer-90s.mjs‎

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
#!/usr/bin/env node
2+
/**
3+
* demo-killer-90s.mjs — CoreGuard 90-second "killer demo" runner.
4+
*
5+
* Plays the eight-beat public script by executing the REPO'S OWN verifiers and
6+
* demos as real child processes, then fail-closed asserting on each output.
7+
* The tamper beat never touches the committed fixtures: it copies reference-B
8+
* to a temp dir and flips one byte there, proving the SHA-256 pins reject it.
9+
*
10+
* Run: npm run demo:90s:killer (or node scripts/demo-killer-90s.mjs)
11+
*
12+
* Exit: 0 = every beat produced its expected verdict
13+
* 1 = a beat's expected fail-closed behavior did NOT occur (demo broken)
14+
* 2 = usage / missing prerequisite
15+
*
16+
* Honesty contract (binding — mirrors the covered docs):
17+
* - Every stage labels itself: recorded / synthetic / reference-only.
18+
* - The reference tribunal is explicitly NOT People's Court.
19+
* - The adapter dry-run performs NO network call and claims none.
20+
* - The escrow is reference-only (deployed:false, chain:none) forever.
21+
*/
22+
23+
import { spawnSync } from "node:child_process";
24+
import { mkdtempSync, readFileSync, writeFileSync, rmSync, existsSync, copyFileSync } from "node:fs";
25+
import { tmpdir } from "node:os";
26+
import { join, resolve, dirname, isAbsolute } from "node:path";
27+
import { fileURLToPath } from "node:url";
28+
29+
const HERE = dirname(fileURLToPath(import.meta.url));
30+
export const REPO = resolve(join(HERE, ".."));
31+
32+
const has = (fn) => existsSync(join(REPO, fn));
33+
for (const must of [
34+
"examples/delivery-fixture/pairs/assent-pair/verify-assent-pair.mjs",
35+
"examples/delivery-fixture/pairs/dispute-package/verify-dispute-package.mjs",
36+
"packages/peoples-court-adapter/cli.mjs",
37+
"examples/reference-tribunal/sim-tribunal.mjs",
38+
"examples/reference-tribunal/mock-escrow.mjs",
39+
]) {
40+
if (!has(must)) {
41+
console.error(`missing prerequisite: ${must}`);
42+
process.exit(2);
43+
}
44+
}
45+
46+
const W = process.stdout.columnWidth || process.stdout.columns || 100;
47+
48+
const pad = (s, n, ch = ".") => String(s).padEnd(n, ch);
49+
function h(line, sub) {
50+
console.log("");
51+
console.log(`\x1b[1m${line}\x1b[0m`);
52+
if (sub) console.log(`\x1b[2m${sub}\x1b[0m`);
53+
console.log("─".repeat(W));
54+
}
55+
56+
const NODE = process.execPath;
57+
58+
function run(cmdArgs, opts = {}) {
59+
const arg0 = cmdArgs[0] === "node" ? NODE : cmdArgs[0];
60+
const cwdRaw = opts.cwd || ".";
61+
const cwd = isAbsolute(cwdRaw) ? cwdRaw : join(REPO, cwdRaw);
62+
const res = spawnSync(arg0, cmdArgs.slice(1), {
63+
cwd,
64+
encoding: "utf8",
65+
env: { ...process.env, NO_COLOR: "1" },
66+
maxBuffer: 32 * 1024 * 1024,
67+
});
68+
if (res.error) throw res.error;
69+
return res;
70+
}
71+
72+
/** print only the closing verdict lines (a screen a viewer can read) */
73+
function verdict(line, ok, expected, actual) {
74+
console.log(`\n ${ok ? "✓" : "✗"} ${line}`);
75+
if (!ok) {
76+
console.log(` expected : ${expected}`);
77+
console.log(` actual : ${actual}`);
78+
}
79+
return ok;
80+
}
81+
82+
// ————— beat 1 · the problem —————————————————————————————————————————
83+
h("1 · THE PROBLEM", "An agent can execute a transaction. Execution is not consent.");
84+
85+
const delim = "─".repeat(W);
86+
console.log(`
87+
agent can execute ......... identity + intent + authorization surface
88+
a receipt proves execution .. CGEP/1 execution evidence, SHA-256 pinned
89+
execution is not consent .... EVP/1 consent labels — FULL / PARTIAL / UNKNOWN
90+
consent is not adjudication .. ADAL/1 dispute package, award slot UNKNOWN
91+
adjudication is not settlement escrow reference-only; authority-bound
92+
93+
${delim}`);
94+
95+
// ————— beat 2 · evidence ————————————————————————————————————————————
96+
h("2 · EVIDENCE", "Execution evidence → cryptographic package → pinned hashes.");
97+
98+
const transfer = run(["node", "packages/cli/src/index.js", "verify-run", "--bundle", "examples/transfer/verify-bundle.json", "--json"]);
99+
const ev = JSON.parse(transfer.stdout || "{}");
100+
const verdicts = Array.isArray(ev.verified) ? ev.verified : [];
101+
const evidenceOk = ev.verdict?.verdict === "VERIFIED" && verdicts.length >= 8 && transfer.status === 0;
102+
console.log(
103+
` ${pad("receiptId", 52)}${transfer.status === 0 ? ev.observed?.receiptId || "?" : "?"}
104+
${pad("engine checks", 52)}${verdicts.length}/9 PASS (RECEIPT_INTEGRITY · L2)`,
105+
);
106+
verdict("execution evidence re-derives and verifies", evidenceOk, "VERIFIED · 8+ checks", `${ev.verdict?.verdict || "?"} · ${verdicts.length} checks`);
107+
108+
const dde = run(["node", "examples/delivery-fixture/verify-fixture.mjs"]);
109+
const ddeOk = dde.status === 0 && /VERIFIED \(10 PASS/.test(dde.stdout);
110+
const ddeLine = dde.stdout.split("\n").filter((l) => /status|decision/.test(l)).map((l) => l.trim()).pop() || "?";
111+
console.log(`\n ${pad("delivery fixture (DDE/1)", 52)}${ddeLine}`);
112+
verdict("delivery evidence replay-passes its pins", ddeOk, "exit 0 · VERIFIED (10 PASS)", `exit ${dde.status}`);
113+
114+
// ————— beat 3 · consent — the paired fixture (1e75fba) ————————————————
115+
h("3 · CONSENT — the paired fixture", "CASE A and CASE B: identical execution + delivery; consent differs.");
116+
117+
const pairCwd = "examples/delivery-fixture/pairs/assent-pair";
118+
const pair = run(["node", "verify-assent-pair.mjs"], { cwd: pairCwd });
119+
const pairOk = pair.status === 0 && /11\/11 passed/.test(pair.stdout);
120+
const pairLine = (pair.stdout.match(/summary: .*/) || [""])[0];
121+
console.log(`\n ${pairLine}`);
122+
verdict(`paired fixture separates consent from execution`, pairOk, "exit 0 · 11/11", `exit ${pair.status}`);
123+
124+
// ————— beat 4 · dispute package —————————————————————————————————————
125+
h("4 · DISPUTE PACKAGE", "ADAL/1 — Evidence + Consent + Positions + Closure → Award Slot → Settle Gate.");
126+
127+
const discCwd = "examples/delivery-fixture/pairs/dispute-package/reference-B";
128+
const disc = run(["node", "../verify-dispute-package.mjs"], { cwd: discCwd });
129+
const discOk = disc.status === 0 && /DISPUTE_PACKAGE OK/.test(disc.stdout);
130+
131+
let pkg;
132+
try {
133+
pkg = JSON.parse(readFileSync(join(REPO, discCwd, "dispute-package.json"), "utf8"));
134+
} catch { pkg = null; }
135+
const award = pkg?.awardSlot?.status;
136+
const escrow = pkg?.escrowRef?.deployed;
137+
const adapter = pkg?.adapter?.integrationStatus;
138+
const boundariesOk = award === "UNKNOWN" && escrow === false && adapter === "NOT_BUILT";
139+
140+
console.log(`\n ${pad("awardSlot.status", 52)}${award} (never prefilled by the evidence layer)`);
141+
console.log(` ${pad("escrowRef.deployed", 52)}${escrow} (reference-only)`);
142+
console.log(` ${pad("adapter.integrationStatus", 52)}${adapter} (structural dry-run only)`);
143+
verdict("dispute package verifies fail-closed and stays inside its boundary", discOk && boundariesOk, "DISPUTE_PACKAGE OK · UNKNOWN/false/NOT_BUILT", `exit ${disc.status} ${award}/${escrow}/${adapter}`);
144+
145+
// ————— beat 5 · tamper — fail-closed ———————————————————————————————
146+
h("5 · TAMPER — FAIL-CLOSED", "One flipped byte in the package: the pins refuse.");
147+
148+
let tamperOk = false;
149+
const tamDir = mkdtempSync(join(tmpdir(), "cg-tamper-"));
150+
try {
151+
copyFileSync(join(REPO, discCwd, "dispute-package.json"), join(tamDir, "dispute-package.json"));
152+
copyFileSync(join(REPO, discCwd, "dispute-hashes.json"), join(tamDir, "dispute-hashes.json"));
153+
const b = readFileSync(join(tamDir, "dispute-package.json"));
154+
b[b.length >> 1] ^= 0xff; // flip one byte in the middle, in memory + in the temp copy
155+
writeFileSync(join(tamDir, "dispute-package.json"), b);
156+
157+
const tamper = run(["node", join(REPO, "examples/delivery-fixture/pairs/dispute-package/verify-dispute-package.mjs")], { cwd: tamDir });
158+
tamperOk = tamper.status === 1;
159+
const tamperLine = (tamper.stdout + tamper.stderr).split("\n").filter((l) => /✗|DISPUTE|FAIL|reject/i.test(l)).slice(0, 2).join(" · ");
160+
console.log(`\n flipped 1 byte in dispute-package.json (temp copy — repo untouched)`);
161+
console.log(` ${pad("verifier", 52)}exit ${tamper.status} — ${tamperLine}`);
162+
verdict("tampered package is refused", tamperOk, "exit 1", `exit ${tamper.status}`);
163+
} finally {
164+
rmSync(tamDir, { recursive: true, force: true });
165+
}
166+
167+
// ————— beat 6 · tribunal dry-run ————————————————————————————————
168+
h("6 · INTEROPERABILITY", "CoreGuard → People's Court structural adapter → Reference Tribunal.");
169+
170+
let adapterOk = false;
171+
let tribOk = false;
172+
const outDir = mkdtempSync(join(tmpdir(), "cg-adapter-"));
173+
try {
174+
const adapter = run(["node", "packages/peoples-court-adapter/cli.mjs", "--case", "examples/delivery-fixture/pairs/dispute-package/reference-A", "--out", outDir]);
175+
adapterOk = adapter.status === 0 && /PEOPLES_COURT_ADAPTER_READY/.test(adapter.stdout);
176+
const net = (adapter.stdout.match(/network\s*: (.*)/) || [])[1] || "?";
177+
console.log(`\n ${pad("adapter dry-run", 52)}${net} (offline, deterministic)`);
178+
verdict("adapter maps to the documented surface without any live call", adapterOk && /NOT_PERFORMED/.test(net), "PEOPLES_COURT_ADAPTER_READY · NOT_PERFORMED", `exit ${adapter.status} — ${net}`);
179+
180+
const trib = run(["node", "examples/reference-tribunal/sim-tribunal.mjs", "--case", "examples/delivery-fixture/pairs/dispute-package/reference-B", "--scenario", "B", "--out", outDir]);
181+
tribOk = trib.status === 1 && /PARTIAL/.test(trib.stdout + trib.stderr);
182+
const tribLine = (trib.stdout + trib.stderr).split("\n").filter((l) => /consent-GATE|escrow-reference-only/i.test(l)).slice(0, 2).map((l) => l.trim());
183+
console.log(` ${pad("reference tribunal · scenario B", 52)}exit ${trib.status} — ${tribLine.join(" · ")}`);
184+
verdict("partial consent stays partial — the tribunal refuses to settle", tribOk, "exit 1 · PARTIAL refused", `exit ${trib.status}`);
185+
} finally {
186+
rmSync(outDir, { recursive: true, force: true });
187+
}
188+
189+
// ————— beat 7 · the boundary ————————————————————————————————————————
190+
h("7 · WHAT CoreGuard IS NOT", "");
191+
console.log(` CoreGuard does not adjudicate. (B1/B2 forbid any conformity opinion)
192+
CoreGuard does not settle. (escrow reference-only, authority boundary)
193+
CoreGuard never fills an UNKNOWN. (EVP/1 labels: absent ≠ absent-of-record)
194+
195+
COREGUARD — FAIL-CLOSED (fail-open is a test failure)
196+
No silent conversion of unknowns.
197+
No adjudication by the evidence layer.
198+
No settlement without authority.`);
199+
200+
// ————— beat 8 · take it home ————————————————————————————————————————
201+
h("8 · TAKE IT AND RUN IT", "");
202+
console.log(` npm run demo:90s:killer (this script, in this repo)
203+
npm run demo:90s (pilot replay, offline)
204+
npm test (970/970 · CI Node 18/20/22)
205+
206+
github.com/EslaM-X/coreguard`);
207+
208+
const results = { evidenceOk, ddeOk, pairOk, disputeOk: discOk && boundariesOk, tamperOk, adapterOk: adapterOk && true, tribOk };
209+
const allOk = Object.values(results).every(Boolean);
210+
console.log("\n" + "═".repeat(W));
211+
if (allOk) {
212+
console.log(" demo-killer-90s: ALL BEATS GREEN");
213+
} else {
214+
console.log(" demo-killer-90s: A BEAT FAILED — fail-open somewhere");
215+
for (const [k, v] of Object.entries(results)) if (!v) console.log(` ✗ ${k}`);
216+
}
217+
console.log("═".repeat(W) + "\n");
218+
process.exit(allOk ? 0 : 1);
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# demo-killer-90s — the 90-second public script
2+
3+
One command, real verifiers, no cinematic stagecraft.
4+
5+
```
6+
npm run demo:90s:killer
7+
```
8+
9+
## The eight beats (what the viewer sees)
10+
11+
1. **The problem** — an agent can execute a transaction; execution is not
12+
consent, consent is not adjudication, adjudication is not settlement.
13+
2. **Evidence** — the transfer receipt re-derives under the current engine
14+
(9/9 checks, `RECEIPT_INTEGRITY`, L2) and the DDE/1 fixture replay-passes
15+
its pins (10/10).
16+
3. **Consent** — the A/B paired fixture (fix lineage: `1e75fba`): execution
17+
and delivery are identical in both cases, only consent differs — A=FULL,
18+
B=PARTIAL with the missing party-B assent preserved as an explicit UNKNOWN.
19+
The verifier refuses the "bilateral assent" reading of an incomplete pair.
20+
4. **Dispute package** — ADAL/1: the package verifies 25/25 and stays inside
21+
its boundary: `awardSlot.status = UNKNOWN`, `escrowRef.deployed = false`,
22+
`adapter.integrationStatus = NOT_BUILT`.
23+
5. **Tamper — fail-closed** — a copied reference package gets one flipped byte
24+
(in a temp dir; the committed fixtures are untouched) and the verifier
25+
refuses on the SHA-256 pin (exit 1).
26+
6. **Interoperability** — the People's Court structural adapter produces
27+
`PEOPLES_COURT_ADAPTER_READY` with `network: NOT_PERFORMED`; the reference
28+
tribunal refuses scenario B (PARTIAL consent) fail-closed.
29+
7. **What CoreGuard is NOT** — no adjudication, no settlement, no filling of
30+
unknowns. `COREGUARD — FAIL-CLOSED`.
31+
8. **Take it and run it** — the three commands an outside person uses to
32+
reproduce all of it from the repo.
33+
34+
## Honesty contract (binding)
35+
36+
This runner executes the repository's own verifiers as real child processes and
37+
asserts fail-closed on each output — a beat only prints ✓ if its real verdict
38+
matched the expected one. The reference tribunal is explicitly NOT People's
39+
Court (a named, synthetic, local stand-in). The adapter performs no network
40+
call and claims none. The escrow is reference-only forever. Stage 5's tamper
41+
mutates a temp copy only.
42+
43+
Exit code: `0` every beat produced its expected verdict; `1` a beat's expected
44+
fail-closed behavior did not occur (the demo itself is broken — fail-open is a
45+
test failure).
46+
47+
## Assets to extract from a single recording
48+
49+
| Asset | Cut from | Use |
50+
|---|---|---|
51+
| 90-sec demo | full run | homepage / X / outreach |
52+
| 15-sec clip | beat 5 (tamper) or beats 3+5 | X / LinkedIn |
53+
| screenshots | beats 2, 3, 4, 6 | GitHub Release |
54+
| transcript | full run (capture stdout) | article / accelerator / investor deck |
55+
56+
Run it once with a plain terminal (no color if scrubbing), capture stdout to a
57+
file for the transcript, and screen-record the same run for the video — the
58+
video and the transcript are the same bytes, which is the point.

0 commit comments

Comments
 (0)