Skip to content

Commit 2200f71

Browse files
Merge pull request #213 from engineeredsoftware/v45/gate-10-formal-spec-consolidation
V45 Gate 10: Formal Specification Consolidation
2 parents b1df3c9 + cf1cc82 commit 2200f71

6 files changed

Lines changed: 1194 additions & 6 deletions

BITCODE_SPEC_V45.md

Lines changed: 857 additions & 0 deletions
Large diffs are not rendered by default.

BITCODE_SPEC_V45_DELTA.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Bitcode Spec V45 Delta
2+
3+
## Status
4+
5+
- Version: `V45`
6+
- V45 state: formal draft delta consolidated from accepted V45 notes atoms; V44 remains active canon until V45 promotion
7+
- Current canonical/latest target: `V44`
8+
- Prior canonical anchor: `BITCODE_SPEC_V44.md`
9+
- Prior generated proof appendix: `BITCODE_SPEC_V44_PROVEN.md`
10+
- Generated structured artifact inventory: draft `.bitcode/v45-spec-family-report.json`, draft `.bitcode/v45-canonical-input-report.json`, V45 notes atom checkers, V45 formal-spec consolidation checker, and pending `BITCODE_SPEC_V45_PROVEN.md` generation contract
11+
- Source parity state: V45 delta records formal protocol-law changes only; implementation parity is pending the next gate and V44 source remains active canon
12+
- Notes companion: `BITCODE_SPEC_V45_NOTES.md`
13+
- Spec companion: `BITCODE_SPEC_V45.md`
14+
- Parity companion: `BITCODE_SPEC_V45_PARITY_MATRIX.md`
15+
- Scope: V45 draft delta from V44 scaled engineering economy to formal knowledge commoditization protocol precision
16+
- Last fully realized canonical target preserved in source: `V44`
17+
18+
## Why V45 exists
19+
20+
V44 made the scaled engineering economy operable. V45 exists to make the
21+
underlying market law precise enough for public protocol comprehension and
22+
implementation parity: Bitcode as knowledge commoditization, AssetPack as the
23+
commodity, BTD as Need-relative scalar knowledge-volume and settled rights, BTC
24+
as settlement money, source-safe interface disclosure, proof-backed state
25+
readback, and gate taxonomy.
26+
27+
## Accepted V45 decisions
28+
29+
- Bitcode is the knowledge commoditization protocol and commercial system.
30+
- AssetPack is the traded commodity; raw source and raw inference artifacts are
31+
not the commodity.
32+
- Deposit-time measurements may show BTD potential, but final BTD size is
33+
Need-relative and requires reviewed Need, selected Fit set, synthesized
34+
Need-Fit AssetPack, deterministic weights, dedupe, and proof roots.
35+
- Settled BTD carries rights, source unlock authority, ownership boundaries,
36+
and source-to-shares allocation context.
37+
- BTC quote, payment observation, finality, settlement, rights transfer,
38+
source unlock, delivery, and compensation are distinct states.
39+
- Interfaces are protocol windows; proof-backed readback advances state.
40+
- Notes atoms precede formal specification, formal specification precedes
41+
parity audit, parity audit precedes grouped implementation, and promotion
42+
alone may update `BITCODE_SPEC.txt`.
43+
44+
## Explicitly deferred
45+
46+
- Implementation parity audit is deferred to the next V45 gate.
47+
- Grouped implementation changes are deferred until accepted parity gaps exist.
48+
- Proof-only, interface-only, rehearsal, and promotion gates are deferred until
49+
their owning parity rows and readiness conditions are closed.
50+
- Value-bearing mainnet operation remains deferred.
51+
- `BITCODE_SPEC.txt` remains `V44` until V45 promotion workflow validation.
52+
53+
## Pre-Implementation Sequence
54+
55+
1. Accept notes-specification atoms for protocol identity, AssetPack lifecycle,
56+
BTD scalar-volume, BTC settlement, interface authority, proof readback, and
57+
gate taxonomy.
58+
2. Consolidate the formal V45 specification family.
59+
3. Audit implementation parity from `BITCODE_SPEC_V45.md`.
60+
4. Group implementation gates by parity gaps.
61+
5. Harden proof-only and interface-only rows.
62+
6. Rehearse end-to-end source-safe commercial behavior.
63+
7. Close promotion readiness and promote V45 only through workflow validation.
64+
65+
## Commit-Body Direction
66+
67+
V45 commit bodies should name the gate class, protocol law affected, evidence
68+
or validation command, source-safety posture, and whether the change is
69+
specification-only, parity-only, proof-only, interface-only, implementation,
70+
rehearsal, or promotion work.

