[package] name = "joule_core" version = "0.1.0" edition.workspace = true publish.workspace = true license = "GPL-3.0-or-later" [lints] workspace = true [lib] path = "src/joule_core.rs" # The GPUI-free heart of agent-mei: the control protocol wire, the on-device # agent loop, worktree-isolated accountable sessions, the JCP cascade/tool gates, # the codebase index, edit-block parsing, the methodology tracker, and the # sandbox + MCP bridges. Both the GUI panel (`agent_mei_panel`) and the headless # worker (`joule-coded`) own a copy of this engine, so it must NOT depend on # gpui/editor/workspace/project/language/ui — that exclusion is what lets the # daemon link it. [dependencies] anyhow.workspace = true futures.workspace = true ignore.workspace = true log.workspace = true serde.workspace = true serde_json.workspace = true sha2.workspace = true util.workspace = true # The session signs its spec, ops, and citations with a per-workspace identity. ed25519-dalek = "2" # must match the open-standards crates (SigningKey crosses the boundary) # Joule Code standard reference library — pinned to the same open-standards rev # as `agent_mei_panel` (bump both together). The cascade tiers are granted, # energy-budgeted, sealed JCP actions; ops are content-addressed; sessions hold # real signed artifacts. joule-code-schema = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } joule-code-cargo = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # The on-device L3 receipt's energy reading + provenance type. joule-code-receipt = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } joule-code-cascade = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } joule-code-jcp = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } joule-code-spec = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } joule-code-review = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } joule-code-release = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } joule-code-identity = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } joule-code-joulecontract = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } joulecontract-schema = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # Sandbox standard: the canonical S0–S7 isolation Tier + DeviceClass ladder the # omni-compute fabric routes against (cheapest device × lowest isolation tier). sandbox-schema = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } jcp-bridge = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # The contextual gate on top of the capability gate: content-keyed allow/deny and # a require-approval consent gate over the loop's tool calls, sealed as policy/1. jcp-policy = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } jcp-schema = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # Seal a finished session as an energy-metered eval/1 receipt: the loop's trace + # its methodology verdicts, with a quality gate, in one ARL-consumable artifact. jcp-trace = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # The L3 edit-contract prompt resolved from a signed, content-addressed registry, # so a session records which prompt version produced its op. jcp-prompt = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # A reconcile loop over the fleet: each peer is a capability-gated, joule-budgeted # harness; every relayed command is decided outside the model and sealed. jcp-orchestrate = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # Verify the sealed fleet-dispatch receipts (shared JCR-1 envelope). jcp-receipt = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # Derive a federation leg's session grant from its A2A Agent Card + AP2 mandate. jcp-a2a = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # Attested interceptor chains around the on-device model/tool calls: redact a # secret before the prompt, cap calls, hold a tool for approval — each step # metered and sealed as an intercept/1 receipt (before/after request digest). jcp-intercept = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # Seal a finished session as an outcome-anchored efficiency/1 receipt: the four # figures the dark-factory economics turn on (µJ/accepted-token, tokens/sec, # value/token, and spend per *completed, verified* unit), with real on-device # token counts and the session's measured joules. jcp-efficiency = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c" } # The L3 tier + measured energy — shared by the GUI editor and the headless # worker. JouleClaw's from-scratch GGUF runtime generates the change in-process # (Runtime backend) or via its safetensors MellumModel (Mellum backend), metered # by jouleclaw-energy: Apple IOReport ModelBased (no sudo), RAPL/NVML HwShunt on # Linux. Same crates, same rev, as agent_mei_panel. jouleclaw-energy = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c", features = ["ioreport"] } # The on-device model runtime is optional (the `l3` feature): it now builds on # all three OSes (the loader's Windows mmap fix is in the pinned rev), but staying # optional lets a minimal worker build without the heavy GGUF runtime / C-free, # reaching the cloud frontier over ACP instead. Energy metering is independent. # NOT built with `fabric`, and that is a measured decision rather than an # oversight. That feature turns on the loader's device-resident decode driver # (Apple Metal, DevstralResident + hybrid prefill) and reads like the fast path. # On this fleet's Apple Silicon host with LFM2-2.6B-Q4, generating the same 192 # tokens: # # reference path 111.1 s 6.49 kJ 1.73 tok/s 33.8 J/token # fabric (Metal) 162.5 s 9.24 kJ 1.18 tok/s 48.1 J/token # # 46% slower and 42% more energy. CPU use does drop (110% -> 72%), so the GPU is # genuinely engaged; it is simply losing to the CPU path at this model size. # Re-measure before enabling it — for a larger model the answer may invert. jouleclaw-runtime = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c", optional = true } jouleclaw-loader-gguf = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c", features = ["accelerate", "rayon"], optional = true } # Linux measured-energy counters: RAPL (Intel/AMD package), NVML (NVIDIA GPU), # and hwmon (a board/INA shunt — gives a Raspberry Pi / ARM SBC a real HwShunt # reading where neither RAPL nor NVML exists). [target.'cfg(target_os = "linux")'.dependencies] jouleclaw-energy = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c", features = ["rapl", "nvml", "hwmon"] } # Windows measured-energy: NVML GPU shunt (HwShunt) via the NVIDIA driver. [target.'cfg(windows)'.dependencies] jouleclaw-energy = { git = "https://git.transaction.science/Transaction-Science/open-standards.git", rev = "6cdc92381361890c1e6bdd79ac82e23236063a2c", features = ["nvml"] } [features] # The on-device L3 model tier (JouleClaw GGUF runtime), opt-in: the GUI panel and # the worker enable it. Off ⇒ no `joule_core::l3` (e.g. a Windows build, where the # loader's upstream Windows support is broken). Energy metering is unaffected. l3 = ["dep:jouleclaw-runtime", "dep:jouleclaw-loader-gguf"]