runward 0.13.2 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { join, resolve } from "node:path";
2
2
  import { analyze, findMissionRoot } from "../lib/mission.js";
3
3
  import { conformance, driftReport, unratifiedAdrs, decisionCoverage } from "../lib/conformance.js";
4
+ import { behavioralProof } from "../lib/behavioral-proof.js";
4
5
  import { runHooks } from "../lib/hooks.js";
5
6
  import { c, createHeader, section, status } from "../lib/styles.js";
6
7
  import { VERSION } from "../lib/paths.js";
@@ -96,6 +97,27 @@ export async function checkCommand(opts) {
96
97
  strictGaps += unratified.length;
97
98
  }
98
99
  if (checked > 0 && strictGaps === 0) {
100
+ // The two proofs, made legible together: this gate is the DOCUMENTARY proof (decisions traced);
101
+ // the BEHAVIORAL proof is the operator's test suite. runward reads the pointer, never runs the code.
102
+ console.log(section("Behavioral proof (advisory, above the gate)"));
103
+ console.log(" " + c.darkGray("this gate is the documentary proof: the decisions are traced. runward did not run your code — it is not a runtime. The behavioral proof is your test suite."));
104
+ const bp = behavioralProof(mission, root);
105
+ if (!bp.declared) {
106
+ console.log(" " + c.darkGray("no behavioral proof declared — add `Behavioral proof: <command>` to runward/floor.md §2 (and optionally `Proof artifact: <path>`)."));
107
+ }
108
+ else {
109
+ if (bp.command)
110
+ console.log(` ${c.darkGray("prove behavior with:")} ${c.white(bp.command)}`);
111
+ if (bp.artifact) {
112
+ if (!bp.present)
113
+ console.log(` ${c.warning("◑")} ${c.darkGray("proof artifact")} ${c.white(bp.artifact)} ${c.warning("missing — run the command to produce it")}`);
114
+ else {
115
+ const fresh = bp.fresh === undefined ? "" : bp.fresh ? c.success(" · fresh") : c.warning(" · stale (older than the code — re-run)");
116
+ console.log(` ${c.success("✓")} ${c.darkGray("proof artifact")} ${c.white(bp.artifact)} ${c.darkGray(`(${bp.date})`)}${fresh}`);
117
+ }
118
+ }
119
+ console.log(" " + c.darkGray("advisory — runward reports presence and freshness, never runs or reads the result. You cross on both proofs."));
120
+ }
99
121
  console.log(section("Semantic check (advisory, above the gate)"));
100
122
  console.log(" " + c.darkGray("the gate proved every CRITICAL/HIGH rule was traced — not that the code applies it. Before you cross, run the verify workflow (runward/workflows/verify.md): an adversarial cite-vs-apply pass, ideally on a different model. Advisory, agent-executed, never blocks the gate (ADR-0007)."));
101
123
  }
@@ -0,0 +1,46 @@
1
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ export function behavioralProof(mission, root) {
4
+ const floor = join(mission, "floor.md");
5
+ if (!existsSync(floor))
6
+ return { declared: false };
7
+ const text = readFileSync(floor, "utf8");
8
+ const cmd = text.match(/^\s*[*_]*Behavioral proof[*_]*\s*:\s*`?([^`\n]+?)`?\s*$/mi);
9
+ const art = text.match(/^\s*[*_]*Proof artifact[*_]*\s*:\s*`?([^`\n]+?)`?\s*$/mi);
10
+ if (!cmd && !art)
11
+ return { declared: false };
12
+ const proof = { declared: true, command: cmd?.[1]?.trim(), artifact: art?.[1]?.trim() };
13
+ if (proof.artifact) {
14
+ const abs = join(root, proof.artifact);
15
+ proof.present = existsSync(abs);
16
+ if (proof.present) {
17
+ const st = statSync(abs);
18
+ proof.date = st.mtime.toISOString().slice(0, 10);
19
+ const codeDir = join(root, "code");
20
+ const newest = existsSync(codeDir) ? newestSourceMtime(codeDir) : 0;
21
+ proof.fresh = newest === 0 ? undefined : st.mtimeMs >= newest;
22
+ }
23
+ }
24
+ return proof;
25
+ }
26
+ /** Newest mtime of a tracked source file under a dir — read-only, node_modules and dotfiles skipped. */
27
+ function newestSourceMtime(dir) {
28
+ let newest = 0;
29
+ let entries;
30
+ try {
31
+ entries = readdirSync(dir, { withFileTypes: true });
32
+ }
33
+ catch {
34
+ return 0;
35
+ }
36
+ for (const e of entries) {
37
+ if (e.name === "node_modules" || e.name.startsWith("."))
38
+ continue;
39
+ const p = join(dir, e.name);
40
+ if (e.isDirectory())
41
+ newest = Math.max(newest, newestSourceMtime(p));
42
+ else if (/\.(ts|tsx|js|jsx|py|go|rs|java|rb)$/.test(e.name))
43
+ newest = Math.max(newest, statSync(p).mtimeMs);
44
+ }
45
+ return newest;
46
+ }
@@ -37,6 +37,10 @@
37
37
  - **Verdict**: criterion met on the replayed sample and the first live week. The gate to `iterate` requires the full two-week live window per the criterion's wording — one more week of live measurement before the gate is crossed. Partial by duration, not by result.
38
38
  - **Observability check**: confirmed — a full trajectory (intake, model proposal, per-field guard outcome, routing decision, persistence) reconstructs from a single request ID; verified on 10 randomly drawn requests.
39
39
 
40
+ **Behavioral proof**: `cd code && npm test`
41
+
42
+ > 14 deterministic tests, no key, no network — including the guard refusing, fail-closed, a record whose action-bearing fields are still model-proposed (ADR-0002). The gate above proves the *decision* to guard was traced; this proves the guard *runs*. runward reports the pointer, never runs it.
43
+
40
44
  ## 3. Gaps and deviations
41
45
 
42
46
  | Gap / deviation | Impact | Agreed with sponsor |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runward",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "description": "After the spec: ship and run. A delivery framework for agentic systems — floor first, evolution on evidence, governance from day zero, handover with proof.",
5
5
  "keywords": [
6
6
  "agentic",
@@ -34,6 +34,11 @@
34
34
  - **Verdict**: [criterion met / partially met / not met — and what that means for the gate.]
35
35
  - **Observability check**: [confirmation that a full trajectory reconstructs from a single request ID.]
36
36
 
37
+ **Behavioral proof**: `[the command that proves the floor's behavior, e.g. cd code && npm test]`
38
+ **Proof artifact**: [optional — a result file the command writes, e.g. code/test-results.json; runward reports it present/fresh, never runs or reads it]
39
+
40
+ > The gate above is the *documentary* proof (the decisions are traced). This line is the *behavioral* proof (your code actually runs). runward never executes it — it is not a runtime; on a green `--strict` it only reports the pointer, and the artifact's presence and freshness if you name one.
41
+
37
42
  ## 3. Gaps and deviations
38
43
 
39
44
  [Anything shipped differently from the architecture note, and anything the measurement revealed. Deviations were agreed with the sponsor, never silent.]