BITCODE_SPEC_V45_NOTES.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,43 @@
66
- Canonical pointer: `BITCODE_SPEC.txt` -> `V44`
77
- Active canonical anchor: `BITCODE_SPEC_V44.md`
88
- Active generated proof appendix: `BITCODE_SPEC_V44_PROVEN.md`
9-
- V45 state: notes-only draft opening
10-
- Scope: discussion-prep notes for the next Bitcode canon candidate after V44 scaled engineering economy promotion
9+
- Current canonical/latest target: `V44`
10+
- Prior canonical anchor: `BITCODE_SPEC_V44.md`
11+
- Prior generated proof appendix: `BITCODE_SPEC_V44_PROVEN.md`
12+
- Generated structured artifact inventory: V45 draft specification consolidation introduces `.bitcode/v45-spec-family-report.json`, `.bitcode/v45-canonical-input-report.json`, V45 notes atom checkers, and the pending V45 formal proof appendix contract; V44 generated artifacts remain active canon until V45 promotion
13+
- Source parity state: V45 notes atoms are accepted into formal draft specification preparation; implementation parity is not yet audited and V44 implementation remains active canon
14+
- V45 state: accepted notes companion for formal V45 draft specification; V44 remains active canon until V45 promotion
15+
- Scope: accepted notes atom provenance for the next Bitcode canon candidate after V44 scaled engineering economy promotion
16+
17+
## Notes companion rule
18+
19+
These notes record the accepted V45 opening atoms. After formal specification
20+
consolidation, `BITCODE_SPEC_V45.md` and its companion family become the V45
21+
draft specification authority while V44 remains active canon through
22+
`BITCODE_SPEC.txt`.
23+
24+
## Concise current-system reading
25+
26+
V45 formalizes Bitcode as the world's knowledge commoditization system:
27+
AssetPacks enter and leave the Depository, BTD measures Need-relative scalar
28+
knowledge-volume and settled rights, BTC is payment truth, interfaces remain
29+
source-safe windows, and proof-backed readback advances protocol state.
30+
31+
## Simplified-spec reading rule
32+
33+
When V45 work becomes broad, reduce it to the formal law:
34+
35+
1. AssetPack is the traded commodity, never raw source.
36+
2. BTD is weighted scalar knowledge-volume whose settled form carries rights.
37+
3. BTC settlement finality precedes BTD rights transfer and source unlock.
38+
4. Interfaces may guide and inspect, but proof readback advances state.
39+
5. Implementation begins only after formal specification and parity audit.
1140

12-
## Notes-only draft rule
41+
## Notes provenance rule
1342

14-
These notes are not first-gate implementation authority. They keep the V45 draft
15-
target visible to strict spec-quality validation while V44 remains the active
16-
canon and while V45 intent is discussed before any gate work begins.
43+
These notes are not implementation authority. They preserve the accepted
44+
notes-level atoms that were consolidated into the formal V45 draft
45+
specification family while V44 remains the active canon.
1746

1847
## Deferred from V44
1948

