[anatrace-core-integration] anatrace-core integration (provenance swap + behavioral attestation)#322
Merged
Merged
Conversation
Exact pin (AC1) so provenance derive + pricing source from the published engine. Single transitive runtime dep is yaml (lockfile verified). Co-authored-by: Ana <build@anatomia.dev>
pricing.ts becomes a re-export surface for core's PRICES, PRICE_TABLE_VERSION,
computeCost, and the TokenCounts/PriceEntry/CostResult types — the local table
and computeCost body are deleted. The table is byte-identical at 0.2.0, so no
displayed cost changes (AC6).
proof.ts threads { priceTable: PRICES } into both computeCost sites (:292,:464)
and sources the displayed table version from the returned CostResult instead of
the per-record stamp, so the label always matches the table actually used (AC6,
A011). The stamped version stays in committed JSON as a historical fact.
Golden card: the AC6 fix surfaces the real 10-char version "2026-06-08" (the
fixtures used a synthetic short "v3"); two stress fixtures are trimmed so the
realistic TOTAL footer fits 80 columns (rendering untouched, per spec).
Co-authored-by: Ana <build@anatomia.dev>
…gine Delete the hand-rolled Claude/Codex derivers and their regex helpers (deriveClaude, deriveCodex, readTranscriptLines, durationFromTimestamps, parseTestCounts, toolResultText, readNumber, readObject). deriveTranscript now reads the transcript bytes once, wraps them in a core NamedBlob, and runs parseSession + deriveCounts — both synchronous (A002). readString stays (readPendingPointer uses it). ProvenanceCounts is re-exported from core so types/proof.ts keeps its import path; core's type adds derive_version (="3"). captureProvenanceAtSave reads the bytes once and stamps transcript_hash (sha256 byte-identity attestation) on the SessionProvenance wrapper alongside captured_at — present iff the transcript was readable, omitted (with derived) when not. All core calls live inside the existing total try-catch (A13). Closes session-capture-C12 (parseTestCounts best-effort), Codex files_touched=0, and empty harness_version — all now delegated to core. Tests re-baselined to invariants against core's actual output. Where core re-baselines a literal it is documented inline (Codex input 300→220: core subtracts cached from gross; duration 30000→28000: span of folded events). Claude fixtures gain message.id (core dedups token usage by id) and tool_use_id links (core gates test counts behind a command tool) — with those, the counts match the old derive. Codex fixture gains a real patch_apply_end so files_touched is derived > 0 (A008). New: transcript_hash present/absent honesty (A005/A006), derive_version stamp (A003), legacy-record backward-compat read (A007). Test fixtures across work/work-merge/proof/proof-card-golden gain derive_version to satisfy core's required field. Co-authored-by: Ana <build@anatomia.dev>
…freedom
Extend the capture-path no-network enforcement to the engine's own dependency
tree: read the installed anatrace-core package.json and assert its runtime deps
are a subset of { yaml } (A012) — fails loudly with the offending dep name if a
future bump adds a network-capable transitive dependency. Also assert the
anatrace-core dependency is pinned exact (A001).
Co-authored-by: Ana <build@anatomia.dev>
Co-authored-by: Ana <build@anatomia.dev>
Co-authored-by: Ana <build@anatomia.dev>
buildRootLaneContext builds the MandateEvaluationContext core evaluates against — the single soundness hinge. Declares a trusted-launcher root-only boundary and reconciles it against extractLineage so root is captured and observed delegates stay uncaptured; never fabricates captured:true. Adversarial soundness suite (test-first): delegate-inclusive negative → unverifiable; unobserved Codex channel never satisfied (codex-blind); runtime contract-matcher never satisfied (runtime-scoped); no delegate lane ever captured. Reasons asserted by set membership, never a single literal. Co-authored-by: Ana <build@anatomia.dev>
…re-boundary env types/proof.ts: ComplianceAttestation (one durable, scrubbed behavioral record per transcript) + ComplianceVerdictRecord, and an optional compliance?[] field on ProofChainEntry — optional, never gates, proof valid without it (mirrors process?). run.ts: buildCaptureEnv emits ANA_CAPTURE_BOUNDARY: 'root', the trusted launcher declaring which lanes it captured (read by buildRootLaneContext). Co-authored-by: Ana <build@anatomia.dev>
captureComplianceAtSave: the save-time producer, mirror of captureProvenance-
AtSave. Resolves the session (reads but never consumes the pointer — provenance
owns deletion and runs after), parses it, builds the mandate from the role's
agent-def + the work item's contract.yaml, hands core a sound root-only context,
runs runCompliance, and writes one compact scrubDeep'd record per transcript at
compliance/{role}-{session_id}.json. Total: any failure → null, save intact.
assembleComplianceAttestations: reads committed compliance/*.json from the
completed dir, skips unparseable, orders deterministically, never throws.
Tests: per-transcript keying (two sessions → two records), version/hashes/
coverage/framework shape, runtime contract-matcher never satisfied, secret
scrubbed from committed record, unreadable transcript → no record/no throw,
capture-off and missing-agent-def → no record, Codex exercised (codex-blind),
reader skip-unparseable + deterministic order.
Co-authored-by: Ana <build@anatomia.dev>
…sites captureComplianceAtSave runs immediately BEFORE captureProvenanceAtSave at each save site (provenance consumes the pending pointer; Codex has no env fallback once it's gone). Its file is staged into the SAME separate non-artifact path list as provenance — kept out of the no-changes guard, git reset on the no-op path, folded into the commit pathspec only when artifacts actually changed (cross-machine-provenance-C1). Co-authored-by: Ana <build@anatomia.dev>
…proof entry writeProofChain assembles the committed compliance records (capture-on only) and conditionally spreads compliance[] onto the entry, alongside process. Emits a loud chalk.yellow warning when any record has incomplete coverage — evidence, never a gate (a violated verdict never changes proof.result). Co-authored-by: Ana <build@anatomia.dev>
…ection formatHumanReadable renders a Session Attestation section after Provenance when entry.compliance is present: per-transcript satisfied/violated/unverifiable counts, a coverage line, abbreviated mandate/transcript hashes, compact scrubbed detail for notable verdicts, and a loud warning on incomplete coverage. The new render helper is module-private (learn-session-memory-C1). Presentation only — a violated verdict renders with a red glyph but never changes the PASS/FAIL headline. Tests: section render with counts/coverage/abbreviated hashes; violated verdict leaves PASS unchanged; incomplete record renders the loud warning; no records → no section; reworked roles get a stable index. Co-authored-by: Ana <build@anatomia.dev>
Co-authored-by: Ana <build@anatomia.dev>
Co-authored-by: Ana <build@anatomia.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Anatomia Proof — anatrace-core integration (provenance swap + behavioral attestation)
✅ PASS · 26/26 assertions satisfied · 10/12 ACs met · 1 deviation
Contract Compliance
Deviations
A014: "A claim about sub-agents we did not capture is reported unverifiable, never satisfied" → "The soundness test for the delegate-inclusive arm augments a real adapter-extracted claim's
subjectto{ kind: 'agent', selector: 'this', delegates: 'include' }before feeding it torunCompliance, rather than obtaining a delegate-inclusive claim directly fromanatomiaAdapter.extract."Reason: Probing core's actual behavior showed
anatomiaAdapterdoes not emit anysubject.delegates: 'include'claim from the current Anatomia agent-defs — every extracted claim carries an absent subject (the legacy flat session union). The spec's Step-1 plan assumed a delegate-inclusive claim would be available from the real mandate; it is not. The base mandate is still genuine adapter output; only the WHO-axis of one claim is set to the value the publishedClaimSubjecttype defines.Generated by Anatomia · Ship with proof.
Summary
ana work completeassembles them onto the proof entry, andana proofrenders a new Session Attestation section.satisfied— is built first and test-first inbuildRootLaneContext: it declares a trusted-launcher root-only boundary and lets the publishedanatrace-coreengine reconcile it against observed lineage, never fabricating a captured delegate lane.violatedverdict renders with a red glyph but never changes a proof's PASS/FAIL. Every record isscrubDeep'd before commit, so no transcript bytes (and no tokens) reach git history.runCompliancefailure leavesana artifact saveintact with the record simply absent. One record per transcript (keyed{role}-{session_id}) — rework is never collapsed.codex-blindchannel path.Pipeline Artifacts
.ana/plans/active/anatrace-core-integration/scope.md.ana/plans/active/anatrace-core-integration/spec.md.ana/plans/active/anatrace-core-integration/build_report_2.md.ana/plans/active/anatrace-core-integration/verify_report_2.mdVerification
Co-authored-by: Ana build@anatomia.dev