1. Why None of the Three Pieces Was Complete on Its Own

When you build infrastructure for autonomous coding agents under sprint pressure, you usually attack one failure mode at a time. Across the HydraDB Hackathon and EVOLVE (the 8090 AI Hackathon in Redwood City), three distinct failure modes surfaced in separate projects:

In Paper #29, I combined the first two pieces into @krusch/toolkit/brick-exchange (Brick #40) and sent a thank-you note to Common Ground's creators crediting their MIT repository. When they wrote back with explicit encouragement to keep iterating on the design, the missing structural link between all three projects became obvious.

Without HydraScope and HydraDB sitting in the middle, even an Ed25519-sealed Brick Exchange still relies on flat text matching to connect builders and agents. Flat text matching breaks in four predictable ways across real multi-stack organizations:

  1. Runtime Purity Blindness: A brick that passes all four Node 22 sandbox gates while importing node:fs or node:crypto looks valid in keyword search, yet immediately breaks a cloudflare-edge Worker isolate or a react-vite browser bundle. Conversely, a Python FastAPI squad searching for a webhook verifier needs to know whether an equivalent native brick already exists in Python (krusch_toolkit.security) or whether it needs a typed hexagonal contract adapter (binding_adapter.py).
  2. Opaque Identifier Collisions: Two bricks that both expose a field named channel_id appear compatible to naive schema or embedding search even when one emits a Slack channel identifier (slack:channel_id) and the downstream brick expects a Discord snowflake (discord:channel_id).
  3. Multi-Hop Composition Blindness: When a team needs to turn a raw signed Stripe webhook into a balanced minor-unit ledger entry, no single brick may span the entire gap, even though brickA produces ledger_event and brickB consumes ledger_event across a 2-hop chain.
  4. Version Supersession Poisoning: As security bricks evolve from @v1 to @v2, lexical and vector similarity continue surfacing retired @v1 bundles alongside current ones unless explicit :SUPERSEDES edges prune superseded versions before ranking.
How the Three Pieces Lock Together: Common Ground defines who may discover a brick and keeps raw sample data strictly local. HydraScope + HydraDB defines what is structurally, temporally, and ontologically compatible across stacks, ports, channels, and models. DEADBOLT defines how verified bricks and parallel coding agents safely mutate a live repository without breaking 2-hop callers.
Cohesive 3-Pillar Architecture: Common Ground + HydraScope (HydraDB v0.4.0) + DEADBOLT Left pillar shows Common Ground MIT trust and privacy gates: pre-traversal visibility filtering, revocable cross-org grants, and zero-upload local sample boundary. Center pillar shows HydraScope on self-hosted HydraDB v0.4.0: 48-bit surrogate OpenCypher ontology across 4 axes (Stacks, Namespaced Ports, Signed Channels, and MoE Profiles), SUPERSEDES temporal filtering, 2-hop port composition, and hexagonal binding.js/ts/py synthesis. Right pillar shows DEADBOLT and @krusch/toolkit repo execution governance: 4-gate fault sandbox, Ed25519 seals, .brick-lock.json drift checks, GOVERNS AST links, and conflict-free 2-hop multi-agent waves. PILLAR 01 · COMMON GROUND (MIT) Trust & Zero-Upload Boundary 1. Pre-Traversal Visibility Filter 2. Time-Bounded Scoped Grants 3. Pure Contract + Check Bundle 4. Private Rows Stay on Machine evaluateVisibilityForBundle() 0xANUSHKA/common-ground-8090 0 Cross-Org Schema Leaks PILLAR 02 · HYDRASCOPE + HYDRADB 4-Axis Property-Graph Ontology • 5 Stacks + Web-Standard Gate • Namespaced Ports (Slack != Discord) • 9 Signed Webhook/MCP Channels • OpenCypher :SUPERSEDES + asOf • 2-Hop Port Chains & :GOVERNS binding.js · binding.ts · adapter.py HydraDB v0.4.0 · 48-Bit Surrogate IDs $0 Tier-0 -> L1 -> 30B MoE Repair PILLAR 03 · DEADBOLT + TOOLKIT Sandbox & 2-Hop Repo Safety 1. 4-Gate + Mandatory Fault Jail 2. Ed25519 Lineage Signatures 3. Vendored .brick-lock.json Drift 4. Disjoint 2-Hop Multi-Agent Waves verifyTwoHopBlastRadius() kruschdev/deadbolt & toolkit SOX +1c & Policy Floor Guard COHESIVE PIPELINE: Scoped Grant -> HydraDB 4-Axis Ontology & 2-Hop Port Plan -> Local Adapter -> DEADBOLT 2-Hop Promotion INV-LEGO-36 · 179/179 @krusch/toolkit · 22/22 HydraScope · 78/78 krusch-stack · Zero Private Data Uploaded
Figure 1: Common Ground's permission-first sharing, HydraScope's HydraDB v0.4.0 property-graph ontology, and DEADBOLT's 2-hop AST governance form a single continuous verification pipeline.

