Skip to content

Web visualization layer — Memory Agent, Visualized (FastAPI + React/Vite)#5

Open
Tbearly55 wants to merge 1 commit into
mainfrom
web-visualization
Open

Web visualization layer — Memory Agent, Visualized (FastAPI + React/Vite)#5
Tbearly55 wants to merge 1 commit into
mainfrom
web-visualization

Conversation

@Tbearly55

Copy link
Copy Markdown
Collaborator

Turns the three-terminal demo into one screen. Additive — everything lives under web/ and never touches the agent scripts (create_agent.py, run_session_*.py). Replays captured artifacts, so the demo needs no network.

Three views (the terminal pains, fixed)

  • Answer Compare — session answers side by side; new words in B highlighted (client-side LCS word diff). The "it got sharper" moment.
  • Memory Browser — clickable /mnt/memory/ file tree at the selected session.
  • Memory Diff (the S8 headline) — git-style red/green of what the agent added/updated, with a difflib unified diff for modified files.

Capture layer

  • web/snapshot_memory.py — dumps a memory store to web/data/memory_s<N>.json (lifts inspect_memory.py's list/retrieve loop). Injects truststore so the Anthropic SDK works behind corporate TLS inspection — the same fix skill_studio uses, and the cause of the APIConnectionError we hit earlier.
  • web/parse_outputs.pyoutputs/session*.txtweb/data/sessions.json.

Backend — web/backend/main.py (FastAPI)

GET /api/sessions, GET /api/memory/{n}, GET /api/diff?from=&to=. Diff is computed, not captured, so re-running sessions never desyncs it. Serves the built frontend at / for a single-port prod deploy.

Merged decisions

  • Stack: FastAPI + React/Vite, replay-only, core scope (compare + browser + diff) — as chosen.
  • Carried over from skill_studio: KPMG cobalt/light-blue accents (on a stage-friendly dark theme), .env loading, truststore TLS handling, /api/ REST conventions.
  • Ships sample Helios/Northwind data so the UI runs before any live session.

Run

pip install -r web/requirements.txt
cd web/frontend && npm install && cd ../..
python web/dev.py        # FastAPI :8000 + Vite :5173 -> open http://localhost:5173

Verification status (honest)

  • ✅ Backend verified live against the sample data: /api/sessions (3 sessions), /api/memory/1 (8 files), /api/diff?from=1&to=22 added + 2 modified + 6 unchanged, from=2&to=3all unchanged (reinforces the S3 flag-and-ask story). All Python compiles.
  • ⚠️ Frontend not built/run here — Node/npm are not installed on this machine. The React code is complete but unbuilt; run npm install && npm run build (or python web/dev.py) on a machine with Node 18+ to verify the UI.

🤖 Generated with Claude Code

Replay-based visualizer for the Helios memory-agent demo. Additive — lives
entirely under web/ and never touches the agent scripts.

Capture layer:
- web/snapshot_memory.py — dump a memory store to web/data/memory_s<N>.json
  (lifts inspect_memory.py's list/retrieve loop; injects truststore so the
  Anthropic SDK works behind corporate TLS inspection).
- web/parse_outputs.py — outputs/session*.txt -> web/data/sessions.json.

Backend (web/backend/main.py, FastAPI):
- GET /api/sessions, /api/memory/{n}, /api/diff?from=&to= (per-file
  added/removed/modified/unchanged + difflib unified diff). Serves the built
  frontend at / for single-port prod.

Frontend (web/frontend, React + Vite):
- Answer Compare (word-level highlight of what got sharper), Memory Browser
  (clickable /mnt/memory/ tree), Memory Diff (git-style red/green — the S8
  headline). Stage-friendly dark theme with KPMG accent colors from skill_studio.
- ←/→ steps Session B; one-command dev launcher (web/dev.py).

Ships sample Helios/Northwind data so the UI runs before any live session.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant