Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/synapse/blob/main/docs/adr/0001-synapse-architecture-and-boundaries.md # synapse A component of the AienOS ecosystem. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `synapse / docs / adr / 0001-synapse-architecture-and-boundaries.md` 63 lines ยท 6881 bytes Raw Blame History Rendered 1 # ADR 0001: Synapse Architecture, Owning Boundary, and Compatibility Invariants 2 3 * **Status**: Accepted; superseded in part by [ADR 0002](0002-synapse-first-git-as-bridge.md) (Synapse-first for AI agents, Git as a bridge; section 2.2 items 1 and 2 and the #515 non-goal "Replacing Git") 4 * **Date**: 2026-10-14 5 * **Tracking Issue**: [aien-spark/aien-sovereign-core#515](https://github.com/aien-spark/aien-sovereign-core/issues/515) 6 7 ## 1. Context 8 9 AIEN executes concurrent multi-agent builder, reviewer, verifier, and benchmark lanes on the NVIDIA DGX Spark (Grace Blackwell GB10). Empirical inspection of `~/workspace` on the DGX Spark (`spark`) shows 291 worktrees in `hive-worktrees` consuming 27.05 GB (25.19 GiB), 276 additional agent clone directories in the workspace root, and 460 registered Git worktrees across `aien-sovereign-core` (150) and `omega` (310). Each `git worktree add` on `aien-sovereign-core` writes 138.98 MiB to disk and takes 588.511 ms at p50, capping checkout throughput at 1.713 worktrees/sec. 10 11 High-frequency agent loops need to create changesets, attach machine test receipts, inspect trees and diffs without cloning or checking out a full working tree, detect path-level conflicts across concurrent lanes, and project accepted changes into Git and Radicle without compromising cryptographic canonicality. 12 13 ## 2. Decision 14 15 ### 2.1 Owning Repository and Daemon Boundary 16 17 Synapse is implemented in a dedicated sovereign repository (`aien-spark/synapse`) rather than inside `aien-sovereign-core`. 18 19 Rationale: 20 1. `aien-sovereign-core` already hosts 51 crates centered on the inference runtime, scheduler, KV store, and legacy adapters. 21 2. Existing primitives in `aien-sovereign-core`, `aien-protocols`, and `omega` solve distinct problems (`WorldStore` is an in-memory runtime draft map; `rad-id-sync` only discovers local SSH/Radicle public keys; `aien-provenance` verifies P-256 dataset/model license grants; `omega_vcstore` stores Verified Crumbs keyed by semantic ID). 22 3. Separating Synapse into non-overlapping workspace crates (`synapse-core`, `synapse-store`, `synapse-auth`, `synapse-api`, `synapse-git`, `synapse-radicle`, `synapse-bench`) allows independent development, verification, and PR review per subsystem. 23 24 ### 2.2 Non-Negotiable Compatibility Boundaries 25 26 1. **Git Remains the Portable Repository History Format**: 27 Every accepted Synapse changeset can be deterministically materialized into standard Git `blob`, `tree`, and `commit` objects (`objects//<38-hex>`) that pass `git fsck --full` and work with standard `git clone`, `git fetch`, `git log`, and `git diff`. 28 2. **GitHub Remains the Human-Facing Forge Projection**: 29 Synapse projects accepted changesets into GitHub branches (`refs/synapse/changesets/`, `refs/synapse/queue/`) and bounded pull request metadata (`GitHubPullRequestProjection`). Bulky machine evidence (full logs, benchmark traces, WAL receipts) remains in Synapse and is referenced by digest. 30 3. **Radicle Remains the Cryptographic Trust and Canonicality Boundary**: 31 Fast ingest ordering (`WalSeq`) and GitHub PR merge state are never treated as authority to advance a canonical branch. Canonical promotion produces a `RadicleCanonicalHead` receipt only after verifying the repository's `refs/rad/id` identity document (`xyz.radicle.project`), verifying Ed25519 signatures over `refs/namespaces//refs/rad/sigrefs`, confirming that at least `threshold` authorized delegates signed the target `GitOid`, and confirming that the changeset's `base_git_oid` matches the current canonical head. 32 33 ### 2.3 Distinct Identity Invariant 34 35 Synapse enforces separate Rust newtypes for every domain identity so that no identifier can be substituted for another: 36 37 | Type | Width / Format | Domain Tag / Authority | Meaning | 38 | :--- | :--- | :--- | :--- | 39 | `ChangesetId` | 32-byte SHA-256 | `"SYNAPSE_CHANGESET_V1\0"` | Immutable agent changeset envelope digest in Synapse | 40 | `BlobDigest` | 32-byte SHA-256 | `"SYNAPSE_BLOB_V1\0"` | Immutable file content digest in the Synapse blob store | 41 | `GitOid` | 20-byte SHA-1 | Standard Git `" \0"` | Materialized or base Git blob, tree, or commit object ID | 42 | `RadicleCanonicalHead` | Struct receipt | Verified `refs/rad/id` + `sigrefs` | Cryptographic proof of delegate quorum on canonical branch | 43 | `GitHubPullRequestProjection` | Struct record | Human forge projection | Mapping from `ChangesetId` and `GitOid` to a GitHub PR | 44 | `IdempotencyKey` | 32-byte token | Client deduplication scope | Idempotent submission key preventing duplicate ingest | 45 | `WalSeq` | `u64` monotonic | Single-writer WAL order | Local ingest and replay sequence number (non-authoritative) | 46 47 None of these types may be aliased to `WorldId` (`aien-runtime`), `SemanticId` (`omega_vcstore`), or `SourceGrant` (`aien-provenance`). 48 49 ### 2.4 Crate Ownership Map 50 51 * `crates/synapse-core`: Distinct identity types, `ChangesetEnvelope` v1 canonical encoding, path validation, `RefusalCode` taxonomy, and domain invariants. 52 * `crates/synapse-store`: Single-writer append-only WAL (`SWAL` v1) with CRC32C and SHA-256 hash chaining, configurable `FsyncPolicy`, content-addressed blob store, atomic sequence visibility, checkpoint compaction, garbage collection, and crash/torn-write fault injection. 53 * `crates/synapse-auth`: Ed25519 agent identity (`did:key:z6Mk...`), capability-scoped grants (`Read`, `Propose`, `Evaluate`, `Review`, `Publish`), expiration and replay guards, rate/size quotas, and hash-chained security audit log. 54 * `crates/synapse-api`: Bounded paginated API (`submit`, `get`, `diff`, `tree`, `history`, `provenance`, `conflicts`, `status`, `watch`), checkout-free virtual tree overlay, exact path-index invalidation, and durable cursor recovery. 55 * `crates/synapse-git`: Deterministic Git loose object writer/reader (`blob`, `tree`, `commit`), bidirectional `ChangesetId <-> GitOid` index, ref namespace management (`refs/synapse/*` vs human `refs/heads/*`), and GitHub PR projection builder. 56 * `crates/synapse-radicle`: Radicle `refs/rad/id` and `refs/namespaces//refs/rad/sigrefs` Ed25519 verifier, multi-delegate threshold checker, stale-base refusal, and split-brain state machine. 57 * `crates/synapse-bench`: Comparative multi-agent benchmark harness and correctness conformance suite against conventional Git worktree workflows. 58 59 ## 3. Consequences 60 61 * Concurrent coding and verification agents can submit changesets, inspect virtual trees and diffs, and detect path conflicts in microseconds without creating 139 MiB Git worktrees on disk. 62 * Standard Git clients and human reviewers continue to interact with ordinary Git commits and GitHub pull requests without silent force-pushes to human branches. 63 * Promotion to canonical history fails closed whenever Radicle delegate threshold signatures are missing, mismatched, or based on a stale head.