Commit Graph

28 Commits

Author SHA1 Message Date
Kartikeya 0f3b55a4f9 feat: one-click join + live pod presence
Join UX: click a member's name to join directly, or type a name and "Join"
(adds to roster + joins) — removes the redundant dropdown step. "Add" still
adds to the roster without joining.

Presence: new GET /api/presence (LiveKit RoomServiceClient) reports who's
connected per pod. The pod list polls it and shows a "N in room" badge plus a
green dot on members currently connected, so people can see active pods and jump in.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 16:46:47 -07:00
Kartikeya 8271188cf1 feat(frontend): live room view, beat connectivity test, session resume
- PodView now shows LIVE LiveKit participants (updates as people join/leave,
  active-speaker highlight) instead of the static roster — no refresh needed.
- "Play beat" button publishes a generated 4/4 beat into the room so every
  participant hears the same audio (speaker lights up) — a real connectivity test.
- "Share my screen" is now a deliberate button; joining only connects to the
  room (fast/reliable), so a denied/slow screen prompt no longer fails the join.
- Session persisted in sessionStorage with auto-reconnect, so a refresh keeps
  you in the room instead of dropping back to the pod list.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 16:37:32 -07:00
Ramis 65a0791022 docs(plan): audit server state + mark tasks 1-5 done, reflect actual arch
Server synced to HEAD (7ff750a). Actual arch differs from original spec:
- Frame capture: LiveKit track subscription (not HTTP /ingest)
- State layer: observations/collisions/interventions/outcomes collections
- Event detection: collision-based detector (not Gemini event prompt)
- Voice: stub only — logs but no audio yet

Tasks done: 1, 2, 3, 4, 5, 10
Tasks partial: 6 (voice stub), 8 (memory persists, no warm-start log)
Tasks missing: 2b (git watcher), 7 (SessionView.tsx)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L8xxvqZtPhzkigb8Z7U4KV
2026-06-27 16:08:30 -07:00
Kartikeya 7ff750ad5e harden: address adversarial review of Pods CRUD
Backend: atomic create with insert-retry-on-duplicate-key (removes slug
TOCTOU race + wrong 400s), resilient per-index creation so a unique-index
failure can't silently drop the constraint or block seeding, idempotent
race-safe seeding via $setOnInsert, type validation + size caps on all pod
fields/members, removeMember no-ops without a write, /api/outcome guarded.
Frontend: per-pod busy state (one mutation no longer disables every card),
joined pod derived from the list (can't go stale), create keeps inputs on error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 16:02:40 -07:00
Kartikeya 4ddc59be08 fix(frontend): self-destroying service worker to avoid stale UI during dev
The precaching PWA SW was serving an old bundle after deploys (stale UI).
Switch to selfDestroying so it unregisters + clears caches on all clients;
deploys are now always fresh. Re-add a tuned PWA before the demo.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 15:52:24 -07:00
Kartikeya 5a03ad4d6b feat: Mongo-backed Pods with full CRUD + member management
Pods are persisted in MongoDB and CRUD'd via /api/pods (list/create/get/
update/delete + add/remove member). Shared Pod reshaped to a persisted entity
(members: string[], description, timestamps) + PodInput. Backend seeds Demo/
Frontend/Backend Pods on first run (Squad -> Pod rename). Frontend replaces
hardcoded teams with live data: PodCard (member chips add/remove, inline edit,
delete, join) + CreatePodForm; App fetches+mutates via API. Removes teams.ts/
TeamCard; gitignores test artifacts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 15:49:05 -07:00
Ramis 789f0da61b docs: remove per-person ownership assignments from PLAN.md and CLAUDE.md
No fixed ownership — any teammate can pick up any task.
PLAN.md: drop Owner field from all tasks, remove team assignments table.
CLAUDE.md: remove ownership map table and person-specific lane rules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFbfi4Cmb7BY75Wtne7bZn
2026-06-27 15:46:40 -07:00
Ramis b4c0107e82 chore(frontend): update demo teams — Zander out, Shakthi in
Demo Pod: remove Zander, keep Karti/Yahya/Ramis/Shakthi
Frontend Squad: replace Zander with Ramis

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFbfi4Cmb7BY75Wtne7bZn
2026-06-27 15:43:33 -07:00
Ramis e16eff83ed docs(claude): add documentation-first enforcement rule
Hard gate: all code must trace to docs/PLAN.md task or a spec.
Claude must stop, consult, and update docs before writing unplanned code.
Includes off-plan signals checklist and rationale for 4-person concurrent team.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFbfi4Cmb7BY75Wtne7bZn
2026-06-27 15:41:49 -07:00
Ramis 9ad65331c3 docs: add git watcher script task + update engineer_states schema
- PLAN.md: add task 2b — scripts/podman-agent.mjs writes git signals
  directly to MongoDB (changedFiles, diffStat, branch, recentCommit)
  every 15s; Hermes reads merged vision+git state for event detection