BITCODE_SPEC_V45_PARITY_MATRIX.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Bitcode Spec V45 Parity Matrix
2+
3+
## Status
4+
5+
- Version: `V45`
6+
- V45 state: draft parity shell created by formal specification consolidation; implementation audit has not yet started and V44 remains active canon until V45 promotion
7+
- Current canonical/latest target: `V44`
8+
- Prior canonical anchor: `BITCODE_SPEC_V44.md`
9+
- Prior generated proof appendix: `BITCODE_SPEC_V44_PROVEN.md`
10+
- Generated structured artifact inventory: draft `.bitcode/v45-spec-family-report.json`, draft `.bitcode/v45-canonical-input-report.json`, V45 notes atom checkers, V45 formal-spec consolidation checker, and pending `BITCODE_SPEC_V45_PROVEN.md` generation contract
11+
- Source parity state: V45 parity rows are drafted from formal V45 law; current judgments are pending implementation audit against source, tests, proofs, workflows, documentation, generated artifacts, and interfaces
12+
- Notes companion: `BITCODE_SPEC_V45_NOTES.md`
13+
- Spec companion: `BITCODE_SPEC_V45.md`
14+
- Delta companion: `BITCODE_SPEC_V45_DELTA.md`
15+
- Scope: V45 draft parity shell for the next implementation audit gate
16+
- Last fully realized canonical target preserved in source: `V44`
17+
18+
## Purpose
19+
20+
This parity matrix is the formal shell for the next V45 gate. It records the audit
21+
areas that must be inspected against `BITCODE_SPEC_V45.md` before any grouped
22+
implementation gate begins.
23+
24+
## Audit basis
25+
26+
Audit V45 against `BITCODE_SPEC_V45.md`, `BITCODE_SPEC_V45_DELTA.md`,
27+
`BITCODE_SPEC_V45_NOTES.md`, active V44 canon, commercial source, tests,
28+
generated artifacts, workflows, documentation, `/deposit`, `/read`, `/packs`,
29+
API/MCP, ChatGPT App, Bitcode Chat, public docs, landing page, proof roots,
30+
ledger/database/storage readback, wallet/provider receipts, and repository
31+
delivery receipts.
32+
33+
## V45 implementation matrix
34+
35+
| Area | Required V45 result | Current judgment |
36+
| --- | --- | --- |
37+
| Knowledge commoditization identity | AssetPack commodity, BTC settlement money, BTD Need-relative scalar volume and rights law are implemented and explained coherently | pending |
38+
| AssetPack lifecycle | Source-safe lifecycle states from deposit option to compensation and repair are represented without collapsed states | pending |
39+
| BTD scalar-volume | Need-relative measurement, deterministic weights, fixed-point volume, measuremint/range, rights, and source-to-shares boundaries are implemented | pending |
40+
| BTC settlement | Quote, acceptance, wallet, PSBT, broadcast, observation, finality, repair, rights, delivery, and compensation states are distinct | pending |
41+
| Interface authority | `/deposit`, `/read`, `/packs`, API/MCP, ChatGPT App, Bitcode Chat, docs, and landing surfaces share entitlement boundaries | pending |
42+
| Proof readback | State advancement requires proof root plus ledger/database/storage/wallet/provider/repository readback | pending |
43+
| Gate taxonomy | Workflow, scripts, PR guidance, and validation commands enforce V45 gate classes and promotion boundary | pending |
44+
45+
## V45 implementation checklist
46+
47+
| Area | Required V45 result | Current judgment |
48+
| --- | --- | --- |
49+
| Source safety | No protected source, unpaid source, raw prompts, raw responses, wallet private material, credentials, or private payloads leak | pending |
50+
| Economic labels | Estimate, potential, preview, quote, observed payment, final settlement, rights transfer, delivery, allocation, and repair stay distinct | pending |
51+
| Ledger reconciliation | Ledger/database/storage projections reconcile before final state claims | pending |
52+
| Route authority | Product routes and machine/conversation interfaces do not bypass protocol law | pending |
53+
| Tests and proofs | Unit, integration, E2E, generated proof, workflow, and rehearsal checks cover every accepted V45 law | pending |
54+
| Documentation | Public, operator, and contributor docs explain V45 law without exposing source or overstating live state | pending |
55+
56+
## Accepted boundaries
57+
58+
V45 parity audit must preserve V44 source-safety, V44 active canon posture,
59+
V43 product route law, V42 Reading shortest path, V41 prompt discipline, V40
60+
testing posture, V38 inference boundaries, V36 economic exchange truth, V30
61+
BTD/BTC/source-to-shares rails, and V27 BTD law.
62+
63+
## Completion condition
64+
65+
This parity matrix is complete only when the next gate replaces pending
66+
judgments with source-grounded findings, groups all gaps into closure gates,
67+
and proves that implementation work is authorized by formal V45 specification
68+
rather than loose notes.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@
395395
"check:v45-gate7": "node scripts/check-v45-gate7-interface-authority-disclosure-boundaries.mjs",
396396
"check:v45-gate8": "node scripts/check-v45-gate8-proof-readback-operational-boundaries.mjs",
397397
"check:v45-gate9": "node scripts/check-v45-gate9-gate-taxonomy-formal-spec-readiness.mjs",
398+
"check:v45-gate10": "node scripts/check-v45-gate10-formal-spec-consolidation.mjs",
398399
"generate:v38-inference-surface-inventory": "node scripts/generate-v38-inference-surface-inventory.mjs",
399400
"check:v38-inference-surface-inventory": "node scripts/generate-v38-inference-surface-inventory.mjs --check",
400401
"check:v38-gate2": "node scripts/check-v38-gate2-inference-surface-inventory.mjs",
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
#!/usr/bin/env node
2+
3+
import { execFileSync } from 'node:child_process';
4+
import { existsSync, readFileSync } from 'node:fs';
5+
import path from 'node:path';
6+
import { fileURLToPath } from 'node:url';
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const defaultRepoRoot = path.resolve(__dirname, '..');
11+
12+
function read(root, relativePath) {
13+
return readFileSync(path.join(root, relativePath), 'utf8');
14+
}
15+
16+
function exists(root, relativePath) {
17+
return existsSync(path.join(root, relativePath));
18+
}
19+
20+
function git(root, args) {
21+
return execFileSync('git', args, { cwd: root, encoding: 'utf8' }).trim();
22+
}
23+
24+
function run(root, args) {
25+
return execFileSync(process.execPath, args, { cwd: root, encoding: 'utf8' }).trim();
26+
}
27+
28+
function assertCheck(failures, condition, message) {
29+
if (!condition) failures.push(message);
30+
}
31+
32+
function normalize(content) {
33+
return content.replace(/\s+/gu, ' ').trim();
34+
}
35+
36+
function parseArgs(argv) {
37+
const args = { repoRoot: defaultRepoRoot, skipBranchCheck: false };
38+
for (let index = 0; index < argv.length; index += 1) {
39+
const arg = argv[index];
40+
if (arg === '--repo-root') args.repoRoot = path.resolve(argv[++index]);
41+
else if (arg === '--skip-branch-check') args.skipBranchCheck = true;
42+
else if (arg === '--help' || arg === '-h') args.help = true;
43+
else throw new Error(`Unknown argument ${arg}`);
44+
}
45+
return args;
46+
}
47+
48+
function printHelp() {
49+
process.stdout.write(
50+
[
51+
'Usage: node scripts/check-v45-gate10-formal-spec-consolidation.mjs [--skip-branch-check] [--repo-root <path>]',
52+
'',
53+
'Checks the V45 formal specification consolidation gate.',
54+
].join('\n'),
55+
);
56+
process.stdout.write('\n');
57+
}
58+
59+
function main() {
60+
const args = parseArgs(process.argv.slice(2));
61+
if (args.help) {
62+
printHelp();
63+
return;
64+
}
65+
66+
const root = args.repoRoot;
67+
const failures = [];
68+
const pointer = read(root, 'BITCODE_SPEC.txt').trim();
69+
70+
assertCheck(failures, pointer === 'V44', `BITCODE_SPEC.txt must remain V44 during V45 formal draft work. Observed ${pointer || 'empty'}.`);
71+
72+
if (!args.skipBranchCheck) {
73+
const branch = git(root, ['branch', '--show-current']);
74+
assertCheck(
75+
failures,
76+
branch === 'version/v45' || /^v45\/gate-\d+-[a-z0-9][a-z0-9-]*$/u.test(branch),
77+
`V45 work must occur on version/v45 or v45/gate-N-* branches. Observed ${branch || 'detached HEAD'}.`,
78+
);
79+
}
80+
81+
for (const relativePath of [
82+
'BITCODE_SPEC_V45.md',
83+
'BITCODE_SPEC_V45_DELTA.md',
84+
'BITCODE_SPEC_V45_NOTES.md',
85+
'BITCODE_SPEC_V45_PARITY_MATRIX.md',
86+
'BITCODE_SPEC_V44.md',
87+
'BITCODE_SPEC_V44_PROVEN.md',
88+
'BITCODE_SPEC.txt',
89+
'package.json',
90+
'scripts/check-v45-gate9-gate-taxonomy-formal-spec-readiness.mjs',
91+
]) {
92+
assertCheck(failures, exists(root, relativePath), `Missing required V45 Gate 10 file: ${relativePath}`);
93+
}
94+
95+
const spec = read(root, 'BITCODE_SPEC_V45.md');
96+
const delta = read(root, 'BITCODE_SPEC_V45_DELTA.md');
97+
const notes = read(root, 'BITCODE_SPEC_V45_NOTES.md');
98+
const parity = read(root, 'BITCODE_SPEC_V45_PARITY_MATRIX.md');
99+
const packageJson = read(root, 'package.json');
100+
const combined = normalize([spec, delta, notes, parity].join('\n'));
101+
102+
for (const phrase of [
103+
'formal draft specification consolidated from accepted V45 notes atoms',
104+
'V44 remains active canon until V45 promotion',
105+
'Bitcode is the knowledge commoditization protocol and commercial system',
106+
'AssetPack is the traded commodity',
107+
'BTD is the non-fungible, proof-addressed scalar unit of technical knowledge volume',
108+
'final BTD size is computed only after a reviewed Need, selected Fit set, synthesized Need-Fit AssetPack',
109+
'BTC is Bitcode settlement money and payment truth',
110+
'Prepared, signed, broadcast, and observed states are not final settlement',
111+
'All Bitcode interfaces are protocol windows',
112+
'Bitcode state advances only by proof-backed readback',
113+
'Telemetry is observability only',
114+
'V45 gates are classified as',
115+
'formal-specification-consolidation',
116+
'specification-parity-matrix',
117+
'Implementation follows accepted parity gaps',
118+
'Promotion alone may advance `BITCODE_SPEC.txt`',
119+
'implementation parity is not yet audited',
120+
'This parity matrix is the formal shell for the next V45 gate',
121+
]) {
122+
assertCheck(failures, combined.includes(phrase), `V45 formal family must include phrase: ${phrase}`);
123+
}
124+
125+
assertCheck(
126+
failures,
127+
packageJson.includes('"check:v45-gate10": "node scripts/check-v45-gate10-formal-spec-consolidation.mjs"'),
128+
'package.json must expose check:v45-gate10.',
129+
);
130+
131+
try {
132+
const output = run(root, [
133+
'scripts/check-bitcode-spec-family.mjs',
134+
'--version',
135+
'V45',
136+
'--mode',
137+
'draft',
138+
'--current-target',
139+
'V44',
140+
]);
141+
assertCheck(failures, output.includes('Bitcode spec family ok for V45'), 'V45 draft spec-family check did not report success.');
142+
} catch (error) {
143+
const detail = error instanceof Error ? error.message : String(error);
144+
failures.push(`V45 draft spec-family check failed: ${detail}`);
145+
}
146+
147+
if (failures.length > 0) {
148+
process.stderr.write('V45 Gate 10 formal specification consolidation check failed:\n');
149+
for (const failure of failures) process.stderr.write(`- ${failure}\n`);
150+
process.exitCode = 1;
151+
return;
152+
}
153+
154+
process.stdout.write('V45 Gate 10 formal specification consolidation check passed.\n');
155+
}
156+
157+
try {
158+
main();
159+
} catch (error) {
160+
const detail = error instanceof Error ? error.message : String(error);
161+
process.stderr.write(`${detail}\n`);
162+
process.exitCode = 1;
163+
}

0 commit comments

Comments
 (0)