agent-joule/dev-docs/MEI_BRIDGE.md
David Charlot 7a59f0ffc5 agent-mei: rename agent_joule panel/theme/workflows to agent-mei, MEI fleet wiring and honest-energy receipts
Brings over the uncommitted agent-mei work (Mac checkout, Sep 22) plus box
follow-ups (Oct 17: agent_mei action namespace in keymap/zed.rs, MEI_BRIDGE.md,
RENAME_AGENT_MEI.md, unmetered receipts report 0 uJ). joule_core, JOULE_CODE_*
and JouleDB names unchanged. *.bak.* scratch files excluded.
2026-10-27 12:59:12 -04:00

39 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MEI bridge (protocol lives in mei-studio)
agent-mei opens **MEI** (Machine Educated Intelligence) artifacts authored in MeiStudio.
The shared wire is implemented in mei-studio (Rust **1.94.1** — do **not** bump this editor’s toolchain to chase it):
- Protocol crate: `mei-studio/crates/agent-mei-bridge`
- Docs: `mei-studio/docs/agent-mei.md`
- **Exact Mac patch steps:** `mei-studio/docs/agent-mei-mac-patch.md`
## Landed in this tree (source)
1. `crates/agent_mei_panel/src/agent_mei_panel.rs` — `control_dispatch`: `"mei_open"`; `"open"` routes `.mei.json` / `.mei` to it.
2. `crates/agent_mei_panel/src/mei_panel.rs` — GPUI `MeiReceiptPanel` over `mei.panel/v1` (tier, joules, measured_vs_modelled, merkle, jcr1_rows + grant toast).
3. `crates/zed/src/zed.rs` — dock loads `MeiReceiptPanel`.
4. `crates/joule_core/src/control.rs` — MCP tool `agent_mei_mei_open`.
5. `crates/joule_core/src/cascade_gate.rs` — MEI grant alignment note (no auto-export / no auto-ACP).
Shells PATH binary **`mei-open`** (prefer binary over path-dep — toolchain split). No network / no phone-home.
## Headless today (works without GPUI)
```bash
mei-open path/to/graph.mei.json # validate + handle JSON
mei-open path/to/graph.mei.json --panel # mei.panel/v1 for the dock
mei-open path/to/graph.mei.json --grant-env # → JOULE_CODE_GRANT=l0,l1,l2,l3[,l4]
```
Naked L4 is refused unless the artifact’s `grant_capabilities` contains `l4_frontier`
(aligned with omitting `l4` from `JOULE_CODE_GRANT` / JCR-1 cascade gate).
## Smoke (Mac, after `mei-open` on PATH)
```bash
export JOULE_CODE_CONTROL_SOCK=/tmp/jc-mei.sock
export JOULE_CODE_GRANT=l0,l1,l2,l3 # no l4
agent-mei /path/to/project &
agent-mei --jc-control mei_open --jc-params '{"path":"/path/to/examples/demo.mei.json"}'
agent-mei --jc-control state
```