Skip to content

Castle: YC demo build — light-mode rebuild, P26–P33, live agent + morning brief#12

Closed
Macintosh1011 wants to merge 6 commits into
mainfrom
yc-demo-build
Closed

Castle: YC demo build — light-mode rebuild, P26–P33, live agent + morning brief#12
Macintosh1011 wants to merge 6 commits into
mainfrom
yc-demo-build

Conversation

@Macintosh1011

@Macintosh1011 Macintosh1011 commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Everything on the yc-demo-build branch toward the 2026-06-15 YC demo. 6 commits, ~all additive.

What's in it

  • Platform (P26–P33) — email-allowlist audit/CSV/test, GitHub-sync CAS lock + webhook events, auth-derived FDE actor, zombie/chunk reapers, attention-rule expansion, founder-hours event log, and P33 multi-tenant readiness (organizations + members tables, nullable organization_id on the 8 operational tables, flag-gated resolveOrgId/scopeToOrg, backfill migration, isolation tests). All behind CASTLE_MULTITENANT (default off).
  • Hero chat pipelinetool_result event protocol (Hermes emits structured results), the tool-result renderer registry (severity cards / table / kanban / chips / json), NarrationRibbon, and action-confirmation cards (propose_mutation + accept/reject/undo). Tool-result widgets now persist in completed messages (reconstructed from agent_tool_events), and list_attention cards are clickable to their engagement.
  • Light-mode "Paper" redesignglobals.css token migration (warm eggshell, single honey-amber accent, soft health colors, shadow ladder), Fraunces + Inter + JetBrains via next/font, all ~20 UI primitives, chrome (TopNav/PageHeader/Breadcrumbs/cmd-K), and all 12 pages rebuilt (templates/extractions/overview/operator pages/assistant/connections/access/sign-in).
  • Assistant — workflow engine + a widget-rich morning brief (daily_digests).
  • Demo seed — 8 customers / 8 engagements / 6 templates+capabilities / 19 deployments / 6 extractions / honest-bumpy founder-hours / manual attention.

Verification

next build ✅ · tsc ✅ · vitest 142/142 · eslint: no new errors vs baseline.

Reviewer notes (please scrutinize)

  • Dev-auth bypass (convex/lib/assertOperator.ts, auth.ts, conversationAuth.ts, middleware.ts, app/page.tsx, lib/load-overview.ts): a local-only auto-operator gated on CASTLE_DEV_AUTH=1 (+ NODE_ENV !== production on the middleware). Inert unless that env var is set; intended for local demo/Loom only, never prod. Flagging it explicitly — confirm the gating is airtight.
  • scripts/loom-agent-worker.ts is a local dev stand-in for the Railway Hermes wrapper (reads ANTHROPIC_API_KEY from env, no secrets committed).
  • P33 query gating: please check no read path leaks across orgs when the flag is on.

@coderabbitai @greptileai review please.

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

Macintosh1011 and others added 6 commits May 31, 2026 13:14
…demo

Castle build toward the 2026-06-15 YC demo. Schema additions are all
additive (tool_result event kind + result_json, propose_mutation action
cards, assistant_* tables, P-phase tables, deployment_events, user_state).

