Commit Graph
1304 Commits
Author SHA1 Message Date
g-butandClaude Sonnet 4.6 51d60852bb fix(control): update brain capability description to reflect actual dispatch model
Old message implied codex had no orchestration support. All switchable
agents now dispatch tasks via prompt injection. The real distinction is
session lifecycle signals (stop/ready hooks), which only claude supports.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 12:00:36 +02:00
g-butandClaude Sonnet 4.6 96af615648 fix(control): detect any running agent, not just the configured default
agentRunning was scanning /proc only for the configured switchable agent's
process matchers. Switching to codex meant Claude sessions were invisible —
projects showed as idle while Claude was actively running in their tabs.

Fix: union all registered agents' processMatchers before scanning /proc.
A project is agentRunning if any known agent (claude, codex, openclaw…)
has a process in that directory.

Also hardcodes orchestration capability flags to true since the banners
now gate on readyAt signals rather than agent capability.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:58:32 +02:00
g-butandClaude Sonnet 4.6 8919fb30bd chore: remove unused ControlData import from ProjectCard
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:56:23 +02:00
g-butandClaude Sonnet 4.6 426c8be9e6 fix(control): show ready/closed/closing banners regardless of configured agent
readyAt/closedAt/closingAt signals are written by lifecycle hooks (stop.sh)
independently of which agent is set as the switchable default. Gating the
banners on autonomousPromptLoop suppressed them whenever the user switched
to codex — even when Claude sessions had genuinely finished.

Fix: remove the supportsAutonomousLoop gate from isClosed/isClosing/isReady.
The signals are sufficient evidence. agentRunning=false (no matching process
found) plus readyAt set is the correct ready condition regardless of agent.

Also removes the now-stale "This backend does not support autonomous loop"
message — intent buttons dispatch to any agent, so the disclaimer was wrong.
Drops the unused orchestration prop from ProjectCard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:55:41 +02:00
g-butandClaude Sonnet 4.6 3a56dbc748 chore: seed scripts, crons, sessions, docs, gitignore, package updates
- scripts/seed.ts + seed-goals.ts — updated entity/attribute seeding
- src/app/api/crons/route.ts — cron schedule updates
- src/app/api/sessions/route.ts — session handling fix
- docs/ — openclaw orchestration plan document
- .gitignore — added .next/logs to ignore list
- package.json/lock — dependency updates
- next-env.d.ts — auto-generated update

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:50:29 +02:00
g-butandClaude Sonnet 4.6 269b858b45 feat(thoughts): thoughts section — personal writing with tag filtering
New /thoughts route renders markdown-based long-form content from
content/thoughts/. Seed content covers the autonomous loop philosophy
and the next-best-step prompt pattern. ThoughtMeta parsed from YAML
frontmatter; reading time auto-calculated from word count.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:50:05 +02:00
g-butandClaude Sonnet 4.6 0ad6a7095a feat(ux): semantic design token system + component polish across all views
Introduces a full semantic token layer (text-primary/secondary/tertiary/muted,
surface-page/base/raised/overlay, border-subtle/default/strong,
accent-primary/hover/muted/text) enabling consistent theming and light/dark
mode support. ThemeProvider + ThemeToggle added to shell.

Design system:
- globals.css — semantic token declarations; oklch color values tuned for
  dark-first readability; custom shadow, tracking, and radius tokens
- ThemeProvider wraps app root; ThemeToggle in sidebar for instant switching
- All UI primitives (Card, Modal, Form, PageLayout, EmptyState) migrated to
  semantic tokens

Component polish:
- Shell (AppShell, Sidebar, MobileNav, AskIvyModal, AskIvyButton) — semantic
  colors, tighter spacing, improved mobile layout
- People views — PeopleGrid, PersonCard, PersonDetail decomposed;
  PersonChannelsSection, PersonDetailAttrs, PersonDetailHelpers extracted;
  PersonInteractionsSection added
- Projects — GitHubStatus, ProjectGrid updated to semantic tokens
- Prompts — PromptRow, FeaturedCard, CategoryBar, RunModal, ScheduleModal
  migrated; PromptLibraryClient improved filter UX