- mongodb.md: extend engineer_states with git fields, document two-writer
  upsert pattern (vision fields vs git fields, no conflict)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFbfi4Cmb7BY75Wtne7bZn
2026-06-27 15:39:18 -07:00
Kartikeya 3fc19194f2 feat(backend): persist memory to MongoDB
Replace the in-memory store with a real MongoDB-backed store. Adds memory/db.ts
(client singleton, typed collections, startup ping + indexes) and rewrites
record{Observation,Collision,Intervention,Outcome} to insert into Mongo
(best-effort — failures log, don't crash). Server connects on startup and
exposes GET /api/memory/stats for verification.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 15:34:59 -07:00
Ramis e8fb91232f docs(claude): add 4-person concurrent team context to CLAUDE.md
Tell Claude this repo has 4 simultaneous owners with distinct lanes.
Adds ownership map, rules for staying in lane, merge conflict guidance,
and integration point contract rules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFbfi4Cmb7BY75Wtne7bZn
2026-06-27 15:29:20 -07:00
Ramis 34d923374a chore: remove docs/generated, expand PLAN.md into full implementation plan
- Remove all docs/generated/* (stale research output from prior workflow)
- Rewrite PLAN.md as ordered implementation plan: 10 tasks by dependency + demo criticality
- Each task has owner, estimate, dependencies, specific files to create/modify
- Cut line separates must-ship from nice-to-have

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFbfi4Cmb7BY75Wtne7bZn
2026-06-27 15:27:23 -07:00
Ramis 923ab1cf58 docs: finalize PodMan architecture and write full integration specs
Replaces v1 plan with locked architecture:
- Hermes orchestrator: POST /ingest → Gemini Vision → MongoDB → event detection → Gemini Live 2.5 voice via LiveKit Agents
- Four MongoDB collections: engineer_states, ownership_map, events, nudges
- Continual learning via ownership_map persisting across sessions

New files: docs/idea.md, docs/gemini.md, docs/livekit.md, docs/mongodb.md, docs/digitalocean.md, docs/demo-setup.md
Updated: README.md, docs/PLAN.md (12-hour build plan), database/README.md, infra/README.md, .env.example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFbfi4Cmb7BY75Wtne7bZn
2026-06-27 15:27:23 -07:00
Kartikeya e26961d526 feat(frontend): team-browsing GUI with pod view
Replace the single join form with a richer UI: team cards (members as
avatars, repo, description), a member picker, and a post-join PodView showing
pod members (you highlighted) plus a PodMan panel with a slot for live
intervention cards. Adds Avatar/TeamCard/PodView components.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 15:17:07 -07:00
Kartikeya fc3752bbe9 feat(frontend): dev mock-join fallback when LiveKit unconfigured
If the backend returns the placeholder LiveKit URL, skip the real connect and
screen capture and drop into the post-join state (with a DEV MODE banner) so
the connected UI is developable without LiveKit creds or HTTPS. Real joins
also guard getDisplayMedia behind isSecureContext.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:56:04 -07:00
Kartikeya 6bf359f4d4 fix: restore CORS + align frontend with /api/token endpoint
The canonical-architecture rewrite dropped app.use(cors()) and moved the
token route to POST /api/token ({room,identity,name}), but the frontend
still called the old /pods/:id/token — causing "Failed to fetch" in the
browser. Re-add CORS and update fetchPodToken to the new contract.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:53:26 -07:00
Kartikeya 48d8ed8aaf feat(frontend): team + engineer dropdowns on join screen
Replace free-text name/pod inputs with select-only dropdowns (pick a team,
then yourself from its members) for fast R&D iteration. Demo teams live in
lib/teams.ts until pods are persisted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:44:18 -07:00
Kartikeya 2d7adea8e5 docs: add workflow research, architecture, strategy, and critique
Generated by the planning workflow: validated API findings (Gemini/LiveKit/
GitHub/DO), full architecture synthesis, winning strategy, and red-team critique.
Canonical source files staged under docs/generated/files/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:31:25 -07:00
Kartikeya da5b2622b2 Integrate canonical architecture: two-process backend + LiveKit agent
Promote all 12 staged canonical files from docs/generated/files/ to their
live paths, creating the full PodMan architecture:

Backend:
- server.ts: HTTP service (token mint, sync-PR, outcome recording, /health, WS relay)
- agent.ts: worker joining LiveKit room, grabbing screenshare frames at ~1fps
- agent/podman.ts: orchestrator loop (vision -> collision detection -> intervention)
- env.ts: flat env var accessors replacing nested stub
- vision/gemini.ts: JPEG -> Gemini vision -> EngineerContext (real implementation)
- collision/detector.ts: fused vision+GitHub collision detection (the moat)
- github/client.ts: Octokit wrapper with caching + sync PR creation
- memory/store.ts: extended with recordObservation/recordCollision/recordIntervention/recordOutcome helpers
- memory/vectors.ts: stub for Voyage+Atlas vector recall (Loop A)
- memory/policy.ts: stub for intervention policy gate (Loop B)
- voice/live.ts: stub for Gemini Live TTS voice output

Shared:
- messages.ts: LiveKit data-channel wire protocol (DataMessage, InterventionOutcome, TeamModel, LocalGitReport)
- index.ts: re-exports messages module

Frontend:
- livekit/useScreenPublish.ts: hook for joining pod and publishing screenshare
- livekit/useInterventions.ts: hook for receiving collision cards and responding
- lib/api.ts: fetchToken + postOutcome HTTP helpers

Database:
- database/init.ts: MongoDB Atlas collections + indexes + vector search index

Infra:
- infra/.do/app.yaml: DO App Platform spec (static_site + service + worker)

Retire stubs superseded by canonical decomposition:
- backend/src/index.ts (replaced by server.ts)
- backend/src/intervention/engine.ts (logic now in agent/podman.ts)
- backend/src/livekit/token.ts (token minting now in server.ts)

Install missing dependencies: @livekit/rtc-node, sharp, mongodb, ws, @types/ws

Type error fixes:
- vision/gemini.ts: use MediaResolution.MEDIA_RESOLUTION_LOW enum value (not string literal)
- agent/podman.ts: wrap SuggestedActionKind into { kind: action } SuggestedAction object

All packages pass pnpm -r typecheck and pnpm -r build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:27:14 -07:00
Kartikeya 253c7438fb style: apply prettier formatting to docs
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:17:14 -07:00
Kartikeya 2223b190f6 feat(infra,database): DO deploy + memory schema
infra: Dockerfile (backend from monorepo root) + DigitalOcean App Platform
spec with health check and secret env vars. database: MongoDB Atlas + Voyage
vector-memory schema and the continual-learning loop notes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:17:08 -07:00
Kartikeya ca0ca37adc feat(frontend): scaffold PWA with LiveKit join flow
Vite + React + TS + Tailwind v4, installable PWA. Join-pod UI that fetches a
LiveKit token from the backend, connects to the pod room, and publishes screen
+ mic so PodMan can watch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:17:08 -07:00
Kartikeya 6559ad3944 feat(backend): scaffold PodMan agent pipeline + token server
Express server with /health and a LiveKit token endpoint. Module skeletons
for the full loop: vision (Gemini), GitHub fusion, collision detector (pure,
testable), intervention engine, and continual-learning memory store. Approve
native build scripts (esbuild/genai/protobufjs) at the workspace root.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:16:58 -07:00
Kartikeya 42c0de52b7 feat(shared): add core domain types
Pod/Engineer, EngineerContext (live pre-push signal), Collision, and
Intervention — the type contract between frontend and backend.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:07:11 -07:00
Kartikeya 7dd613d250 chore: set up pnpm workspace tooling
Root package.json with workspace scripts, pnpm-workspace.yaml, shared
tsconfig base, ESLint flat config, Prettier, editorconfig, .nvmrc, and
.env.example covering LiveKit/Gemini/GitHub/Atlas/Voyage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:07:11 -07:00
Kartikeya 3223e331f4 docs: add PodMan vision README and master plan
Define the product (ambient AI teammate that prevents merge collisions
before push), architecture, stack per folder, build order, and demo script.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:04:54 -07:00
Kartikeya 1bb15724c6 Initial monorepo scaffold
Set up top-level structure (backend, frontend, database, infra, shared,
docs) with .gitkeep placeholders, root README, and .gitignore.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:00:20 -07:00