Skip to content

Commit 55b2f44

Browse files
wip v28
1 parent 7a6ccda commit 55b2f44

8 files changed

Lines changed: 261 additions & 19 deletions

File tree

BITCODE_SPEC_V28.md

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,14 @@ The V28 pipeline harness must write a manifest before execution containing:
410410

411411
- Read id and Read text;
412412
- Deposit id and optional deposited AssetPack id;
413-
- optional Deposit proof root, measurement root, and reconciliation readback
414-
root when the deposited evidence already has them;
413+
- Deposit proof root, measurement root, and reconciliation readback root.
414+
When a recorded Deposit activity already asserts wallet/attestation proof
415+
and asset measurement posture but has not stored root fields, the harness
416+
must materialize deterministic manifest-bound roots from the Deposit id,
417+
AssetPack id, Read id, repository, branch, and commit. These roots are
418+
admissible as harness evidence roots for candidate recall and Fit review;
419+
they are not external finality claims and still require SQL/ledger readback
420+
before settlement.
415421
- repository full name, branch, and commit;
416422
- host capability summary;
417423
- expected stages: deposit search, candidate ranking, Read comprehension,
@@ -462,17 +468,19 @@ Read/Fit result review remains fail-closed:
462468
validation, and Finish stay model-backed while deterministic source-bound
463469
depository discovery preserves enough route budget to synthesize, ship, and
464470
read back the AssetPack. `BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=full`
465-
is reserved for long-running sandbox audits outside the deployed streaming
466-
route. A run with omitted per-agent `*_USE_PTRR` flags is not an acceptable
467-
staging posture unless the global real-inference flag and explicit profile
468-
are present.
471+
is reserved for the later long-running async completion gate described below;
472+
the current deployed Terminal route must reject it until sandbox completion
473+
pushes finished state to a server-side stream/socket handler. A run with
474+
omitted per-agent `*_USE_PTRR` flags is not an acceptable staging posture
475+
unless the global real-inference flag and explicit profile are present.
469476
- manifest-only Deposit supply can satisfy candidate recall but cannot produce
470477
`worthy_fit` unless proof and measurement posture are explicitly visible to
471478
the pipeline input and the downstream readback queries confirm them. Boolean
472-
wallet/measurement posture is not enough when the Read asks for proof-root,
473-
finality, or reconciliation readback; those roots must be supplied by the
474-
deposited evidence, synthesized and read back during Finish, or returned as
475-
explicit `blocked_readiness`.
479+
wallet/measurement posture must be converted into deterministic
480+
manifest-bound proof, measurement, and reconciliation roots before Fit
481+
evaluation; if that conversion cannot be made, the run must return explicit
482+
`blocked_readiness`. Manifest-bound roots support Read/Fit selection but do
483+
not claim BTC fee broadcast, BTD minting, or external ledger finality.
476484
- every SDIVF phase, PTRR agent step, ThriceifiedGeneration, and tool execution
477485
must be inspectable as prompt/context input, raw model/tool output,
478486
parsed/typed output, usage/timing metadata, and phase/agent/step/failsafe
@@ -667,6 +675,78 @@ The V28 domain model is:
667675
The V28 operator chain is Readiness -> Read -> Fit -> Proof -> Measuremint -> Fee -> Anchor -> Range -> Read -> Journal -> Reconcile -> Protocol readback.
668676
Every link must make proof or readiness state visible.
669677

