Repository navigation
feat(brain-orb): Phase 4a/4b KB-write + voice-transcript + write→graph refresh (ent#61, #66, #67, #68) - #1407
Conversation
…ink) (abilityai/trinity-enterprise#61) Completes the Brain Orb write surface with the low-risk half of Phase 4: owner/admin-only capture-a-note and link-two-notes. Split from the full Phase 4 during /autoplan (two independent reviews) — run_skill (headless claude -p exec), automatic transcript capture, and transcript injection are deferred to trinity-enterprise#66 (they carry the exec/injection risk and depend on an unproven Gemini-Live-transcription path). Backend: - routers/agent_brain_orb.py: GET /brain-orb/actions + POST /brain-orb/action (OwnedAgentByName). Action verb enum-validated at the boundary (run_skill/ capture_transcript -> 400, never forwarded), body-capped (413), rate-limited per (user, agent, action), audit-logged, Idempotency-Key deduped (Invariant #18, key folded per verb; effect_guard doesn't fit — no execution_id). - services/brain_orb_voice_service.py: can_write folds capture_note/link_notes into the LOCKED voice manifest only for owners; shared users keep the read-only Phase-3 manifest. can_write computed in the mint route. - config.py + routers/settings.py: BRAIN_ORB_WRITE_ENABLED kill-switch (default OFF, distinct from BRAIN_ORB_ENABLED) -> brain_orb_write_available. Agent-server (Invariant #5 mirror): - routers/brain_orb.py: GET/POST /api/brain-orb/action[s] via the hardened _run_hook over the agent's ~/.trinity/brain-orb/action convention hook (agent owns the write, Invariant #8; stdin-only, no shell string). Frontend: - orb.js: rewire initActions/postAction/doCapture/doLink from the dead localhost voice proxy (X-Orb-Token) to the broker + Bearer JWT + Idempotency-Key; un-hide #actions via body.brain-orb-write only after the broker confirms owner + flag + hook; add capture_note/link_notes to ORB_TOOLS; double-submit re-entrancy guard. - orb-trinity.css / AgentBrainOrb.vue / stores/sessions.js: gate the panel on the write flag, relay writeAvailable in the init handshake. Tests: 14 new cases (owner-gate 403, flag-off 404, no-hook 404, enum 400, 413, 429 + claim-release, idempotency replay/409, owner-only voice manifest, agent-server action hook). 62/62 green. Security: /review 0 critical, /cso --diff 0 findings. Docs: requirements §46 FR-8, feature-flows/brain-orb.md Phase 4a, learnings (effect_guard vs Idempotency-Key), cso-diff-2026-07-01 report. Refs abilityai/trinity-enterprise#61 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…he flag reaches the container (abilityai/trinity-enterprise#61) The Phase 4a write flag existed in config.py + settings feature-flags but was never added to the backend `environment:` block in docker-compose.yml (mirrors BRAIN_ORB_ENABLED/BRAIN_ORB_VOICE_ENABLED at lines 40-41). Without it the flag never reaches the container, so brain_orb_write_available stays false and the write routes 404 regardless of .env. Surfaced during the localhost demo. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ost-session processing (abilityai/trinity-enterprise#66)
Mirrors the original cornelius-internal voice proxy (resources/agent-visualization/
voice/{proxy_server,transcript_io}.py): the client captures per-turn transcription,
the agent renders + saves it, Trinity brokers. De-scoped per direction — transcript
saving (for debug/analyze) + an optional post-session prompt; run_skill (arbitrary
exec) stays out.
- Mint (brain_orb_voice_service): add input_audio_transcription +
output_audio_transcription to the LOCKED LiveConnectConfig so the constrained
ephemeral token returns per-turn transcription. Verified: auth_tokens.create
accepts it and the mint returns a real token (de-risks the F6.1 unknown).
- voice.js: buffer content.inputTranscription/outputTranscription into conversation
events (session_start/user_turn/model_turn/tool_call/session_end); flush in
endConversation() (the correct seam — onclose early-returns on wsClosedByUs) AND
the error-close branch; relay {session_id, events} to the parent orb.
- orb.js: on 'orb-capture-transcript' (owner + ACTIONS.enabled) →
postAction('capture_transcript', {..., process:true}) with session_id as the
Idempotency-Key (double session-end = one save). postAction gains an optional key.
- Backend (agent_brain_orb): accept capture_transcript + process_transcript verbs
(still OwnedAgentByName, audited); raise the action body cap to 1 MiB for whole
conversations. run_skill remains rejected (400).
- Agent-server (brain_orb): raise the /action body cap to 1 MiB to match.
- Agent action hook (cornelius template): render markdown transcript (ported
transcript_io) → resources/inbox/Voice Conversations/; process_transcript runs the
agent's configured prompt (~/.trinity/brain-orb/voice-postprocess.md — configuring
it is the opt-in) over the transcript via a DETACHED claude -p with the transcript
on STDIN (no shell string → no command injection), writing a processed note.
Security posture (owner-gated exec): OwnedAgentByName + owner-authored prompt +
owner's-own-transcript; transcript via stdin closes command injection. Residual
(follow-up): the post-process claude -p uses --dangerously-skip-permissions (full
tools) — a tool-constrained sub-invocation + transcript credential-sanitization are
the hardening path if this graduates beyond a debug tool.
Verified on localhost: mint accepts transcription config; synthetic voice events
render + save to the KB; process_transcript spawns the detached claude -p (ran end
to end — only blocked by the agent's Claude credit balance, not code). Full
live-audio transcription streaming is a manual voice-session check. 64 unit tests
green.
Refs abilityai/trinity-enterprise#66
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Added Phase 4b (trinity-enterprise#66) on this branch per direction: voice-transcript capture + configurable post-session processing, mirroring the original
Verified on localhost: constrained-token mint accepts the transcription config; synthetic voice events render + save; post-process spawns end-to-end. 64 unit tests green. Residual hardening (follow-up): the post-process |
…te control (abilityai/trinity-enterprise#67, #68) Fixes the feedback from the live voice test: notes/links created via the orb landed in the inbox but never appeared on the graph, and there was no way to confirm integration happened. #67 (mechanism): - Backend `POST /brain-orb/refresh` (OwnedAgentByName, 200s timeout mirroring /scope, audited `brain_orb_refresh`) → agent-server `POST /api/brain-orb/refresh` → the `action` hook's `refresh` verb reindexes + re-exports data.json (folds inbox notes + _links.md edges into the graph; agent owns generation, Invariant #8). - orb.js `refreshGraph()` refetches /data and rebuilds in place (same machinery as setScope). Auto-triggered after capture/link; voice writes debounced ~4s so a burst coalesces into one rebuild. #68 (observability): - Visible "↻ integrate & refresh" control in the actions panel, an "integrating…" state, and a "graph updated · +N notes, +M links" / "graph up to date" confirmation toast so the user can see the write land. Verified on localhost: capture → refresh folds the note in as a real graph node (1072 → 1079 nodes, +3 edges), and the UI control rebuilds with the confirmation toast. 70 unit tests green (6 new refresh cases). Refs abilityai/trinity-enterprise#67 abilityai/trinity-enterprise#68 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Added the write→graph refresh loop (trinity-enterprise#67 + #68) on this branch: |
…yai/trinity-enterprise#70) Voice-test feedback: navigating to a note or highlighting a topic/group lit the target but didn't zoom/center to fit it — it settled at a fixed distance (focusNode→195, highlightGroup→250) regardless of where the selection sat or how spread out it was, so the highlight read as "not focused." Add frameNodes(indices): centers on the selection's centroid direction AND derives a fit distance from the selection's max shell radius + angular spread vs the camera FOV (single note zooms in; a spread-out cluster zooms out), clamped to the existing zoom bounds and never inside the node shell. Route focusNode and highlightGroup(frame) through it, replacing the fixed 195/250. Verified on localhost: navigate to a single note 330→144 (zooms in; was fixed 195); highlight a cluster computes a per-group fit; the highlighted group is centered and framed. (Client-side WebGL camera math — no pytest surface; verified in-browser.) Fixes abilityai/trinity-enterprise#70 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ding refresh on miss (abilityai/trinity-enterprise#70) Second round of voice-test feedback: after "create a node, link it to Dopamine, now show me the connection," the user saw the Dopamine node but not the edge to the new note. Two causes, both under the navigate/focus (#70) umbrella: 1. Framing showed a LONE node. focusNode already lit up the node + neighbours + drew the connecting edges (setHover), but frameNodes([i]) fit only the single node — so the other endpoint of a just-made link sat off-screen. Now frame the node TOGETHER with its highlighted neighbours (hoverSet), so both ends of the edge are in view. 2. Timing race. Voice writes integrate on a ~4s debounce, so navigate_to_note could fire before the new note was a graph node and fall back to the vault reader. Now, on a miss, if an integration is pending, flush it (refreshGraph) and retry before the vault fallback — so "create X → show me X" lands on the real graph node. Verified on localhost: navigate to the just-created "Random Node 24" frames it with Dopamine and draws the connecting edge (both endpoints visible, link line rendered). Fixes abilityai/trinity-enterprise#70 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…points (abilityai/trinity-enterprise#71, #72) Two more voice-test issues in the write→refresh loop: #72 — selection lost on refresh. applyData()→teardownGraph() wipes lastInspectedIdx/hover and node indices change, so a capture/link auto-refresh deselected whatever the user was looking at mid-task. refreshGraph() now snapshots the selection BY ID (inspected node, or highlighted group) before the rebuild and re-selects/re-frames it after; and it SKIPS the rebuild entirely when nothing changed (added_nodes==0 && added_edges==0) so a no-op refresh never disturbs the selection. Camera view was already preserved by teardown. #71 — link to a non-existent note silently "succeeded" (dangling reference, false success, no renderable edge). The agent action hook's `link` verb now validates BOTH endpoints resolve to real notes (graph node or inbox file) and returns a clear "note not found — create it first" error otherwise (agent-owned per Invariant #8; the orb already surfaces r.error). This repo change is the contract note + the orb selection fix; the demo cornelius hook was updated to match and the real agent adopts the same. Verified on localhost: selecting Dopamine then refreshing (with a pending capture forcing a real rebuild) keeps Dopamine selected + inspector shown; linking to a non-existent "Random Node 25" now returns a clear not-found error. Fixes abilityai/trinity-enterprise#71 abilityai/trinity-enterprise#72 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ntegrates it (abilityai/trinity-enterprise#72) Feedback: "add the node" captures + refreshes a few seconds later, but the new node isn't selected — you had to ask to select it separately. Now a capture sets a _pendingFocusTitle that refreshGraph() consumes after the rebuild: it focuses the just-created note (inspector + highlight + framing) once it's folded into the graph, taking priority over restoring the prior selection. Falls back to restoring the prior selection when there's no pending capture. Purely client-side — the agent doesn't need a second navigate_to_note call. Verified on localhost: a voice capture_note with no follow-up navigate ends with the new note auto-selected in the inspector after the debounced refresh. Refs abilityai/trinity-enterprise#72 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…toggle + prompt editor) (abilityai/trinity-enterprise#73) The Brain tab was a launch button + a "no settings yet" placeholder. Give it its first real control: configure the post-voice-session processing (#66) from the UI. - BrainPanel.vue: "Post-voice processing" section — an on/off toggle ("run a processing step after each voice session") + a prompt textarea + Save, loaded on mount. Shown only when brain_orb_write_available + agent running. - Backend GET/PUT /api/agents/{name}/brain-orb/postprocess (OwnedAgentByName, write-flag-gated, PUT audited) → agent-server GET/PUT /api/brain-orb/postprocess (direct file I/O). Config is agent-owned (Invariant #8): ~/.trinity/brain-orb/voice-postprocess.json = {enabled, prompt}, with the legacy .md as a prompt-only read fallback. - The action hook's _spawn_postprocess now gates on the `enabled` flag (default OFF) — disabling keeps the saved prompt but skips the claude -p. Verified on localhost: the Brain tab shows the toggle + prompt (loaded from config); saving writes voice-postprocess.json and GET reflects it; with enabled:false a capture_transcript still saves the transcript but the post-process is skipped ("post-processing disabled"). 76 unit tests green (6 new). Refs abilityai/trinity-enterprise#73 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…gn system (abilityai/trinity-enterprise#73) The Brain-tab Save + Open Brain Orb buttons used bg-state-autonomous-500/600 (amber, and a non-standard lighter shade — the only -500/-600 primary buttons in the app). The app-wide primary-action convention is bg-blue-600 hover:bg-blue-700 (22 usages); focus rings are focus:ring-blue-500 (35 usages). Aligned the buttons, the enable checkbox accent, and the prompt textarea focus ring to blue. Amber (state-autonomous) is kept ONLY for the Brain Orb identity (the orb icon + BETA badge). No shared Button component exists, so this matches the established Tailwind convention rather than a component. Verified on localhost: both buttons compute rgb(37,99,235) = blue-600. Refs abilityai/trinity-enterprise#73 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…meout stagger, safe audit (abilityai/trinity-enterprise#61) Applies the fixes from the final pre-merge review of the Phase-4 branch: - F1 (med): /refresh drove the agent action hook but was gated only on BRAIN_ORB_ENABLED — the write kill-switch wasn't airtight. Added _require_write_enabled() + test_refresh_write_flag_off_404. - F3 (low/med): /action backend timeout == agent-server timeout (60/60); a premature backend 504 could release the idempotency claim → double-write on retry. Staggered backend to 90s > agent 60s (mirrors the scope route). - F4 (low): /postprocess PUT capped at 1MiB vs the agent-server's 64KiB; capped the backend at 64KiB to match. - F5 (low): audit awaited after complete() unguarded → an audit failure 500s a completed write (fresh-key retry double-writes). Added _safe_audit best-effort wrapper on all post-write audit calls. - orb-tool postMessage handler lacked an origin check; 4a added owner-write tools to ORB_TOOLS. Added the origin guard (matches the two sibling handlers; CSP frame-ancestors already mitigated it). - F2 (med): the committed 4a-only CSO report declared "0 findings / no claude -p" — stale vs the shipped exec/transcript surface. Rewrote it as the full-branch final review (findings + resolution). Auth boundaries, can_write split, enum gate, stdin-only exec, and idempotency ordering all verified clean by an independent reviewer. 77 unit tests green. Learning captured (kill-switch completeness across incremental routes). Refs abilityai/trinity-enterprise#61 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
dolho
left a comment
There was a problem hiding this comment.
Reviewed the full incremental diff (vs base feature/60-brain-orb-voice), focused on the security-critical surface. Verdict: strong PR — approve with two small suggestions; no blocking bugs found.
What's solid
- Auth boundary is correct.
/action,/actions,/refresh,/postprocessare allOwnedAgentByName(owner/admin). The voice manifest's write tools are a UX affordance only — the/actionroute is the hard gate. Shared-user voice sessions get the read-only manifest verbatim, and since the wholeLiveConnectConfigis locked into the ephemeral token, the browser can't widen the tool surface at connect time. - Exec surface is safe. The agent-server hook runs via
_run_hook(stdin=body)— stdin-only, no shell string;_hook_readygate; agent owns the write semantics (Invariant #8); the endpoints are reachable only behind theX-Trinity-Agent-Tokenmiddleware (#1159). - Idempotency ordering is deliberately right — the claim is taken before the rate-limit check so a legit retry replays instead of 429ing;
fail()releases the claim on 429 / agent-error / 504; the no-key path (begin(None)→enabled=False) makesfail/completesafe no-ops. The timeout ladder (backend 90s > hook 60s) prevents an ambiguous-outcome double-write. - No XSS.
ACTIONS.skills=[]is hardcoded for 4a,innerHTML=''only clears, and therun_skillrenderer is dead/commented code. - Kill-switch correct —
brain_orb_write_available = WRITE_ENABLED and BRAIN_ORB_ENABLED, default OFF, distinct from the read/voice flags. Same-originpostMessageguard; the JWT stays in the same-origin orb frame (the nested voice iframe only ever receives the single-use Google token). - Test coverage is excellent — every branch is exercised: owner-gate 403, both flag-off 404s, no-hook 404, enum 400, body 413, rate 429 + claim-release, idempotency replay / in-flight-409, owner-vs-shared manifest, and the agent-server hook forwarding / absent / 413.
Findings (non-blocking)
1. The Summary understates the shipped scope. It calls this "the low-risk half… run_skill / automatic transcript capture / injection deferred to #66." But the diff ships capture_transcript/process_transcript in the action enum, input/output_audio_transcription in the voice config, /refresh, and the #73 postprocess config — whose purpose is to trigger a detached claude -p over a transcript. That transcript-exec is precisely the "real risk surface" the Summary says is deferred (it's agent-owned + owner-gated + constrained — not arbitrary run_skill — but it is an exec path shipping here). The title is honest (4a/4b … #66, #67, #68); please align the Summary so reviewers don't under-scrutinize it, and confirm the CSO diff covered process_transcript + the detached claude -p trigger.
2. The idempotency key isn't namespaced by user (one-line hardening). Scope is per-agent and the key is brain_orb_action:{action}:{client_key} with no user id. Two owner/admins writing to the same agent with the same client-supplied Idempotency-Key would collide — one could replay the other's stored snapshot instead of performing its own write. Low real risk (trusted actors, keys are typically random), but the rate-limit key already folds in current_user.id; doing the same for the idempotency key closes it.
Minor notes (no action required)
- A successful-but-unparseable agent response stores a
{}replay snapshot (snapshot = None→ replay returnssnapshot or {}). Harmless edge case — successful writes return JSON. - Per the author's own note, the constrained-token transcription path "has no working precedent in-repo," so the unchecked in-stack verification box genuinely matters before flipping
BRAIN_ORB_WRITE_ENABLEDon in prod. - Reviewed as the incremental diff against
feature/60-brain-orb-voice(stacked; merge order 58 → 60 → 61), not againstdev.
🤖 Generated with Claude Code
…or below the state card (#2538, #2539) (#2546) * fix(brain-orb): latch wheel routing per gesture so momentum never zooms (#2538) The single window-level `wheel` listener in public/brain-orb/orb.js decided zoom-vs-scroll PER EVENT via panelCanScroll(), with no gesture memory. On a macOS trackpad one flick keeps emitting `wheel` at frame cadence long after the fingers lift, so the inertia tail that arrived after a panel reached its edge was routed to camTargetDist and the camera zoomed out. - Gesture latch: a run of wheel events with inter-event gaps <= 150 ms (WHEEL_GAP_MS — the top of the issue's 120-150 ms range) is one gesture. Its first vertical event decides the route from the scroll container under the pointer; every later event keeps it. Panel-latched events that can scroll nothing are swallowed (preventDefault), never zoomed. A fresh gesture (gap > 150 ms) over an already-edged panel still zooms, so the deliberate "scroll to the end, then keep going to zoom out" chaining is preserved. - Clock is e.timeStamp (input time) with a performance.now() fallback. Chromium coalesces events queued behind a stalled frame into one, so a stall > 150 ms still ends the gesture — bounded to one re-decided step. - deltaY === 0 (pure-horizontal) events never start a latch; they refresh the clock and otherwise behave exactly as before. deltaX handling stays deferred, as the issue itself defers it. - Allowlist gone: panelCanScroll() walks the target's ancestors up to <body> and asks computed style, so the CSS is the single source of truth. #scopePanel (overflow-y:auto all along) scrolls under the wheel at last. - The ctrlKey pinch branch and the Safari gesture* listeners are untouched. - index.html: orb.js is un-hashed under prod nginx's 1y-immutable cache, so the <script> tag now carries ?v=2026-09-06 (comment says: bump BOTH). Proof: e2e/brain-orb-wheel-latch.spec.js (@smoke; standalone /brain-orb/index.html FALLBACK graph — no agent, no auth; skips without WebGL, fails loudly on a boot error). Red before the fix at A2+A3 (camTargetDist 330 -> 473.9 across a 25-event tail), A4 ([true,false]) and A5 (#scopePanel wheel zoomed, defaultPrevented true); 9 passed after. A1 scrolls #inspContent into the inspector's visible box and asserts the aim point before firing its one trusted wheel, so a mis-aim can never read as a routing failure. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(brain-orb): floor the inspector below the state card (#2539) #stateBox (top:26px, 174px tall) and #inspector (top:50%; translateY(-50%); max-height:82vh) are both right-anchored .panels at z-index 10 with nothing reserving vertical space, so a tall inspector rose into the state card and, being later in DOM order, painted over "STATE / Idle" — measured overlap 128 / 119 / 103 px at 1280×800 / 1440×900 / 1920×1080 (132 px on the real 1280×756 iframe viewport). CSS only — exactly two values on #inspector change: - transform: translateY(max(-50%, calc(224px - 50vh))) keeps the centring while the box is short and floors its TOP edge at 224px (26 + 174 card + 24 gap) once it is tall — continuous, no jump. The 174px premise holds for every STATES desc and the boot-time "reflecting last run" string (<=3 lines at 26ch); spec B1 asserts it rather than trusting it. - max-height: min(82vh, calc(100vh - 224px - 26px)) keeps the BOTTOM edge 26px inside the viewport. No fallback pairs: the sheet already relies on min() unguarded. No JS: makeDraggable/restorePanels set inline right:auto + transform:none, so a dragged or restored inspector keeps its user-chosen spot (spec B3). Cost, stated so nobody raises the cap later: on the real iframe a full-height inspector shrinks from 82vh to 100vh-250px (~549 -> 420 px at a 1280×800 window). Out of scope, follow-ups: the #controls legend under a full-height inspector, #scopePanel's own gutter collision, and — surfaced by spec B1 — the top-centred #dock covering the state value at <=760px. index.html: styles.css now carries the shared ?v=2026-09-06 token (the orb.js tag got it in the previous commit; bump BOTH on every edit). Proof: e2e/brain-orb-inspector-layout.spec.js (@smoke; standalone FALLBACK page, no agent/auth). Red against the previous styles.css at all five viewports — "inspector.top 72|81|97|68|81 vs stateBox.bottom 199.86, Expected >= 215.86" — 8 passed after. The shared helper gains a `paragraphText` option so B2's short note sits inside the centring band (h <= 100vh - 448) instead of on its edge. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(brain-orb): state the ?v= cache-bust convention in the feature flow (#2538, #2539) The "Known limitations" bullet said the orb was frozen (verbatim) and that a future orb update "needs a cache-bust" — both false once #2538/#2539 edit orb.js and styles.css and index.html carries the shared ?v=2026-09-06 token. Rewrite that one bullet to state the convention (bump BOTH tokens on every edit) and its residual (/brain-orb/index.html itself is heuristically cached by prod nginx — the \.html$ no-store rule is a paired follow-up), and list the two Playwright HUD specs + helper in the file map. Nothing else in the flow changes. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(brain-orb): name the symmetric latch at the zoom branch so nobody re-decides per event (#2538) The block comment above panelCanScroll() states the gesture rule ("every later event of the gesture keeps that route"), but the line a future reader would actually edit — the zoom branch that runs while `can` is true for a zoom-latched gesture — only said "zoom-latched". That is exactly where an `if(wheelMode==='zoom' && can) return;` "improvement" would land and quietly turn a zoom flick into an inspector scroll (the reported bug's mirror image). Say it at that line: the latch is symmetric by design, the first event decides, and spec A4 pins it. Comment only — no behaviour change; spec A re-run green (9 passed). Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(brain-orb): the ?v= bullet — first orb edits since v0.8.0, not since vendoring (#2538, #2539) "the first edits to the orb since it was vendored" is false: `git log --all -- src/frontend/public/brain-orb/orb.js` shows the Phase 2–4 PRs (#1395, #1407, #1494 and their hardening follow-ups) editing orb.js in-repo after #1389 vendored it. What IS true, and what the cache-bust convention hinges on, is that #2538/#2539 are the first orb edits to reach `dev` since the v0.8.0 release merge (the only commit touching these files on origin/dev). Say that instead. Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Eugene Vyborov <[email protected]> Co-authored-by: Claude Fable 5.1 <[email protected]>
Summary
Brain Orb Phase 4a — owner-gated KB-write actions (capture a note · link two notes). The low-risk half of Phase 4, split out during
/autoplan(two independent reviews).X-Orb-Token) to the platform broker with Bearer JWT.BRAIN_ORB_WRITE_ENABLEDkill-switch (default OFF, distinct fromBRAIN_ORB_ENABLEDso writes can be disabled without downing read/voice).capture_note/link_notesfolded into the locked Gemini manifest; shared users keep the read-only Phase-3 manifest.What's deferred (→
abilityai/trinity-enterprise#66, Phase 4b)run_skill(headlessclaude -pexec), automatic transcript capture, and transcript injection. Both reviews flagged these as the real risk surface: they need the #1083 detached-execution subsystem, atemplate.yamlallow-list ceiling, a tool-constrained injection sub-invocation, and a Gemini-Live-transcription spike (the constrained-token path has no working precedent in-repo — the only transcription reader is dead code). #66 is filed (sub-issue of the epic #58) and carries every review finding.Changes
Backend —
routers/agent_brain_orb.py(GET /brain-orb/actions,POST /brain-orb/action, bothOwnedAgentByName; action enum-validated → 400 on deferred verbs; body-cap; per-verb rate limit; audit;Idempotency-Keywith the verb folded into the key),services/brain_orb_voice_service.py(can_write→ owner-only write tools),config.py+routers/settings.py(BRAIN_ORB_WRITE_ENABLED→brain_orb_write_available).Agent-server (Invariant #5) —
routers/brain_orb.pymirrors the routes over the hardened_run_hook+ the agent's~/.trinity/brain-orb/actionconvention hook (agent owns the write, Invariant #8; stdin-only, no shell string).Frontend —
orb.js(rewire actions to the broker + Bearer + Idempotency-Key, un-hide#actionsviabody.brain-orb-writeonly after the broker confirms owner + flag + hook, add the voice write handlers, double-submit guard),orb-trinity.css/AgentBrainOrb.vue/stores/sessions.js(flag gating + init handshake relay).Test Plan
pytest tests/unit/test_brain_orb.py— 62/62 pass (14 new: owner-gate 403, flag-off 404, no-hook 404, enum 400, body 413, rate 429 + claim-release, idempotency replay/409, owner-only voice manifest, agent-server action hook)/review— 0 critical (2 informational auto-fixed)/cso --diff— 0 findings ≥ 8/10 (report:docs/security-reports/cso-diff-2026-07-01.md)~/.trinity/brain-orb/actionhook (agent-side; the generic surface ships here, likepre-check/scope/search)Refs abilityai/trinity-enterprise#61 · deferral abilityai/trinity-enterprise#66
🤖 Generated with Claude Code