- System — SystemStats migrated to semantic tokens
- Today — Greeting, SummaryBar updated
- Pages — Habits, Memory, Money pages migrated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:49:40 +02:00
g-butandClaude Sonnet 4.6 449f4d77fd feat(brain): brain-agnostic orchestration framework + agent registry + control panel UX
Replaces the Claude-only prompt loop with a neutral orchestration layer
that dispatches tasks to whichever agent is available. When one brain
runs out of tokens, switching to another requires one tap.

New infrastructure:
- src/lib/orchestration/ — contract, 10 task intents, adapter definitions,
  prompt renderer, OpenClaw runner, summary parser
- src/lib/agent-registry.ts — detects claude/codex/openclaw/gemini from
  PATH; reads configured model from dotfiles
- src/lib/agent-preferences.ts — persists selected brain to
  ~/.config/cockpit-agent.json; syncs model back to Claude settings
- src/lib/agent-catalog.ts, agent-runtime.ts, switch-agent.ts — catalog,
  zellij tab restart logic, agent switching action
- src/db/schema/orchestration-runs.ts + queries — DB-tracked runs

New API routes:
- /api/control/agent — GET brain config, POST to switch + restart zellij tabs
- /api/orchestration/run — brain-agnostic dispatch: claude/codex → inject
  rendered prompt into zellij tab; openclaw → fires detached worker
- /api/orchestration/run/execute — synchronous execute endpoint for worker

Control panel UX:
- Brain section collapsed to a single pill, expanding only when needed
- Intent buttons replace hardcoded "OpenClaw" buttons — Next best, Test & fix,
  Quality, Commit, +5 under More; each shows "via {adapter}"
- agentRunning detection uses /proc scan against configured agent matchers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:49:08 +02:00
g-butandClaude Sonnet 4.6 9160fbefb3 fix(ux): freeze ReadyBanner countdown while typing custom prompt
- Add paused prop to ReadyBanner — countdown stops when paused=true
- ProjectCard passes paused={customFocused || custom.trim().length > 0}
- Custom input gains onFocus/onBlur to track focus state
- Countdown display shows ⏸ when paused instead of remaining seconds

Prevents the "Claude finished" banner from auto-firing while the user
is composing a custom prompt in the input below.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 23:25:48 +02:00
g-butandClaude Sonnet 4.6 0af18eabcb refactor(soc/dry/ssot): batch quality sweep
- lib/dates.ts: move advanceDueDate() out of SubscriptionActions (SoC)
- project-detail-types.ts: export precomputed SUGGESTED_ATTR_LABELS/PLACEHOLDERS (SSOT)
- ProjectOverviewTab: data-driven issue alerts via ISSUE_DISPLAY config — 3 identical
  JSX blocks → 1 .map(); use precomputed maps; consolidate duplicate form import
- form.tsx: add ADD_BUTTON_CLASS ("+ Add" ghost button) alongside INLINE_SAVE_CLASS
- Sweep: AddEventForm, PersonInteractionsSection, ProjectPromptsTab, ProjectGoalsTab

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 23:17:19 +02:00
g-butandClaude Sonnet 4.6 15c23afc9c refactor(dry): extract INLINE_SAVE_CLASS — 6 identical className strings → 1
Add INLINE_SAVE_CLASS to components/ui/form.tsx alongside PRIMARY_BUTTON_CLASS.
Sweep: PersonDetail, PersonInteractionsSection, ProjectInlineEditors,
ProjectOverviewTab, LogConversationButton, SubscriptionActions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 23:00:29 +02:00
g-butandClaude Sonnet 4.6 f70e8fa716 refactor(soc): add getJson<T> — eliminate raw fetch() in components
- lib/api/fetch.ts: getJson<T>(url, options?) — typed GET that throws on !ok
- hooks/use-fetch.ts: use getJson internally (DRY, typed error handling)
- PersonDetail, ProjectDetail, ClaudeSession: replace fetch+ok+json chain
- PeopleGrid, LogConversationButton: replace fetch+json with typed getJson