2. What HydraDB's Property-Graph Ontology Brings to the Exchange

The word ontology gets overused in AI tooling, often as a dressed-up label for a static JSON taxonomy. What HydraDB v0.4.0 (ghcr.io/hydra-db/hydradb:0.4.0) and SelfGraph bring to HydraScope is concrete and operational: an executable OpenCypher property graph with deterministic vertex addressing, typed multi-hop edge traversal, pre-flight answerability gates, and first-class temporal supersession.

In brick-ontology-bridge.js and @krusch/toolkit/brick-exchange/ontology, five graph capabilities turn isolated bricks into a navigable engineering ontology:

  1. Deterministic 48-Bit Surrogate OpenCypher Vertices & 10 Typed Relations: Every ontology entity (brick:<id>@<hash>, stack:*, port:*, channel:*, moe:*, and org:*) hashes via surrogateOntologyVertexId(namespace, logicalId) into a collision-resistant IEEE-754 safe integer in [1000, 281474976711655] matching HydraDB's native OpenCypher vertex contract. Edges are strictly allowlisted across ten structural types: :TARGETS_STACK, :CONSUMES_PORT, :PRODUCES_PORT, :BRIDGES_CHANNEL, :ROUTES_TO_MODEL, :USES_STACK, :LISTENS_CHANNEL, :REQUIRES_PORT, :SUPERSEDES, and :GOVERNS. Before any vertex touches HydraDB, INV-HS-02 scrubs private network literals, file paths, and email addresses.
  2. The Permission-Before-Traversal Invariant: Graph databases become dangerous across organizational boundaries if you traverse the full global graph first and redact unauthorized nodes at the end, because 2-hop path existence can still leak a partner company's private capabilities. Fusing Common Ground's privacy rule directly into store.planCrossStackComposition({ viewerId, ... }) enforces a strict ordering: evaluateVisibilityForBundle filters the candidate set for viewerId before compileBrickOntologyGraph materializes a single vertex or edge. Unshared bricks never enter the caller's ontology subgraph.
  3. Temporal :SUPERSEDES Lineage & Historical asOf Replay: When brick:webhook-hmac@v2 declares supersedes: ["brick:webhook-hmac@v1"], the graph compiler automatically marks @v1 with isCurrent: false, retiredAt, and supersededBy. Live OpenCypher and embedded traversals prune retired bricks by default so coding agents stop adopting deprecated helpers, while passing asOf: "2026-11-01" deterministically reconstructs the exact brick topology that was active on an earlier audit date.
  4. 2-Hop Typed Port Composition Without False Bridges: When a developer or agent requests a workflow spanning webhook_envelope -> audit_record on typescript-node, HydraScope traverses both 1-hop direct bricks and 2-hop pipelines (brickA -[:PRODUCES_PORT]-> port:ledger_event -[:CONSUMES_PORT]-> brickB). Crucially, shared canonical ports allow composition while vendor-namespaced opaque identifiers (slack:channel_id vs. discord:channel_id) refuse to bridge.
  5. Unified :GOVERNS Merging Into Repository AST Graphs: Because HydraScope already compiles polyglot repositories (10 languages via WebAssembly Tree-sitter) into file, symbol, and ADR vertices, mergeOntologyIntoRepoGraph(repoGraph, ontologyGraph) wires :GOVERNS edges directly from adopted ontology bricks into the exact repository symbols and files importing bricks/<id>. An agent querying HydraScope sees, in one unified graph, the upstream Common Ground contract, the HydraDB port and channel invariants, and DEADBOLT's 2-hop caller blast radius inside the repo.

3. Inside the 4-Axis Ontology: Stacks, Ports, Channels & MoE Specialists

To keep ontology metadata practical rather than bureaucratic, normalizeBrickOntologyMetadata infers sensible defaults from existing blueprints while checking four orthogonal axes in under 1 ms:

Ontology Axis Canonical Entities in INV-LEGO-36 Deterministic Safety or Compatibility Check Failure Code / Bridge Action
Axis 1: Runtime Stacks
(ONTOLOGY_STACKS)
node-esm, typescript-node, python-fastapi, react-vite, cloudflare-edge + 40 JS/TS/Py catalog equivalents Comment/literal-aware lexer (isWebStandardPureSource) rejects node:* / host bare modules on Edge & Browser stacks; resolves Python krusch_toolkit.* twins STACK_RUNTIME_INCOMPATIBLE or bridgeMode: "contract-adapter" (binding_adapter.py)
Axis 2: Data Ports
(ONTOLOGY_DATA_PORTS)
timeseries_window, ledger_event, webhook_envelope, audit_record, identity_claims, document_page + <ns>:<id> Maps field-alias synonym rings (ts_ms/recorded_at -> ts; amount_cents -> gross) and isolates vendor ID namespaces PORT_NAMESPACE_COLLISION (blocks slack:channel_id -> discord:channel_id)
Axis 3: Channels
(ONTOLOGY_CHANNELS)
webhook:github, webhook:slack, webhook:stripe, workspace:gmail|drive|calendar, mcp:stdio, http:sse, telemetry:timeseries Verifies constant-time HMAC + replay-window bricks (@krusch/toolkit/webhooks) on signed webhooks & PII scrubbing on Workspace channels CHANNEL_SECURITY_GUARD_MISSING when required verifier brick is absent
Axis 4: MoE Specialists
(ONTOLOGY_MOE_PROFILES)
timeseries-cadence-moe, financial-integer-ledger, cross-stack-schema-adapter, channel-security-normalizer Enforces numerical invariants (integer minor units, monotonic timestamps, NaN/Infinity rejection) & routes unmapped adapter repair via cascade.js TIMESERIES_INVARIANT_VIOLATION; escalates $0 Tier-0 -> L1 gemma4:e4b -> L2 30B MoE