- Hero flow: NarrationRibbon + tool-result renderer registry
  (table/cards/kanban/chips/json) + action confirmation cards w/ undo;
  chat-landing decomposed into components/chat/*.
- Hermes (serve.py): emits structured tool_result events + friendly names.
- Action backend: agentActions accept/reject/dismiss/undo + /api/actions/*
  + castle-mcp propose_action tool.
- P26 allowlist audit/testEmail/CSV; P27 GitHub sync CAS lock + webhook
  rename/archive/transfer; P28 auth-derived FDE actor; P30 zombie/chunk
  reapers + retry; P31 attention rules (underutilized, expiring,
  no-deployment, unanchored); P32 founder_hours event log.
- Assistant: workflow engine + morning-brief → daily_digests + /assistant
  page + assistant-mcp scaffold.
- Full demo seed (data/*.json): 8 customers, 8 engagements, 6 template
  cards w/ capabilities, 19 deployments, 6 extractions, 4mo founder-hours,
  2 manual attention items. seed.ts imports manual attention.
- Tests: 131/131 (repaired 15 pre-existing failures — operator-identity
  in convex-test, seed-relative fixtures, relative-date staleness).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…le_design_overhaul.md §1-§5)

Full dark→light visual rebuild for the YC demo. The triggering verdict was
"localhost:3000/templates is dark, ugly, nothing does anything" — this fixes
both the look and the affordances across every surface.

- Tokens (§2): globals.css rewritten to light "Paper" — warm eggshell page,
  warm near-black ink, single honey-amber accent, soft sage/amber/terracotta
  health, multi-layer soft shadows, decel-only motion, reduced-motion. Existing
  token NAMES remapped so every component flips to light for free. Fraunces +
  Inter + JetBrains Mono via next/font. (NB: trailing comments inside @theme
  silently drop the theme in Tailwind v4 — kept comments on own lines.)
- Components (§3): Button, Card, Input, Select, Dialog, Toast, Badge/Chip/Tag,
  Table+TableEmpty, EmptyState, PageSkeleton, ErrorState, Tooltip, Popover,
  ProgressBar, Avatar, InFlightDot, SectionDivider — all public APIs preserved.
- Chrome (§3.10/3.16): TopNav (accent-underline nav, ⌘K hint), PageHeader
  operator/editorial variants, Breadcrumbs, footer, palette restyle, keyboard
  cheat-sheet (?).
- Pages (§5): /templates investor rebuild (featured/standard/quiet cards by
  reuse count, Deploy/Copy-link actions, reuse arc); /extractions reuse-sized
  timeline; /overview editorial greeting + Fraunces-72px MRR + grouped attention
  + redesigned honest founder-leverage chart; operator pages (filter chips,
  bulk-action bar, phase-grouped engagements, Notion-doc detail, FDE capacity
  bars); /assistant newspaper column; /connections App Store; /settings/access
  2-col; /sign-in centered card.

Cut per §8.14 (flagged, not faked): engagement drag-drop, undo/redo,
bulk actions beyond /customers, the extractions cumulative sparkline.
next build + tsc + eslint clean; verified light-mode render at /templates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- CopyLinkButton (prod URL + ⌘⇧C global binding), PulseOnChange (soft-pulse
  on Convex value change) — primitive-ready, ⌘⇧C copy works globally.
- user_recents table + userRecents.record/listForUser + useRecents() hook +
  RecordRecent drop-in (Convex side fully wired).
- keyboard-shortcuts.tsx: g+t/c/e/f/x/o/a navigation, mounted in layout.
- global-error.tsx: dark hex → light Paper (last dark-mode regression).

Per §8.14, deferred (flagged honestly): undo/redo, global search, bulk beyond
/customers, and mounting CopyLink/Pulse/RecordRecent on every detail page
(primitives ready). next build + tsc clean; eslint 23 errors (all pre-existing
debt, down from 24 baseline — zero new).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rm_master.md §6)

Final phase of the platform master. Additive + feature-flagged (CASTLE_MULTITENANT,
default OFF) so it's inert until enabled — flag-off behavior is byte-identical
(scopeToOrg(null) is a pass-through; seeded demo data unaffected, verified).

- Schema: organizations + organization_members tables; nullable organization_id
  + by_org index on customers/engagements/fdes/templates/deployments/
  pattern_extractions/founder_hours/email_allowlist (all optional — existing
  rows validate).
- convex/lib/org.ts: MULTITENANT_ON flag, resolveOrgId(ctx) (null when off;
  user's org membership when on, default-org fallback), scopeToOrg (no-op on
  null; filters to org + unstamped legacy rows when on).
- Gated reads: dashboard.overview + customers/fdes/engagements/templates/
  deployments/patternExtractions/founderHours/emailAllowlist .list. Creates
  stamp organization_id when flag on.
- convex/organizations.ts (create/addMember/listForUser/createOrgWithMembers);
  migrations.stampDefaultOrg (idempotent backfill to "42nights-default",
  operator-gated).
- convex/multitenant.test.ts: 11 tests (scopeToOrg units, flag-off no-op proofs,
  flag-on cross-org isolation, migration idempotency).

next build + tsc clean; vitest 142/142 (131 prior + 11 new, zero regressions);
flag-off seeded data still renders (templates 6, customers 8). Completes
castle_platform_master.md P0–P33.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tail crash

Lets every operator surface render locally without GitHub OAuth (for the demo
Loom smoke test). Inert by default — fires only when CASTLE_DEV_AUTH=1 is set,
which lives in gitignored .env.local (Next) + `convex env set` (backend), never
committed. Middleware is additionally gated on NODE_ENV !== production.

Bypass choke points (all flag-gated, dev-only, loudly commented):
- middleware.ts — pass through without a session cookie
- lib/load-overview.ts requireOperator + app/page.tsx — skip redirect / render ChatLanding
- convex/lib/assertOperator.ts isOperator — return dev@42nights.dev (matches *@42nights.dev rescue)
- convex/auth.ts getCurrentUser — synthetic operator linked to seeded "idan" FDE
- convex/lib/conversationAuth.ts requireUser — synthetic user (chat queries don't 401)

Fix: components/customers/engagement-cards.tsx was a Server Component passing
onClick to a <span> (wrapping the WeeklyHoursInput client control) → "Event
handlers cannot be passed to Client Component props" crash on /customers/[slug].
Added "use client". Swept all rebuilt pages — no other instances.

Smoke test: all 11 surfaces render (/, /overview, /templates(+slug), /customers
(+slug), /engagements(+slug), /fdes, /extractions, /assistant). tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n cards, live brief

- Tool-result widgets now persist in completed assistant messages: reconstruct
  the turn's ToolActivity[] from agent_tool_events (new agentToolEvents.forTurn
  query + ChatMessage.turnId + HistoricalToolResults) so the severity cards stay
  in the response instead of vanishing when streaming ends.
- list_attention severity cards are clickable through to their engagement /
  customer href (with a hover chevron affordance).
- Dev-auth bypass extended to conversationAuth.tryConversation so the chat
  transcript renders under CASTLE_DEV_AUTH (local only; inert in prod).
- /assistant: structured, widget-rich morning brief (weather banner, metric
  tiles, calendar, people cards, follow-ups, attention, starred unread) +
  dailyDigests seed + most-recent fallback.
- Seed: roughen founder_hours so hoursPerArrK is honestly bumpy (21→17→25→16),
  not a suspiciously clean curve.
- scripts/loom-agent-worker.ts: local dev stand-in for the Hermes Railway
  wrapper — drives a real Claude turn (AI SDK) with a working list_attention
  tool and streams the same Convex rows the prod wrapper writes. Reads
  ANTHROPIC_API_KEY from env; local/dev only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

Unable to deploy a commit from a private repository on your GitHub organization to the team team on Vercel, which is currently on the Hobby plan. In order to deploy, you can:

  • Make your repository public or
  • Upgrade to Pro. A Pro subscription is required to deploy from a private organization repository.

To read more about collaboration on Vercel, click here.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 168 files, which is 18 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 621caa0a-d051-4ed7-a72e-a0aa4448aab1

📥 Commits

Reviewing files that changed from the base of the PR and between 709b555 and 6fdfdda.

⛔ Files ignored due to path filters (1)
  • convex/_generated/api.d.ts is excluded by !**/_generated/**
📒 Files selected for processing (168)
  • app/api/actions/accept/route.ts
  • app/api/actions/dismiss/route.ts
  • app/api/actions/reject/route.ts
  • app/api/actions/undo/route.ts
  • app/api/agent/retry/route.ts
  • app/api/deployments/[id]/events/route.ts
  • app/api/templates/sync-github/route.ts
  • app/api/webhooks/github/route.ts
  • app/assistant/page.tsx
  • app/assistant/view.tsx
  • app/connections/page.tsx
  • app/connections/view.tsx
  • app/customers/[slug]/page.tsx
  • app/customers/page.tsx
  • app/engagements/[slug]/page.tsx
  • app/engagements/page.tsx
  • app/extractions/error.tsx
  • app/extractions/loading.tsx
  • app/extractions/page.tsx
  • app/extractions/view.tsx
  • app/fdes/[slug]/page.tsx
  • app/fdes/page.tsx
  • app/global-error.tsx
  • app/globals.css
  • app/layout.tsx
  • app/overview/error.tsx
  • app/overview/loading.tsx
  • app/page.tsx
  • app/settings/access/manager.tsx
  • app/settings/access/page.tsx
  • app/sign-in/page.tsx
  • app/templates/[slug]/page.tsx
  • app/templates/error.tsx
  • app/templates/grid.tsx
  • app/templates/loading.tsx
  • app/templates/page.tsx
  • components/assistant/attention-rows.tsx
  • components/assistant/calendar-list.tsx
  • components/assistant/follow-ups.tsx
  • components/assistant/metric-strip.tsx
  • components/assistant/people-cards.tsx
  • components/assistant/starred-unread.tsx
  • components/atoms.tsx
  • components/breadcrumbs.tsx
  • components/chat-landing.tsx
  • components/chat/action-card.tsx
  • components/chat/composer.tsx
  • components/chat/empty-state.tsx
  • components/chat/historical-tool-results.tsx
  • components/chat/message-assistant.tsx
  • components/chat/narration-ribbon.tsx
  • components/chat/tool-result.tsx
  • components/command-palette.tsx
  • components/copy-link-button.tsx
  • components/customers/customers-table.tsx
  • components/customers/engagement-cards.tsx
  • components/customers/filter-chips.tsx
  • components/customers/hero-stats.tsx
  • components/editorial-greeting.tsx
  • components/engagements/engagement-document.tsx
  • components/engagements/engagements-list.tsx
  • components/engagements/phase-grouped-table.tsx
  • components/engagements/view-toggle.tsx
  • components/extractions/extractions-summary.tsx
  • components/extractions/extractions-timeline.tsx
  • components/fdes/capacity-strip.tsx
  • components/fdes/fde-card-grid.tsx
  • components/footer.tsx
  • components/in-flight-dot.tsx
  • components/keyboard-help.tsx
  • components/keyboard-shortcuts.tsx
  • components/overview-sections.tsx
  • components/page-shell.tsx
  • components/pulse-on-change.tsx
  • components/record-recent.tsx
  • components/sections/attention.tsx
  • components/sections/extraction-timeline.tsx
  • components/sections/fde-workload-board.tsx
  • components/sections/founder-hours-chart.tsx
  • components/sections/hero-metrics.tsx
  • components/sections/mrr-chart.tsx
  • components/sections/phase-columns.tsx
  • components/sections/template-overview.tsx
  • components/templates/deploy-dialog.tsx
  • components/templates/template-card.tsx
  • components/templates/template-filters.tsx
  • components/top-nav.tsx
  • components/ui/badge.tsx
  • components/ui/bulk-action-bar.tsx
  • components/ui/button.tsx
  • components/ui/dialog.tsx
  • components/ui/empty-state.tsx
  • components/ui/error-state.tsx
  • components/ui/input.tsx
  • components/ui/page-skeleton.tsx
  • components/ui/popover.tsx
  • components/ui/progress-bar.tsx
  • components/ui/section-divider.tsx
  • components/ui/select.tsx
  • components/ui/sonner.tsx
  • components/ui/table.tsx
  • components/ui/tooltip.tsx
  • convex/agentActions.ts
  • convex/agentMessageChunks.ts
  • convex/agentToolEvents.ts
  • convex/agentTurns.ts
  • convex/assistantActions.ts
  • convex/assistantWorkflows.ts
  • convex/attention.test.ts
  • convex/attention.ts
  • convex/auth.ts
  • convex/captureInbox.ts
  • convex/crons.ts
  • convex/customers.ts
  • convex/dailyDigests.ts
  • convex/dashboard.ts
  • convex/deploymentEvents.test.ts
  • convex/deploymentEvents.ts
  • convex/deployments.ts
  • convex/emailAllowlist.ts
  • convex/engagements.test.ts
  • convex/engagements.ts
  • convex/fdes.ts
  • convex/founderHours.ts
  • convex/integration.test.ts
  • convex/lib/assertOperator.ts
  • convex/lib/conversationAuth.ts
  • convex/lib/org.ts
  • convex/migrations.ts
  • convex/multitenant.test.ts
  • convex/mutations.test.ts
  • convex/organizations.ts
  • convex/patternExtractions.ts
  • convex/schema.ts
  • convex/seed.test.ts
  • convex/seed.ts
  • convex/templates.ts
  • convex/userPreferences.ts
  • convex/userRecents.ts
  • convex/workflowRuns.ts
  • data/customers.json
  • data/deployments.json
  • data/engagements.json
  • data/fdes.json
  • data/founder_hours.json
  • data/manualAttention.json
  • data/pattern_extractions.json
  • data/templates.json
  • docker/hermes/serve.py
  • lib/load-overview.test.ts
  • lib/load-overview.ts
  • lib/tool-renderers.ts
  • lib/use-actor.ts
  • lib/use-hermes-chat.ts
  • lib/use-recents.ts
  • middleware.ts
  • scripts/assistant-mcp.ts
  • scripts/castle-mcp.ts
  • scripts/loom-agent-worker.ts
  • scripts/seed-convex.mjs
  • src/workflows/builtins/morning-brief.ts
  • src/workflows/llm.ts
  • src/workflows/mcp-stub.ts
  • src/workflows/registry.ts
  • src/workflows/run.test.ts
  • src/workflows/run.ts
  • src/workflows/schema.ts
  • vitest.config.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yc-demo-build

Comment @coderabbitai help to get the list of available commands and usage tips.

@Macintosh1011

Copy link
Copy Markdown
Collaborator Author

Superseded by 3 reviewable slices (each under CodeRabbit's 150-file limit): #13 backend, #14 design system + pages, #15 feature components. Together they equal this branch. Keeping yc-demo-build as the integration branch.

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