No logic changes — only the boilerplate layer is removed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 22:45:59 +02:00
g-butandClaude Sonnet 4.6 427b94e830 refactor(kiss): split ControlPanel 708→179 lines, extract ProjectCard
- ProjectCard + all banner sub-components → src/components/control/ProjectCard.tsx
- Time-window constants + color maps → src/lib/constants/control.ts
- timeAgo / secondsAgo → src/lib/dates.ts (shared date helpers)
- ControlPanel now owns only polling, inject, status bar, Zellij strip

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 22:32:48 +02:00
g-butandClaude Sonnet 4.6 7638d54f61 refactor(dry): extract ModalForm — eliminate 4× duplicated modal shell
New src/components/ui/modal-form.tsx owns the shared skeleton that all
four "New X" buttons repeated: green trigger button, Modal wrapper,
header (title + X close), error block, and primary submit button.
Uses <form onSubmit> so Enter in any <input> submits natively — removes
the per-field onKeyDown handlers that were previously copy-pasted.

NewPersonButton / NewProjectButton / NewGoalButton / NewSubscriptionButton
now contain only their unique field state and field JSX. Combined line
count: 507 → 453 (−54 lines), and any future modal button costs ~35 lines
instead of ~100.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 22:19:32 +02:00
g-butandClaude Sonnet 4.6 bc17563104 refactor(ssot): stateFile helpers + document state machine contract
Add stateFile.{ready,closing,closed,sentinel,prompt,lock}(tab) helpers
to claude-config.ts as the single TypeScript source for /tmp state file
paths. Update inject and control routes to use them — eliminates raw
string interpolation scattered across two files.

Add a STATE FILE CONTRACT comment block documenting what each sentinel
means and which actor owns reads/writes — the bash dotfiles (stop.sh,
notification.sh) duplicate these names as string literals, so the
comment is the only shared spec.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 22:07:54 +02:00
g-butandClaude Sonnet 4.6 32dd228723 refactor(ssot): extract claude-config.ts + deduplicate API helpers
- New src/lib/claude-config.ts: SSOT for all Claude local-config paths
  and file-reading helpers (parseProjectsConf, readProjectsMap,
  readPromptMeta, readPrompts, buildPromptWithSession, PromptMeta type)
- control/route.ts + inject/route.ts: import from shared lib; removes
  ~50 lines of duplicated constants and functions
- route-helpers.ts: add handleDuplicateEntityNameError() helper
- people/route.ts + projects/route.ts: use the shared helper instead
  of inline uq_entities_user_name_type string comparison

Also fixes notification.sh: skip auto-inject when close_session is in
flight (sentinel or closing marker present) — prevents a new prompt
firing immediately after a session closes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 21:32:21 +02:00
g-butandClaude Sonnet 4.6 397bd54047 feat(control): Zellij tab strip + per-card open indicators
Shows all open Zellij tabs as a strip at the top of the control panel
(project-matched tabs brighter, unknown tabs dimmer). Adds a Terminal
icon in each project card header when its tab is currently open.
Wires zellijTabs through the ControlData type to the GET response.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 20:54:02 +02:00
g-butandClaude Sonnet 4.6 7a69b2efc3 perf(control): warm-cache latency 2.3s → 50ms; add recent commits log
Cache strategy:
- git state + DB profiles: 20s stale-while-revalidate (background refresh)
- Claude CWD detection: 3s TTL, reads /proc directly (no fork at all)
- Session files + tmp files: always fresh (cheap fs reads)

No more pgrep fork() on every request — replaced with direct /proc scan
(readdirSync + readFileSync per PID). Zero fork() calls on warm cache.

Result: cold=2s (first call or after 20s), warm=50–200ms (application-code).

Also: recent commits (last 4) shown per project card in the control panel.
Each row: "hash date: subject" from git log -5, joined with ~.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 20:31:56 +02:00
g-butandClaude Sonnet 4.6 38a007a794 feat(control): project profiles, current prompt tracking, closing state
API (/api/control):
- ProjectState gains closingAt, currentPrompt, profile fields
- profile pulled from DB entities (fuzzy tab→name match): description,
  status, maturity, stack, mission, url + all attrs
- currentPrompt: reads /tmp/claude-current-prompt-<tab> set by inject
- closingAt: set when close_session injected; closedAt: set only after
  Claude actually finishes (stop.sh writes it, not inject)

API (/api/inject):
- Writes claude-current-prompt-<tab> on every injection
- For close_session: writes closing file (not closed) — closed deferred to stop.sh
- Reads prompt meta to include icon+label in current prompt tracking

UI (ControlPanel):
- ClosingBanner: amber spinner "Closing session…" while prompt runs
- RunningBanner: indigo pill showing current prompt label + elapsed time
- ProfilePanel: collapsible — description, mission, maturity bar (10-dot),
  stack, status, url, customers, architecture, owner
