Skip to content

Commit be29c41

Browse files
committed
feat(viz): add viz monitor web dashboard
Introduces the `humanize monitor web` command and its Flask + SPA dashboard for RLCR sessions, plus the accumulated review-phase fixes and UX polish. Feature - Per-project session discovery and summary (state.md, goal tracker, round summaries, review results, methodology reports). - Pipeline canvas with snake-path node layout, SVG connectors, pan / zoom, and per-round flyout details. - Session-detail page carries a below-canvas live-log panel with a three-state toggle (collapsed / normal / expanded) driven by --log-h and a single grid-template-rows declaration. Clicking a pipeline node auto-collapses the log; closing the flyout restores the prior state. - Incremental pipeline update (_updatePipelineIncremental) appends or replaces individual nodes and redraws only the SVG connectors, preserving zoom / pan across round additions. - Diff-based home refresh: only cards whose rendered HTML changed are replaced; unchanged cards stay untouched. - Per-session SSE live-log streaming from ~/.cache/humanize with snapshot / append / resync / eof / retained-replay protocol. - Active-log selection mirrors the CLI monitor: pick the top round's codex-run log, with codex-review / gemini-run / gemini-review fallbacks. - REST + WebSocket + SSE transports. Localhost binds skip auth; remote binds require a bearer token (Authorization header for fetch, ?token= query for SSE) plus origin-matched CSRF gating on every mutating route. - Ops-menu Preview Issue flow: calls local Claude CLI to generate a sanitized methodology report (humanize issue taxonomy), shows a preview modal, and submits via `gh issue create --repo humania-org/humanize`. Falls back to a copy-to-clipboard path when gh is unauthenticated. - Active-session dynamic progress visualization, methodology report generation via local Claude CLI, and a comprehensive frontend test suite. Correctness and safety - broadcast_message uses set.difference_update to avoid the UnboundLocalError from Python treating `-=` as a local rebind. - Session path validation rejects `..`, dotfiles, symlink escapes; plan-file reads are constrained to the project / session dir. - Remote-mode auth fail-closed when no token is configured. - CSRF layer enforced on every mutating route, including wildcard binds and IPv6 literals. - Parser accepts table-form acceptance criteria and legacy / single-letter criterion ids; multi-id table cells are split correctly; COMPLETE verdict only fires on terminal lines. - Finalize-phase classification scoped to the live round, and skip-impl sessions correctly classify round 0 as review-only. Transport and watcher - watcher.py starts a cache-log observer per active session that broadcasts `round_added` when a new round-N-*.log file appears, so the dashboard switches the live-log pane to the new round without waiting for the next state.md write. - SessionWatcher.on_session_created hook primes cache-log observers for brand-new sessions; every event retries the hook so the state-dir-before-cache-dir race eventually heals. - Non-destructive toggleTheme (no DOM rebuild). The analytics route is the only surface whose charts bake CSS vars into SVG at render time, so that route alone re-renders on theme change. - Remote-mode slow polling (10s) uses the same targeted refresh helpers as the WS path so card counters and pipeline nodes catch up without a full-page reload. - Session-detail refresh race guard: after awaiting /api/sessions/<id>, re-check the active route + layout skeleton before mutating DOM. Install and CLI - Preflight codex_hooks and idempotent hook merge when paths contain spaces. - Relaxed runtime detection and tolerate unwritable default shim paths. - `humanize monitor web` foreground mode passes --host explicitly, IPv6 brackets in the printed URL, readiness probe is fail-closed. Parser and API - /api/sessions summary carries every field the terminal `humanize monitor rlcr` status bar needs (push_every_round, ask_codex_question, agent_teams, drift, stall count, ultimate_goal, tasks_active / deferred, active_log_path, git_status, etc.). - cache_logs entries carry round / tool / role / path / basename for deterministic client-side selection. Version: 1.17.0. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
1 parent 5990827 commit be29c41

41 files changed

Lines changed: 12847 additions & 7 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ temp
55
/.claude/settings.json
66
/.claude/scheduled_tasks.lock
77

