Commit c703308
authored
feat(idef0): Pillar C — live onboarding agent (daemon + Agent SDK + camera chat) (#169)
## Summary
**The live onboarding agent (PRD-038 Pillar C).** Talk to your project
in the web chat and a **real local Claude Code session** answers —
grounded in the actual repo — while the **map moves as it explains**.
Two-tier + graceful: Tier 0 answers offline from `map.json`; Tier 1
upgrades to the live agent when the daemon is running.
This PR consolidates the Pillar C **shape + build + evidence**
(supersedes the shape-only #168).
## Proven end-to-end (EVID-096)
Spawned the daemon, connected a WS client, asked *"what is this project
and what is it for?"* — the local CC answered verbatim: *"@forgeplan/web
is a tiny zero-install npm CLI that scaffolds a pre-built SvelteKit app
into `.forgeplan-web/`, serves a read-only force-directed map of
Forgeplan artifacts… `npx @forgeplan/web start`…"* — then **called
`show_on_map` → `{zone: z.surfaces}`** and narrated the zone flow. Real
model turn, grounded, camera-driven.
## What's in it
- **RFC-034 + ADR-010** (active) — the daemon/protocol/camera/chat
architecture + the packaging decision (separate optional package +
spawn-only subcommand).
- **Phase 1** — `camera-bus` seam (the one primitive a chat uses to move
the RFC-033 tour camera) + Tier-0 chat (`map-chat`: client-grounded,
model-free, offline).
- **`agent/`** — NEW separate package `@forgeplan/web-agent` (ADR-010:
own deps `@anthropic-ai/claude-agent-sdk` + `ws` + `zod`, never in
core): a 127.0.0.1 WebSocket daemon booting a persistent Agent SDK
`query()` session in a **read-only** profile (Read/Glob/Grep +
`show_on_map`; deny Write/Edit/Bash), with an in-process
`createSdkMcpServer` `show_on_map` tool that relays camera frames.
- **`bin/commands/onboard-agent.mjs`** — spawn-only subcommand (rule 23:
`spawn`s the package, never imports it).
- **Tier-1 web wiring** — `agent-client.ts` (read-only WS client) +
`chat-store` Tier-1 (stream → assistant bubble; `show_on_map` →
camera-bus; degrades to Tier 0 when the daemon is down).
## Invariants
- **Rule 22**: the live path is browser↔daemon over `ws://127.0.0.1`;
`/api/*` is never involved.
- **Rule 23 / ADR-010**: core `bin/` stays `node:*`+citty+siblings
(spawn-only); the SDK lives only in the `agent/` package; root
`package.json` untouched.
- **Read-only**: the agent cannot mutate the workspace.
## Test plan
- `npx vitest run src/widgets/map-chat src/widgets/composed-map` →
**153/153**.
- `npx svelte-check` → **0 errors**.
- `node agent/scripts/smoke.mjs` → exit 0 (protocol + read-only profile
+ bind + `/health` + `{ready}`).
- Rule-23 allow-list grep over `bin/` → OK.
- **Live end-to-end turn** (above) — daemon + local CC + `show_on_map`
(EVID-096, CL3).
## To try it
`npx @forgeplan/web onboard-agent` in your project → the web chat
detects it (`● live`) → ask away.
Refs: PRD-038, RFC-034, ADR-010, EVID-096, RFC-033
🤖 Generated with [Claude Code](https://claude.com/claude-code)45 files changed
Lines changed: 12719 additions & 165 deletions
File tree
- .forgeplan
- adrs
- evidence
- rfcs
- agent
- bin
- lib
- scripts
- bin
- commands
- template
- src
- app/styles
- routes
- onboard
- playground
- widgets
- composed-map
- model
- ui
- map-chat
- model
- ui
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 112 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
Lines changed: 95 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
0 commit comments