678+
## staged Reading acceptance path
679+
680+
V28 separates Reading into distinct reviewable stages so commercial buyers can
681+
decide whether Bitcode understood the need before Bitcode exposes or settles
682+
source-bearing AssetPack material.
683+
684+
The staged Reading path is:
685+
686+
1. **Need synthesis.** The user Read request is input to a Need pipeline. The
687+
pipeline synthesizes a measured Need object with requirements, closure
688+
criteria, failure modes, target artifact kinds, source constraints,
689+
proof/settlement expectations, and pricing measurement inputs. Terminal
690+
shows this Need in full detail. The user can accept it or request another
691+
synthesis with feedback. No depository Fit search, BTC fee, BTD mint, or
692+
AssetPack source disclosure is allowed before Need acceptance.
693+
2. **Need-Fit synthesis.** An accepted Read-Need is input to the AssetPack
694+
synthesis pipeline. This stage searches the deposited asset-space, ranks
695+
candidates, measures candidate fit against the Need measurement, synthesizes
696+
the candidate AssetPack, and returns `worthy_fit`, `no_worthy_fit`, or
697+
`blocked_readiness` with proof-bearing search/fit telemetry.
698+
3. **Preview and settlement.** A worthy synthesized AssetPack is previewed
699+
without leaking the full source. Preview may show Need measurement, Fit
700+
measurement, selected candidate ids, roots, score bands, proof posture,
701+
settlement boundary, and price; it must not show protected source material
702+
before payment/right settlement. Settlement then records the reader BTC fee,
703+
mints or assigns the BTD range according to the standing supply law, writes
704+
ownership and read-license rows, anchors/journals the event, and only then
705+
unlocks the full AssetPack source/right surface to the buyer/reader.
706+
707+
The commercial question therefore splits into two explicit operator questions:
708+
709+
- Does Bitcode understand the Read's Need?
710+
- Did Bitcode find and synthesize a match good enough to preview confidently
711+
and pay for in BTC without source-IP leakage?
712+
713+
### Share-to-Fee measurement clarity
714+
715+
V28 keeps the standing supply law intact while sharpening the initial
716+
deterministic pricing/readiness interface. The initial Share-to-Fee calculation
717+
must be deterministic from recorded measurements:
718+
719+
- each Need measurement vector dimension has a volume and a measurement weight;
720+
- each candidate Fit measurement vector is evaluated against the accepted Need
721+
measurement vector;
722+
- the priced measurement volume is the weighted admitted volume after fit,
723+
quality, proof, and settlement eligibility gates;
724+
- BTC price is derived from that priced measurement volume by the configured
725+
staging-testnet fee schedule and recorded as a reader fee quote;
726+
- the quote is previewable before payment, but source contents and licensed
727+
read rights are not unlocked until settlement readback succeeds.
728+
729+
This pricing path is a V28 commercial product acceptance target, but it must
730+
remain fail-closed: if the Need measurement, Fit measurement, fee schedule,
731+
wallet authorization, BTC fee, BTD range, or ledger readback is missing, the
732+
Terminal shows blocked readiness rather than implying settlement.
733+
734+
### Long-running full-profile pipeline gate
735+
736+
The current V28 route-streaming gate uses
737+
`BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=bounded` because the Vercel Function
738+
route can stream live progress and collect artifacts only inside its request
739+
window. `BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=full` is scoped to a
740+
subsequent V28 gate.
741+
742+
That later gate may run for dozens of minutes in Vercel Sandbox. The sandbox
743+
execution itself must push finished result state, artifacts, and readback
744+
signals to a server-side stream/socket handler or durable queue; the route that
745+
starts the run must not be responsible for waiting synchronously for the final
746+
result. Full-profile acceptance requires the same evidence as bounded profile
747+
plus durable async completion delivery, resumable status readback, and Terminal
748+
reattachment to the live execution stream.
749+
670750
## canonical subsystem surfaces
671751

672752
### Depositing and asset supply

