feat(run-dash): universal agent run observability + Codex L2 integration#16
Open
feat(run-dash): universal agent run observability + Codex L2 integration#16
Conversation
Specs only (no code) under _common/apex-dash/ for a Web dashboard that visualises long-running /nexus apex sessions. Generators (forge/builder) materialise per-repo instances under <repo>/.agents/apex-dash/ via the prompt in GENERATION.md. Why: apex chains span 8-25 agents across two sub-orchestrators and an engine boundary; postmortem-only logs are insufficient for live ops. Covers: events.jsonl schema (single source of truth), declarative topology, UI/animation spec, emit protocol, auto-spawn pre-flight.
- _common/scripts/apex-emit.sh: portable bash emitter that producers (Nexus apex agents and Codex orbit subagents) call to append events.jsonl entries. No-op when APEX_RUN_ID is unset. - _common/apex-dash/POSTMORTEM.md: spec for run_end postmortem generation and Lore handoff. - _common/apex-dash/sample/: end-to-end Bun + Hono + React + xyflow reference MVP. Tails events.jsonl over SSE, renders the phased topology with state animations, Risk Gate radar, Orbit convergence chart, active agents cards, checkpoints, event stream, and a postmortem export button after run_end. Serves as a golden reference for forge/builder when materialising per-repo dashboards via GENERATION.md.
Lift the dashboard from "apex only" to "any run kind" by renaming
apex-dash → run-dash and splitting the schema into a core + per-recipe
extensions.
- Schema: events.jsonl gains run_kind / parent_agent / depth / recipe in
the core. Apex-only kinds (phase_enter, risk_gate, orbit_iter,
engine_switch) remain as `apex` extensions.
- Modes: apex (fixed topology), recipe (step rail; feature / bug /
refactor), generic (dynamic DAG built from parent_agent + depth, with
Gantt timeline) auto-selected from run_kind.
- Topologies: split TOPOLOGY.md into TOPOLOGIES/{apex,feature,bug,
generic}.md.
- Helper: scripts/run-emit.sh handles every recipe; scripts/apex-emit.sh
is a thin alias for backward compatibility.
- Hooks: INTEGRATION.md documents Claude Code SessionStart / PreToolUse
/ PostToolUse / Stop hook configuration so any session can be observed
without per-skill changes.
- Sample: reducer tracks run_kind / steps / dynamicNodes / toolCounts;
Header surfaces a run_kind colour badge; ships feature-* and manual-*
example runs alongside the existing apex run.
Backward compatible: APEX_RUN_ID / APEX_DASH_DIR / APEX_DASH_DISABLED
env vars and apex-emit.sh continue to work.
- App.tsx derives mode from run_kind and switches panels:
apex → PhaseRail + Topology + RiskGateRadar + OrbitChart
recipe → StepRail + Topology + ToolHistogram + OrbitChart
generic → rail placeholder + DynamicGraph + ToolHistogram + Timeline
- StepRail.tsx: dynamic step rail driven by step_enter / step_exit events
- DynamicGraph.tsx: dagre-laid-out DAG built from dynamicNodes
(parent_agent + depth) with xyflow rendering
- Timeline.tsx: SVG Gantt of completed + active agents with tool_use ticks
- ToolHistogram.tsx: Recharts BarChart of top-6 tool counts
- Add @dagrejs/dagre dependency
- Fix server boot log ("run-dash sample server listening")
- styles.css: step-rail / timeline / empty-canvas / rail-placeholder
- _common/RUN_DASH_PROTOCOL.md: agent-side contract (L1 hooks / L2 recipes / L3 specialists) defining who emits which event, env vars, recipe override pattern, state-sharing files, failure behaviour, and end-to-end verification procedure - nexus/SKILL.md: add "Live Dashboard Integration" section pointing to the protocol and the per-recipe emit checklists - nexus/references/apex-recipe.md: add §13 "Live Dashboard Emit" with the full emit-point table and a copy-paste skeleton for apex orchestration - nexus/references/feature-recipe.md: new — 4-step (Discover/Spec/Implement /Ship) recipe with topology link and emit skeleton - nexus/references/bug-recipe.md: new — 4-step (Reproduce/RCA/Fix/Verify) recipe with topology link and emit skeleton Specialist agents (plea, accord, atlas, builder, …) intentionally NOT modified — Claude Code hooks already capture every Agent invocation.
Codex CLI lacks PreToolUse / PostToolUse hooks, so L1 auto-instrumentation does not apply. Document Codex as L2-only and ship codex-wrap.sh, a pure-bash wrapper that brackets a Codex spawn with agent_start / agent_end events tagged engine=codex_cli, preserving stdout, stderr, and exit code. - _common/scripts/codex-wrap.sh: new wrapper (silent when RUN_ID unset) - RUN_DASH_PROTOCOL.md: new section 11 covering Codex L2-only contract - INTEGRATION.md section 2.5: rewritten with wrapper usage and limits - apex-recipe.md section 13: Phase 6 skeleton uses codex-wrap; new section 13.5 calls out L2-only constraints (no per-tool ticks)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apex-dash(Apex 専用ダッシュボード) をrun-dashにリネーム/汎化し、/nexus apexだけでなくfeature/bug/refactorの各 Recipe、単発の skill 起動、手動セッションまで含めた任意のエージェント実行をリアルタイム可視化できるようにしました。L1 Claude Code hooks / L2 recipe orchestrator / L3 specialist の3層プロトコルとしてRUN_DASH_PROTOCOL.mdに成文化し、Codex CLI 用の L2-only ラッパー (codex-wrap.sh) を追加して engine boundary も観測可能にしています。Changes
Core protocol
_common/RUN_DASH_PROTOCOL.md(新規): L1/L2/L3 責務分離マトリクス、recipe override パターン、env 規約、Codex CLI L2-only 契約 (§11)。_common/scripts/run-emit.sh(新規): pure bash の event emit ヘルパー。RUN_ID未設定時は silent no-op、mkdir lock で seq、ISO8601 ms タイムスタンプ。apex-emit.shは薄いエイリアスとして互換維持。_common/scripts/codex-wrap.sh(新規): Codex CLI 起動をagent_start engine=codex_cli/agent_end status/durationで挟む薄ラッパー。stdout/stderr/exit code 透過。Dashboard spec (
_common/run-dash/)README.md/DESIGN.md/EVENTS.md/INTEGRATION.md/UI.md/POSTMORTEM.md/GENERATION.md: 3 mode (apex / recipe / generic) アーキテクチャ、event schema、生成手順を完全英語化。TOPOLOGIES/{apex,feature,bug,generic}.md: Recipe ごとの UI トポロジ。generic は dynamic DAG 構築アルゴリズムを定義。Working MVP (
_common/run-dash/sample/)[project] run-id · run_kind形式、5s polling。Recipe wiring
nexus/SKILL.md: Live Dashboard Integration セクション + recipe override パターン参照。nexus/references/apex-recipe.md§13: 完全 emit スケルトン、Phase 6 でcodex-wrap.sh使用、§13.5 に Codex L2-only 制限を独立記載。nexus/references/feature-recipe.md(新規) /bug-recipe.md(新規): step-based emit checklist。Layout (rename)
_common/apex-dash/→_common/run-dash/(リネーム + 内容拡張)APEX_RUN_ID/APEX_DASH_DIR/APEX_DASH_DISABLED) はrun-emit.shで引き続き honour。Architecture
Test plan
run-emit.shsmoke (apex / feature / manual の 3 fixture を実 events.jsonl から再現)codex-wrap.shsmoke: 成功 / exit 7 失敗 /RUN_ID未設定 (silent no-op) の 3 pathbun run dev起動、RUN_DASH_EVENTS_DIR=$HOME/.claude/run-dashで global mode 動作確認、3 sample run を picker から切替表示SessionStart→ manual run が picker に出現)/nexus apex実行時に L2 emit + L1 自動 emit がマージされて表示Notes
~/.claude/hooks/run-dash-*.shおよび~/.claude/settings.jsonの hook 配線はリポジトリ外 (このPRには含まれない)。_common/run-dash/sample/に常駐し、RUN_DASH_EVENTS_DIRを~/.claude/run-dash/に向けることで全プロジェクトの run を 1 ダッシュボードで観測する global mode を推奨。