Zero-Upload Hexagonal Adapter Synthesis Across JavaScript, TypeScript, and Python

One of Common Ground's sharpest insights at EVOLVE was separating an immutable verified logic file from a recipient-editable local binding so each company maps its own internal column names on its own laptop. Extending that pattern across the 4-axis ontology yielded synthesizeBrickBinding:

4. Walkthrough: One Cohesive Pipeline From Cross-Org Grant to 2-Hop Repo Merge

Putting all three pillars side by side shows how a real cross-team task flows through the unified stack without hand-offs or copy-pasted glue code:

Step 1 · Common Ground Gate

Team A seals a TypeScript telemetry or Stripe settlement brick (passing all 4 sandbox + fault-injection gates with an Ed25519 signature) and issues a time-bounded Grant to Team B. Unshared orgs see zero vertices.

Step 2 · HydraScope + HydraDB

Team B runs ontology compose for cloudflare-edge or python-fastapi. HydraScope prunes retired :SUPERSEDES bricks, blocks slack != discord port collisions, and synthesizes a local binding adapter at 0 B upload.

Step 3 · DEADBOLT Promotion

Team B vendors the brick with .brick-lock.json, merges :GOVERNS edges into HydraScope's repo AST graph, and runs planAgentFanOut + verifyTwoHopBlastRadius so parallel subagents wire consumers without 2-hop regressions.

# 1. Inspect the 4-axis ontology & JS/TS/Python/React/Edge catalog equivalents
node bin/krusch-lego.js ontology inspect
node bin/krusch-lego.js ontology inspect webhooks --json

# 2. Check runtime purity, channel HMAC guards & port compatibility in <1ms
node bin/krusch-lego.js ontology check ./sealed-brick.json \
  --stack cloudflare-edge \
  --channel webhook:stripe

# 3. Run permission-pre-filtered 1-hop & 2-hop composition with temporal asOf replay
node bin/krusch-lego.js ontology compose \
  --db ./exchange.db \
  --viewer partner-eng \
  --stack typescript-node \
  --channel webhook:stripe \
  --ports ledger_event,audit_record

# 4. Synthesize a zero-upload TypeScript or Python 3.11+ hexagonal adapter locally
node bin/krusch-lego.js ontology bind ./sealed-brick.json \
  --stack python-fastapi \
  --sample ./local-private-rows.json \
  --out ./bricks/telemetry-completeness/binding_adapter.py

When self-hosted HydraDB v0.4.0 is online, HydraScope's syncAndQueryBrickOntology syncs these exact vertices and 10 edge types into OpenCypher via idempotent MERGE batches (sustaining 416.4 ops/sec concurrent throughput in HydraScope's load benchmark) while keeping an automatic sub-millisecond embedded BFS fallback (INV-HS-03) whenever an engineer works offline on a laptop.

5. Scope Boundaries, Tradeoffs & Where Simpler Tooling Wins

Uniting a cross-organization grant model, a 4-axis OpenCypher ontology, and a 2-hop AST blast-radius verifier solves real failure modes, yet clear engineering honesty requires naming what this architecture does not claim to do:

6. Run the Full 3-Pillar Ontology Stack Locally

All three repositories ship under the MIT License, crediting Anushka Jogalekar and Connor Hood's MIT-licensed 0xANUSHKA/common-ground-8090 for inspiring the permission-scoped contract-sharing layer and hydra-db/hydradb + hydra-db/selfgraph for the OpenCypher graph and temporal ontology foundations:

# 1. Verify @krusch/toolkit (179/179 tests incl. 4-axis ontology & Brick Exchange)
git clone https://github.com/kruschdev/toolkit.git && cd toolkit
PUPPETEER_SKIP_DOWNLOAD=true npm install && npm test

# 2. Verify HydraScope's OpenCypher ontology bridge & :GOVERNS AST merge (22/22 tests)
git clone https://github.com/kruschdev/HydraScope.git && cd HydraScope
npm install && npm test

# 3. Verify standalone zero-dep parity in krusch-stack (78/78 tests)
git clone https://github.com/kruschdev/krusch-stack.git && cd krusch-stack
npm install && npm test