BITCODE_V28_QA.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,11 @@ unset, when `OPENAI_API_KEY` is missing, or when
11991199
`BITCODE_PIPELINE_HARNESS_MAX_RUNTIME_MS` exceeds `600000`.
12001200
When no profile is configured, the deployed route injects
12011201
`BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=bounded`.
1202+
The current deployed route also preflight-fails if
1203+
`BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=full`. Full profile is a later V28
1204+
gate: the sandbox can run for dozens of minutes, but final state must be pushed
1205+
from the sandbox execution to a server-side stream/socket handler or durable
1206+
queue instead of waiting synchronously inside the route request.
12021207
12031208
```bash
12041209
curl -N "$BITCODE_UAPI_URL/api/pipeline-harness/asset-pack" \
@@ -1301,6 +1306,16 @@ Blockers:
13011306
- Terminal enables settlement, minting, branch materialization, BTC fee
13021307
broadcast, or ledger finality from a host smoke result.
13031308
1309+
Subsequent V28 Reading gates prepared by this pass:
1310+
1311+
| Gate | Scope | Acceptance boundary |
1312+
| --- | --- | --- |
1313+
| Need synthesis review | Split "What is the need?" from Fit search. The Read request enters a Need pipeline, producing requirements, closure criteria, failure modes, target artifact kinds, proof expectations, and pricing measurement inputs. | User can accept the Need or request resynthesis with feedback. No Fit search, source preview, BTC fee, or BTD settlement is allowed before Need acceptance. |
1314+
| Need-Fit search and synthesis | Input is the accepted Read-Need, not raw prompt text. The AssetPack synthesis pipeline searches deposited supply, ranks candidates, measures Fit against the Need, and synthesizes the candidate AssetPack. | Result is `worthy_fit`, `no_worthy_fit`, or `blocked_readiness` with query root, ranking root, selected ids, proof/measurement posture, and model/tool telemetry. |
1315+
| Source-safe preview | Show enough proof to decide whether to pay without leaking source. | Preview may show Need/Fit measurements, score bands, roots, candidate ids, proof posture, ownership boundary, and BTC quote. It must not expose protected AssetPack source before settlement. |
1316+
| Settle and unlock | Deterministic Share-to-Fee and BTD settlement. | Price is derived from weighted admitted measurement volume and the staging fee schedule. Reader pays BTC fee, BTD range/ownership/license/journal/anchor rows are written and read back, then full AssetPack source/right surface is unlocked. |
1317+
| Full-profile async pipeline | Run the full PTRR profile for long-running audits. | Vercel Sandbox execution may run for dozens of minutes and must push completion artifacts to server-side stream/socket or durable queue; Terminal can reattach and read final state without the starter route waiting. |
1318+
13041319
Observed staging-testnet harness evidence on 2026-05-17:
13051320
13061321
- Vercel Sandbox run `sbx_ktb5Z6VnP5A16m9k4a0FkBcJg1d3` completed all six
@@ -1329,9 +1344,10 @@ Observed staging-testnet harness evidence on 2026-05-17:
13291344
`BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=bounded` is now the required
13301345
profile: setup, synthesis, validation, and Finish produce model-generation
13311346
telemetry while deterministic source-bound discovery preserves budget for a
1332-
complete AssetPack run. Full discovery PTRR remains available through
1333-
`BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=full` for long-running sandbox
1334-
audits outside the deployed route.
1347+
complete AssetPack run. Full discovery PTRR is now scoped to the later
1348+
async-completion V28 gate; the current deployed route must reject `full`
1349+
until sandbox completion pushes finished state to a server-side stream/socket
1350+
handler or durable queue.
13351351
- Ledger readback correctly showed zero BTD range, BTC fee, journal, anchor, and
13361352
crypto telemetry rows, and `btd_supply_state.total_minted=0`, because source
13371353
overlay QA evidence cannot mint BTD, claim BTC fee settlement, or anchor
@@ -1408,6 +1424,40 @@ Second local overlay evidence on 2026-05-17:
14081424
search/readback tool registration or prompt tightening before full PTRR audits
14091425
can be considered clean.
14101426
1427+
Third local overlay evidence on 2026-05-17 after bounded real-inference and
1428+
manifest-bound Deposit evidence root fixes:
1429+
1430+
- Vercel Sandbox run `sbx_rLVfPTD3HuITtCbrR0AmZ26spEYO` exported artifacts to
1431+
`.bitcode/pipeline-harness-runs/2026-05-17T21-19-26-275Z-sbx_rLVfPTD3HuITtCbrR0AmZ26spEYO/`.
1432+
- The run intentionally passed only the UI-shaped Deposit proof and measurement
1433+
flags, with no manual `BITCODE_SANDBOX_DEPOSIT_*_ROOT` overrides. The harness
1434+
materialized manifest-bound `proofRoot`, `measurementRoot`, and
1435+
`reconciliationReadbackRoot` values before pipeline execution.
1436+
- Pipeline run `3b3339b4-5695-46fa-9ce4-2163c7eb1f11` reached candidate recall,
1437+
model-backed setup, model-backed Read comprehension, model-backed synthesis,
1438+
`pipeline-complete`, and `ledger-settlement-readback`.
1439+
- The pipeline selected the proof-bearing candidate `manual-deposit-qa`,
1440+
searched 1 deposited candidate, returned `pipelineResultState='worthy_fit'`,
1441+
and synthesized `AssetPack:read-satisfaction-summary` with query root
1442+
`sha256:d989394a41b1956b45988066165fc4c8be3063028cad8dd1367c3038456d5212`,
1443+
ranking root
1444+
`sha256:00307ab87da48266ee346d5ccae1d06dd228c3441610277d73015cb5e9250d3a`,
1445+
and embedding policy `openai text-embedding-3-small`.
1446+
- The exported telemetry contained 698 lines. Bounded real-inference statuses
1447+
were `success` for setup plan, Read comprehension, and synthesis, and
1448+
telemetry included `llm.input`, `llm.output`, `llm.usage`, and
1449+
`llm.parsedOutput` for the model-backed stages.
1450+
- Final harness `resultState` remained `blocked_readiness` for the correct
1451+
reason: `BITCODE_SANDBOX_APPLY_LOCAL_PATCH=1` means the run cannot mint BTD,
1452+
claim reader BTC fee settlement, or anchor finality. The reason text now
1453+
distinguishes that settlement block from missing pipeline output:
1454+
"Pipeline produced worthy_fit evidence; final settlement remains blocked by
1455+
harness readiness constraints."
1456+
- The remaining V28 closure gate is a clean no-overlay staging run at the
1457+
deposited source revision, with Supabase database streaming enabled, so the
1458+
same worthy fit can write and read back BTD range, BTC fee, ownership,
1459+
license, journal, ledger anchor, and crypto telemetry rows.
1460+
14111461
## 2026-05-13 Staging Deployment Readiness Gate
14121462
14131463
Purpose:

packages/pipeline-hosts/README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,12 @@ Staging-testnet Read/Fit QA must also set
8282
`BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=bounded` is the expected profile:
8383
setup, synthesis, validation, and finish stay model-backed, while deterministic
8484
source-bound discovery evidence preserves enough budget to ship and read back
85-
the AssetPack. Set `BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=full` only for
86-
long-running sandbox audits outside the deployed route. The phase-specific
85+
the AssetPack. `BITCODE_ASSET_PACK_REAL_INFERENCE_PROFILE=full` is scoped to a
86+
later async completion gate: the sandbox may run for dozens of minutes, but it
87+
must push final result state and artifacts to a server-side stream/socket
88+
handler or durable queue rather than relying on the starter route to wait
89+
synchronously. The current deployed Terminal route rejects `full` preflight.
90+
The phase-specific
8791
`BITCODE_ASSET_PACK_*_USE_PTRR=1` flags remain available for local bisection,
8892
but they are not sufficient as a staging posture because a missed flag silently
8993
turns part of the run back into deterministic evidence.
@@ -94,6 +98,13 @@ matching provider credential is also forwarded; stale pins without credentials
9498
are stripped so staging does not silently require an unavailable model service.
9599
Database streaming requires a real Supabase URL and service-role key; placeholder
96100
`.env.local` values fail preflight before a sandbox is created.
101+
When the recorded Deposit activity has wallet/attestation proof and asset
102+
measurement posture but no explicit proof root fields, the harness materializes
103+
deterministic manifest-bound proof, measurement, and reconciliation roots from
104+
the Deposit id, AssetPack id, Read id, repository, branch, and commit. Those
105+
roots let the Read/Fit pipeline evaluate a proof-bearing deposited candidate,
106+
but they do not by themselves claim BTC fee broadcast, BTD minting, or external
107+
ledger finality.
97108
The deployed streaming route declares an 800 second Vercel Function window; keep
98109
`BITCODE_PIPELINE_HARNESS_MAX_RUNTIME_MS` at or below `600000` there so the
99110
route still has time to collect and stream the blocked-readiness artifact if the

packages/pipeline-hosts/src/__tests__/asset-pack-harness.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,28 @@ describe('asset-pack sandbox harness plan', () => {
121121
});
122122
});
123123

124+
it('materializes manifest-bound deposit evidence roots when activity flags are present', () => {
125+
const plan = buildAssetPackSandboxHarness({
126+
...baseOptions,
127+
deposit: {
128+
id: 'deposit-1',
129+
assetId: 'asset-repository-revision',
130+
hasWalletOrAttestationProof: true,
131+
hasAssetMeasurementEvidence: true,
132+
},
133+
});
134+
135+
expect(plan.manifest.deposit).toMatchObject({
136+
id: 'deposit-1',
137+
assetId: 'asset-repository-revision',
138+
hasWalletOrAttestationProof: true,
139+
hasAssetMeasurementEvidence: true,
140+
});
141+
expect(plan.manifest.deposit.proofRoot).toMatch(/^sha256:[a-f0-9]{64}$/);
142+
expect(plan.manifest.deposit.measurementRoot).toMatch(/^sha256:[a-f0-9]{64}$/);
143+
expect(plan.manifest.deposit.reconciliationReadbackRoot).toMatch(/^sha256:[a-f0-9]{64}$/);
144+
});
145+
124146
it('generates a syntactically valid live pipeline runner', () => {
125147
const plan = buildAssetPackSandboxHarness({
126148
...baseOptions,
@@ -146,5 +168,7 @@ describe('asset-pack sandbox harness plan', () => {
146168
expect(source).toContain('depositor owns minted BTD range');
147169
expect(source).toContain('reader pays BTC fee');
148170
expect(source).toContain('verificationEvidence');
171+
expect(source).toContain('Pipeline produced ');
172+
expect(source).toContain('ledgerSettlement,');
149173
});
150174
});

0 commit comments

Comments
 (0)