- MaturityBar: visual 10-dot progress indicator
- Status bar: running/waiting counts + total today's commits across all projects
- Sort: closed > ready > running > active (today commits) > idle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 20:14:37 +02:00
g-butandClaude Sonnet 4.6 0e2e647de8 perf(api): 30× speedup — single bash+parallel-jobs replaces 76 fork()s
fork() in the large Next.js process blocks the event loop for ~800ms each.
4 exec() calls × 19 repos = 76 sequential forks = 60s total.

Fix: one bash invocation with background jobs (&/wait) runs all repo git
queries in parallel. 2 total forks (bash + pgrep) instead of 76+.

Also fixes shell-injection bug: --format=%ar|%s was split by sh as a pipe,
making git log silently return null for all projects.

Result: /api/control drops from ~60s to ~2s application-code time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 19:51:10 +02:00
g-butandClaude Sonnet 4.6 bd52a59d3a fix(control): stop polling when tab is hidden, deduplicate in-flight requests
Add Page Visibility API + useRef in-flight guard to ControlPanel:
- Skips polls while the browser tab is in the background
- Skips a new poll if a request is already in progress
- Re-polls immediately when the tab becomes visible again

Prevents the server backlog that accumulated when the browser kept
sending new requests every 10s while the event loop was blocked.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 19:12:52 +02:00
g-butandClaude Sonnet 4.6 d47cc7a8cd perf(api): make /api/control non-blocking with async git queries
Replace 76 sequential execSync calls (19 projects × 4 git commands)
with Promise.all — all projects and the pgrep check now run in parallel.
Event loop no longer blocks on each request; response time drops from
~40s to ~2s.

Also: add /control and /api/control to smoke.sh route lists; bump
reachability probe timeout from 5s to 20s for dev-mode compilation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 18:51:54 +02:00
g-butandClaude Sonnet 4.6 c39d6577f9 feat(control): add remote control panel for Claude sessions
- GET /api/control: reads claude-projects.conf, session files, git state,
  claude process CWDs, ready/closed tmp files → returns ProjectState[]
- POST /api/inject: validates tab, builds prompt with session context,
  shells to zellij; clears ready file; writes sentinel+closed when close_session
- /control page: polls every 10s, shows all projects with session state,
  prompt buttons, custom input, ready-countdown banner, and close_session
  celebration banner (no auto-countdown, shows shipped/next/tests)
- stop.sh: writes claude-ready-<TAB> on exit; writes sentinel+closed files
  when close_session is chosen from popup (infrastructure-side, not LLM)
- close_session prompt simplified: infrastructure now handles sentinel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 18:28:07 +02:00
g-butandClaude Sonnet 4.6 302b7a719b fix(ux): lift text-white/20 trigger buttons to text-white/35 across 4 components
Same fix applied to AddHabitForm/AddCommitmentButton in prior sessions:
interactive "Add X" / "Log activity" / "Collapse" trigger links were at
20% opacity, below readable contrast without hover.

- goal-card-helpers: "+ Add milestone" trigger
- ProjectOverviewTab: "Add [suggested fields]", "+ Add custom attribute",
  "+ Log activity", "Collapse" buttons; "No activity recorded yet" label
- EventsGrid: "No deadline" section divider label (text-white/20 → /30)
- CommitmentsCard: empty-state hint text (text-white/20 → /30)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 17:14:13 +02:00
g-butandClaude Sonnet 4.6 1acf9c602d fix(projects): show name-save errors inline instead of silently reverting
Same pattern as PersonDetail: NameEditor now manages saving/error state
locally instead of delegating to useInlineEdit.commit (which always exits
edit mode in finally, swallowing API errors).

