Skip to content

WIKI_LOG

Jacob S Vickers edited this page Jul 16, 2026 · 9 revisions

Integrity Protocol Wiki — Log

Chronological record of wiki actions. Append-only — never edit past entries. Actions: ingest, create, update, lint, query, archive

[2026-07-07] create | Wiki initialized for the from-scratch rewrite

  • Rebuilding the Integrity Protocol monorepo at INTEGRITY-LATEST/ from scratch, after an audit of the old INTEGRITY/ prototype found working code alongside protocol-critical pieces (ZK proving, TEE attestation, OPA evaluation, on-chain BAA checks, Merkle anchoring) that were explicit, self-documented mocks.
  • Ground rule for this rewrite: no silent mocks — real implementations, tested against real toolchains, or an honestly-labeled, documented gap.
  • Created docs/INTERFACE_CONTRACT.md (cross-package schemas/ports/protocol decisions), .agents/AGENTS.md (this wiki's read-work-write-lint loop), WIKI_SCHEMA.md, this log, and seed concept pages for AIS, BCC, Merkle batching, DID, and the ZK pipeline — all sourced from the interface contract, which is real and decided now even though several packages aren't built yet.
  • Scope: core seven packages (contracts, integrity-zkp, integrity-oracle, integrity-sdk, integrity-cli, bcc_middleware, integrity-dashboard) plus integrity-demo, a closed-loop MVP. Old repo's marketing site, unrelated scaffolding, legacy backups, and stray installer scripts are intentionally out of scope.

[2026-07-07] create | integrity-zkp entity page

  • integrity-zkp finished: real Noir circuit (Pedersen-hash identity + intent binding), 4/4 nargo test passing, real bb prove/bb verify round-trip, real generated Solidity verifier (2465 lines, UltraHonk scheme).
  • Flagged for contracts: generated verifier expects 11 public inputs (Honk's accumulator inputs), not the circuit's 3 logical inputs — needs reconciling when contracts wires it in.
  • Created entities/integrity-zkp.md, concepts/zkp.md. Updated index.

[2026-07-07] create | integrity-cli entity page

  • integrity-cli finished: real Ed25519 DID generation (hand-rolled base58, verified against the reference package), real BCC commitment signing (canonical JSON, sorted keys), insecure default auth token from the old prototype removed. 48 tests passing.
  • Flagged for integration: /v1/agent/register and /ais response shapes are best-effort against the old prototype, not yet pinned by any finished sibling — needs confirmation once integrity-oracle lands.
  • Created entities/integrity-cli.md. Updated index.

[2026-07-07] create+update | full package documentation pass

  • All 7 core packages are now real and tested (contracts 127, sdk 46, oracle 37+e2e, cli 49, bcc_middleware 49+12 opa, dashboard 28, zkp real bb pipeline), and the genesis is deployed live to Base Sepolia — so the wiki's no-aspirational-content rule can finally be satisfied for all of them.
  • New concept pages: concepts/agent-primitives.md (the central 7-primitive self-sovereign architecture) and concepts/compliance-gate.md (Xibalba Shield / HIPAA vertical).
  • New entity pages: entities/contracts.md, entities/integrity-oracle.md, entities/integrity-sdk.md, entities/bcc_middleware.md, entities/integrity-dashboard.md.
  • Updated concepts/bcc.md (reconciled 7-field signed commitment with self-certifying agent_public_key + covered_entity_address) and entities/integrity-cli.md (now runs the real on-chain self-deploy sequence, 49 tests). Both carried stale content from before the packages landed.
  • Wrote/refreshed every package README to be comprehensive (specs, goals, the agents-own-their-contracts model + its implications): top-level README, contracts, integrity-oracle, integrity-sdk (new); integrity-cli, bcc_middleware, integrity-dashboard (updated for reconciled state).
  • Updated index.

[2026-07-09] update | Multi-vertical MVP: markets layer, integrity-dashboard +

integrity-demo merged into integrity-mvp, three-backend architecture resolved

  • Shifted scope from a healthcare-only closed-loop demo to a multi-vertical investor/developer MVP (prediction markets, binary options, A2A capital allocation, real ITK wallet, healthcare Shield) proving one mechanism (AIS-gated participation + BCC-committed intent) across many verticals.
  • New on-chain layer contracts/src/markets/: IntegrityMarket.sol (an agent-owned, factory-clonable market/binary-option primitive — extends "agents own their contracts" to the application layer), MarketFactory.sol, A2ACapitalPool.sol. Deployed to Base Sepolia via a new INCREMENTAL script DeployMarkets.s.sol (never re-runs genesis Deploy.s.sol against a live network with real agents already on it). 148/148 contracts tests green.
  • integrity-sdk: new markets.py (BCC-gated market/allocation flows), extended ComplianceGate.Vertical support in registration.py. Found and fixed a real bug: testnet ITK must mint to the agent's SovereignAgent CONTRACT address, not its wallet, since application-layer calls are execute-routed through the contract. 53/53 SDK tests green.
  • integrity-dashboard/ and integrity-demo/ merged into one package, integrity-mvp/ (dashboard app at the package root, demo scenario engine in demo/) — the protocol has exactly one user-facing product surface, not a dashboard + a separate demo UI + a separate marketing site. Renamed entities/integrity-dashboard.mdentities/integrity-mvp.md.
  • Resolved backend architecture: bcc_middleware (pre-execution BCC/OPA/ on-chain-BAA gate) is NOT a peer service or SDK-adjacent — it's Oracle's before-the-action half of one trust domain (integrity-oracle is the after-the-action half: telemetry/AIS/on-chain reads). New integrity-userapi/ (FastAPI+Postgres) owns strictly user-account data, never touches a contract. docs/INTERFACE_CONTRACT.md §6.8 (agent contract ownership formalized as a protocol primitive), §6.9 (market layer), §6.10 (backend split), §11 (rewritten for multi-vertical scope), §13 (integrity-userapi, new) revised accordingly.
  • Found a real PHI-safety gap: integrity-sdk's OTel instrumentation (integrations/openai_integrity.py) sets raw prompt/completion text as span attributes with no redaction — if flushed to the oracle this could leak PHI. Fix (pending): SDK never transmits raw content, only derived tri-metric signals + a hash; oracle-side rejection as defense in depth.

[2026-07-09] update | PHI design correction + AGENTS.md test-coverage loop restored

  • Corrects the entry directly above (append-only log, not edited in place): the "SDK never transmits raw content, hash-only" PHI design was superseded after reading Xibalba Solutions' prior spec docs (13 files on ~/Desktop, cross-referenced this session). OBSERVABILITY_VTL.md already names the real design: a targeted Redactor (integrity_sdk/security/redactor.py, new — not yet implemented, [PLANNED]) doing entity-specific PII/PHI/secret masking client-side — NOT a blanket strip — because oracle-side LLM-as-judge evaluation (also [PLANNED], new judge_evaluations table) needs structurally-intact, if-redacted trace content to actually judge anything. Oracle-side raw-content rejection on /v1/telemetry/ingest stays as defense in depth either way. Root README.md's "Vision & long-term roadmap" section and ~/.claude/plans/zippy-wishing-candy.md carry the corrected design; this log entry brings the wiki record in line with them.
  • Restored .agents/AGENTS.md §6 "Continuous test-coverage loop" to match the predecessor project's fuller version: a prior port of this file had compressed the old repo's three-phase loop (Coverage Discovery → Parallel Test Generation & Verification via independent autonomous background subagents → Consolidation) down to a single inline "add a test" step, losing the parallel-subagent mechanism. Re-added, translated to this harness's actual Agent tool (run_in_background: true) in place of the old environment's define_subagent/"Jules Tasks" terminology. User feedback that triggered this: "the old wiki was mature and i liked the wiki loop please keep that."

[2026-07-09] ingest+create+update | Old-wiki migration pass (INTEGRITY/docs/wiki -> here)

  • Read the ~95-page old wiki at INTEGRITY/docs/wiki/ (50 concepts, 45 entities) and ported what's still relevant to the rewritten protocol, correcting naming/facts against real files in this repo rather than copying. Confirmed the Redactor mentioned as [PLANNED] in the entry above landed for real mid-session (integrity_sdk/security/redactor.py, wired into openai_integrity.py/langchain_callback.py, tested in tests/unit/test_redactor.py) — updated its status to built accordingly.
  • 8 new concept pages: concepts/integrity-market.md (IntegrityMarket/ MarketFactory/A2ACapitalPool — real, live on Base Sepolia, 21 new forge test cases, but flags the oracle's markets/leaderboard/wallet read API as not yet built); concepts/local-metrology.md (real derive.py Shannon-entropy/grounding/sacrifice/compliance heuristics, replacing the old wiki's fictional hardware-fingerprint/offline-moat/7-risk-indicator content with what's actually in the SDK); concepts/observability-vtl.md (the real, tested Redactor + the still-[PLANNED] LLM-as-judge/ oracle-side rejection halves, replacing the old wiki's speculative GuardrailEngine/StateStore/time-travel/separate-observability-backend content); concepts/smart-baa.md (merges old hybrid-escrow.md + smart-baa-technical-guide.md into one page documenting the real 4-state SmartBAA.sol escrow, explicitly flagging the old pages' 72-hour dispute window, on-chain EIP-712 signing, controller recovery, and 3-party multisig as never-built); concepts/identity-ceiling.md ([PLANNED], ties to the README's verification-ladder table, corrects the old wiki's MAC-address/CPU-serial hardware-fingerprint mechanism to the real roadmap direction — TEE/HSM attestation); concepts/ cross-chain-spec.md, concepts/a2a-negotiation-spec.md, concepts/ zk-ml-spec.md (all [PLANNED] stubs tied to README's "Advanced primitives" section and the documented CCIPReputationBridge gap).
  • Updated existing pages rather than forking new ones: entities/ contracts.md (added the markets/ trio to Contents, bumped 127->148 tests), entities/integrity-sdk.md (added markets.py and security/redactor.py, bumped 46->66 tests), concepts/compliance-gate.md and concepts/ais.md (cross-links to the new pages, no content duplicated).
  • Deliberately skipped (not ported): all *.sol.md dumps of deleted singleton-era contracts (ReputationRegistry.sol.md, StateAnchor.sol.md, XibalbaAgentRegistry.sol.md as integrity-registry.md, etc.) — literal old source code with hardwareFingerprint fields and Ownable global admin, zero salvageable design rationale for the per-agent clone model that replaced them; every contract-stub .sol.md under ~250 bytes (AgentCreditFacility, AgentMarketplace, AuditShield, ClaimsAdjudicator, ClinicalTrialBond, EnterpriseRegistry, IntegrityPaymaster, IntegrityProtocol, MedicalCreditLine, MockITK, MockPaymaster, OracleRegistry, ReputationLendingPool, ReputationSBT, StablecoinPaymaster, StakingReputation, XibalbaNameService, AgentFactory — deleted) — none of these contracts exist in contracts/src/ today; pure business/vision pages already superseded by README.md's "Vision & long-term roadmap" section or not evidenced anywhere in this repo (business-plan, business-strategy, cco-executive-summary, mainnet, roadmap-and-governance, adoption-strategy, institutional-use-cases, healthcare-value-proposition, integrity-master-specification, white-paper-agents-as-economic-sovereigns, whitepaper, integrity-protocol-strategy, integrity-protocol-governance-proposal, mindmap, world-awareness-spec, model-contextual-integrity-protocol, mcip, generative-ui-security, ai-proxy-optimism, gemini, metadata-catalog, phi-provenance-devil-advocate-plan, proactive-tee, xibalba-shield.md, xibalba-shield-proposal.md, itk-token.md, stablecoin-vault-paymaster.md, mcp-integration.md, developer-guide.md/developing-on-integrity-protocol.md/ integration-guide.md/api-reference.md/cli-reference.md/ dashboard-reference.md — all superseded by this repo's own per-package READMEs and entity pages); explicitly out of scope per the task brief (personal-site, quant_zerodrift, xibalba-quant, simulation, devil_advocate_results, anything under old plans/archive/integrity-legacy/). phi.md was a one-line redirect stub, folded into observability-vtl.md's PHI-safety framing rather than kept as a separate page. tri-metric-protocol.md was not ported as its own page — its real, current-code content (the four derived signal heuristics) now lives in local-metrology.md; its formula (3-component, wE=.30/wG=.40/wS=.35, no compliance term, no sum-to-1.0 constraint) directly conflicts with concepts/ais.md's real 4-component formula and was not carried forward as fact.
  • Did not create entities/integrity-userapi.md or an entities/integrity-demo.md: integrity-userapi/ has real, complete endpoint implementations (app/main.py covers every §13 endpoint) but zero test files (tests/ is empty) as of this pass; integrity-mvp/demo/ is an empty directory. Both stay in the index's "pending" section with accurate status notes rather than getting entity pages, consistent with every other entity page here citing a real test count.
  • Real architectural conflicts found, not just naming drift (flagged for the user, not silently resolved): (1) the old wiki's identity design was hardware-tethered (did:xibalba:<hardware_hash> from MAC address + CPU serial + machine-id) — the current design is a software Ed25519 keypair with hardware trust as an explicit, unbuilt roadmap item (TEE/HSM attestation, not a local hardware hash); (2) the old wiki's Tri-Metric AIS formula had 3 components summing to an unconstrained total (wE=.30/wG=.40/wS=.35) — the current formula has 4 components (adds S_compliance) summing to exactly 1.0; these are different formulas, not a renamed one; (3) the old wiki's Smart BAA technical guide described mechanisms (72-hour dispute window, on-chain EIP-712 signing, controller recovery, nested/subcontractor BAAs) that the real SmartBAA.sol does not implement — a real feature-scope shrinkage between spec and build, not a documentation lag.
  • Updated WIKI_INDEX.md (14 -> 22 pages; new acronym glossary entries BAA, VTL; "pending" section rewritten with accurate per-package status; new open query re: the undefined LLM-as-judge rubric).

[2026-07-09] create | integrity-userapi: real test coverage + Postgres compose wiring

  • Closed this package's stated gate ("pytest green against a real Postgres"). It arrived from a prior rate-limited session with real, non-stub implementations of every §13 endpoint but a completely empty tests/ directory and no Postgres wired into the root docker-compose.yml — confirmed by reading every app/*.py file before writing anything, per this file's own read-first rule.
  • Wrote 33 pytest tests (integrity-userapi/tests/), all green against a real Postgres (never sqlite/mocked): register/login/token flow, wrong password rejection, /me auth + deleted-user token rejection, API key create/list/revoke (including double-revoke and cross-user revoke both 404ing), POST/GET /me/agents covering all three states of oracle_client.fetch_agent's AgentLookupResult (live data / not found / oracle unreachable) against a real local ThreadingHTTPServer standing in for integrity-oracle — never a mock of oracle_client's internals — and POST/GET /demo/runs. tests/conftest.py drives the real FastAPI startup/shutdown lifespan via asgi-lifespan so app/db.py's real run_migrations runs for real on every test, and forces (not setdefaults) ORACLE_URL to a closed port so the "unreachable" test can't silently pass against whatever real oracle happens to be reachable in a dev/CI shell that has the documented shared env var exported — caught this exact fragility via the harness's advisor review before declaring done, verified the fix with ORACLE_URL=http://localhost:8080 pointed at the actually-running oracle-backend.
  • Wired docker-compose.yml: new userapi-postgres service (postgres:16-alpine, integrity/integrity_dev_only, db integrity_userapi, host port 5435 — its own instance/port, distinct from integrity-oracle's 5432 compose service and its separate 5434 ad hoc e2e-test convention) and a userapi app service (new integrity-userapi/Dockerfile, uv-based, matching bcc_middleware's pattern, port 8090).
  • Verified for real, not just claimed: uv sync installed cleanly; docker compose build userapi succeeded; docker compose up -d --no-deps userapi booted against userapi-postgres over the compose network, GET /health returned 200, and schema_migrations showed 0001_init.sql applied; a manual uv run uvicorn run against the same Postgres also confirmed a real register -> login round trip over HTTP.
  • No production-code bugs found worth fixing (existing revoke_api_key, add_my_agent upsert, and JWT/argon2 logic all held up under test). Documented one honest scope gap instead of "fixing" it: no endpoint currently authenticates via a raw developer API key (get_current_user_id only decodes JWTs), so "a revoked key can't be reused" has no code path to regress yet.
  • Created docs/wiki/entities/integrity-userapi.md; moved it from WIKI_INDEX.md's "pending" section into "Entities (built)"; updated docs/INTERFACE_CONTRACT.md §2 (new Postgres/5435 ports row) and §13 (Postgres wiring + test convention paragraph, matching what's now real).

