@fabric_v1/compiler
Version:
Fabric DSL compiler (parser, checker, IR & backends)
202 lines (115 loc) • 4.5 kB
Plain Text
FAB-RFC-0002: Atom-Level Execution & Provenance
Title: FabricAtom-Based Execution and Bit-Level Provenance
Authors: Shawn Blackmore (Atomic Limited)Status: DraftVersion: 1.0.0Created: 2025-07-24
Summary
This RFC proposes a foundational extension to Fabric 1.0 introducing FabricAtom as the atomic unit of execution, audit, and memory. This allows .fab modules to be compiled into atomic arrays where each byte is split into immutable protons and mutable electrons. The system enables:
Bit-level provenance tracking
Policy-enforced mutation control
Probabilistic modeling and quantum-class behavior
Microtransaction-based royalty and audit accounting
Motivation
Fabric 1.0 provides block-level provenance, but this RFC introduces bit-level trust, enabling:
Detection and rollback of unauthorized state mutations
Cryptographically verifiable computation per bit
Fine-grained energy budgeting and fairness enforcement
A universal substrate for quantum-style computation
1. DSL Grammar Extensions
1.1 New Type: FabricAtom
// Defines a bit-level atomic memory cell
struct FabricAtom {
protons: Bit[8], // Immutable at runtime, compiled & signed
electrons: Bit[8], // Mutable runtime state
policy: {
privacy: anonymized,
integrity: immutable,
energy_budget: 1J
}
}
1.2 Usage in Agent Definitions
agent QuantumGuard {
id: "agent-uuid4"
model_id: "guard-model:1.0.0"
inputs: [FabricAtom[]]
outputs: [FabricAtom[]]
fallback: LocalSimulator { state:preserve }
}
2. Compiler Phase Additions
2.1 Atomization Phase
Bytecode output from Fab AST is decomposed into FabricAtom[]
Protons generated from original source byte values
Electrons initialized to default mutable state (0 or mirrored)
2.2 Mutation Policy Linking
Policies attached per FabricAtom
Policy DSL validated against integrity/fairness/privacy schemas
Generates Merkle signature for proton hash at compile time
2.3 Entanglement Analysis (optional)
Cross-agent FabricAtom references generate entanglement graphs
Enforced at runtime by QuantumCoordinationBlock
3. Runtime Memory Model
3.1 Atomic Memory Space
struct RuntimeAtom {
Protons [8]bool // fixed, signed
Electrons [8]bool // mutable, bitwise addressed
Policy AtomPolicy
Hash []byte // SHA256(Protons)
ID string // Atom ID (UUID)
}
Protons: never mutated, enforced by policy kernel
Electrons: writable, but logged in audit stream
ID: deterministic from module + offset
3.2 Access Semantics
Read: electrons[i]
Write: only allowed if policy permits mutation and is logged
4. Policy Enforcement Logic
4.1 Enforcement Points
Write attempt on electrons triggers:
Policy check (integrity, privacy, fairness)
Energy budget decrement
Provenance event
4.2 Violation Handling
Policy breach → error code (FAB_6001)
Execution blocked or fallback agent invoked
Audit trail records attempted mutation
4.3 Audit Example
{
"atom_id": "agent-xyz::offset-12",
"bit_index": 6,
"old_value": 0,
"new_value": 1,
"timestamp": "2025-07-24T11:00:00Z",
"policy_violated": false,
"signature": "HMAC(...)"
}
5. Storage Layer Design: Merkle-Atom DAGs
5.1 DAG Structure
Each FabricAtom is a leaf node
DAG groups atoms by:
agent
block
execution round
5.2 Integrity Guarantees
SHA256(protons) → proton_hash
DAG node: { atom_id, hash, parent_hashes[] }
DAG signed and stored in Provenance Ledger
5.3 Snapshot + Recovery
Snapshots of atom groups stored at:
planStart, planCommit, planFinish
Any mutation delta can be reversed using DAG path
6. Future Extensions
QuantumBitArray type with probabilistic electrons[i] ∈ [0,1]
Visual Atom Viewer in Fabric VS Code extension
Atomic micro-royalty engine (0.00001 FAB / bit mutated)
7. Backward Compatibility
All Fabric 1.0 .fab files remain valid
Atomization is opt-in via fab build --atomized
Mixed execution supported: classical + atomized
8. References
RFC-0001: Governance
Fabric DSL Grammar (fabric.rst)
Fabric Provenance Ledger Spec
SGX Attestation APIs
HMAC RFC 2104
9. Status
This RFC is open for review by the Fabric Steering Committee. Once approved, it will be integrated into the Fabric 1.1 specification.
Appendix A: Visual Diagram (TBD)
Agent → ExecutionBlock → Atom DAG → Provenance Ledger