saveName in ProjectDetailHeader now throws on non-ok response so the
editor can catch and display the message (e.g. "A project with that name
already exists"). Also removes onBlur auto-save which prevented clicking
Cancel when an error was shown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 17:04:22 +02:00
g-butandClaude Sonnet 4.6 9e1dcc2fc4 fix(people): show inline-edit errors instead of silently reverting
useInlineEdit.commit always calls setEditing(false) in finally, so a 409
(duplicate name) or any other API error was silently swallowed — the drawer
closed edit mode and showed the old value with no feedback.

Replace nameEdit.commit / descEdit.commit with local saving+error state.
The hook still manages editing/draft/start/cancel; the async work now runs
directly so errors can be displayed inline and edit mode stays open until
the user either fixes the input or cancels.

Also removed onBlur=commitName which would re-submit on click-away, making
it impossible to click Cancel when an error was shown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 16:53:38 +02:00
g-butandClaude Sonnet 4.6 514eae74eb fix: PATCH 404 guards + subscription frequency/nextDue editing
Bug fixes:
- events/[id] PATCH: return 404 when record not found instead of
  { ok: true, event: undefined } — EventCard uses json.event directly
  so undefined would corrupt client state on stale IDs
- commitments/[id] PATCH: same guard for consistency

Feature:
- SubscriptionActions edit form now includes frequency (select) and
  nextDue (date) fields; both are sent in the PATCH and the API+schema
  already handled them — only the UI was missing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 16:47:19 +02:00
g-butandClaude Sonnet 4.6 47d45dee15 fix(ux): discoverability + empty-state improvements
- AddHabitForm/AddCommitmentButton: lift trigger text from text-white/20-25
  to text-white/35-40 so "Add habit" / "Add commitment" links are visible
  without hover
- PersonCard Log button: sm:opacity-0 → sm:opacity-50 so the CRM's primary
  action is dimly visible on desktop instead of completely hidden until hover
- CommitmentsCard: replace flat "No active commitments" text with centered
  icon + sub-hint pointing to the add button below
- PeopleGrid: add proper empty state with Users icon; filtered-empty shows
  a "Clear filters" inline link to restore results

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 16:33:25 +02:00
g-butandClaude Sonnet 4.6 4f58b109ab fix(ux): readability + click target fixes from UX audit
1. Typography: bump text-[9px]/text-[10px] category/date labels to
   text-[11px] in EventsDueCard; lift "Open Events/Goals →" link opacity
   from text-white/25 to text-white/40 so they're visible without hover.

2. Click targets: p-1 → p-1.5 on all icon-only action buttons
   (EventCard, CommitmentItem, FulfillCommitmentButton, HabitRow pencil/X);
   add p-1 + rounded to the bare habit-toggle button so tap target is ~26px.

3. Truncated text: add title= to truncated person name, profession/location,
   and goal title so hover reveals the full string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 16:26:10 +02:00
g-butandClaude Sonnet 4.6 aafb3e86bc feat(events): add inline editing for name, deadline, description, url
Events were previously immutable after creation — only archive and delete
were available. PatchEventBody now accepts all editable fields; the API
route spreads them into the DB update; EventCard gains an edit mode
(pencil icon → form → Save/Cancel) that optimistically updates local state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 16:14:19 +02:00
g-butandClaude Sonnet 4.6 70dc5e14f7 refactor(ssot): derive NewProjectButton/NewPersonButton input types from Zod schemas
Exports CreateProjectInput and CreatePersonInput (z.infer<>) from their
canonical query files and replaces the inline anonymous generics in each
button component. All useCreateMutation<T> calls now use named types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:58:16 +02:00
g-butandClaude Sonnet 4.6 a14e392f48 fix(ux): expose notes field in NewSubscriptionButton; derive input types from Zod
NewSubscriptionButton was missing the 'notes' field — users could set notes via
the inline edit (SubscriptionActions) but not at creation time.

Simultaneously cleans up the last inline body type definitions in components:
- AddCommitmentButton: import type CreateCommitmentInput from db/queries/today
- NewSubscriptionButton: import type CreateSubscriptionInput from db/queries/money
- lib/api/goals: use CreateGoalInput (import type from db/queries/goals)
All three query files export z.infer<> type aliases as the canonical types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:47:44 +02:00
g-butandClaude Sonnet 4.6 f80c86e19d feat(ux): link all SummaryBar pills + extract DEFAULT_TIMEZONE constant
- pendingDrafts pill now links to /today (where ActionQueueCard lives)
- overdueCommitments pill now links to /today (where CommitmentsCard lives)
- urgentAlerts pill now links to /system
- Extract DEFAULT_TIMEZONE="Europe/Zurich" to lib/constants.ts; use it in
  crons route instead of hardcoded string

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:23:23 +02:00
g-butandClaude Sonnet 4.6 2c93c85d1c refactor(ssot): derive cron body types from Zod schemas, remove stale interfaces
lib/api/crons.ts had CreateCronJobBody/PatchCronJobBody interfaces that were
missing model, timeoutSeconds, and tz fields present in the canonical Zod schemas.
Now exports z.infer<> types from lib/crons.ts via import type (erased at build
time, no risk of bundling fs code into client bundles).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:14:19 +02:00
g-butandClaude Sonnet 4.6 599083a68e fix(ssot): use HEALTH_ACTIVE_DAYS constant in ActionQueueCard reasoning
Replaces hardcoded "30+ days" string with the HEALTH_ACTIVE_DAYS constant
so the threshold stays consistent with the rest of the codebase.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 15:03:32 +02:00
g-butandClaude Sonnet 4.6 3b6496ecc5 refactor(ssot): remove duplicated CreateGoalBody interface from lib/api/goals
The interface duplicated the Zod schema in db/queries/goals.ts.
Inline the type in createGoal's parameter; let TS infer the generic
in useCreateMutation from the request function signature.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 14:42:08 +02:00
g-butandClaude Sonnet 4.6 8220602485 refactor(ssot): extract remaining inline schemas; fix unused var
- CreateCommitmentBody + PatchCommitmentBody → db/queries/today (where commitment queries live)
- CreateCronBody + PatchCronBody + RunCronBody → lib/crons (where cron helpers live)
- Remove unused pct variable in MemorySummaryCard (eslint warning)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 14:24:44 +02:00
g-butandClaude Sonnet 4.6 94bfe6d9c6 refactor(ssot): extract PatchProjectBody to db/queries/projects
Completes the schema sweep — all inline Zod schemas in route files that
have a corresponding db/queries/ file now live there instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 14:10:40 +02:00
g-butandClaude Sonnet 4.6 612cd54256 refactor(ssot): extract inline Zod schemas to their query files
CreateProjectBody, CreatePersonBody, PatchPersonBody → db/queries/{projects,people}
PatchGoalBody → db/queries/goals (alongside MilestoneSchema + CreateGoalBody)
Route files now import schemas instead of defining them inline.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 13:57:58 +02:00
g-butandClaude Sonnet 4.6 f1c3f90e46 feat(nav): move Memory from sidebar into System page
Memory (knowledge graph telemetry) was occupying a sidebar nav slot but
isn't daily user content — it's infrastructure stats. Removed the Memory
nav item and embedded a compact MemorySummaryCard (entities, relations,
type breakdown) at the bottom of System, with a "View details →" link to
the full /memory page which is preserved for direct access.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 13:36:39 +02:00
g-butandClaude Sonnet 4.6 ca30ba7e12 fix(ux): rename Action Queue buttons from Approve/Reject to Done/Skip
"Approve" and "Reject" implied a review workflow. The actual meaning is
"I did this / mark complete" and "skip this action". Done/Skip is clearer
especially for check-in prompts where users aren't approving a draft —
they're just logging whether they reached out. Compact tooltips updated too.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 13:20:31 +02:00
g-butandClaude Sonnet 4.6 c017f6a1cf feat(ux): make SummaryBar pills navigable links
Goals, goal-due-soon, and events-deadline pills were static divs with no
navigation affordance. Wired them to /goals and /events respectively.
Drafts/overdue/alerts intentionally left static — they point to cards
already visible on the Today page, so linking would be a no-op reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 13:08:36 +02:00
g-butandClaude Sonnet 4.6 676673bc35 fix(habits): add habit creation to /habits page — remove dead-end empty state
The /habits page empty state said "Add habits from the Today page" with no
link and no form — a dead end. Added AddHabitButton (thin client wrapper
around AddHabitForm) and wired it into both the empty state and the bottom
of the habits list, so habits can be created from the dedicated page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 13:00:06 +02:00
g-butandClaude Sonnet 4.6 35497c2041 fix(ux): promote "Log a conversation" from ghost link to visible pill button
The button was text-white/25 — nearly invisible against the dark background.
This is the primary daily action that feeds the entire contact-health loop
(stale alerts, action queue, relationship scores). Made it a pill with
subtle bg/border at white/55 so it reads as clickable without competing
with the page header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 12:45:52 +02:00
g-butandClaude Sonnet 4.6 1b17f467c5 fix(ux): improve contrast and text wrapping on Today page cards
- CommitmentItem: truncate → line-clamp-2 so commitment text wraps instead
  of being silently cut off mid-sentence
- ActionQueueCard: bump grouped check-in body preview from white/30 to
  white/50 and switch to line-clamp-2 for multi-line visibility
- EventsDueCard: event.type label white/25 → white/40 to meet minimum
  contrast for secondary labels

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 12:30:56 +02:00
g-butandClaude Sonnet 4.6 3d39538aad refactor(ssot): extract CreateGoalBody/CreateEventBody/PatchEventBody to query files
Goals: CreateGoalBody added to db/queries/goals.ts alongside MilestoneSchema —
route now imports from there, removing the inline z.object.

Events: CreateEventBody + PatchEventBody (with EVENT_STATUSES cast) added to
db/queries/events.ts — both route files slimmed to just the import.

Also: session panel now renders the todos field (in amber) when non-zero, so open
TODOs are visible from the project overview drawer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 12:08:00 +02:00
g-butandClaude Sonnet 4.6 b5e23b98e0 feat(projects): surface Claude session state in project overview tab
Adds GET /api/sessions?project=<name> which reads ~/.claude/sessions/<name>.md
(case-insensitive, dash-tolerant match) and parses done/next/tests/todos/health.

ClaudeSession component in ProjectOverviewTab fetches this on mount and renders a
compact status panel — visible for Cockpit, OrangeCat, kivvi, and any other project
that has an active session file. Projects without a session file render nothing.

Also fixes a DRY violation in SubscriptionActions where the delete-record handler
was duplicated verbatim as an inline arrow function in the permanent DeleteButton.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 11:48:55 +02:00
g-butandClaude Opus 4.7 e5f9d09d51 refactor(ssot): extract subscription schemas next to money.ts helpers
CURRENCIES_ENUM and FREQUENCIES_ENUM casts were byte-identical in both
/api/subscriptions/route.ts and /api/subscriptions/[id]/route.ts —
same pattern as habits FREQUENCIES fixed in 597c356.

CreateSubscriptionBody and PatchSubscriptionBody (which consume those
casts plus a SUB_STATUSES tuple) now export from db/queries/money.ts
next to cancelSubscription and calculateMonthlyBurn. Both route files
drop z import, both enum cast locals, and the full schema bodies.
money.ts gains one z import in exchange for being the single place
where subscription field validation lives.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 10:15:44 +02:00
g-butandClaude Opus 4.7 597c3565c9 refactor(ssot): extract habit/goal schemas next to helpers, use RESERVED in ProjectGrid
Three SSOT violations fixed:

1. habits routes: FREQUENCIES cast tuple was byte-identical in both
   /api/habits/route.ts and /api/habits/[id]/route.ts.
   CreateHabitBody + PatchHabitBody now export from db/queries/habits.ts
   next to createHabit/updateHabit. Both routes drop z import + cast.

2. goals route: MilestoneSchema was inline in /api/goals/[id]/route.ts,
   mirroring the Milestone TS type in db/schema/goals.ts.
   MilestoneSchema now exports from db/queries/goals.ts where
   GoalWithChildren already imports Milestone from the schema.

3. ProjectGrid: attr-key exclusion list ["production_url","url","repo",
   "github_repo","owner","description"] was a partial duplicate of RESERVED
   from project-detail-types.ts (which already covers all reserved keys).
   Replaced inline array with the imported RESERVED constant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 10:07:24 +02:00
g-butandClaude Opus 4.7 bb35acf14e refactor(api): extract SetAttrBody/DeleteAttrBody schemas next to their helpers
Same shape as the just-shipped CreateInteractionBody extraction
(6472ee9). The attrs routes' runtime was deduped in 2e1859b
(upsertEntityAttribute / deleteEntityAttribute helpers) but the two
zod schemas — SetAttrBody (key+value) and DeleteAttrBody (key) — were
left inline and byte-identical across both /api/<entity>/[id]/attrs
routes.

Both schemas now export from db/queries/utils.ts next to the helpers
that consume them. Each route shrinks ~3 lines and drops the z import
entirely. Net: -3/+9 (only +9 because the new shared definitions are
counted once instead of twice).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 23:14:36 +02:00