[2026-07-09] update | Oracle markets/leaderboard/wallet endpoints — build fixed, verified green

  • The background agent building integrity-oracle's markets/leaderboard/ wallet/judge endpoints (task #18) hit the same session rate limit as two other parallel agents this round and stopped mid-verification, but had already written real, substantial work: GET /v1/markets, GET /v1/markets/{id}, GET /v1/leaderboard, GET /v1/agent/{id}/wallet handlers, routes wired, migrations/0002_markets_and_judge.sql (judge_evaluations table + market/leaderboard cache tables), and a new src/phi.rs module implementing the oracle-side defense-in-depth raw-content rejection backstop (mirrors the SDK Redactor's categories — SSN/credit-card/email/phone/API-key/private-key/MRN — with its own real regex tests, not shared code with Python, by necessity of the language boundary).
  • Left in a non-compiling state at handoff: src/chain.rs's new read_market used futures::future::join_all over alloy EthCall builders directly (not a Future until .call() resolves) and chained contract.field().call() inline inside a tokio::try_join! macro (E0716 — the builder is a temporary the macro's expansion outlives). Fixed directly (not re-delegated — a small, mechanical alloy API-usage fix): each call builder now gets a named local binding before the try_join!/join_all, so the future doesn't borrow from a same-statement temporary.
  • Verified for real after the fix: cargo build clean, cargo test 43/43 lib tests passing (including 12 new phi::tests::* cases) + the e2e test green. This closes task #18.
  • Updated WIKI_INDEX.md: removed the now-stale "oracle's market/ leaderboard/wallet endpoints not yet present" pending-section note, bumped entities/integrity-oracle.md's test count (37→43).

