Eliminates hand-rolled req.json().catch() + safeParse patterns in
me, user-projects POST, and user-projects PATCH routes. Also adds
readIdParam to user-projects DELETE for consistent UUID validation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add ui-btn-chip, ui-btn-icon, ui-btn-save, ui-btn-add, ui-btn-submit to globals.css.
Remove SECONDARY_BUTTON_CLASS, ICON_BUTTON_CLASS, INLINE_SAVE_CLASS, ADD_BUTTON_CLASS,
PRIMARY_BUTTON_CLASS, DANGER_BUTTON_CLASS string constants from form.tsx.
All 36 usages across 13 files now reference ui-* classes directly — no import needed.
form.tsx now contains only FIELD_INPUT_CLASS alias and the Field component.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the remaining 10 raw fetch() calls across 6 files with getJson/postJson/patchJson.
No more repeated { method, headers, body: JSON.stringify } boilerplate outside the SSOT helper.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a single-click "→ Reached out" button to each person card so reviewing
stale contacts requires no extra steps — tap once, health updates immediately.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three related state-sync gaps closed:
1. Deleting a person from the detail drawer no longer leaves a ghost card
in the grid — onDeleted callback removes from local state immediately
(router.refresh() was unreliable since PeopleGrid uses useState).
2. Creating a person now shows the new card — NewPersonButton moved inside
PeopleGrid and passed an onCreated callback that calls search() with
the current query/sort/filter state.
3. useRouter import removed from PersonDetail (no longer needed).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PersonDetail (drawer) had no callback back to PeopleGrid, so logging an
interaction from the drawer left the card's health dot and last-seen
timestamp stale until a page reload. Adds onInteractionLogged prop to
PersonDetail, extracts shared handleLogged into PeopleGrid so both the
inline PersonCard log and the drawer route through the same update logic.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Eliminates repeated { method, headers, body: JSON.stringify(...) } patterns
across 6 components, and migrates NewProjectModal to the shared <Modal>
component instead of rolling its own fixed inset-0 z-50 backdrop.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a health filter is active (fading/stale/unknown) and you log an
interaction that moves the contact to 'active', the card now disappears
immediately from the list and the total count decrements. Previously the
contact stayed in the list with an updated dot, leaving noise in the
stale-contact review workflow.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The type input in AddEventForm now shows a datalist of types already in
the list, preventing accidental "conference" vs "Conference" splits that
would fragment the filter chips. New types still accepted freely.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously adding a sub-goal required the global New Goal modal + parent
dropdown. Now each active goal card has an inline '+ Add sub-goal' button
that expands an input field in the children section — Enter to save,
Escape to cancel. Refreshes server state on success.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously you could only link existing goals to a project — now you can
create a new goal (with title + optional target date) inline, pre-linked
to the project in a single API call. Adds entityId to CreateGoalBody/POST
route, and replaces the single 'Link existing' button with a mode-based
panel (idle → create | link → idle).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Error messages in sign-in and invite pages used style={{ color: "oklch(...)" }}
which was literally the --status-negative token value. Replace with className.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Error messages and destructive hover states in ProjectsSettings, ProfileSettings,
and onboarding were using the shadcn 'destructive' token instead of our SSOT
semantic token text-status-negative.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Moves all data fetching, SSE subscription, and API callbacks into
src/hooks/use-control-data.ts. ControlPanel drops from 488 → 278 lines,
staying under the 300-line god-component limit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extracted ProjectCardHeader, SessionSummary, ProjectBanners, and
IntentButtonPanel into project-card-sections.tsx (388 lines). Header
self-manages syncing/syncResult; IntentButtonPanel self-manages
showMore/clearingContext. ProjectCard now contains only state, effects,
computed values, and a clean JSX skeleton.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 inactive state dots (never-run, low-progress) → bg-status-neutral.
2 intentional exceptions remain: hover:border-white/60 on goal checkboxes
(interactive 60% hover highlight has no defined token equivalent).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All text-white/X inline opacity classes replaced with the correct
semantic token: /80-85→text-text-primary, /50-75→text-text-secondary,
/35-40→text-text-tertiary, /10-30→text-text-muted. Eliminates hardcoded
color pattern across 44 component files per SSOT rule.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extracted ActivityLogPanel, BrainConfigPanel, FleetStatusBar, and
NewProjectModal into control-panel-helpers.tsx (362 lines). ControlPanel
now contains only state, effects, and callbacks — no large JSX blocks.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ProjectCard.tsx was 809 lines (god component per CLAUDE.md >300 rule).
The 8 self-contained presentational helpers — SessionBadge, MaturityBar,
ClosedBanner, ClosingBanner, RunningBanner, ReadyBanner,
LatestOrchestrationPanel, ProfilePanel — are moved to
project-card-helpers.tsx (298 lines). ProjectCard.tsx is now 524 lines
containing only the main interactive component logic.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Next.js 16 renamed middleware.ts to proxy.ts. Having both files caused a
build error. Merged the complete auth logic (public paths, invite bypass,
API pass-through, onboarding redirect) into proxy.ts and deleted the
redundant middleware.ts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Greeting now shows the logged-in user's name (via getCurrentUserName())
instead of the hardcoded DEFAULT_USER_NAME constant
- getAllProjectStates() replaced with getProjectStatesByUserId(userId) so
the control panel only surfaces project states owned by the current user
(or legacy rows with null userId for backward compat)
- auth.ts Session type uses explicit fields instead of Omit<DefaultSession>
which was collapsing to {} under TypeScript's union distribution
- session.ts: add getCurrentUserName() helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- /api/inject: pass userId to upsertProjectState so project-state rows are
scoped to the authenticated user (matches the rest of the multi-user migration)
- control-fast-state: validate JSON shape in readCurrentPrompt() before casting
to CurrentPrompt — malformed /tmp files no longer silently produce undefined fields
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Every DB query now scopes data to the authenticated user via userId param
sourced from getCurrentUserId(). Invited team members no longer see the
owner's data. Affected: people, projects, memory, utils, orchestration-runs,
prompt-history, events, habits, money, alerts, actions, today.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Navigation:
- Add description field to NavItem type (navigation.ts is now SSOT)
- Write real per-item descriptions for all 12 nav items
- Control: "Dispatch agents across projects" (was "Brain switching")
- 9 generic items: specific descriptions (was "Tracked view" x9)
- Sidebar reads item.description instead of hardcoded ternary
- Control page subtitle: "Dispatch AI agents across your projects — pick an intent and fire"
(was "Switch brains, models, and terminal sessions")
Multi-user read path fix:
- today.ts: all 5 functions now accept userId param (was DEFAULT_USER_ID)
- goals.ts: getGoals/getGoalStats now accept userId param
- goals/page.tsx, prompts/page.tsx: call getCurrentUserId()
- CommitmentsCard, GoalsDueCard, SubscriptionsCard, SummaryBar: call getCurrentUserId()
- actions.ts fulfillCommitment: call getCurrentUserId() in server action
CLAUDE.md:
- Add Mission section (2-sentence product definition)
- Add control/ to Architecture component list
- Add /control, /thoughts, /settings to Views table
- Update /control description to match actual fleet command feature
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Invitation system: token-based /invite/[token] registration page, TeamSettings
component in /settings, DB schema + queries, full API (create/list/accept)
- Create & Launch: "New project" modal in ControlPanel, ensureTabExists() in
agent-runtime so zellij tab is created if not open, Play button on idle tiles
- Git sync guard: behindRemote field in GitState (git rev-list HEAD..@{u}),
"↓ N behind" warning badge + git pull button + /api/project/sync route
- Clear context: /api/project/clear-context sends /clear to Claude without
writing prompt state; "Clear context" button in ProjectCard More section,
only shown when currentAdapter === "claude"
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
First-run flow:
- /setup page + /api/setup: creates first user with hashed password
(Node crypto scrypt, no new deps). POST rejects if users already exist.
- Landing page redirects to /setup when DB has no users
- middleware.ts: protects app routes, passes public pages through
Auth:
- passwordHash column added to users schema (drizzle-kit push applied)
- src/lib/password.ts: hashPassword/verifyPassword via Node scrypt
- auth.ts Credentials: env var takes priority, falls back to DB hash
so packaged installs work without LOCAL_AUTH_PASSWORD
Multi-tenancy groundwork:
- Replaced DEFAULT_USER_ID with getCurrentUserId() across all 12 API
route files (people, subscriptions, events, goals, projects, commitments)
Docker:
- Dockerfile: multi-stage Node 22 alpine, standalone output
- docker-compose.yml: postgres + migrate + app services
- .dockerignore, .env.example with documented required vars
- next.config.ts: output: standalone
- package.json: added migrate script (drizzle-kit push)
- tsconfig.json: scope to src/ only, exclude .next generated files
Install: clone → cp .env.example .env.local → docker-compose up
First visit → /setup → create account → sign in → done.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Deep near-black background (#080808) with subtle 72px grid overlay
- Radial center glow adds depth without color
- 80px bold headline at lg, tight -3% tracking
- Reduced text/CTA to essentials — no feature card grid
- Proof line at bottom: "Built on Claude · Runs on your machine"
- Rounded-full CTAs: white primary, ghost outline secondary
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Active projects (agent running, recent ready/closed/closing signal, or current
prompt) show as full ProjectCards. Idle projects compress to a 3-column tile
grid with name, health, git branch, and session.next preview.
- ProjectTile.tsx: new compact tile with spinner for running, health dot,
branch, and session.next truncated to one line
- ControlPanel: isActiveProject() helper (5-min window), expandedTabs state
to promote tiles back to full cards on click, collapsible idle section
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Design system:
- globals.css: add status color tokens (status-positive/warning/negative)
- constants/control.ts: replace hardcoded color classes with semantic tokens
- Components: replace hardcoded colors (emerald-400, amber-400, red-400) with
status-positive/warning/negative tokens throughout
Route structure:
- Move all app pages into (app)/ route group alongside shared layout
- Remove flat src/app/ page files (moved to src/app/(app)/)
Orchestration SSOT:
- contract.ts: convert AdapterId and OrchestrationTaskIntentId from string union
types to const arrays so z.enum() can use them as runtime values
- run/route.ts: remove hardcoded intent/adapter enum lists; import from contract
- run/route.ts: use getCurrentUserId() instead of DEFAULT_USER_ID
Misc:
- control/route.ts: remove unused fs import
- Sessions API: minor cleanup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Control panel:
- Add SSE endpoint (/api/control/stream) pushing agent state diffs every 2s
- Extract shared fast-state reader to lib/control-fast-state.ts (DRY)
- ControlPanel: reduce polling from 10s to 30s; SSE handles fast path (2s latency)
- ControlPanel: add collapsible 24h activity log (was fetched but never rendered)
- ProjectCard: fix RunningBanner elapsed time bug ("154s" → "2m 34s")
- ProjectCard: add warning color to elapsed timer after 15 min (possible stall)
- ProjectCard: fix ClosingBanner elapsed time bug ("3ms running" → "3m running")
- ProjectCard: remove duplicate Pause icon from auto-continue toggle button
- ProjectCard: show session.tests and session.todos in status tab summary
Navigation:
- Move /control to mobile nav (remove /money from mobile); control is flagship view
DB schema:
- project_states: add user_id FK column + index (was only table missing user isolation)
- prompt_history: add idx_prompt_history_user_id index
- habits.habit_completions: add idx_habit_completions_user_id index
- goals: add composite idx_goals_user_status index on (userId, status)
- getRecentActivity query added to prompt-history queries
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Auth & multi-user:
- GitHub OAuth via next-auth DrizzleAdapter; signIn callback absorbs first
login into is_default=true user so all pre-auth data stays accessible
- getCurrentUserId() helper; onboarding + profile pages
- normalizeUsername() extracted to lib/username.ts (DRY fix)
Design system:
- All public pages (landing, sign-in, onboarding, settings) rebuilt to use
ui-* classes and semantic tokens only — zero raw Tailwind color violations
- ui-input, ui-btn-*, ui-panel, bg-surface-*, text-text-* throughout
Reliability (M1–M7):
- M1: Stale claude-stop-active lock cleanup on stop hook entry
- M2: /api/inject validates tab exists in Zellij before writing /tmp
- M3: Prompt SSOT unified — claude-prompts.json single array format
- M4: DBUS UID hardcode removed (already in dotfiles)
- M5: auth.ts signIn callback + AdapterAccountType cast
- M6: project_states DB table — persists ready/closing/closed/session/prompt
across reboots; stop.sh PATCHes on stop/close; control falls back to DB
when /tmp is empty (24h window); inject writes currentPrompt to DB
- M7: scheduleOpenClawWorker now async; waits for spawn event (2s timeout);
marks run as error in DB if worker fails to start
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add ProjectProfile tab to every project card: 7 dimensions (Engineering,
Product, UX, Marketing, Content, Business, Deploy), each with 3 crafted
prompts that interpolate project context (name, path, mission, stack, url)
- Per-project agent selector: override global brain per card; chosen agent
used for all dimension prompt dispatches and auto-launches agent in tab
if not running (via /api/agent/launch → restartTab)
- Add intent:"custom" to orchestration contract so dimension prompts dispatch
as full free-form text, not a fixed intent enum
- Add prompt_history table (append-only log of every dispatch: adapter,
intent, custom_prompt, dispatched_at) — foundation for reuse and learning
- Log every /api/orchestration/run dispatch to prompt_history regardless of adapter
- Return recentCustomPrompts per project in /api/control response (batch query)
- Show reusable chips below custom input: click to prefill, ×N for repeat use
- Show usage count on dimension prompt buttons in Profile tab
- Add /api/agent/launch route: wraps restartTab + launchAgentInTab
- Extract launchAgentInTab to agent-runtime.ts (shared, no duplication)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Unsorted join caused cache misses whenever project list order changed
between polls (same set, different order = treated as different dirs).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Was duplicated verbatim in inject/route.ts and orchestration/run/route.ts —
any fix to the shell-escape logic needed double application. Now SSOT.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Runs stuck in "running" beyond 60 min now auto-transition to error state
on every /api/control poll (every ~10s), preventing phantom active states.
Cleanup runs in parallel with the latestRuns query so it adds no latency.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>