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 Source # Synapse 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. ## Language ### Identities ChangesetId: 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. Avoid: Git commit SHA, GitOid, WorldId, SemanticId, PR number BlobDigest: 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. Avoid: Git blob OID, ChangesetId, Verified Crumb digest GitOid: 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. Avoid: ChangesetId, BlobDigest, RadicleCanonicalHead RadicleCanonicalHead: 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. Avoid: WalSeq, GitHubPullRequestProjection, unverified Git ref GitHubPullRequestProjection: 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). Avoid: canonical head, Radicle quorum, source of truth IdempotencyKey: 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`. Avoid: ChangesetId, WalSeq, random request ID ### Storage and Ordering WalSeq: 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. Avoid: canonical commit order, Git commit timestamp, Radicle revision ChangesetEnvelope: 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. Avoid: working tree diff, mutable draft, WorldDraft VirtualTree: 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. Avoid: Git worktree checkout, working directory GarbageRoot: 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. Avoid: unpinned speculative changeset, permanent history ### Authorization AgentCapabilityGrant: 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. Avoid: SourceGrant, ambient filesystem permission, unauthenticated agent ID ### Directory Crumb Context Directory Crumb: 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). Avoid: Verified Crumb, Crumbline crumb, crumb (unqualified) Directory Crumb dialect: 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. Avoid: legacy crumb (ambiguous), crumb version, coerced crumb CrumbContext: 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`. Avoid: crumb (unqualified), working-tree crumb lookup CrumbContextDigest: 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. Avoid: BlobDigest, ChangesetId, GitOid, Verified Crumb digest Verified Crumb: 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. Avoid: Directory Crumb, `.crumb`, crumb (unqualified) Crumbline: 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. Avoid: Directory Crumb, Verified Crumb, training crumb in Synapse ### AI-Native Model (ADR 0003, proposed) ChangeId: 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`. Avoid: ChangesetId, branch name, task title TreeDigest: 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. Avoid: Git tree OID, ChangesetId, working directory ChunkDigest: 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. Avoid: BlobDigest, Git delta AdmissionWitness: 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. Avoid: ChangesetId (content only), AuthorshipAttestation, created_at_ms AuthorshipAttestation: 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. Avoid: commit author, signature inside the content digest IntentRecord: 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`. Avoid: commit message, PR description Claim: 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. Avoid: description, checklist item Footprint: 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. Avoid: diff, touched files after the fact ObsolescenceMarker: 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. Avoid: reflog entry, deleted changeset RevisionState: 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. Avoid: branch, phase, PR status ConflictTerm: 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. Avoid: conflict markers in file text, failed merge MergeTier: 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. Avoid: merge strategy name Operation: 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. Avoid: WalSeq (the ordering number), audit entry (refusals), commit View: The complete set of references (canonical head, workspace pointers, visible heads per change) after an operation, identified by a Merkle digest. Avoid: branch list, checkout Workspace: 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. Avoid: Git worktree, clone, working directory ActionDigest: 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. Avoid: test name, CI job ID EvidenceReceipt: 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. 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. Avoid: EvidenceAttachment (v1, unbound), PASS label, CI badge Receipt identity: 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. Avoid: digest of the whole record, ChangesetId, BlobDigest, CrumbContextDigest ActionCache: 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. Avoid: test result reuse across different trees PromotionQueue: 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. Avoid: GitHub merge button, WalSeq order MachineDelegate: 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. Avoid: human maintainer, reviewer CapabilityChain: 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`. Avoid: shared token, bearer secret ChangeGroup: 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. Avoid: distributed transaction, submodule bump PhysicalBound: 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. Avoid: target, speedup, operations per second headline Segment: An append-only storage file holding WAL records and content chunks together, so one batch is one sequential write plus one flush. Avoid: blob file, loose object, packfile Turing (T): 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. Avoid: tesla (also symbol T), throughput, compression ratio DerivationAttestation: 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. Avoid: agent signature on server output, unsigned merge Flaky: 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. Avoid: pass, fail, non-deterministic error GroupManifest: 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. Avoid: compensating revert, distributed lock OwnerRetention: 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. Avoid: retention counted in WalSeq, client created_at_ms CryptographicErasure: 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. Avoid: history rewrite, force push, delete