[2026-07-09] update | docs/INTERFACE_CONTRACT.md reconciled for the integrity-mvp rename + two-trust-domain split (closes task #22)

  • Fixed every remaining stale reference in docs/INTERFACE_CONTRACT.md to the pre-2026-07-09 package names/framing that earlier passes missed: §1's scope list ("core seven" → six core + integrity-mvp), §2's ports table (integrity-dashboardintegrity-mvp), the toolchain table's node/npm row, §6.6's deployments-file-readers list, §6.7's Shield panel reference, §6.8's Contracts/Factory-IDE reference, §9's directory tree (removed top-level integrity-dashboard//integrity-demo/, added integrity-mvp/ with src/+demo/), §11's title and body (now integrity-mvp/demo/, explicit about living inside the dashboard package rather than being a sibling), §13's demo_runs description.
  • §6.10 got more than a rename: retitled "two trust domains, not three peer services" and restructured so bcc_middleware and integrity-oracle are presented as one Oracle trust domain (before/ after-the-action halves) with integrity-userapi as the separate second domain — the actual locked architecture decision from this session's planning, which the prior "three services, one boundary" framing technically wasn't wrong about the rule but undersold the coupling on.
  • Also fixed, opportunistically (found while running cargo build on integrity-oracle for task #18, unrelated to this pass but real): a compile error in chain.rs's new read_marketalloy EthCall builders chained inline as contract.field().call() inside tokio::try_join!/futures::future::join_all are dropped-too-early temporaries (E0716) that the compiler could not previously catch mid- edit; now each builder gets a named local first. cargo build clean, cargo test 43/43 + e2e green after the fix.
  • This closes task #22 (doc reconciliation). Task #21 (the actual integrity-mvp dashboard rebuild) remains not started — this pass was documentation only, no dashboard code was written.

[2026-07-09] fix | Live Base Sepolia bug: AgentPrimitivesFactory rejected 3 of 5 Vertical values — redeployed, verified

  • Real bug, found by the integrity-mvp/demo background agent, not hypothetical: the live AgentPrimitivesFactory and its complianceGateImpl were deployed by genesis Deploy.s.sol BEFORE ComplianceGate.Vertical was extended from {None, Healthcare} to 5 members (+ PredictionMarket, Trading, CapitalAllocation, this session's markets work). Solidity's ABI decoder rejects any enum value outside the range the DEPLOYED bytecode was compiled with — so registerPrimitives(..., vertical=2|3|4) reverted on-chain for every agent attempting to register in any vertical except Healthcare/None, even though current source supported all 5. No funds were at risk (the demo agent's probe failed client-side during gas estimation, before broadcast).
  • User sign-off obtained before touching live infrastructure (asked via AskUserQuestion — redeploy now / honest workaround / pause — user chose redeploy).
  • Fix: new contracts/script/FixComplianceGateFactory.s.sol — an incremental script (same read-existing-file/merge pattern as DeployMarkets.s.sol) deploying a corrected ComplianceGate implementation + a new AgentPrimitivesFactory pointing at it (required because complianceGateImpl is immutable, no setter — the whole factory had to be redeployed, not just the one contract). Grants REGISTRAR_ROLE to the new factory on both XibalbaAgentRegistry and DomainRegistry, then revokes it from the old factory (maintaining the documented "only one factory ever holds this role" invariant). Safe for already-registered agents: their EIP-1167 clones' delegatecall target was fixed at clone time to the OLD (untouched, still-live) implementation address, permanently unaffected by this.
  • Verified for real, twice: (1) locally against a fresh anvil + genesis deploy, a real integrity_sdk.registration.register_agent(compliance_vertical="prediction_market") call — the exact call that used to revert — succeeded end-to-end; (2) the identical real call against LIVE Base Sepolia after the real broadcast, confirmed via cast call ... vertical() returning 2 on the new agent's actual on-chain ComplianceGate clone.
  • Process bug also found and fixed while doing this: a forge script dry run (no --broadcast) still executes the vm.writeJson filesystem cheatcode even though it skips broadcasting on-chain — an unguarded dry run of the new script briefly overwrote deployments.baseSepolia.json with addresses that were only ever simulated, never deployed. Caught immediately (before anything else read the corrupted file) and restored from the known-good prior values. Fixed going forward in FixComplianceGateFactory.s.sol via vmSafe.isContext(...ScriptBroadcast/ScriptResume) guarding the file-write. Open flag, not yet fixed: Deploy.s.sol and DeployMarkets.s.sol both have the same latent unguarded-dry-run risk — anyone running either without --broadcast would silently corrupt the deployments file the same way. Worth the same guard in a future pass; not touched here to keep this fix scoped.
  • New live addresses: AgentPrimitivesFactory 0xC19fc9cB2cB87297EfDF11DA7e211e44A6C1181D, ComplianceGate (clone impl) 0xf973cfB78215c9bc7e1f1DC2B5D3A45ad436AbfA. Old factory 0x215f39C8a2Cea2F8c6976fA10bbf48479825aD6e remains deployed (existing agents still resolve against it fine) but no longer holds REGISTRAR_ROLE — do not use it for new registrations.

[2026-07-09] create+update | integrity-mvp/demo built and run for real against live Base Sepolia

  • Built the closed-loop scenario engine at integrity-mvp/demo/ (uv/hatchling Python package, local path dep on integrity-sdk, make demo target added to the root Makefile): integrity_demo/{config,links,reporter,fleet, register_phase,market_phase,capital_phase,healthcare_phase,shield_chain, main}.py. Registers a real 4-persona fleet (Honest-Alpha/Reckless-Beta/ Fraud-Gamma/Clinician-Delta, each a full 7-primitive self-sovereign registration) and drives real transactions: a real IntegrityMarket binary-option deployment, three personas entering positions with real signed BCC commitments (Fraud-Gamma's on-chain position deliberately differs from what it signed — a real, checkable fraud footprint, not oracle-detected or slashed by this script), a labeled demo-resolver settlement, real payout claims (losers' claimPayout correctly reverts with LosingPosition()), a real A2ACapitalPool allocate+release to the honest agent, and a real CoveredEntityRegistrySmartBAAFactorySmartBAA Business Associate Agreement lifecycle for the healthcare persona, ending in a genuine ComplianceGate.isHealthcareCompliant() == true on-chain read.
  • Found and fixed, in this same pass: extended scripts/sync_abis.py (and re-ran make sync-abis) to add ComplianceGate/CoveredEntityRegistry/ SmartBAAFactory/SmartBAA ABIs to integrity-sdk/integrity-cli — this demo is their first Python caller. Re-ran both packages' full test suites after the sync (66/66 SDK, 49/49 CLI) to confirm no regression from the ABI additions.
  • Found, surfaced, and (via the user) fixed a real live-deployment bug: the AgentPrimitivesFactory.registerPrimitives call reverted for every compliance_vertical other than none/healthcare — see the entry directly above this one ([2026-07-09] fix | Live Base Sepolia bug...) for the root cause and fix. This session's role was finding it (isolated via a 5-way read-only eth_call sweep before any funds were at risk), stopping to flag it rather than silently working around it with a compliance_vertical="none" substitution, and then, after the fix landed, independently re-verifying it with the identical eth_call sweep against the new factory before spending real registration gas.
  • Found a second, still-open integration bug (documented, not fixed this pass — out of this task's scope): integrity_sdk.registration.register_agent's oracle-registration POST body ({agent_id, did_document, primitives}) does not match the current integrity-oracle's RegisterAgentRequest schema ({did, did_document, primitives, ed25519_pubkey_hex/eth_address_hex, verification_tier}) — never caught before because the SDK's own tests always pass skip_oracle_registration=True. This demo does the same, documented in integrity-mvp/demo/README.md's honest-gaps section.
  • Corrected two stale wiki entries found via direct source re-read while building this (drift the schema's Phase 4 lint step exists to catch): entities/bcc_middleware.md's "honest open gap" claiming agent_id_to_address still uses a placeholder keccak256(pubkey)[-20:] derivation was wrong — current source already resolves the real SovereignAgent address via the oracle (resolve_agent_primitives); updated the page and removed the matching stale line from WIKI_INDEX.md's open queries. Also removed WIKI_INDEX.md's "Entities (pending)" line for integrity-mvp/demo/ (said "empty directory — no code yet", no longer true).
  • Updated entities/integrity-mvp.md's frontmatter source_files + added a full "demo/ — the scenario engine" section (composition, per-persona on-chain behavior, the live bug found/fixed, the honest-gaps list). No new wiki page created (extended the existing entity page, which already covered the merged dashboard+demo package) — index page count unchanged.
  • Full real BaseScan output from the successful run is in integrity-mvp/demo/README.md's "Sample real run" section.
  • Self-caught post-completion defect, fixed before reporting done: main.py never actually called python-dotenv's load_dotenv() despite the README and the new Makefile demo target both documenting a .env-file setup path — config.py only read bare os.environ, so a fresh user following "cp .env.example .env" would hit ConfigError immediately. The successful run above only worked because env vars were exported directly in-shell, which is exactly why this slipped past the first self-check. Fixed: main() now calls load_dotenv(<package_dir>/.env, override=False) before load_config(). Verified cheaply (no chain calls) with a throwaway .env + unset process env, confirming load_config() succeeds via the file path alone.

[2026-07-09] fix | integrity-sdk registration.py's oracle POST fixed — real 422/400 reproduced and closed (task #27)

  • Reproduced for real, not guessed: fresh local anvil + real contracts/script/Deploy.s.sol genesis (also writes the market layer now — no separate DeployMarkets.s.sol run needed, the file already had MarketFactory/A2ACapitalPool), ephemeral postgres:16-alpine + redis:7-alpine Docker containers, and a real cargo run of integrity-oracle/backend pointed at all three. Called integrity_sdk.registration.register_agent(...) WITHOUT skip_oracle_registration and got the real failure: 422 Unprocessable Entity, body Failed to deserialize the JSON body into the target type: missing field \did` at line 1 column 1286`.
  • Root cause, field-for-field: registration.py's step 11 POSTed {"agent_id": agent_did, "did_document": doc, "primitives": registration.to_dict()}. integrity-oracle/backend/src/handlers.rs's real RegisterAgentRequest struct requires a field named did, not agent_id — a straight naming drift, not a typo introduced this session; it's been wrong since the oracle's HTTP layer was built (confirmed via integrity-oracle/backend/tests/support/register_agent.py's own comment: "Skips the oracle POST ... since the oracle is exactly what the Rust test is standing up separately" — the Rust e2e test hand-builds the correct payload itself and never exercised the SDK's own POST code path). Manually curl-testing after renaming agent_iddid surfaced a SECOND, independent mismatch: the handler also requires at least one of ed25519_pubkey_hex/eth_address_hex (plain field absence, not a naming issue — registration.py never sent either), returning 400 {"error": "invalid request: agent must supply at least one of ed25519_pubkey_hex / eth_address_hex"} even with did fixed. The primitives sub-object itself was incidentally fine structurally (serde ignores the extra did/evm_address/domain_id/oracle_registered fields registration.to_dict() carries beyond PrimitiveSetDto's 7), but was tightened anyway to send only the 7 real fields, matching the schema exactly rather than relying on serde's permissiveness.
  • Fix, and why the SDK side was the one to change: docs/ INTERFACE_CONTRACT.md was completely silent on this endpoint's schema (confirmed via grep — zero prior mentions of RegisterAgentRequest, ed25519_pubkey_hex, eth_address_hex, or verification_tier), so there was no documented contract to defer to; changed integrity-sdk/ integrity_sdk/registration.py (not the oracle) because the oracle's Axum struct is the actual enforced contract a Rust compiler already checked, and per the task's own rule of thumb, that's the side to trust when the contract doc is silent. registration.py now POSTs {"did", "did_document", "primitives": {sovereign_agent, state_anchor, reputation_registry, slasher, verifier_registry, compliance_gate, agent_profile}, // exactly these 7, built explicitly, not registration.to_dict() "ed25519_pubkey_hex": "0x"+keypair.public_bytes().hex(), "eth_address_hex": evm_account.address}. verification_tier deliberately left unsent (server defaults to 0 via #[serde(default)]) — no verification-ladder semantics exist yet (Identity Ceiling & Verification Ladder is still [PLANNED]), so sending a fabricated nonzero value would be dishonest.
  • Verified for real, twice: (1) the exact repro call above, re-run after the fix, against the same live cargo-run oracle — oracle_registered became True, and a real GET /v1/agent/{did} returned has_ed25519_key: true, has_eth_address: true with the on-chain-matching primitives; (2) a real GET /v1/agents on that same running oracle listed the newly registered DID, closing the exact "demo-registered agents are invisible to the oracle" symptom that surfaced this bug.
  • New regression test: integrity-sdk/tests/test_registration_oracle_e2e.py (new file — test_registration.py's existing scaffolding always sets skip_oracle_registration=True, so it was extended with a sibling file rather than mutated in place). Opt-in via ORACLE_E2E=1 (same gate name integrity-oracle/backend/tests/e2e.rs already uses, for cross-package consistency) since it additionally needs Docker + cargo on top of this package's already-required anvil/forge. Its oracle_backend fixture spins up ephemeral Postgres/Redis containers and a real cargo run oracle against the session deployed_chain fixture's real anvil + the real deployments.local.json that Deploy.s.sol/DeployMarkets.s.sol write to the repo root as a side effect (reused as-is, not hand-rebuilt). The test calls register_agent() with no skip_oracle_registration override and asserts oracle_registered is True, a real GET /v1/agent/{did} 200s with matching primitives, and the DID appears in a real GET /v1/agents. Ran green standalone (ORACLE_E2E=1 pytest tests/test_registration_oracle_e2e.py) and as part of the full suite (skipped when ORACLE_E2E unset, as designed).
  • Full suite re-run, no regressions: integrity-sdk — 66 passed, 1 skipped (the new opt-in test, ORACLE_E2E unset in that run) — same 66 always-run count as before this change. integrity-oraclecargo test — 43 lib tests + the existing opt-in e2e test (also skip-printed, ORACLE_E2E unset), all green; no oracle-side code changed, so no new Rust test was needed there.
  • Also found, not fixed here (flagged, out of this task's #27 scope): integrity-mvp/e2e/global-setup.ts (Playwright E2E setup, owned by the parallel task #21 dashboard work — not touched) registers its seed agent via this exact same register_agent(...) call, without skip_oracle_registration. It would have hit this identical bug the first time make test-e2e actually ran that step; this fix incidentally unblocks it too, but that file itself was left untouched per this task's file-scoping rule (integrity-sdk/, integrity-oracle/, docs/ only). integrity-mvp/demo/ is a separate, NOT-automatically-fixed case, important not to conflate with the above: integrity_demo/register_phase.py still hardcodes skip_oracle_registration=True for every persona (see its own module docstring and README.md's honest-gaps section, both untouched here — same file-scoping boundary). This SDK fix makes a demo-style registration capable of succeeding against the oracle now, but the demo agents remain invisible to the oracle (no AIS, absent from GET /v1/agents) until whoever owns integrity-mvp/ removes that flag — that is a separate, still-open follow-up, not something this pass silently completed.
  • Also found (Rust-side reading confirmed by a grep, not a full repro — documented, not fixed, same file-scoping reason): integrity-cli's agent register command (integrity-cli/integrity_cli/main.py) hand-builds its own oracle POST body independently of integrity_sdk.registration (this package "carries its own copy" of the identity/wallet/chain logic per its wiki page) and has the exact same agent_id-vs-did / missing-address-fields drift. integrity agent register without --skip-oracle would hit the identical 422/400 this task fixed in the SDK. Logged in docs/wiki/entities/integrity-cli.md's new "Known open gap" section rather than fixed, since integrity-cli/ is outside this task's scoped file set.
  • Updated docs/INTERFACE_CONTRACT.md §6.3 with the now-documented real request schema (it was previously silent on this endpoint entirely) and docs/wiki/entities/integrity-sdk.md / entities/integrity-oracle.md / entities/integrity-cli.md with the fix + new test coverage + the two flagged-but-unfixed parallel gaps (demo/, CLI).

[2026-07-09] update | Landing page rebuilt: agent-ownership narrative, real Mermaid architecture/roadmap diagrams, logo

  • Per explicit product direction, rebuilt integrity-mvp/src/pages/LandingPage.tsx from a minimal hero+bento+demo-run page into the full investor/developer narrative: the "agents own their own contracts" thesis and its consequences (no platform lock-in, real skin in the game via Slasher, portable reputation, a real application-layer economy), a real client-rendered architecture diagram, a verification-ladder table, and a decentralization-roadmap diagram — every factual claim mirrors the root README.md's "Vision & long-term roadmap" section and docs/INTERFACE_CONTRACT.md §6.8/§6.10 verbatim in substance, built-vs- roadmap kept visually distinct throughout (badges: "not built" / "not yet enforced" / "planned"), consistent with the repo's no-silent-mocks/no- oversold-status rule extending to investor-facing copy.
  • New src/components/MermaidDiagram.tsx — real mermaid npm package (new runtime dependency), client-side rendered SVG from real diagram source (kept as reviewable/diffable strings in LandingPage.tsx, not a static image export). Verified with a real headless-Chromium check (not just vitest/jsdom): both diagrams render as real <svg> elements, zero console/page errors.
  • Logo: copied XibalbaSolutionsLogo.png verbatim from the old ~/Projects/INTEGRITY/integrity-dashboard/public/ into integrity-mvp/public/, referenced in the hero section.
  • New src/pages/LandingPage.test.tsx (5 tests, all passing) + CSS additions in index.css (.landing__logo, .landing__narrative, .narrative-list, .mermaid-diagram, .landing__closing).
  • Real, previously-latent bugs found and fixed while verifying this in an actual browser (not hypothetical — each one blocked the page from rendering at all until fixed):
    1. src/index.css's design-tokens comment contained a literal */ substring inside itself (--gauge-*/--*-dim), prematurely closing the CSS comment and leaving the rest of the comment text as invalid CSS — broke PostCSS transform for every page, not just this one. Fixed by adding a space (--gauge-* / --*-dim).
    2. No .env existed for local integrity-mvp dev (client.ts's requireEnv('VITE_ORACLE_URL') throws at any page's module-load time, since App.tsx imports every page eagerly, not lazily) — a real local-dev-setup gap for anyone starting this app fresh. Created integrity-mvp/.env from .env.example.
    3. Adding the new mermaid dependency to an already-running dev server produced a stale Vite dep-optimization cache (504 Outdated Optimize Dep) until the server was restarted — a normal Vite quirk, not a code bug, noted here only because it looked like a real failure during verification until diagnosed.
  • This work landed while task #21's background dashboard-rebuild agent was mid-flight on the other pages (Markets/Leaderboard/Wallet/Shield/ Login/Register/Account/MarketDetail) — deliberately scoped to avoid touching any file that agent was also editing (App.tsx, AuthGate.tsx, AgentListPage.tsx were all left exactly as that agent wrote them).

[2026-07-09] update | Closed both follow-up gaps task #27 flagged: integrity-mvp/demo's skip_oracle_registration workaround removed, integrity-cli's own oracle POST fixed to match the real schema

  • Task #27 fixed integrity-sdk/integrity_sdk/registration.py's oracle POST schema (agent_iddid, added ed25519_pubkey_hex/eth_address_hex) and, out of its own file-scoping boundary, flagged two parallel consumers that had the identical drift and were NOT touched by that fix: integrity-mvp/demo/integrity_demo/register_phase.py (hardcoded skip_oracle_registration=True as a workaround) and integrity-cli's main.py agent register command (hand-builds its own oracle POST body, never called the SDK's registration.py). Both are now closed.
  • integrity-mvp/demo fix: register_phase.py no longer passes skip_oracle_registration=True to registration_module.register_agent(...) — it now passes oracle_url=config.oracle_url and lets the SDK's already- fixed step 11 run for real. Docstring rewritten to describe the current state instead of the historical workaround. Added a reporter.fact(f"{persona.display_name} oracle registered", ...) line so a real run's console output visibly confirms the oracle accepted each persona, not just the on-chain steps.
  • integrity-mvp/demo verification (real infra, not hypothetical): spun up a fresh local anvil (port 18545), ran the real contracts/script/Deploy.s.sol + DeployMarkets.s.sol against it (writing a real deployments.local.json to the repo root), ephemeral Postgres (docker run postgres:16-alpine) + Redis (docker run redis:7-alpine) containers, and a real cargo run of integrity-oracle/backend pointed at that chain/deployments file. Drove integrity_demo.register_phase.register_fleet() directly (a single test persona, not the full 4-persona/market/BAA scenario — the task's own gate says a local-anvil oracle-registration check is sufficient, not a full paid live-Base-Sepolia run) against this real stack: persona.registration. oracle_registered came back True, a real GET /v1/agent/{did} on that oracle returned has_eth_address: true with matching primitives, and a real GET /v1/agents listed the registered DID — closing the exact "demo-registered agents are invisible to the oracle" symptom.
  • integrity-mvp/demo/README.md honest-gaps section updated: gap #2 (the schema mismatch / skip_oracle_registration=True workaround) is now marked [RESOLVED 2026-07-09] with the verification above cited directly, rather than left as stale text claiming a gap that no longer exists (per this task's explicit instruction). Gap #1 (no live AIS scoring) and gap #3 (no oracle instance was running against the LIVE Base Sepolia deployment during the 2026-07-09 sample run) were reworded, NOT closed — they're real, still-open infra-availability gaps distinct from the code-level schema bug that's now fixed: the fix means a demo run CAN now register with a real oracle when one is reachable, not that live Base Sepolia currently has a matching oracle running against it. .env.example and the README's Prerequisites/Environment sections gained ORACLE_URL (previously undocumented there even though config.py already read it), since a demo run now hard-fails at Phase 1 without a reachable, schema-matching oracle (deliberate — register_agent() re-raises RegistrationError on a failed oracle POST rather than swallowing it, same as always).
  • integrity-cli fix: read the real RegisterAgentRequest struct in integrity-oracle/backend/src/handlers.rs directly (lines 75-94) to confirm the exact current shape rather than trusting the wiki's prior description. main.py's agent_register command's oracle POST payload changed from {"agent_id": agent_did, "alias", "description", "did_document": doc, "primitives": registration.to_dict()} (the CLI's own AgentRegistration.to_dict(), which — like the SDK's pre-fix version — carries extra fields PrimitiveSetDto doesn't have) to {"did": agent_did, "did_document": doc, "primitives": {the 7 real fields, built explicitly}, "ed25519_pubkey_hex": "0x"+private_key.public_key().public_bytes_raw().hex(), "eth_address_hex": evm_account.address, "alias": alias, "description": description}alias/description deliberately kept (the oracle's struct has no #[serde(deny_unknown_fields)], so it silently ignores them, same reasoning the SDK used for its own extra to_dict() fields before they were narrowed out). identity.load_private_key(identity_name) is now called inside the oracle-POST branch to get the raw Ed25519 public key bytes (public_bytes_raw(), the same helper bcc.py already used elsewhere in this package — no new dependency).
  • integrity-cli verification (real infra, not hypothetical): reused the same live local anvil + real cargo run oracle stack from the demo verification above. Ran the actual CLI as a subprocess (HOME pointed at a fresh temp dir so identity.IDENTITY_DIR, computed from Path.home() at import time, resolved cleanly): integrity identity keygen then integrity agent register --alias verify-cli-bot --rpc-url ... --oracle-url ... (no --skip-oracle) — printed "Oracle accepted the registration" and "oracle_registered": true in the final JSON. Independently confirmed via a real GET /v1/agent/{did} (has_ed25519_key: true, has_eth_address: true, matching primitives) and a real GET /v1/agents listing that DID.
  • New regression test: integrity-cli/tests/test_register_oracle_e2e.py (new file). Opt-in via ORACLE_E2E=1 (same gate name integrity-oracle/backend/tests/e2e.rs and integrity-sdk/tests/test_registration_oracle_e2e.py already use, for cross-package consistency). Its deployed_chain fixture mirrors this package's own tests/test_chain.py (real anvil, real Deploy.s.sol + DeployMarkets.s.sol, addresses parsed from forge's own broadcast log); its oracle_backend fixture mirrors the SDK's oracle e2e test's fixture (ephemeral Docker Postgres/Redis + real cargo run, never the shared dev-time docker-compose services). The test drives the actual agent register Typer command via CliRunner (not a direct function call — this exercises the real command wiring, flags, and console output), asserts "Oracle accepted the registration" appears in stdout, reads the real persisted <name>.primitives.json for the registered DID (noting in a comment that this file's own oracle_registered field is written BEFORE the oracle POST and is therefore stale — the DID it carries is what's used, not that field), and then independently re-verifies via real GET /v1/agent/{did} + GET /v1/agents calls against the same oracle — the same "don't trust the client's own success claim, check the server" pattern the SDK's e2e test uses. Ran green standalone (ORACLE_E2E=1 uv run pytest tests/test_register_oracle_e2e.py, 1 passed) and as part of the full suite (uv run pytest: 49 passed, 1 skipped when ORACLE_E2E unset — same 49 always-run count as before this change, plus the new opt-in test, matching the task's "49+" gate).
  • Updated docs/wiki/entities/integrity-cli.md's "Known open gap" section — replaced with a "Resolved gap" section describing the fix and its real verification, rather than leaving stale open-gap text next to a new fix (per this task's explicit instruction not to just add more text alongside the old gap note). Updated docs/wiki/entities/integrity-mvp.md's demo section and honest-gaps list, docs/wiki/WIKI_INDEX.md's integrity-cli one-line summary (49 tests → 49 tests + 1 opt-in oracle e2e), and docs/INTERFACE_CONTRACT.md §6.3 with a note that integrity-cli now conforms to the same documented RegisterAgentRequest schema as integrity-sdk.
  • All ephemeral verification infra (anvil, cargo-run oracle process, the two verify-pg/verify-redis Docker containers, temp HOME/tmpdir scratch dirs) was torn down after verification; deployments.local.json at the repo root was left as the freshly-regenerated artifact from this session's real Deploy.s.sol/DeployMarkets.s.sol runs (gitignored, not committed state, safe to leave — matches the convention every other real-anvil test in this repo already relies on).

[2026-07-09] create+update | integrity-mvp full multi-page rebuild (task #21) — real auth swap, 5 new pages, real oracle wire-shape bugs found+fixed

  • Routing (src/App.tsx) rebuilt from 2 routes to the full IA: public Landing (/), Agents (/agents, /agents/:agentId), Wallet (/agents/:agentId/wallet, new), Shield (/agents/:agentId/shield, new), Markets (/markets, /markets/:marketAddress, new), Leaderboard (/leaderboard, new), Capital Allocation (/capital, new, an honest "oracle exposes no A2ACapitalPool endpoint" gap page rather than fabricated data); account-scoped /account, /login, /register behind a real session. Cognition intentionally folded into Agent Detail rather than built as a separate page (avoids a near-duplicate view; call flagged as a deliberate IA choice, not a missed requirement).
  • Auth swap, complete: deleted Firebase (firebase.ts, the old AuthContext/AuthGate), replaced with real integrity-userapi JWT auth (new lib/api/userapi.ts, lib/api/client.ts's userapiClient + localStorage token + axios request interceptor, rewritten AuthContext.tsx/AuthGate.tsx, new LoginPage/RegisterPage/AccountPage). Only /account sits behind a session check — Landing/Agents/Markets/ Leaderboard/Wallet stay public (real protocol data, no login wall).
  • Real, empirically-found oracle wire-shape bugs, fixed client-side (integrity-oracle itself out of scope — a parallel agent, task #27, owned integrity-sdk/integrity-oracle this session): ran the pre-existing Playwright suite for the first time before starting page work (per this repo's own testing-strategy convention) and got 4/5 failures. Root causes, all in integrity-mvp/src/lib/api/types.ts: GET /v1/agents returns {id, verification_tier, created_at} (AgentSummary), not the previously-assumed agent_id/alias/ais/ zk_proof_verified/registered_at/last_active; GET /v1/agent/{id} never returns a did_document (accepted on registration, never persisted/returned by any GET — real, confirmed gap, not fixed here); PrimitiveSetDto's own doc comment in handlers.rs incorrectly claims "camelCase" — it actually serializes snake_case (no #[serde(rename_all)]); ComplianceResponse fields are is_compliant/covered_entity, not isCompliant/coveredEntity; AisResponse.weights fields are w_entropy/w_grounding/w_sacrifice/ w_compliance, and there is no history array (the old AIS sparkline was reading a field the oracle never sends — removed, not stubbed). Fixed types.ts, oracle.ts, AgentListPage.tsx, AgentDetailPage.tsx, CompliancePanel.tsx, and every corresponding vitest mock to match reality. Full itemized list in docs/INTERFACE_CONTRACT.md §14.
  • Real E2E harness bug found and fixed: e2e/constants.ts's E2E_SEED_AGENT_ID ('e2e-seed-agent') was being used to query the oracle, but it's only a local wallet/DID-home slug (integrity_sdk.did.agent_dir) — the real on-chain DID is did:integrity:<sha256 fingerprint of a freshly generated Ed25519 keypair>, unrelated to that string. This alone caused 4 of 5 pre-existing specs to fail for real (agent not found: e2e-seed-agent oracle-side errors, confirmed by running the suite before any fix). Fixed: e2e/global-setup.ts now writes the real registration result (did, sovereign_agent) to .e2e-state/seed-agent.json; constants.ts's new getSeedAgentState() reads it at spec runtime.
  • e2e/global-setup.ts extended (real, necessary reason, per this repo's own extension convention): now also deploys one real IntegrityMarket with min_ais_to_enter=1000 (unreachable by any realistic AIS, guaranteeing a deterministic negative-path gate regardless of the seed agent's actual scored AIS) and boots a real integrity-userapi instance (its own ephemeral Postgres database on the shared E2E Postgres container, port 8093) for the new auth specs. global-teardown.ts and playwright.config.ts's webServer.env updated to match (VITE_USERAPI_URL).
  • integrity-userapi/app/main.py: added CORSMiddleware (allow_origins=["*"], allow_credentials=False) — this service had NO CORS policy before, a hard-blocking gap for any browser caller (integrity-mvp is cross-origin by construction). Verified: all 33 existing pytest tests unaffected; re-ran green. Documented in docs/INTERFACE_CONTRACT.md §13-§14 and entities/integrity-userapi.md.
  • vite.config.ts: fixed a real, pre-existing npm test failure — vitest's default include glob was also collecting integrity-mvp/e2e/*.spec.ts (Playwright's own spec files), erroring with "Playwright Test did not expect test() to be called here" on all 3 e2e files. Added test.exclude: ['e2e/**', 'node_modules/**'].
  • MarketDetailPage.tsx: a real AIS-gated entry check (pick a registered agent from a live dropdown, compare its real GET /v1/agent/{id}/ais score against the market's real on-chain min_ais_to_enter, badge + disable state reflect the real comparison). The "Enter market" button is unconditionally disabled regardless of gate outcome — the oracle exposes no position-entry endpoint (every market write is agent-wallet-signed via integrity-sdk, confirmed against routes.rs) and this app has no browser wallet-signing flow — a real, stated gap. (Self-caught and fixed a bug in this pass's own first draft: the button was only conditionally disabled, meaning a qualifying agent got a clickable control wired to nothing.)
  • Gates, all actually run: npm test 55/55 passing across 19 files (up from 28/9 — MSW-mocked, one deliberate seam per the pyramid), npx tsc -b --noEmit clean, npm run build clean, npx playwright test 13/13 passing (up from 3 pre-existing specs, of which only 1 actually passed before this session's fixes) against the real stack: agent-list, agent-detail (both rewritten), auth (new, replaces the old Firebase-pinning auth-gate.spec.ts per its own docstring — real register/login + the required negative path, a real 401 on bad credentials), markets (new — list + the required AIS-gated negative path), leaderboard, wallet, shield, capital-allocation (all new).
  • Landing page (hero narrative, bento-grid feature cards, real Mermaid architecture + decentralization-roadmap diagrams, "Run demo" surface pulling real integrity-userapi data with an honest real-literal fallback) was built by a coordinating session in parallel this pass — not rebuilt or altered here; verified still green as part of the full gate run above (LandingPage.test.tsx 5/5, landing.spec.ts n/a — no dedicated Playwright spec for it yet, a real remaining gap, though its content is exercised incidentally by auth.spec.ts's public-page check and capital-allocation.spec.ts's nav-click-through).
  • Updated docs/wiki/entities/integrity-mvp.md (full rewrite of the "What's built"/"Design" sections + source_files), entities/integrity-userapi.md (new CORS section), docs/wiki/WIKI_INDEX.md (both entities' one-line summaries), docs/INTERFACE_CONTRACT.md (new §14 + a CORS note in §13). No new wiki pages created (both entity pages already existed) — index page count unchanged at 24.
  • Honest remaining gaps, not silently left out: no dedicated landing.spec.ts Playwright spec (Landing's own content was built by a parallel session this pass, per its own report already verified via a real headless-Chromium check + 5/5 vitest); no dark/light theme toggle (personal-site's toggle mechanism, a deliberate scope cut, documented in LandingPage.tsx's doc comment); Capital Allocation has no live reads at all (oracle exposes no endpoint — states this plainly); Markets has no real transaction-submission path from the browser (no wallet-signing flow built — states this plainly, button always disabled); AgentDetail's DID document panel was removed (the oracle never returns one — a confirmed, out-of-scope-to-fix oracle gap, not an integrity-mvp regression).

[2026-07-10] update | integrity-mvp gold/navy legacy-UI redesign + Seeded Demo/Live data mode (5-phase pass)

  • Reimagined the dashboard's visual layer and IA per a plan at /home/xibalba/.claude/plans/use-the-xibalba-hermes-snappy-globe.md, combining the legacy dark-navy/gold dashboard's feel (Playfair Display headings, glass "enterprise-card" panels, circular gauges) with the Stitch-generated mockups' sidebar-dashboard structure — the direction tokens.css had already committed to in an earlier pass's code comment, not a fresh design decision.
  • Phase 1: extended (not replaced) tokens.css with Playfair Display, layout constants, glass tokens, and 7 per-section accent colors.
  • Phase 2 — the load-bearing piece: a Seeded-Demo/Live data-mode toggle. lib/api/client.ts gained a per-request axios adapter override that serves fixture data (lib/mock/fixtureMatcher.ts + lib/mock/fixtures/*.ts) in Demo mode without touching the network, falling through to the real transport in Live mode or for any unseeded route. Verified live via npm run dev with zero backend processes running: Live mode fails loudly (no fabrication), Demo mode fully populates every page. Also fixed eslint.config.js's hand-picked 3-global list (missing localStorage/setTimeout/fetch/URL/ process), which this phase's browser-API usage would otherwise have made worse.
  • Phase 3: replaced the single flat NavBar with two react-router-dom v6 layout routes — PublicLayout (Landing/Login/Register) and AppShell (glass Sidebar + TopBar for every other route). TopBar's health dot is a real GET /healthz against integrity-oracle (confirmed in routes.rs), never a fabricated "healthy."
  • Phase 4: CSS-only restyle of the 12 existing routes into the glass/ Playfair treatment; a new .dashboard-grid (legacy 1fr/1fr/1.1fr) replaced vertical stacking on AgentDetailPage and WalletPage. Real bug found via visual QA (not just code review): Primitives' flex-row address layout wrapped 42-char hex addresses one character per line once its column narrowed inside the new grid — fixed by stacking label above address instead of side-by-side.
  • Phase 5: built the 5 mockup pages with no backend today (Cognition, Contracts, Intelligence, Factory, Traces), each gated Live(honest-gap)/ Demo(seeded) per this repo's .agents/AGENTS.md §3 no-aspirational- content rule — verified per-page in *Page.test.tsx. New shared widgets, all hand-rolled (no new dependency): RadarChart, CodePanel, Timeline, DataTable, StatCardRow. Route reconciliation: AgentSelectorPage backs new /wallet + /shield routes (flat top-level sidebar items the mockups want, over a data model that's genuinely per-agent) — redirects when there's exactly one owned agent, otherwise shows a real pick list, never a fabricated single default. Two more real bugs found via visual QA: StatCardRow rendered a block-level child inside a <p> (invalid HTML, fixed to a <div>); CodePanel's syntax highlighter ran one .replace() pass per token type over the previous pass's output, so a later pass matched text inside an already-inserted <span> from an earlier one (a comment span's own class="..." attribute leaked as visible text) — rewritten as one combined-regex, single-pass tokenizer.
  • Gates run after every phase: npm run build (tsc -b + vite build) and npm run lint clean throughout; npm test grew from 55/55 (pre- existing) to 129/129 passing across 44 files by the end of Phase 5, zero regressions in any pre-existing test at any phase.
  • Repo had no git history before this pass (git init'd as part of Phase 1 so each phase lands as a reviewable commit) — see the integrity-mvp package's own .git history for the 5 phase commits.
  • Honest gap, not silently skipped: the plan named e2e/data-mode-honesty.spec.ts as its most important new test — not added. e2e/global-setup.ts boots the full live stack (anvil + a compiled integrity-oracle + Postgres + Redis + integrity-userapi) unconditionally for any Playwright run; this environment has no redis-server installed and no built integrity-oracle binary, making that a substantially separate undertaking from this UI pass. The same honesty gate is verified, and passing, in every one of the 5 new pages' own unit tests instead.
  • Backend build-out for the 5 new pages (replacing their Live-mode honest-gap states with real reads, sequenced Cognition → Contracts → Factory → Intelligence → Traces by lift) is an explicitly separate, not-yet-started later phase per the plan's §8 — the UI above is complete and functional on its own, with Demo mode as its permanent (not transitional) preview surface either way.
  • Updated docs/wiki/entities/integrity-mvp.md (source_files + a new "Gold/navy legacy-UI redesign" subsection under Design) and docs/wiki/WIKI_INDEX.md (integrity-mvp's one-line summary, updated date). No new wiki pages created — index page count unchanged at 24.

[2026-07-11] update | integrity-mvp gold/navy → Linear-inspired monochrome redesign pivot

  • Direct user feedback on the 2026-07-10 gold/navy/Playfair redesign, once actually seen running in the browser: "terrible," not professional. Follow-up direction: drop it entirely for a Linear-inspired look — near-monochrome dark neutral background, ONE restrained indigo accent (#5e6ad2) used sparingly (primary actions/ active states/links, never a per-section rainbow), sans-serif throughout (Inter — Playfair Display removed), small radii (4-12px, down from 24-32px), flat bordered cards instead of glass/blur/glow.
  • Implemented as a pure token-VALUE change in tokens.css, not a rewrite — every custom property name stayed the same (--accent, renamed from --gold/--gold-dim since it no longer holds a gold hue, is the one real rename; done via sed across 5 files, grep- verified clean afterward), so every consumer across index.css and component TSX files needed zero changes. The 5 per-section "rainbow" accent tokens (Cognition/Contracts/Intelligence/Factory/Traces/ Shield/Finance) now all resolve to the same global --accent; also removed the 5 now-dead .page--<name> .panel h2::before override rules that had become no-ops once every accent collapsed to one value, and the decorative translateY hover-lift transforms on cards/buttons for a calmer, flatter feel.
  • Attempted to delegate this to the agy CLI (Google's Antigravity, installed separately in this environment) per the user's explicit ask — blocked by Claude Code's own auto-mode safety classifier for the same reason the earlier hermes CLI delegation attempt was (an unattended run with all approval gates disabled reads as "creating an unsafe agent" regardless of which external tool it is); the user's agy quota was also separately exhausted. Implemented directly.
  • Verified: 129/129 vitest, 16/16 Playwright e2e (real live stack — anvil + deployed contracts + compiled oracle + userapi + Postgres/ Redis), build + lint clean, visual confirmation via npm run dev across Landing/Agents/Agent Detail/Cognition.
  • Updated docs/wiki/entities/integrity-mvp.md (new "Gold/navy → Linear -inspired monochrome pivot" subsection, Design section summary, updated date) and docs/wiki/WIKI_INDEX.md (last-updated date). No new wiki pages created — index page count unchanged at 24.

[2026-07-11] update | AIS API wire-protocol spec (Phase 1) + verification-tier gate goes live

  • First concrete build-out of the wire-protocol standardization effort agreed earlier this session (decisions: standard = wire protocol only, not a canonical registry or redeployable Solidity interfaces; still primarily Xibalba's own product; read-side before write-side).
  • AIS API spec: added spec/README.md (top-level versioning policy — additive-only within a major version, semver on shape/semantics not computed values, RESERVED-field discipline for unbuilt semantics, single-vendor-appropriate deprecation window) and spec/ais-api/v1/ (openapi.yaml, README.md, ../CHANGELOG.md). The spec is generated, not hand-authored: added utoipa/utoipa-gen to integrity-oracle/backend, annotated every DTO/handler in handlers.rs, assembled them in new src/openapi.rs, and added src/bin/gen_openapi.rs (cargo run --bin gen_openapi) to regenerate the committed openapi.yaml from source — the direct fix for the failure mode docs/INTERFACE_CONTRACT.md §6.3 already documents (the agent_id/did field drift that shipped once because nothing forced spec and code to stay in sync).
  • Fixed a real gap surfaced while wiring this up: GET /v1/agent/{id} accepted did_document on registration but never persisted or returned it (no DB column existed). Added migrations/0003_agent_did_document.sql, threaded it through db.rs/handlers.rs. Not run against a live Postgres in this session (no DB credentials available in this environment) — the SQL is a trivial ALTER TABLE ADD COLUMN, all 51 existing lib tests still pass against the updated schema code, but run it for real before relying on it in production.
  • Verified via direct on-chain bytecode check (not just docs): the deployed UltraPlonkVerifier on Base Sepolia (234 bytes) is still the fail-closed placeholder, not the real generated verifier (would be many KB) — deployments.baseSepolia.json listing it as "deployed" is misleading about its actual functional state. Not redeployed this session (live contract action, needs explicit sign-off) — flagged to the user instead.
  • Verification-tier gate, real for the first time. Found and fixed a security-relevant gap while building this: verification_tier was previously fully client-asserted at registration (any client could claim verification_tier: 3, nothing checked it). register_agent now always computes it server-side (SERVER_VERIFIED_TIER, currently always 1 — the only tier with a real verification path). Added bcc_middleware/app/chain.py::resolve_verification_tier (fails closed to tier 0 on lookup failure, deliberately un-cached unlike resolve_agent_primitives since tier is agent-mutable state) and a new min_tier_by_intent_type rule in bcc.rego, gating the clinical intent-type set as defense-in-depth on top of the existing allowlist. Thresholds deliberately capped at 1 (achievable tier) rather than set to 2/3, which don't have a real verification path yet and would either be a permanent no-op or a policy that looks enforced but can't be satisfied.
  • Verified: forge test 148/148 (contracts, confirms README.md's stale "127" — now fixed), cargo test --lib --workspace 51/51, opa test policies/ 16/16 (4 new tier-gate tests), bcc_middleware pytest 52/52 (3 new resolve_verification_tier tests, using a new verification_tier param on the existing mock_oracle_agent_ resolution test helper).
  • Updated docs/wiki/entities/bcc_middleware.md (pipeline description, new "Reconciled this cycle" entry, test count, source_files), docs/wiki/concepts/identity-ceiling.md (title/frontmatter from [PLANNED] to [PARTIALLY BUILT], new lead section describing what's now real vs. still not), docs/wiki/concepts/ais.md (Related links, updated date), and docs/wiki/WIKI_INDEX.md (new page listed, test counts, page count). Created one new page: docs/wiki/concepts/ais-api-spec.md. Index page count: 24 → 25.

[2026-07-11] update | XNS (Xibalba Name Service) built for the first time in this rewrite

  • Next item in the user-directed queue after the AIS spec/tier-gate work above. Legacy INTEGRITY had a real, tested XibalbaNameService.sol + dashboard UI; it was never carried into INTEGRITY-LATEST's rewrite (confirmed earlier this session — no XNS contract anywhere in contracts/src/, only a [PLANNED] wiki stub at docs/wiki/concepts/xns.md referencing the root README's roadmap table).
  • Deliberately not a port. The legacy contract required an admin-only REGISTRAR_ROLE to register a handle ON BEHALF OF an agent — directly contradicts this rewrite's self-sovereign thesis ("nothing is registered on behalf of the agent by a privileged factory"). New contracts/src/framework/XibalbaNameService.sol is instead modeled on DomainRegistry.registerDomain's already-established self-service pattern in this codebase: any address that XibalbaAgentRegistry. isRegisteredAgent(msg.sender) confirms is a real registered agent can self-service claim an unclaimed handle, first-come-first-served, no privileged party in the critical path. XNS's own REGISTRAR_ROLE exists only for dispute intervention (revokeByRegistrar), same scope as DomainRegistry's — left ungranted at deploy time by design (a deploy/governance decision to make explicitly later, not silently at genesis).
  • 14 new tests (test/XibalbaNameService.t.sol), all passing — including a self-inflicted single-shot-vm.prank gotcha (evaluating registry.didHash(...) as a call argument after vm.prank consumed it as a staticcall before the intended pranked call ran), caught by an immediate test failure and fixed the same way XibalbaAgentRegistryTest's own setUp already documents avoiding.
  • Wired into script/Deploy.s.sol (deployed right after XibalbaAgentRegistry, logged, serialized into the deployments JSON) and verified with a real dry-run broadcast against a local anvil — not just unit tests, the actual genesis deploy sequence including the new contract. Not broadcast to Base Sepolia — a live-contract action needing explicit sign-off, flagged to the user rather than taken automatically.
  • Verified: forge test 162/162 (148 prior + 14 new), full genesis forge script script/Deploy.s.sol --broadcast against local anvil succeeds end-to-end.
  • Fixed a real, independently-discovered stale-doc issue while updating this: docs/wiki/concepts/xns.md was an orphan page — it existed on disk but was never listed in WIKI_INDEX.md at all (confirmed via direct grep), despite the schema requiring every page be indexed. Per that page's own "when a real contract lands, replace this page, don't update in place" instruction: deleted it and folded XNS into the existing entities/contracts.md (this repo's convention consolidates Solidity contracts under one package-level entity page rather than one-page-per-contract, despite WIKI_SCHEMA.md's example suggesting per-contract .sol.md pages — followed actual practice, not the schema's literal example, for consistency with every other contract in this package).
  • Also updated, since they independently claimed a stale contracts test count and described XNS as roadmap: root README.md (the "Built today | Long-term roadmap" identity table's XNS row, and the package table's test count 148 → 162) and docs/TESTING.md (148 → 162).
  • Updated docs/wiki/entities/contracts.md (XNS added to Singletons list and a new bullet under Contents, test count, State section noting built-but-not-yet-broadcast, source_files, updated date) and docs/wiki/WIKI_INDEX.md (contracts entity summary line). No net change to indexed page count (25) — one orphan page removed, zero new indexed pages added (XNS content lives in the existing contracts.md, not a new page).

[2026-07-11] update | integrity-cli xns command group — real bug caught by the real anvil test

  • Next item in the user-directed queue after XNS itself. Added integrity xns register/resolve/primary-handle/set-primary/release, synced XibalbaNameService's ABI into both integrity-cli's and integrity-sdk's abis/ directories via make sync-abis (scripts/sync_abis.py's CONTRACTS list, one new entry).
  • Real bug, caught only by the real end-to-end test, not the Solidity unit tests. First version called XibalbaNameService directly with the controller EOA as the transaction signer — reverted with NotRegisteredAgent() even for a genuinely, successfully registered agent. Root cause: XibalbaNameService.register() checks XibalbaAgentRegistry.isRegisteredAgent(msg.sender), and that registry only recognizes SovereignAgent contract addresses, never controller EOAs — every other agent-facing contract in this codebase (ComplianceGate, EHRGate, StateAnchor.grantRole via grant_anchor_role) is correctly called by routing through SovereignAgent.execute(target, value, calldata), which is what makes the SovereignAgent contract itself msg.sender from the callee's point of view. contracts/test/XibalbaNameService.t.sol's own unit tests never caught this because they legitimately vm.prank the SovereignAgent address directly to unit-test the contract's own logic in isolation — that's correct for testing the contract, but it means those tests structurally can't catch a caller-side integration mistake like this one. integrity-cli/tests/test_chain.py's real anvil + real Deploy.s.sol + real registered agent flow is what surfaced it. Fixed by routing all three chain.py XNS writes through sovereign_agent.functions.execute(xns_address, 0, calldata), mirroring grant_anchor_role's already-established pattern exactly; the three write commands in main.py now also resolve the caller's own SovereignAgent address via a GET /v1/agent/{did} oracle lookup first (not persisted locally by agent register).
  • Also fixed the negative test's own bug in the same pass: it originally used a bare funded EOA with no SovereignAgent at all, which would have failed for the wrong reason (can't call execute() on nothing) rather than proving the isRegisteredAgent check specifically. Fixed to deploy a real SovereignAgent for the stranger identity but skip registerPrimitives, isolating "has a real agent contract but isn't indexed" from "has no agent contract at all."
  • This session also hit an unrelated, transient infrastructure outage (the auto-mode safety classifier serving intermittent "temporarily unavailable" errors across many Bash/Edit calls) that stalled verification for a while — noted here only because it's why this entry's fix arrived well after the code that needed fixing, not because it's otherwise relevant to this codebase.
  • Verified: full integrity-cli suite 50/50 always-run (was 49; +1 new test_chain.py case — the second new assertion block was added to the existing test_cli_chain_full_registration, not a new test function) + 1 opt-in skipped, python -m integrity_cli.main xns --help smoke-tested directly.
  • Updated docs/wiki/entities/integrity-cli.md (new xns command-group section documenting the bug/fix, test count, source_files, updated date) and docs/wiki/WIKI_INDEX.md (integrity-cli entity summary line). No new wiki pages.

[2026-07-11] update | CCIPReputationBridge reworked for the per-agent clone model

  • Last item in the user-directed queue's original scope-reversal pair (the other, the LLM-judge rubric, remains out of scope — it's an open product question, not an engineering task, per the wiki's own existing "Open queries" entry).
  • CCIPReputationBridge.sol previously held one immutable ReputationRegistry address — a leftover from before per-agent EIP-1167 clones existed. Reworked to hold XibalbaAgentRegistry instead and resolve each agent's own ReputationRegistry clone via resolveAgent(agent).primitives.reputationRegistry on every call — the same idiom already established by EHRGate/IntegrityMarket/ A2ACapitalPool (confirmed via grep resolveAgent( src/, not assumed).
  • Real consequence of the fix, not present in the old design: bridging is now genuinely per-agent opt-in. Each ReputationRegistry clone's DEFAULT_ADMIN_ROLE belongs to that specific agent's own SovereignAgent contract (per AgentPrimitivesFactory's initialize call), so an agent's controller must explicitly grant this bridge BRIDGE_ROLE on its own clone before _ccipReceive can touch its score — there is no way for a deploy script to wire this up globally anymore, which is correct: a bridge with standing write access to every agent's score by default would itself be the kind of privileged-third-party control this protocol's self-sovereignty thesis rejects.
  • test/CCIPReputationBridge.t.sol updated to match: setUp now stands up a real XibalbaAgentRegistry and registers the test agent's primitive set for real (rather than just cloning a bare ReputationRegistry), and 3 new tests added: unregistered-agent reverts on both bridgeReputation and _ccipReceive (XibalbaAgentRegistry.UnknownAgent), and a registered second agent who never granted BRIDGE_ROLE on their own clone still correctly rejects an inbound score update.
  • Still not deployed by Deploy.s.sol — but that's now a genuine operational decision (a peer bridge needs a real second chain deployment to be meaningful) rather than a remaining code gap, per this page's updated entities/contracts.md "Honest gaps" entry.
  • Verified: forge test 165/165 (was 162; +3 new), including the full existing CCIPReputationBridgeTest suite (send/receive/trusted-sender/ role-gating) still green against the reworked resolution path.
  • Updated docs/wiki/entities/contracts.md (Honest gaps section rewritten for CCIP — no longer described as architecturally incompatible, just not yet broadcast; test count; source_files; updated date already current) and docs/wiki/WIKI_INDEX.md (contracts entity summary line). Also fixed the now-stale 162 → 165 test count in root README.md and docs/TESTING.md, caught in the same pass rather than left to drift like the 127/148 counts earlier this session. No new wiki pages.

[2026-07-11] update | integrity-sdk: OTel pre-execution intent capture + two real telemetry bugs found and fixed along the way

  • The originally-requested feature (two prior research passes: OTel span schema design, then behavioral-metrics design). New integrity-sdk/integrity_sdk/telemetry/intent.py: invoke_intent (+ client.invoke_intent(...) pre-bound convenience) is the OTel counterpart to the already-real bcc.build_bcc_commitment — builds/signs the actual BCC commitment (unchanged), opens a real integrity. invoke_intent span BEFORE the caller's execution code runs, and records a trace_run-shaped entry sharing tracing.py's existing _current_run_id nesting so a @client.traceable-wrapped execution inside the with block correlates as a child span automatically — verified directly by a new test (test_nested_execution_span_correlates_via_parent_run_id). intent_id reuses the commitment's own intended_state_hash rather than minting a second ID space. IntentDeviationResult/ compare_planned_to_actual implement tier-1 (deterministic, structural tool-name+args diff) plan-adherence scoring only, per the metrics research's own recommendation to ship the auditable deterministic tier first and treat tiers 2/3 (semantic similarity, sampled LLM-judge) as explicit, documented follow-on work, not silently dropped scope.
  • Along the way, found that telemetry/metrics.py's MetricsRegistry — fully built, documented as attaching to the outgoing telemetry envelope — was never actually instantiated by IntegrityClient, the same dangling-reference pattern client.py's own docstring already describes fixing for tracing.py/bcc.py/derive.py once before. Wired in (client.record_metric/define_metric, drained on every flush_telemetry) since record_outcome's plan-adherence score needed somewhere real to go.
  • That, in turn, surfaced a much bigger, previously-undiscovered bug: flush_telemetry was sending a request the real oracle could never accept, confirmed independently by two things at once — this session's own direct reading of integrity-oracle/backend/src/handlers.rs's TelemetryIngestRequest struct, and a parallel background audit agent (auditing integrity-oracle/bcc_middleware/integrity-userapi concurrently) reaching the identical conclusion independently. Two separate breaks: otel_spans was sent as a JSON object ({"telemetry": [...], "trace_runs": [...]}) against an oracle schema requiring a JSON array (Vec<serde_json::Value>), and signature was sent as None against a required, cryptographically-verified String field — the in-code comment claiming "the handler currently treats the signature as optional" was simply false. Net effect: every telemetry flush this SDK ever sent to a real oracle would have been rejected before the handler even ran — confirmed by the fact that integrity-oracle's own real-HTTP e2e test only exercises the PHI-reject path (which returns before signature verification), so this was never caught. Fixed: otel_spans is now one flat, "kind"-tagged array (telemetry / trace_run / custom_metrics elements, opaque JSONB on the oracle side regardless of shape); IntegrityClient now accepts optional keypair=/bcc_nonce_store= at construction and, when present, signs the canonical envelope for real; without a keypair it now sends an honest empty-string signature (correctly 401's) rather than a malformed request.
  • Fixing that then surfaced a second, related bug on the oracle side: crypto::canonical_json_bytes (Rust) doesn't escape non-ASCII by default, unlike the Python convention (ensure_ascii=True) every producer this oracle must verify against actually uses — both bcc.py's and bcc_middleware/app/canonical.py's own docstrings had already warned exactly this would happen. Was masked until the fix above (nothing successfully reached signature verification before). Fixed in integrity-oracle/backend/src/crypto/mod.rs with a custom AsciiEscapingFormatter (serde_json::ser::Formatter override, write_string_fragment only). This same fix was independently identified, unprompted, by the same parallel background audit agent above — two independent paths (this session's own direct implementation work, and a separate audit sweep) converged on the identical finding.
  • Also fixed, found by a third parallel background audit agent (auditing integrity-sdk/integrity-cli/integrity-mvp): the SDK's own documented, recommended general-purpose tracing API — telemetry/tracing.py's trace_run/traceable/client.traceable(...) — captured a wrapped function's raw arguments/return value with zero PHI/PII redaction, contradicting docs/wiki/concepts/observability-vtl.md's prior claim that redaction was "wired into both instrumentation paths" (that page was only ever scoped to the two named integrations, not this lower-level, actually- recommended API). Fixed with a new recursive _redact_value helper applied in TraceRun.set_outputs/_capture_inputs.
  • Verified: integrity-sdk full suite 97/97 always-run + 1 opt-in skipped (up from 67 — new test_intent.py (14 tests), new test_tracing.py (11 tests, this module had zero dedicated tests before), new cases in test_client.py), integrity-oracle backend+scoring-core 54/54 (up from 51 — 3 new crypto:: tests for the ASCII-escaping fix), full cargo build/forge-adjacent checks clean.
  • Updated docs/wiki/entities/integrity-sdk.md (new intent-capture section, two "dangling-reference gaps closed" sections, corrected PHI section, test count, source_files), docs/wiki/entities/integrity-oracle.md (new canonical-JSON-fix section, test count, source_files), docs/wiki/concepts/observability-vtl.md (corrected the "wired into both instrumentation paths" overstatement, source_files), and docs/wiki/WIKI_INDEX.md (both entity summary lines). No new wiki pages — all folded into existing ones.

[2026-07-12] fix | Catch-up entry: three parallel background-agent audit fixes, interrupted mid-run last session, now verified landed

  • Three background agents were dispatched in parallel last session (2026-07-11) to close audit findings across bcc_middleware, contracts, and integrity-sdk/integrity-cli, and the session was cut off mid-run by an API session-limit error before any of them could log to this file — despite that, all three sets of edits are confirmed present on disk and green this session (forge test; uv run pytest in integrity-cli, bcc_middleware, integrity-sdk). This entry closes that gap retroactively; nothing below was written in this session, only verified.
  • Merkle odd-node convention fix (bcc_middleware): app/merkle.py's merkle_root changed from promoting an unpaired odd node unchanged into the next level to duplicating it (_hash_pair(level[-1], level[-1])), matching the OpenZeppelin-standard convention integrity-oracle's merkle.rs and contracts' StateAnchor.sol already use bit-for-bit (see the module's *** ODD-NODE-COUNT CONVENTION *** docstring). tests/test_merkle.py's odd-leaf-count test had encoded the old (wrong) "promote unchanged" convention and was corrected; a dedicated regression guard (test_merkle_root_with_odd_leaf_count_does_not_promote_unhashed) and a 7-leaf case exercising two odd-node levels (test_merkle_root_with_larger_odd_leaf_count) were added. README.md updated to match. Pytest count moved 52 → 54 (the two new tests).
  • Contracts deploy-script + doc-staleness fixes: contracts/script/DeployMarkets.s.sol and contracts/script/FixComplianceGateFactory.s.sol both now read/write XibalbaNameService in their singleton JSON-merge logic. Previously XNS was deployed by Deploy.s.sol and written into deployments.*.json's .singletons, but these two later-running scripts' merge logic omitted it — re-running either against an already-deployed chain would have silently dropped the XNS address from the deployments file. contracts/README.md's test count corrected to 165 (forge test --summary, 165/165 across 15 test contracts, including the newer XibalbaNameServiceTest and HIPAAGuardrailRegistryTest).
  • SDK/CLI doc-staleness + langchain_callback fix: integrity-sdk/integrity_sdk/integrations/langchain_callback.py swapped a bare print() for logger.warning(...) (a library integration shouldn't write to stdout). Root README.md's PHI/telemetry section was corrected to state the redaction gate is "closed everywhere it needs to be" — it had still been describing a gap that was already fixed earlier in the same (2026-07-11) session. integrity-cli gained new CliRunner tests for the xns command group's CLI-level error-surfacing behavior (unreachable RPC, missing identity, missing wallet password — integrity-cli/tests/test_main.py, six new test_xns_* cases; distinct from the real-anvil xns chain-logic tests already in tests/test_chain.py from the earlier 2026-07-11 session), moving the CLI suite from 50 to 56 always-run + 1 opt-in oracle-e2e (57 total).
  • Verified this session (not re-run by the interrupted agents, run fresh now): contracts 165/165 (forge test), integrity-cli 56 passed + 1 skipped, bcc_middleware 54 passed, integrity-sdk 97 passed + 1 skipped — all four green.
  • Updated docs/wiki/WIKI_INDEX.md: integrity-cli entity summary's test count (50 → 56 always-run), bcc_middleware entity summary's pytest count (52 → 54), and the "Last updated" date. contracts and integrity-sdk summary lines were checked and already reflect current reality (165 tests; 97 + 1 opt-in) — left as-is. No new wiki pages — this is a fold-into-existing-entries catch-up, not new content.

[2026-07-12] create | Dev guide: build and deploy a smart contract (task #12)

  • Added docs/guides/smart-contract-development.md — a grounded, example-driven walkthrough for adding a new contract to contracts/, built directly off XibalbaNameService.sol/XibalbaNameService.t.sol as the template. Covers Foundry setup/layout, a full worked example (AgentEndorsementRegistry, a new self-service agent-endorsement registry, not wired into AIS/reputation scoring — written purely as a teaching example), its test using the confirmed makeAddr/vm.prank/vm.expectRevert(Contract.Error.selector) conventions, wiring a new contract into Deploy.s.sol (genesis) vs. DeployMarkets.s.sol (incremental, for an already-live network) plus the make sync-abis step that syncs ABIs into integrity-sdk/integrity-cli, a real local (make chain) and Base Sepolia deploy walkthrough with the actual required env vars from contracts/.env.example, and a closing section on the SovereignAgent.execute vs. direct-EOA call-routing convention (linked to docs/wiki/concepts/agent-primitives.md rather than re-derived).
  • Added ## Guides to WIKI_INDEX.md (a new top-level category, alongside Concepts/Entities) — this is the first page to live outside docs/wiki/ proper, at docs/guides/, since it's a task-oriented walkthrough rather than a reference page the schema's existing concept/entity split fits.

[2026-07-12] create | Multi-domain guardrails research + design (task #13)

  • Added docs/guides/multi-domain-guardrails-design.md: a survey of how production agent platforms implement pluggable, domain-scoped guardrails (NeMo Guardrails, Guardrails AI, LlamaGuard, OpenAI Moderation, Bedrock Guardrails, Presidio) mapped against four common properties (domain-scoped, toggleable, lifecycle-hooked, structured verdict), followed by a concrete design generalizing this repo's existing HIPAA-only bcc_middleware + bcc.rego + HIPAAGuardrailRegistry.sol pattern to arbitrary domains.
  • Load-bearing design decision: domain selection must be oracle-resolved (via GET /v1/agent/{id}'s server-verified domain_id), never client-asserted — the same reasoning bcc.rego already applies to verification_tier. bcc.rego itself stays as-is, documented as "the healthcare domain bundle" by convention (its OPA path is frozen by docs/INTERFACE_CONTRACT.md §7). A new GuardrailRegistry.sol is proposed (domainId-keyed, explicitly not a factory/clone, since none of AgentPrimitivesFactory/SmartBAAFactory's actual reasons for cloning apply to a data-only policy anchor); HIPAAGuardrailRegistry.sol is left untouched as the healthcare-specific instance of the pattern.
  • Stretch goal built for real: bcc_middleware/policies/general.rego + bcc_middleware/policies/general_test.rego — a genuinely new, working baseline domain bundle (prompt-injection pattern rejection, nonce-sentinel check) following bcc.rego's exact shape (default allow := false, allow if count(violation)==0). Verified: opa test policies/ -v → 28/28 passing (16 pre-existing bcc.rego tests + 12 new), opa fmt -l clean. The domain-aware bcc_middleware wiring (resolve_agent_domain in chain.py, opa_client.py's evaluate_domains()) and GuardrailRegistry.sol itself are design-only, not implemented this pass.
  • Added the Guides-section line for this doc to WIKI_INDEX.md (see the task #12 entry above for the new ## Guides section itself).

[2026-07-12] update | ZKP concept page corrected + deepened

  • docs/wiki/concepts/zkp.md overclaimed "real at every layer." Corrected, not just extended: the deployed Base Sepolia UltraPlonkVerifier (0xD6eE9031320382831c8C96627D02aEE573089226) is confirmed to be the fail-closed placeholder (contracts/src/oracle/UltraPlonkVerifier.sol, reverts unconditionally), not the real 2465-line generated verifier, which only exists at integrity-zkp/generated/UltraPlonkVerifier.sol and has never been copied over. contracts/script/Deploy.s.sol:108 confirms it deploys the placeholder.
  • make generate-verifier / contracts/script/GenerateVerifier.sh, referenced in CLAUDE.md and the placeholder's own NatSpec as the intended hand-off tooling, do not exist anywhere in the repo — flagged as a genuine open gap, not invented.
  • New findings folded in: integrity_sdk/prover.py really shells out to nargo/bb but proves against a stand-in circuit (integrity-sdk/circuits/poc_commitment/), not integrity-zkp's real circuit; nothing in this repo calls ReputationRegistry.submitZkAttestation; the oracle's zk_proof_verified AIS field is a self-reported telemetry flag (handlers.rs/db.rs), not a recomputed proof check — onchain_zk_boost_consistent is the only real chain read (chain.rs::is_zk_boosted) and can currently only detect disagreement.
  • Added a full Noir/pipeline explainer (what Noir is, exact compile/prove/verify commands with real transcripts, the Honk-vs-Plonk naming trap, the 11-vs-3 public-inputs trap) and a stage-by-stage real/gap summary table.
  • Updated docs/wiki/concepts/zkp.md only (frontmatter updated, expanded source_files). No new page created — folds into the existing page per the no-duplication rule. entities/integrity-zkp.md (circuit internals) left as-is; still accurate, just no longer the only place pipeline-wiring gaps are documented.

[2026-07-12] update | integrity-mvp rewritten UI: build fixed, real wiring, wiki corrected

  • integrity-mvp/src/ had been independently rewritten (all mtimes ~00:00-00:20 same day, well after this wiki's prior "2026-07-11" entity page) into a new 16-page shell, confirmed by the user as intentional ("the new mvp ui") rather than lost work. A full read-only audit found it cosmetically complete but non-building (ContractsPage.tsx missing return (; two components importing a nonexistent axios/../../ constants) and 100% mock — src/services/api.ts fully fake, no wagmi/viem, no env config, no tests. The prior entities/ integrity-mvp.md described a much more mature, entirely different build (real JWT auth, Demo/Live fixture toggle, demo/ scenario engine, 129 vitest + 16 Playwright specs) whose files no longer exist anywhere in the tree — rewritten from scratch rather than patched, per this wiki's "no aspirational content" rule.
  • User confirmed (via AskUserQuestion) the MVP should be wallet-interactive — real wallet-signed transactions, not read-only. Plan written to /home/xibalba/.claude/plans/ joyful-giggling-leaf.md and approved before implementation.
  • Phase 0 (build fix): missing return ( fixed; ContactModal.tsx's axios/API_BASE imports were dead code (removed, its real call already used fetch); RegistryExplorer.tsx rewired from fake axios+nonexistent /v1/identity/* routes to real fetch against the oracle's actual GET /v1/agent/{id} + GET /v1/agent/{id}/ais, field names corrected to the real AgentResponse/AisResponse shape (it had assumed nonexistent eth_address/current_ais/trust_level fields); ImmutableLedger.tsx's missing useIsMobile import fixed, dead ITK_TOKEN_ADDRESS/RPC_URL/API_BASE constants removed; new src/shared/{Panel,StatusBadge}.tsx created (imported by ActuarialHub.tsx/TraceAnalysisPanel.tsx but never existed) using this app's existing .panel/.badge-* CSS classes rather than new styles. A background agent then cleared a large batch of noUnusedLocals/noUnusedParameters/dead-import errors and one real type mismatch in LandingPage.tsx. Verified: npm run build/npm run lint both clean, and a real Playwright pass confirmed all 16 routes render with zero console errors.
  • Phase 1 (wallet/data infra): wagmi+viem+@tanstack/react-query added. scripts/sync_abis.py extended (new MVP_ABIS_DIR/ MVP_DEPLOYMENTS_DIR constants, XibalbaAgentRegistry added to the synced contract list) to also emit {abi}-only JSON into integrity-mvp/src/abis/ for the 6 contracts the frontend calls directly, and copy both deployments.*.json files into integrity-mvp/ src/deployments/ — same one-way sync convention integrity-sdk/ integrity-cli already use, now with a third consumer. New src/ chain/{wagmi,deployments,abis}.ts, src/config.ts (env var reads), ConnectWalletButton.tsx (wired into TopBar), src/services/ {oracle,userapi}.ts (typed fetch clients — field names verified against spec/ais-api/v1/openapi.yaml, confirmed snake_case throughout, not assumed), src/hooks/useSovereignAgentWrite.ts (the one shared SovereignAgent.execute(target, 0, calldata) pattern, mirroring integrity_sdk/markets.py's _execute_via_agent, so every future agent-write page reuses one implementation).
  • Phase 2 (real reads, verified against a genuinely live local stack — not just response-shape inspection): brought up a real local anvil + forge script Deploy.s.sol + a real cargo run oracle-backend + Postgres/Redis (a throwaway integrity-verify-pg Docker container was used instead of the pre-existing integrity-latest-postgres-1, whose password didn't match its own docker-compose.yml — root cause found: host port 5432 is already bound by an unrelated native Postgres process, so the compose container's port was never actually reaching the host; not fixed, just worked around non-destructively — flagged for whoever owns that host's Postgres setup). Registered one real agent via integrity-cli, confirmed the oracle's real JSON responses match the new oracle.ts TypeScript interfaces field-for-field, then confirmed via Playwright that the real registered DID renders in the actual browser-fetched page content for AgentsPage and IntelligencePage. Wired: AgentContext (was 3 hardcoded fake agents — did:intg:0x7a2... f89c etc. — now oracle.listAgents()), AgentsPage (real DID/tier/ AIS/created_at, dropped fabricated staked/enclave/uptime/txns columns with no real backing), IntelligencePage (new real Leaderboard panel), IdentityPage (real DID + real ITK balance/open-positions via oracle.getWallet()), ExchangePage (real Active Markets list via oracle.listMarkets()), FinancePage (real ITK balance in Token Wallet), DashboardPage (real AIS distribution + high-integrity % computed from real per-agent AIS scores).
  • Honest labeling for what stays simulated: new src/shared/ SeededDataBadge.tsx, applied to ChainOfThoughtPage, SdkTelemetryPage, CognitionPage, CompareTracesPage, DocumentsPage, ShieldPage, ContractsPage's Monaco sandbox, ExchangePage's order-book/candlestick UI (IntegrityMarket is pari-mutuel — there is no on-chain order book or price feed this could ever honestly show), FinancePage's treasury stats + ActuarialHub (no A2ACapitalPool/benchmark oracle read endpoints exist), DashboardPage's throughput/latency/node-fleet/security-event widgets (no such telemetry exists — see PRODUCTION_GAPS.md's WSS/OTLP/TSDB gaps), and several SettingsPage panels. This directly avoids repeating the exact wiki-staleness pattern already caught twice this session — real and simulated content are now visually distinguishable instead of silently mixed.
  • New: integrity-mvp/scripts/seed_mock_data.py (a genuine user mid-session request, not part of the original plan) — registers real test agents (and deploys one real market) via integrity_sdk exactly the way a real agent would, gated by MOCK=true as a safety rail against ever running it against a shared/production deployment. NOT a fake-Postgres-rows script — everything it creates is a real on-chain registration, consistent with this repo's "no silent mocks" rule. Must run outside the browser (documented in the script's own docstring and in the new SettingsPage "Developer" panel) since it needs FUNDER_PRIVATE_KEY, which must never reach client JS — VITE_MOCK_MODE in .env is a build-time, read-only status flag, not a live seeding toggle. Run for real this session: 3/3 test agents registered + 1 real market deployed against the local stack, then re-verified end-to-end via Playwright (4 real agent DIDs rendering, real market visible on ExchangePage, zero console errors across all 16 routes, SettingsPage correctly showing "Mock Mode: ON"). integrity-mvp/ .env/.env.example gained VITE_MOCK_MODE; .gitignore gained a .env rule (previously absent — real values had no ignore rule at all).
  • Rewrote entities/integrity-mvp.md from scratch (the prior version described the pre-rewrite build in full; none of its cited source_files exist anymore) and corrected WIKI_INDEX.md's summary line for it, marking it [PARTIALLY BUILT] with an honest list of what's real vs. not yet wired (wallet-interactive writes, userapi auth, test suite).
  • Deliberately not done this pass, flagged for next time: wallet- interactive writes (ExchangePage place-order, ClaimAgentModal, ShieldPage BAA actions) — blocked on there being no way to Playwright-verify a MetaMask-signed flow without first building a mock-EIP-1193-connector test harness, a real decision left to the user rather than guessed at; userapi auth wiring into SettingsPage; a test suite (package.json still has no test script).

[2026-07-12] update | Notion-Style Block Dashboard & Claim Agent workflows

  • Notion-Style Block Dashboard: Refactored DashboardPage.tsx using react-grid-layout to support dynamic, customizable widget placement. Created WidgetRegistry.tsx (defining 7 widgets: AIS Distribution, Oracle Throughput, BCC Latency, Node Fleet, Security Events, Integrity Radar, and Dashboard Notes) and WidgetWrapper.tsx (providing drag handles ⋮⋮ and deletion/action menus). Custom layouts and widget configurations are persisted in LocalStorage.
  • Port Legacy Claim Agent & XNS: Ported ClaimAgentModal.tsx and XNSSearchService.tsx from the legacy repository. Integrated them into IdentityPage.tsx to support resolution of Handles/DIDs and initiate MetaMask personal_sign challenge claim sequences.
  • Updated WIKI_INDEX.md and entities/integrity-mvp.md to document the new architecture.

[2026-07-12] fix | WidgetRegistry.tsx rules-of-hooks linter fix and build verification

  • Audit of the linter errors on integrity-mvp showed a react-hooks(rules-of-hooks) failure in WidgetRegistry.tsx due to React's useState hook being called inside an anonymous function component mapping.
  • Fix: Extracted the notes component to a named React functional component NotesWidget in WidgetRegistry.tsx and updated the registry mapping.
  • Verification: Re-ran the build (npm run build) and linter (npm run lint), confirming that the build completes successfully and the linter exits with code 0 (no errors). Updated the integrity-mvp entity page and this log.## [2026-07-12] update | Endpoints and UI Integration for Telemetry and Judge Evaluations
  • Axum Telemetry & Traces Endpoints: Implemented database queries (get_recent_telemetry and get_recent_evaluations) in integrity-oracle/backend/src/db.rs and wired them to new Axum handler endpoints (/v1/agent/{id}/telemetry and /v1/agent/{id}/traces) in handlers.rs and routes.rs. Documented both paths and DTO types in the OpenAPI specification via openapi.rs.
  • E2E Integration Validation: Added a comprehensive database-insert and HTTP-read verification test case to the integration test suite in integrity-oracle/backend/tests/e2e.rs. Set up case-insensitive Ethereum address checks and dropped newly introduced tables (markets_cache, markets_index_sync, judge_evaluations) in test setup. All E2E integration tests are green (TEST_DATABASE_URL=postgres://integrity:integrity_dev_only@127.0.0.1:55432/integrity ORACLE_E2E=1 cargo test --test e2e passes successfully).
  • Frontend Real Telemetry Wiring: Updated integrity-mvp/src/services/oracle.ts client to include getTelemetry and getTraces. Wired integrity-mvp/src/pages/SdkTelemetryPage.tsx using the AgentContext and oracle.getTelemetry to fetch and render real telemetry history in the live ingestion feed. Verified frontend build succeeds with zero errors.

[2026-07-12] update | Backend-infra audit: gap check, telemetry pipeline verified end-to-end, one architectural gap flagged

  • User asked for a fresh audit of integrity-mvp (by then significantly changed by concurrent work — see the four log entries directly above this one) to find any backend infrastructure the frontend needs but doesn't have, and to implement anything missing.
  • Full API-surface diff: every oracle.*/userapi.* method actually called anywhere in integrity-mvp/src/ was enumerated and compared 1:1 against integrity-oracle/backend/src/routes.rs and integrity-userapi/app/main.py's real registered routes. Result: full coverage, no missing backend routes — the only two that had been missing (GET /v1/agent/{id}/telemetry, GET /v1/agent/{id}/traces) were the ones the concurrent work above had just added. oracle.ts's getTelemetry/getTraces were typed any[]; tightened to real TelemetryEventDetailDto/AgentJudgeEvaluationDto interfaces matching handlers.rs exactly.
  • Full pipeline verified for real, not just route-existence: cargo build+cargo test --workspace --lib (54/54) confirmed the new endpoints compile and pass; restarted the local oracle-backend process (it was serving a binary older than these changes); registered a fresh test agent via integrity_sdk.registration.register_agent, flushed one real signed telemetry event via IntegrityClient.record_metric+flush_telemetry, and confirmed it round-trips correctly through GET /v1/agent/{id}/telemetry — real signed ingest → real Postgres row → real HTTP read → real browser render, verified via Playwright (all 16 routes, zero console errors, SdkTelemetryPage showing the real ingested event).
  • One real architectural gap found and deliberately NOT silently patched: ClaimAgentModal.tsx (ported from the legacy repo per the log entry above) implements a "claim an already-deployed agent via signature challenge" flow — but contracts/src/core/SovereignAgent.sol's only ownership-change function, rotateController(address), is onlyController-gated: the CURRENT controller can hand off to a new one, but there is no mechanism anywhere in the contract for a non-controller to claim an agent via any kind of challenge/signature scheme. The modal's handleClaimOwnership also submits a hardcoded transaction using selector 0x095ea7b3, which is ERC-20 approve(address,uint256), not any real SovereignAgent method — calling it would either revert or do something unrelated to claiming, and the surrounding try/catch swallows that failure (console.warn + continue) rather than surfacing it. api.generateClaimChallenge/api.claimOwnership (services/api.ts) are still the original mock stubs from before this session's work, not backed by anything. This is not a "missing backend endpoint" gap — it's a feature whose premise doesn't match the real on-chain access-control model, and building it for real would mean designing and shipping a new contract-level claim mechanism, a protocol decision out of scope to make silently. Flagged here rather than either faking a fix or quietly implementing new contract functionality.

[2026-07-12] update | Phases 3-6: real wallet writes, ClaimAgentModal rebuilt on the real access-control model, test infra, docs

  • User asked to continue the approved plan's remaining phases (3: wallet writes; 4-6: userapi auth, tests, docs) — including, mid-flight, an explicit instruction to build a real fix rather than leave the ClaimAgentModal gap flagged above as unbuildable.
  • Phase 3 — real writes, verified against a live local anvil+oracle stack, not just compiled:
    • ExchangePage: real "Place Order" flow. IntegrityToken.approve then IntegrityMarket.enterPosition, both routed through useSovereignAgentWrite's SovereignAgent.execute() wrapping, gated on the connected wallet matching the selected agent's on-chain controller (read live from XibalbaAgentRegistry.resolveAgent). bccCommitmentHash is sent as a zero hash — this frontend doesn't do BCC intent-commitment signing yet, and the contract never validates the hash on-chain (confirmed by reading IntegrityMarket.sol), so zero is honest, not faked. Verified with a real signed transaction (via integrity_sdk.markets.enter_position, replicating the identical two-call pattern the new frontend code implements) that moved a real market's outcome_staked[0] from 0 to 10000000000000000000 — confirmed both on-chain and via the oracle's real GET /v1/markets/{address} response, then confirmed the frontend renders that real updated state (Playwright, zero console errors).
    • ShieldPage: Smart BAA registry now reads real SmartBAAFactory.BAACreated event logs directly via viem's getLogs (no oracle endpoint needed for this — a legitimate direct-chain read) filtered by the selected agent's businessAssociate address, with real per-BAA status/requiredCollateral reads. Real sign()/revoke() writes wired (business-associate side only, routed through execute(); the covered-entity/arbitrator side isn't a persona this dashboard represents, and is left read-only). The fabricated "114 Active BAAs" hero stat now counts real fetched BAAs; the "100% Enclave Integrity" stat was changed to an honest (no TEE attestation exists, see IdentityPage). The other three Shield tabs (PHI Access Gates, Audit & Compliance, Quarantine Zone) remain genuinely un-backed and are now individually SeededDataBadge-labeled rather than covered by one page-level badge that would have become misleading once Smart BAAs went real.
    • ClaimAgentModal rewritten, not patched. Re-examined after the user pushed back on leaving it flagged: the modal's actual goal — proving a connected wallet controls a given agent — has a real, buildable equivalent even though "claiming an agent you don't control" does not. New flow ("Verify Agent Control"): resolve the real on-chain controller from XibalbaAgentRegistry.resolveAgent(sovereignAgentAddress), compare to the connected wallet, and if they match, have the user personal_sign a real message as a "prove you hold this key right now" confirmation (verified client-side via viem's verifyMessage) — no transaction submitted, none needed. All fake api.generateClaimChallenge/api.claimOwnership calls and the wrong-selector transaction removed; those two now-dead mock functions deleted from services/api.ts (confirmed no remaining callers first). Verified via Playwright: entering a real registered agent's SovereignAgent address resolves its real on-chain controller.
  • Phase 4 — userapi auth, verified for real: the concurrent work's SettingsPage login/register/API-key wiring was verified end-to-end against a real running integrity-userapi (its own isolated Postgres database, per the architecture's trust-domain separation) — real registration, then a real POST /api-keys call confirmed not by a UI string match but by the created key actually appearing in a subsequent real GET /api-keys re-fetch (a revoke button rendering for it), zero console errors throughout.
  • Phase 5 — real test infrastructure, not stubs: vitest + @testing-library/react added (vitest@^4.1.10, not the initially-chosen ^2.x, which had an incompatible bundled-vite type conflict against this repo's vite@8 — a real dependency-compatibility issue, not a config mistake, resolved by upgrading rather than working around). 9 unit tests: services/oracle.test.ts (asserts exact request URLs/query-param behavior against a mocked fetch, including the 404→OracleError.status path), hooks/useSovereignAgentWrite.test.ts (asserts the execute()-wrapping calldata shape, since this is the one pattern every write page depends on), contexts/AgentContext.test.tsx (asserts real-oracle-backed population replaces the old 3-agent hardcoded fixture). @playwright/test added as a proper dependency (previously only bare playwright was present, unused beyond an ad-hoc root audit.cjs screenshot script) with a real playwright.config.ts and e2e/smoke.spec.ts (18 tests: all 16 routes zero-console-error, a real-network-response assertion on AgentsPage that also asserts the old hardcoded fixture DID is genuinely gone, wallet-connect-button presence) — run against the real live local stack per this repo's testing philosophy, not a mocked network. All 9 vitest + 18 Playwright tests pass.
  • Phase 6 — docs: integrity-mvp/README.md rewritten from the untouched default Vite/React/TS/Oxlint scaffold into real project documentation (setup, every env var and what it does, the wallet-interactive on-chain-write model, an explicit real-vs-seeded page inventory, test commands and what each layer actually covers). entities/integrity-mvp.md and WIKI_INDEX.md's summary line updated to match — the entity page's "What is NOT done yet" section, which previously listed wallet-interactive writes/userapi auth/tests as not built, is corrected; the only genuinely remaining gaps are integrity-mvp/demo/ (pre-existing, separately tracked), the explicitly-seeded order-book/telemetry-widget panels, the disabled BAA-creation stub (no covered-entity persona modeled), and unaddressed JS bundle size.

[2026-07-14] update | Real-time SSE updates and dynamic wallet histories added to integrity-mvp

  • User requested deeper integration between the UI and the backend APIs to support agent wallets and real-time dashboard tracking.
  • Backend / Schema extensions: WalletResponse API was expanded to include full array DTOs for transaction_history (types: Send, Receive, Swap, Contract Deploy, etc.) and allowances (agent spending limits, amounts spent, and statuses). Updated handlers.rs and the cross-package contract spec/ais-api/v1/openapi.yaml.
  • Real-time SSE (/v1/stream): Configured a useOracleStream React hook utilizing EventSource to pipe live Telemetry, OTelSpan, and AisUpdate frames into the MVP.
    • DashboardPage dynamically subscribes to stream updates to update AIS score distributions and totals per agent in real-time, falling back on an initial REST fetch.
    • ChainOfThoughtPage already uses the stream hook to render agent execution flow paths and telemetry graphs in real time.
  • Dynamic Wallet / Finance UI: FinancePage was upgraded from seeded transactions and allowances to properly hydrating its historical data tables directly from oracle.getWallet responses, reverting to seeded mocks only if not provided by the backend response. Integrated recharts to render a time-series portfolio AreaChart on the Finance view.
  • Tests / Stability: Cleaned up 19 TS6133 unused declaration issues throughout components (Sidebar, HeroSection, FinancePage, LandingPage, WidgetRegistry) ensuring a clean tsc --noEmit build, and properly restored double-backslash unescaped LaTeX strings to components using KaTeX parsing for metrics (e.g. TriMetricWidget.tsx, LandingPage.tsx).

[2026-07-14] update | MVP Build Fixes, Architecture Gap Analysis, and Documentation

  • Fixed strict TypeScript compilation errors across DashboardPage.tsx, FinancePage.tsx, and LandingPage.tsx that were blocking the production build (npm run build). Corrected state initialization variables, missing imports, and updated the TRANSACTIONS mock to correctly match TransactionDto interface (where usd is explicitly nullable instead of an empty string).
  • Ran an end-to-end QA pass and recognized that integrity-mvp explicitly relies on the real backend (integrity-oracle + Postgres + Anvil) and is architected specifically to throw network/console errors when these services are offline, preventing "silent mock" regressions in the Playwright E2E suite.
  • Replaced the scaffolded README.md with comprehensive documentation of the project architecture, dependencies, build/test commands, and explicitly documented Architectural Gaps (as requested by the user):
    • OTel Aggregation: The Oracle needs an OTel metrics sink to provide the MVP with real-time throughput/latency figures.
    • Security Events: The Oracle needs an event-sourcing layer to capture blocked bcc_middleware transactions.
    • Transaction USD Valuation: Needs external price feed integration to populate retroactive USD portfolio values.

[2026-07-14] create+update | bcc_middleware CLAUDE.md written; interface-contract §4.2 schema drift closed; wiki caught up to the reputation-sync loop

  • Wrote bcc_middleware/CLAUDE.md (via /init), the package's first dedicated Claude Code guidance file — commands, the fail-closed/best-effort request pipeline, the reputation-sync loop, config resolution, and the integration contracts a future session needs before touching schema/chain code.
  • Real gap found and fixed while writing it, in docs/INTERFACE_CONTRACT.md §4.2: the canonical BCC Commitment JSON example still showed the original 6-field shape. agent_public_key (required) and covered_entity_address (optional) have been real, signed, load-bearing fields in bcc_middleware/app/schemas.py/app/canonical.py since an earlier reconciliation cycle (already correctly reflected in concepts/bcc.md and entities/bcc_middleware.md's "Reconciled previous cycle" section) — but the actual cross-package contract doc, the one other packages are supposed to build against, never caught up. Added both fields to the example plus prose explaining their binding rules, and pinned ensure_ascii=True canonicalization explicitly (previously implied only by the phrase "canonical JSON").
  • Two smaller staleness bugs found and fixed in the same pass: bcc_middleware/.env.example's BAA_CONTRACT_NAME=SmartBAA (the real app/config.py default and the README both require SmartBAAFactory — the per-pair SmartBAA escrow instances don't implement isBAAActive; a fresh local setup following the example file would silently misconfigure into BAA_CANNOT_VERIFY), and app/canonical.py's module docstring, which still described the pubkey/fingerprint binding as an open "INTEGRATION FLAG" guess directly contradicting the real verification code three lines below it — updated to state its actual ✅ RECONCILED status.
  • Wiki gap found on follow-up ("should we add this to wiki"): the reputation-sync/slashing loop (app/reputation.py + app/scoring_loop.py, new untracked files this cycle, already reconciled into docs/INTERFACE_CONTRACT.md §7a and briefly noted in concepts/ais.md by earlier work) was never added to the actual owning page, entities/bcc_middleware.md, or to WIKI_INDEX.md's summary line for it — the entity page's pipeline description, "Reconciled this cycle" list, and source_files all predated it. Added a full "Reconciled this cycle (2026-07-14)" section there (loop mechanics, signer-key reuse rationale, why automated dispute-raising is safe) plus the §4.2/.env.example/canonical.py fixes above.
  • Test counts corrected everywhere they'd drifted: actual current count (pytest --collect-only -q, opa test policies/) is 75 pytest + 28 OPA tests, not the "49 + 12" figure README.md, bcc_middleware/CLAUDE.md (this session's own new file), and entities/bcc_middleware.md's "State" section all still carried — the two new reputation-sync test files (test_reputation.py, test_scoring_loop.py) plus additional OPA policy tests had pushed the real numbers up without any of the three being updated. Fixed in all three; WIKI_INDEX.md's bcc_middleware line and "Last updated" date bumped to match.

[2026-07-15] update+lint | Wiki-wide validation pass: mermaid diagrams added to the flow-heavy pages, several more stale facts found and fixed

  • User asked ("can you validate all wiki pages look good with plenty of mermaid charts where appropriate") for a quality pass across the whole wiki, not just the bcc_middleware-scoped work above. Read all 25 pages (17 concepts + 8 entities) plus index.md and WIKI_SCHEMA.md directly rather than delegating to subagents — this wiki's "no aspirational content" rule means a cold agent told to "add plenty of charts" would be likely to invent flows/relationships not actually in the code, which is the exact failure mode this wiki exists to prevent.
  • Baseline: only 2 of 25+1 pages had a mermaid diagram going in (index.md's system-at-a-glance flowchart, concepts/ais.md's scoring data-flow diagram). A suspected dead link (WIKI_INDEX.md's guides/ references) turned out to be a false alarm — checked from the wrong working directory; docs/guides/ does exist with both files.
  • 9 new mermaid diagrams added, each to a page with a real flow, state machine, or multi-actor relationship to visualize (not decorative) — short reference/formula/wire-schema pages and low-confidence [PLANNED] stubs were deliberately left undiagrammed:
    • concepts/agent-primitives.mdsequenceDiagram of the 5-step self-sovereign registration sequence.
    • concepts/bcc.mdsequenceDiagram of the intercept/sign/bind/verify flow (deliberately deferring circuit-breaker/OPA/BAA internals to entities/bcc_middleware.md's own diagram, per the schema's no-duplication rule).
    • concepts/zkp.mdflowchart splitting the pipeline into "real, working today" vs. "documented gaps [PLANNED]" subgraphs, matching the page's existing prose summary table 1:1 — the highest-value addition, since this page's whole point is which stages are real vs. disconnected and a table alone under-communicates the shape of the gap.
    • concepts/smart-baa.mdstateDiagram-v2 for the real Proposed/Active/Disputed/Terminated state machine.
    • concepts/compliance-gate.mdflowchart of the three independent callers (bcc_middleware, ComplianceGate, EHRGate) all consulting the same SmartBAAFactory.isBAAActive read.
    • concepts/testing-strategy.mdflowchart of the 3-layer pyramid (per-package → Playwright e2e → hosted CI [NOT BUILT]).
    • concepts/integrity-market.mdflowchart of the market lifecycle (deploy → AIS-gated enterPositionresolveclaimPayout).
    • concepts/observability-vtl.mdflowchart of the PHI redaction pipeline (SDK Redactor → signed envelope → oracle phi.rs backstop).
    • entities/bcc_middleware.mdsequenceDiagram of the reputation-sync/ dispute loop added earlier in this same session's work above; a genuinely new flow, not a duplicate of the bcc.md diagram.
  • More stale facts found and fixed while reading every page for real (this wiki's own Phase 4 "staleness audit" lint step, run for the first time in a while against pages outside the bcc_middleware-focused work above):
    • concepts/testing-strategy.md had drifted furthest: contracts "148" (real: 165), oracle "43 lib" (real: 54), sdk "66" (real: 97), cli "49" (real: 57), bcc_middleware "49+12 OPA" (real: 75+28) — every count on the page was behind what the other entity pages and WIKI_INDEX.md already correctly said elsewhere; this page alone just never got the memo across several prior update passes.
    • entities/integrity-cli.md was internally self-contradictory: stated "51 tests (50 always-run + 1 opt-in)" in one paragraph and "49 passed, 1 skipped" in another, neither matching the real, freshly-verified count (pytest --collect-only -q: 57). Fixed both mentions and WIKI_INDEX.md's matching line (previously said "56").
    • entities/integrity-zkp.md's "Related" line still read "ZKP concept (not yet written — see queries)" — concepts/zkp.md has existed since 2026-07-07 and is one of the most substantial pages in the wiki; this dangling note just never got cleaned up when that page landed. Fixed to a normal link.
    • entities/integrity-mvp.md's "What actually exists now" numbered list had a real duplicate: item 1 and item 8 both described the identical Notion-style widget-dashboard feature (WidgetRegistry.tsx, WidgetWrapper.tsx, LocalStorage persistence) in near-identical words — apparently written by two separate append passes that didn't check the existing list — with the numbering also skipping straight from 6 to 8. Deleted the duplicate item 8, renumbered 9-11 → 8-10, and fixed a dangling "(built by concurrent work referenced in item 7)" note (item 7 never existed in this list) — caught my own first attempt at this fix mid-edit, which had wrongly attributed the referenced work to "item 1" (the widget dashboard, unrelated to the SettingsPage auth work the sentence actually describes); corrected to note the work was concurrent and not separately itemized, rather than inventing a specific wrong citation.
  • Not changed: concepts/{merkle-batching,did,local-metrology, ais-api-spec,identity-ceiling}.md (formula/wire-schema/table-driven pages where a diagram would be redundant, not clarifying) and concepts/{cross-chain-spec,a2a-negotiation-spec,zk-ml-spec}.md (short [PLANNED]/confidence: low stubs — diagramming an unbuilt design in detail risks reading as more concrete than it is). entities/{contracts, integrity-oracle,integrity-sdk,integrity-userapi}.md were read and found accurate but not diagrammed — their natural diagrams would either duplicate index.md's system-at-a-glance flowchart or a concept page's diagram already added above, which the schema's no-duplication rule argues against.
  • All mermaid blocks hand-verified by eye against concepts/ais.md's existing (working) diagram's style — no local mermaid renderer exists in this environment, so no automated render-check was possible; flag for a human/agent with mermaid preview access to spot-check if any block looks off.

[2026-07-15] update | UI improvements for legacy layouts and fleet management in MVP

  • IdentityPage: Redesigned to replicate the core legacy aesthetic from integrity-dashboard. Swapped massive glassmorphism panels for a compact, tab-based layout with a dedicated Hero Bar, an Agent Metric Strip (DID, AIS, Tier, TEE), and sub-navigation tabs mapping MVP data into Identity & DID, Enclave & Security, Economic Capacity, and Credentials. Replaced the stubbed "Launch Explorer" action with a functional, embedded XNSSearchService integration.
  • AgentsPage: Extracted the onboarding and control verification paths (ClaimAgentModal, AgentOnboarding) out of disconnected modals. They are now presented as prominent inline cards (ClaimAgentCard, RegisterAgentCard) above the global agents grid, heavily improving UX discoverability.
  • Updated WIKI_INDEX.md and docs/wiki/entities/integrity-mvp.md to reflect these major architectural layout adjustments, maintaining consistency between implementation and our "Wiki-as-Memory Loop".

[2026-07-15] update | Jules autonomous CI loop completed — auto-merge workflow + root AGENTS.md

  • Context: ci.yml already contained a notify-jules-on-failure job (added in a prior session) that calls the Jules API (POST jules.googleapis.com/v1alpha/sessions, AUTO_CREATE_PR mode) when any CI job fails on main. That job was wired but incomplete — two missing pieces kept the loop from being fully autonomous.
  • .github/workflows/auto-merge-jules.yml (new): fires on any PR opened or updated by jules-google[bot]. Approves the PR via the Actions bot (Jules cannot self-approve) and enables squash auto-merge via GitHub's GraphQL enablePullRequestAutoMerge mutation. GitHub enforces the branch protection rule's required status checks before the merge actually executes — this workflow enables the merge, the CI gate prevents it from landing until tests are green. Inline comments document the one-time repo setup required (Settings → General "Allow auto-merge", branch protection required checks for all 8 CI jobs).
  • AGENTS.md (new, repo root): Jules and other GitHub-integrated agents read AGENTS.md from the repository root by convention. Prior to this, the full protocol file was at .agents/AGENTS.md — a subdirectory Jules may not scan. The new root file is a structured quick-start (package table, test commands, 5 non-negotiable rules, Jules-specific task description, key files list) that cross-references the full .agents/AGENTS.md rather than duplicating it. No content in .agents/AGENTS.md was changed.
  • No code changes — infrastructure/CI only. No package test suites were affected; no wiki entity pages required updating beyond this log entry.

[2026-07-15] update | Live stack wiring — oracle can now run against Base Sepolia

  • Root cause of the gap: docker-compose.yml's oracle-backend service had RPC_URL passthrough (${RPC_URL:-http://host.docker.internal:8545}) but was missing CHAIN_ID and DEPLOYMENTS_FILE — so pointing RPC_URL at Base Sepolia alone would still have left the oracle reading deployments.local.json (default: ../deployments.local.json) with chain ID 31337. The oracle's ChainClient::connect reads singleton/clone addresses from the deployments file; without the right file it would call the wrong contract addresses on the wrong chain.
  • Fix (docker-compose.yml, 2 lines added):
    • CHAIN_ID: ${CHAIN_ID:-31337} — passthrough with local-anvil default
    • DEPLOYMENTS_FILE: ${DEPLOYMENTS_FILE:-../deployments.local.json} — passthrough with local default Setting either in a root .env (or exported in the shell) now switches the containerised oracle's target network without any code changes.
  • .env.example (new, repo root): documents the three vars that need to change to switch networks (RPC_URL, CHAIN_ID, DEPLOYMENTS_FILE), pre-populated with Base Sepolia values (https://sepolia.base.org, 84532, ../deployments.baseSepolia.json), plus all signing-key vars the demo/CLI need. .env is already gitignored (line 2 of .gitignore); .env.example is already unignored (line 8). No new gitignore entries required.
  • Nothing else changed — no Rust code, no migrations, no contract changes. The oracle binary, its migrations, its on-chain read logic, and all 54 tests are untouched.

[2026-07-15] update | Live agent registration & Dockerfiles setup

  • Accomplishments:
    • Dockerfiles (created): Added integrity-oracle/Dockerfile (multi-stage Rust nightly build) and integrity-mvp/Dockerfile (Node 22) to enable docker-compose building.
    • Docker Compose Port Mappings: Moved host Postgres port from 5432 to 5436 to avoid conflict with local postgres instances. Exposed shared_preload_libraries=timescaledb in docker-compose.yml to support the hypertable migrations.
    • Load-Balancer Lag Mitigation: Added manual nonce tracking and 5-second propagation delays to integrity-cli to handle RPC latency/lag on public Base Sepolia gateways.
    • Agent Registration: Bootstrapped and registered xibalba-agent-02 on-chain (Base Sepolia) and cached it successfully in the live oracle (did:integrity:7c7ecd09e7a89075749baaf73292f211003f49992fa7712f6d42496e967bea8b).
  • No changes to core contracts or logic — all modifications are infrastructure, Docker config, or client resiliency-oriented. All test suites remain green.

[2026-07-15] update | IDE ContractsPage expansion

  • Expanded the IDE workstation in integrity-mvp/src/pages/ContractsPage.tsx with full features: multi-tab editor, interactive build/deploy panel, and a dynamic Deployed Contracts inspector that generates interactive ABI buttons via source code regex analysis.
  • Updated integrity-mvp.md entity wiki page to reflect these changes.

[2026-07-15] update | Retroactive wiki catch-up: AIS trust hardening, integrity-userapi §6, TriMetric fix — none previously logged

A gap in this session's own read→work→write→lint discipline: several material changes landed earlier the same session (confirmed via git log predating this log entry) without the required Phase-3 wiki write. Caught up here rather than left silently undocumented — per .agents/AGENTS.md §3, "a previously-mocked component becomes a real implementation... is the single most important thing to keep truthful here," and none of the below had been captured.

  • AIS server-side signal re-derivation (integrity-oracle/backend/src/derive.rs, new module) — closes a real spoofing vector: the oracle used to trust a client's self-reported derived_signals blob inside the signed telemetry envelope; it now independently recomputes entropy/grounding/sacrifice from the same request's raw otel_spans content, and only its own recomputation feeds AIS. Two real polarity/calibration bugs fixed at the same call site: performance_variance was receiving the wrong polarity (backwards for every agent), and gpu_hours_verified was being double-log-compressed. concepts/ais.md already documented this (updated 2026-07-13) — this pass's gap was that entities/integrity-oracle.md and the wiki index did not.
  • integrity-userapi §6, all four tracked PRODUCTION_GAPS.md findings closed: developer API keys now actually authenticate requests (X-API-Key header, get_current_user_id) — but minting/revoking a key stays JWT-only, a deliberate scope decision to stop a leaked long-lived key from perpetuating itself past its own revocation; JWTs are now revocable (jti claim, revoked_tokens table, POST /auth/logout); login is now rate-limited (LoginRateLimiter, mirrors bcc_middleware's circuit breaker); demo_runs gained a real PATCH /demo/runs/{id} completion path plus an opt-in integrity-mvp/demo/src/integrity_demo/userapi_bridge.py that reports real status back from the scenario engine. 51 userapi tests + 6 new demo-bridge tests, all real (Postgres/local HTTP server, no mocked internals). No entities/integrity-userapi.md update made yet — flagged as a follow-up, not done in this pass (scope was the telemetry docs request that prompted this catch-up).
  • TriMetricWidget.tsx (dashboard) — was badged "LIVE MODEL" while every number was fake (hardcoded thresholds, literal strings, fabricated sparklines); the single most severe fake-data surface left in integrity-mvp. Two of three metrics now real (network-wide AIS deficit and BCC violation rate, fanned out from oracle.getAis()); the third stays honestly marked unavailable (no risk model exists). Two real runtime bugs only surfaced by actually loading the dashboard against the live stack: a KaTeX-remount render-storm freeze (formula sub-components were redefined every render) and a grid-height clipping bug — both fixed, re-verified via live screenshots. Not yet reflected in entities/integrity-mvp.md — follow-up.
  • This entry's actual proximate cause: creation of Telemetry Ingestion Pipeline, the first page to document the full SDK-collection→batching→signing→oracle- pipeline→AIS flow end to end (previously split, undocumented in the connective parts, across local-metrology.md/ais.md/ observability-vtl.md). Along the way: fixed observability-vtl.md's now-stale claim that redaction ran unconditionally in openai_integrity.py/langchain_callback.py (it's now redact_phi-gated, defaulting to False — a real, deliberate behavior change, not a bug) in both its prose and its mermaid diagram; updated entities/integrity-sdk.md (test count 97→135, new redact_phi section, new source_files) and entities/integrity-oracle.md (test count 54→80 lib + 9 e2e, new derive.rs/otlp.rs sections, full API list); added cross-links from local-metrology.md/ais.md. WIKI_INDEX.md page counter 25→26.

Clone this wiki locally