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/CONTEXT.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 / CONTEXT.md` 208 lines ยท 18979 bytes Raw Blame History Rendered 1 # Synapse 2 3 Synapse is AIEN's high-throughput agent changeset and integration service. It enables concurrent coding, review, verification, and benchmark agents to submit, inspect, validate, and queue source changes without materializing a full Git working-tree checkout for every operation, with Radicle as the cryptographic canonicality boundary. Synapse is source control for AI agents only (ADR 0002). Git is a small machine bridge at the edge: full-history import and export and interop with existing tooling and hosting, through deterministic Git object materialization. Git is not the primary history format. 4 5 ## Language 6 7 ### Identities 8 9 **ChangesetId**: 10 The 32-byte domain-separated SHA-256 digest (`"SYNAPSE_CHANGESET_V1\0"`) of a canonical `ChangesetEnvelope`. It identifies one immutable agent proposal and its provenance metadata inside Synapse. 11 _Avoid_: Git commit SHA, GitOid, WorldId, SemanticId, PR number 12 13 **BlobDigest**: 14 The 32-byte domain-separated SHA-256 digest (`"SYNAPSE_BLOB_V1\0"`) of an immutable file content blob stored in the Synapse content-addressed store. 15 _Avoid_: Git blob OID, ChangesetId, Verified Crumb digest 16 17 **GitOid**: 18 The 20-byte standard Git SHA-1 object identifier (`blob`, `tree`, or `commit` header plus payload). It identifies an object materialized into or imported from a Git repository through the Git bridge. 19 _Avoid_: ChangesetId, BlobDigest, RadicleCanonicalHead 20 21 **RadicleCanonicalHead**: 22 A cryptographically verified promotion receipt proving that a target `GitOid` on a repository's default branch is signed by at least `threshold` authorized delegates in `refs/namespaces//refs/rad/sigrefs` under a verified `refs/rad/id` identity document. 23 _Avoid_: WalSeq, GitHubPullRequestProjection, unverified Git ref 24 25 **GitHubPullRequestProjection**: 26 A human-facing projection record linking a `ChangesetId` and its materialized `GitOid` to a GitHub pull request number and bounded review metadata. Merging a GitHub pull request never by itself establishes a `RadicleCanonicalHead`. Legacy edge adapter: kept until agent cutover (Phase 8), then removed (ADR 0002). 27 _Avoid_: canonical head, Radicle quorum, source of truth 28 29 **IdempotencyKey**: 30 A 32-byte client-supplied deduplication token bound to a changeset submission. Repeating a submission with the same `IdempotencyKey` and identical `ChangesetId` returns the existing committed `WalSeq`; repeating it with a different `ChangesetId` fails closed with `IdempotencyKeyConflict`. 31 _Avoid_: ChangesetId, WalSeq, random request ID 32 33 ### Storage and Ordering 34 35 **WalSeq**: 36 A strictly monotonic 64-bit sequence number assigned by the single-writer append-only write-ahead log (WAL). It defines ingest and replay order within one Synapse repository store and serves as the read-your-writes visibility token. It never confers authority to promote a canonical branch. 37 _Avoid_: canonical commit order, Git commit timestamp, Radicle revision 38 39 **ChangesetEnvelope**: 40 The signed, immutable proposal record submitted by an agent. It binds the repository identifier, base `GitOid`, parent `ChangesetId` dependencies, sorted path mutations, intent summary, structured machine evidence receipts, `IdempotencyKey`, agent `DidKey`, and Ed25519 signature. 41 _Avoid_: working tree diff, mutable draft, WorldDraft 42 43 **VirtualTree**: 44 An in-memory or indexed directory tree view constructed by applying one or more committed `ChangesetEnvelope` path mutation sets atop a base Git tree without checking out files onto the filesystem. Since C1 it is served from the shared, bounded Merkle tree store: each view is a `TreeDigest` root whose unchanged subtrees are shared with every other view. 45 _Avoid_: Git worktree checkout, working directory 46 47 **GarbageRoot**: 48 A retention anchor that prevents a changeset and its referenced blobs from being collected during checkpoint compaction. Garbage roots are verified `RadicleCanonicalHead` lineages, open `GitHubPullRequestProjection` heads, active evaluation leases, and changesets inside the retention window. 49 _Avoid_: unpinned speculative changeset, permanent history 50 51 ### Authorization 52 53 **AgentCapabilityGrant**: 54 An Ed25519-signed authorization token issued by a repository authority that grants a specific agent `DidKey` a bounded set of capabilities (`Read`, `Propose`, `Evaluate`, `Review`, `Publish`) on a single repository until an explicit expiration timestamp, subject to rate and payload size quotas. 55 _Avoid_: SourceGrant, ambient filesystem permission, unauthenticated agent ID 56 57 ### Directory Crumb Context 58 59 **Directory Crumb**: 60 A `.crumb` file committed in a repository directory that gives agents architectural context (name, purpose, invariants) before they touch that directory, together with the coordination plane (claims, scents, whispers) kept outside history. Synapse reads only the committed file (ADR 0004). 61 _Avoid_: Verified Crumb, Crumbline crumb, crumb (unqualified) 62 63 **Directory Crumb dialect**: 64 One of the typed `.crumb` formats Synapse recognizes: D1 RFC-0001 JSON (`schema_version` `"1.0.0"`), D2 pre-RFC Atlas/`spark-crumbs` JSON (`version`, no `schema_version`), D3 YAML-like `schema: "crumb/v1"`. Each parses into its own variant and is never converted into another; anything else is refused with a typed reason. 65 _Avoid_: legacy crumb (ambiguous), crumb version, coerced crumb 66 67 **CrumbContext**: 68 The chain of `.crumb` entries from the repository root down to a path's directory in one `VirtualTree` snapshot, root first. Each entry records the directory, its status (present, missing, or invalid with a reason), its dialect, and the `BlobDigest` of its bytes. Its nearest present entry and inherited invariants match `crumb.c explain`. 69 _Avoid_: crumb (unqualified), working-tree crumb lookup 70 71 **CrumbContextDigest**: 72 The 32-byte domain-separated SHA-256 digest (`"SYNAPSE_CRUMB_CONTEXT_V1\0"`) of a `CrumbContext`, covering every entry including missing and invalid ones. It names exactly which context was seen. 73 _Avoid_: BlobDigest, ChangesetId, GitOid, Verified Crumb digest 74 75 **Verified Crumb**: 76 A content-addressed, receipt-bound Omega library object (ARCH-0029, stored by `omega_vcstore`). It is program-verification evidence and unrelated to Directory Crumbs. Synapse does not interpret it. 77 _Avoid_: Directory Crumb, `.crumb`, crumb (unqualified) 78 79 **Crumbline**: 80 The AIEN learning curriculum (`aien-sovereign-core` `crates/crumbs`): problems shown to the learner as observations only, with a sealed side and held-out tiers the learner never sees. Synapse never exposes, indexes, or merges its records. 81 _Avoid_: Directory Crumb, Verified Crumb, training crumb in Synapse 82 83 ### AI-Native Model (ADR 0003, proposed) 84 85 **ChangeId**: 86 A 16-byte random identifier that names one unit of intended work across all its rewrites, rebases, and retries. It is bound to its creating chain: only keys whose chain descends from it, or whose grant names it in change scope, may add revisions, and pruning needs the creating chain or one that dominates it. Each rewrite is a new `ChangesetId` with the same `ChangeId`. 87 _Avoid_: ChangesetId, branch name, task title 88 89 **TreeDigest**: 90 The domain-separated digest of a whole repository state, encoded as a native Merkle tree of directories. Evidence receipts bind to it. Git tree OIDs are computed from it only at the Git bridge. 91 _Avoid_: Git tree OID, ChangesetId, working directory 92 93 **ChunkDigest**: 94 The digest of one content-defined chunk of a large blob. A storage and transfer unit only; a blob's identity stays its `BlobDigest` over the whole content. 95 _Avoid_: BlobDigest, Git delta 96 97 **AdmissionWitness**: 98 The immutable record of a revision's first admission: `repo_id`, the submitting agent's DID and signature (or, for a server-derived revision, the server's machine-key signature and its `DerivationAttestation` digest), the `IdempotencyKey`, the admission `WalSeq`, and the server's admission time. Idempotency is keyed on repository, DID, and key; replay order is the `WalSeq`; retention follows per-owner rules and the server's clock, never a client clock. 99 _Avoid_: ChangesetId (content only), AuthorshipAttestation, created_at_ms 100 101 **AuthorshipAttestation**: 102 A signed statement that an agent produced a given revision at a given time. Under envelope v2 the `ChangesetId` covers content only, so identical content submitted by two agents under the same `ChangeId` is one revision with two attestations. 103 _Avoid_: commit author, signature inside the content digest 104 105 **IntentRecord**: 106 The machine-structured purpose of a revision: a closed `kind`, a typed task reference, a list of claims, a footprint, superseded revisions, and an optional digest of a machine-readable rationale. It replaces the prose `intent_summary`. 107 _Avoid_: commit message, PR description 108 109 **Claim**: 110 A machine-checkable assertion in an `IntentRecord` (for example "action A passes on the resulting tree" or "behaviour unchanged") that must be discharged by a passing `EvidenceReceipt` before promotion. 111 _Avoid_: description, checklist item 112 113 **Footprint**: 114 The declared set of paths (later, symbols) a change intends to touch. Every actual mutation must lie inside it. Used for predictive conflict queries and subscriptions, and charged against the declarer's footprint quota by breadth. 115 _Avoid_: diff, touched files after the fact 116 117 **ObsolescenceMarker**: 118 A signed record that one revision was replaced by zero (pruned), one (rewritten), or several (split) successors. Pruning needs the change's creating chain or one that dominates it. Dependent `Private` and `Draft` revisions without receipts are rebased onto successors lazily: a read returns a computed view and admits nothing; the rebased revision is admitted only on proposal or at the request of the creating chain. 119 _Avoid_: reflog entry, deleted changeset 120 121 **RevisionState**: 122 Where a revision stands: `Private` (visible only to its owner's delegation chain) or `Draft` (visible within `Read` scope), then `Proposed`, `Verified` (every claim and required action discharged on its exact tree), and `Canonical` (promoted by quorum, immutable). States never move backwards. 123 _Avoid_: branch, phase, PR status 124 125 **ConflictTerm**: 126 A tree entry that records an unresolved merge as data: a sorted multiset of add terms and a sorted multiset of remove terms, with one more add than remove. Each term is a full entry state (absent, or a file, directory, or symlink with its mode and content digest). Identical add and remove terms cancel. Trees containing any conflict term cannot be materialized for a build or promoted. 127 _Avoid_: conflict markers in file text, failed merge 128 129 **MergeTier**: 130 The level at which two revisions were merged: T0 path, T1 region, T2 syntax tree, or T3 first-class conflict. Recorded in the merged revision. 131 _Avoid_: merge strategy name 132 133 **Operation**: 134 One admitted mutation of repository state (revision created, marker recorded, reference moved, receipt attached, capability granted or revoked), carried by one WAL frame and recording the actor, the capability chain, and the view digest before and after. Undo is a new operation that restores an earlier view. 135 _Avoid_: WalSeq (the ordering number), audit entry (refusals), commit 136 137 **View**: 138 The complete set of references (canonical head, workspace pointers, visible heads per change) after an operation, identified by a Merkle digest. 139 _Avoid_: branch list, checkout 140 141 **Workspace**: 142 A server-side pointer to a base plus an overlay of changed paths, owned by a capability. Forking copies the pointer, not the content; every write is a draft revision. 143 _Avoid_: Git worktree, clone, working directory 144 145 **ActionDigest**: 146 The digest of one exact evaluation: input root, toolchain digest, command digest, environment digest, and platform. The input root is a Merkle root over sorted (`repo_id`, `TreeDigest`) pairs, so one action can cover trees from several repositories. 147 _Avoid_: test name, CI job ID 148 149 **EvidenceReceipt**: 150 A signed record of one action's result that applies only to the exact input root in its `ActionDigest`. Its deterministic part (exit status plus declared output digests) is its identity, the result digest; its observation part (logs, seconds, joules when measured) is stored but never part of that identity. It also records the hermetic flag and the executor machine key. Only receipts from registered executors (machine keys listed in the identity document, running a sandbox the requesting agent does not control) count toward promotion. 151 Record version 1 exists today (ADR 0004 D4, crate `synapse-evidence`): a separate record that references a `ChangesetId` and binds the source revision, two `CrumbContextDigest`s for each changed directory (at the changeset's base, what the author saw; and in the changeset's own tree, what the runner tested under), a single-repository input root, the test identity, and a typed outcome (`Pass`, `Fail`, `Flaky`, `Error`; only `Pass` is a pass), signed by the runner's Ed25519 key under its canonical `did:key`. Synapse reports a receipt whose bound context differs on either side as `Stale`, naming the side (`AtBase` or `InChangeset`). The hermetic flag, registered executors, resources, and the composite input root come in a later record version. A receipt never grants publication, and no coordination record (claim, scent, whisper) ever enters one. 152 _Avoid_: EvidenceAttachment (v1, unbound), PASS label, CI badge 153 154 **Receipt identity**: 155 The `EvidenceReceiptId` (`"SYNAPSE_EVIDENCE_RECEIPT_ID_V1\0"`): a digest over the record version, the action digest (what was run, on which changeset, base, Crumb contexts, and input root), the result digest (exit status, outcome, declared output digests), and the executor. Logs and timings are excluded, so two runs differing only in those share one identity. 156 _Avoid_: digest of the whole record, ChangesetId, BlobDigest, CrumbContextDigest 157 158 **ActionCache**: 159 The map from `ActionDigest` to stored results that returns a result for an identical hermetic action from a registered executor instead of running it again. Receipts are compared by result digest only (exit status plus declared outputs), so differing logs agree; differing result digests make the entry `Flaky`. A receipt is served only while its inputs and outputs are retained. 160 _Avoid_: test result reuse across different trees 161 162 **PromotionQueue**: 163 The service that advances the canonical head by compare-and-swap only to a tree that passed every required action and discharged every claim on that exact tree and carries the delegate threshold of signatures over the `ChangesetId`, `TreeDigest`, admission witness digest, and receipt-set root; candidates are batched and failed batches bisected. 164 _Avoid_: GitHub merge button, WalSeq order 165 166 **MachineDelegate**: 167 A delegate in the repository identity document that is a machine or agent key, for example one that signs only after independently re-executing the required actions and getting matching output digests. 168 _Avoid_: human maintainer, reviewer 169 170 **CapabilityChain**: 171 A sequence of grants from the repository authority to an agent in which each link may only narrow operations (`Read`, `Propose`, `Evaluate`, `Review`, `Publish`, `Undo`), paths, references, change scope, quotas (request rate, storage, and footprint), and expiry. Each link signs its parent's digest, the `repo_id`, the audience, and its caveats; child quotas never sum above the parent's. The server accepts a chain only if every link is unexpired and unrevoked at the request's `WalSeq`. 172 _Avoid_: shared token, bearer secret 173 174 **ChangeGroup**: 175 A record naming one revision per repository for changes that must land together across repositories (for example a pinned dependency and its consumer). The group is tested as one action over a composite input root and promotes by one compare-and-swap on the group manifest, so every member lands or none does. 176 _Avoid_: distributed transaction, submodule bump 177 178 **PhysicalBound**: 179 The least time or energy the hardware allows for a given piece of work, derived from device flush time and bandwidth, memory bandwidth, and all-core throughput, with every source stated; never from one implementation's single-core rate. Where the hardware gives no closed-form limit, the best measured all-core implementation is used and labelled as a reference, replaced whenever beaten, so the fraction achieved stays at most 1. Performance results are reported in seconds, joules, and watts with the fraction of this bound achieved. 180 _Avoid_: target, speedup, operations per second headline 181 182 **Segment**: 183 An append-only storage file holding WAL records and content chunks together, so one batch is one sequential write plus one flush. 184 _Avoid_: blob file, loose object, packfile 185 186 **Turing (T)**: 187 One bit of net held-out description-length saving against a declared baseline, after charging the model's own size. ADR 0003 section 7 proposes it, at Level 0 (definition only: never computed on Synapse data, not independently replicated, energy instrument uncalibrated), for scoring how well Synapse's change representation predicts code history. It is not a performance measure. 188 _Avoid_: tesla (also symbol T), throughput, compression ratio 189 190 **DerivationAttestation**: 191 A record signed by the server's registered machine key for a revision the server produced (a lazy rebase, a promotion-queue merge, or a derived-file output). It names the input revisions or trees, the deterministic rule applied, and the output digests, so any replica can recompute and check it. 192 _Avoid_: agent signature on server output, unsigned merge 193 194 **Flaky**: 195 The typed action-cache result for an `ActionDigest` whose registered receipts disagree in their deterministic part (exit status or declared outputs). It lists each distinct result and executor, is served as `Flaky`, and never discharges a claim or counts toward promotion. 196 _Avoid_: pass, fail, non-deterministic error 197 198 **GroupManifest**: 199 One record mapping each linked repository's `repo_id` to its canonical `TreeDigest`. A `ChangeGroup` promotes by one compare-and-swap on it, so linked repositories move together or not at all. 200 _Avoid_: compensating revert, distributed lock 201 202 **OwnerRetention**: 203 The v2 garbage-collection rule: an owner's revisions, operations, and views are kept while its grant or a lease it holds is live and for a server-clock window after, within a storage quota partitioned down its delegation chain. One owner's write volume never shortens another owner's retention. A final discard, issued only by the owner chain and not undoable, stops the work counting against quota at once and makes it collectable unless another root reaches it. 204 _Avoid_: retention counted in WalSeq, client created_at_ms 205 206 **CryptographicErasure**: 207 The only exception to never-lose-work: under the delegate threshold, the data key of a leaked secret is destroyed so every stored copy becomes unreadable; index, cache, and trace references are removed, the digest stays, and the erasure record is permanent. 208 _Avoid_: history rewrite, force push, delete