8+
# Local Codex CLI marker (empty file occasionally left behind in worktree)
9+
/.codex
10+
811
# Humanize state directories (runtime-generated, project-local)
912
.humanize/
1013
.claude-flow/

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,15 @@ Requires [codex CLI](https://github.com/openai/codex) for review. See the full [
6868
humanize monitor skill # All skill invocations (codex + gemini)
6969
humanize monitor codex # Codex invocations only
7070
humanize monitor gemini # Gemini invocations only
71+
humanize monitor web # Browser dashboard for the current project
7172
```
7273

74+
The `humanize monitor web` subcommand launches a per-project browser dashboard
75+
that layers on top of the same data sources the terminal monitors read. It runs
76+
in the foreground by default; pass `--daemon` for the background tmux launcher
77+
and `--host` / `--port` / `--auth-token` to configure remote access. See the
78+
upgrade note: `/humanize:viz` has been removed in favour of `humanize monitor web`.
79+
7380
## Monitor Dashboard
7481

7582
<p align="center">

docs/drafts/viz-monitor-web.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Draft: Optimize viz-dashboard — Merge into `humanize monitor` as a Web View
2+
3+
## Background
4+
5+
The `feat/viz-dashboard` branch currently introduces a `/humanize:viz` Claude
6+
slash command and a local visualization dashboard for Humanize. While the
7+
dashboard does show some data, the visualization of a *live, dynamically
8+
running RLCR loop* is not clear enough today: status, progress per round, and
9+
streamed log output are hard to follow as a loop progresses.
10+
11+
Separately, Humanize already ships a CLI-side monitoring capability that the
12+
user runs in another terminal (NOT inside Claude Code):
13+
14+
```bash
15+
source <path/to/humanize>/scripts/humanize.sh # or add to .bashrc / .zshrc
16+
17+
humanize monitor rlcr # RLCR loop
18+
humanize monitor skill # All skill invocations (codex + gemini)
19+
humanize monitor codex # Codex invocations only
20+
humanize monitor gemini # Gemini invocations only
21+
```
22+
23+
This monitor capability already captures live state (RLCR rounds, skill / Codex
24+
/ Gemini invocations, log output). The web dashboard does not need to invent
25+
its own capture pipeline — it should consume what `humanize monitor` already
26+
provides.
27+
28+
## Goal
29+
30+
Optimize the viz-dashboard branch so that:
31+
32+
1. The dashboard becomes a **web view** layered on top of the existing
33+
`humanize monitor` data sources, rather than an independent capture layer.
34+
2. The dashboard can show **multiple live RLCR loops simultaneously**, with
35+
per-loop status and streamed log output.
36+
3. The entry point moves out of Claude (no more `/humanize:viz` slash command)
37+
and into the `humanize monitor` CLI command, as a new web-online viewing
38+
subcommand.
39+
4. The new capability targets **online / remote viewing in a browser**, not a
40+
local-only viewer that requires the user to be on the same machine running
41+
Claude.
42+
5. Useful features from the existing viz-dashboard branch — notably **cross-
43+
conversation querying** (browsing past sessions / loops across different
44+
Claude conversations) — are preserved.
45+
46+
## Non-goals
47+
48+
- Reimplementing the monitor capture pipeline (`humanize monitor rlcr/skill/
49+
codex/gemini`). The dashboard consumes it; it does not replace it.
50+
- Continuing to ship `/humanize:viz` as a Claude slash command.
51+
- Adding chart panels or features explicitly removed in commit 1b575fe
52+
("multi-project switcher + restart + remove chart panels").
53+
54+
## Required behaviors
55+
56+
1. **CLI entry point unification**
57+
- Remove `commands/viz.md` and any `/humanize:viz` Claude command surface.
58+
- Add a new `humanize monitor` subcommand (name to be agreed during
59+
planning, e.g. `humanize monitor web` or `humanize monitor dashboard`)
60+
that starts the web dashboard server.
61+
- The other `humanize monitor rlcr|skill|codex|gemini` subcommands must
62+
keep working unchanged (terminal-attached live tail).
63+
64+
2. **Live multi-loop view**
65+
- The web dashboard MUST be able to display 2+ concurrently running RLCR
66+
loops at the same time, each with:
67+
- current status (running, paused, converged, stopped, …)
68+
- current round / phase
69+
- live streamed log output, updated in near real time
70+
71+
3. **Reuse existing monitor data**
72+
- The dashboard MUST source its data from the same files / events that
73+
`humanize monitor rlcr/skill/codex/gemini` already read. It MUST NOT add
74+
a parallel capture mechanism (no new hooks just for the dashboard).
75+
76+
4. **Online / remote-viewable**
77+
- The dashboard MUST be reachable from a browser over the network, not
78+
only via `localhost` on the machine running Claude. Concrete binding /
79+
auth design to be agreed during planning.
80+
81+
5. **Cross-conversation history**
82+
- Cross-conversation querying (browsing past loops from different Claude
83+
conversations / sessions) from the existing viz-dashboard branch MUST be
84+
preserved.
85+
86+
## Branch hygiene
87+
88+
Before implementation begins, the branch `feat/viz-dashboard` MUST be rebased
89+
onto the latest `upstream/dev` (humania-org/humanize). Several relevant changes
90+
have landed on `upstream/dev` after the branch diverged, including:
91+
92+
- `Add ask-gemini skill and tool-filtered monitor subcommands` (introduces the
93+
`humanize monitor skill|codex|gemini` subcommands the dashboard must reuse)
94+
- `Remove PR loop feature entirely` (the viz-dashboard branch still references
95+
PR-loop concepts via `commands/cancel-pr-loop.md`, `commands/start-pr-loop.md`,
96+
`hooks/pr-loop-stop-hook.sh`)
97+
- Multiple monitor / hook fixes
98+
99+
The rebase is therefore both a precondition for correctness (the dashboard
100+
consumes the new monitor subcommands) and a cleanup step (PR-loop references
101+
must be dropped).
102+
103+
## Out of scope (for this plan)
104+
105+
- Changes to RLCR semantics, hooks, or skill behavior.
106+
- Authentication providers, identity systems, or multi-user account models —
107+
basic remote-access protection is in scope, but full IAM is not.

0 commit comments

Comments
 (0)