interplane.Get Omega
Read in your language

synapse

A component of the AienOS ecosystem.

Brought by drakestapleton

branch main Branches Tags History

synapse / CONTEXT.md

208 lines · 18979 bytes Raw Blame History Rendered
1# Synapse
2
3Synapse 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**:
10The 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**:
14The 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**:
18The 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**:
22A 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/<nid>/refs/rad/sigrefs` under a verified `refs/rad/id` identity document.
23_Avoid_: WalSeq, GitHubPullRequestProjection, unverified Git ref
24
25**GitHubPullRequestProjection**:
26A 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**:
30A 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**:
36A 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**:
40The 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**:
44An 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**:
48A 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**:
54An 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**:
60A `.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**:
64One 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**:
68The 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**:
72The 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**:
76A 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**:
80The 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**:
86A 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**:
90The 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**:
94The 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**:
98The 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**:
102A 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**:
106The 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**:
110A 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**:
114The 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**:
118A 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**:
122Where 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**:
126A 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**:
130The 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**:
134One 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**:
138The 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**:
142A 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**:
146The 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**:
150A 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.
151Record 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**:
155The `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**:
159The 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**:
163The 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**:
167A 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**:
171A 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**:
175A 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**:
179The 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**:
183An 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)**:
187One 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**:
191A 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**:
195The 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**:
199One 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**:
203The 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**:
207The 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