Commit Graph
331 Commits
Author SHA1 Message Date
Mao NakamotoandClaude Opus 4.8 09fb142d52 fix(rag): page embeds + insert-first reindex (index-empty regression)
Section-chunking grew the index to ~669 chunks; embedTexts sent them in ONE
request, which overran the local embed server ("fetch failed") → 0 embedded.
Combined with deleting owned rows BEFORE inserting, that emptied the index.
- embedTexts pages requests (48/batch); a failed page nulls only its inputs.
- reindexer is insert-first, prune-after (pruneKnowledgeToIds); an embed outage
  can no longer empty the index.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 07:53:15 +02:00
Mao NakamotoandClaude Opus 4.8 5765603098 feat(loki): harden context — robust fallback, section chunking, retrieval diversity
Push toward "useful even on a modest model": make the harness so good and so
robust that model quality matters less.

- Robustness: askLoki now treats an empty or "couldn't generate a response"
  gateway reply as a failure (not just !ok) and falls back — so a flaky/thinking
  model that emits no final payload never surfaces a broken answer as Loki's.
- Precision: chunkMarkdown splits essays into section-sized passages (h2/h3, then
  paragraph) so retrieval returns the relevant passage, not a truncated 6k blob.
  Reindexer re-chunks essays; deleteKnowledgeByTypes clears owned types first so
  the index is a true mirror (no orphans from id changes / removed docs).
- Coverage: Loki's retrieved-detail now pulls a larger pool and caps chunks per
  source, so a cross-project question gets breadth instead of six chunks of one
  project.

Pure chunker unit-tested (32/32). tsc + lint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 07:41:53 +02:00
Mao NakamotoandClaude Opus 4.8 69634ef896 feat(loki): index goals + essays; source-aware retrieval
Ask: "everything I have, Loki should have." The RAG index held only project
dossiers + dev logs. Extended reindex-knowledge.ts to also embed:
  • goal — every project's roadmap/task-list (title, description, %, milestones,
    joined to its project) — the raw material for cross-project synthesis.
  • thought — the published strategic essays, where the operator has written
    down HOW the projects relate (three-layer thesis, the two halves) — so Loki
    reasons about synergies from first-hand sources, not guesses.
Added "goal" to KnowledgeSourceType (free-text column, no migration).

Loki's retrieved-context block is now source-aware: each line is labelled by
kind + project (or essay title) — "[BiasLens · goal]", "[essay: The Two
Halves]" — and Loki is told to cite the [source], so it shows its work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 00:08:22 +02:00
Mao NakamotoandClaude Opus 4.8 3ef8e8a751 feat(loki): Loki is on top of all projects (fleet index + RAG)
askLoki injected zero project context — it sent the raw message to the gateway
with a generic system prompt, so Loki only knew what the shared OpenClaw agent
happened to remember. The fleet-knowledge RAG (pgvector) was wired into
dispatches, never into Loki chat.

Now every Loki turn prepends a read-only fleet-context block:
  • BREADTH — a compact index of every active project (name, stack, description,
    latest dev-log state) so Loki can answer across the whole fleet, not just
    whatever RAG retrieved. (buildFleetIndex, pure + unit-tested.)
  • DEPTH — top-K semantically-relevant chunks from knowledge_embeddings
    (searchKnowledge / pgvector) scoped to the question — the dossiers + dev logs
    reindexed this session.

Injected on both the gateway and Groq-fallback paths; best-effort (a failed
lookup degrades to plain Loki, never a broken turn). Pure index split into
loki-fleet-index.ts so it unit-tests without a DB (31/31).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 23:46:43 +02:00
Mao NakamotoandClaude Opus 4.8 5dc3ef5b7f feat(pricing): public /pricing page (Stripe-aware, honest tiers)
Closes the named trust gap (audit: "no pricing visible; looks abandoned or
confused about whether it's commercial"). Founder can't connect Stripe yet, so
the page is honest by construction: paid CTAs open checkout only when
isStripeReady(); until then every CTA routes to a free signup — no dead Buy
buttons — and flips live automatically when keys land, no code change.

- src/config/plans.ts: SSOT for tiers (free/personal/pro/team) deriving the
  project limit from PLAN_LIMITS (lib/plan.ts, the only gate the code enforces).
  Prices are the master-plan §7.2 anchors (CHF 15/40/90) — one edit to change.
  Rich capabilities live in PRICING_INCLUDED ("every plan includes") rather than
  faked as per-tier gates the product doesn't apply — honest by construction.
- src/app/pricing/page.tsx: responsive card grid, reuses ui-public-* classes,
  works 320px+, semantic tokens only (no palette/hex).
- Wired into public nav (PUBLIC_NAV), footer Product group, and smoke.sh.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 23:05:03 +02:00
Mao NakamotoandClaude Opus 4.8 e3ce10d21a fix(projects): share link uses canonical public URL, not internal bind
Dogfooding the shipped share feature on the box surfaced a dead link: the API
built the shared URL from req.nextUrl.origin, which behind Caddy is the internal
bind (https://0.0.0.0:4002). Every copied/opened/displayed share link was
unreachable. Build it from appUrl() (NEXTAUTH_URL) instead — the same canonical
base URL email links already use. authenticated-smoke now asserts SH03b: the
returned url is a public https link containing the token, never 0.0.0.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 18:05:24 +02:00
Mao NakamotoandClaude Opus 4.8 4fbadfe2ee chore(deploy): sync reindex script, bound restart stop, cover share lifecycle
- deploy-hetzner.sh: sync scripts/reindex-knowledge.ts to the box runner so the
  nightly fleetcrown-reindex uses current (dossier-aware) code — it was pinned to
  a 2026-06-25 copy while src/ shipped daily, so project_profile embeddings never
  picked up the richer shared-dossier text.
- deploy-hetzner.sh: poll /sign-in for readiness (up to 20s) instead of one
  immediate curl, so a slow-to-stop old Next process no longer rolls back a build
  that is actually fine.
- systemd units (box-units + sync-infra): TimeoutStopSec=15 + KillMode=mixed so a
  `systemctl restart` can't block on Next draining keep-alive connections.
- authenticated-smoke: add SH01–SH09 share-lifecycle probes (create → public
  render → update → revoke → public 404 → clean), non-destructive on already-
  shared projects. Validated green against production.
- CLAUDE.md: note the per-project dossier + shareable public link.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 17:58:12 +02:00
Mao Nakamoto b598fb2ffc feat(projects): shareable dossiers and lifecycle resources 2026-07-08 16:08:23 +02:00
Mao NakamotoandClaude Opus 4.8 98953e9ab0 feat(control): goal-mode — per-project DoD + turn cap on the stop-gate
Realizes the /goal loop pattern for FleetCrown: a project declares what "done"
means and how many tries it gets, and the existing cross-model DoD judge loops
the fleet until the bar holds or the cap is hit — instead of stopping on the
agent's own say-so.

- dod-gate.ts: applyDoDGate gains an optional turn cap. Under the cap it still
  downgrades success→partial (loop continues); AT the cap it stops downgrading
  so the run keeps success (no gap → the continue-loop halts naturally) and
  records the cap in `next` for the captain. Enforced entirely at the gate — no
  continue-loop change. +7 pure test cases (12/12).
- getProjectGoalConfig sources definition_of_done + a new goal_max_turns attr
  (clamped 1–20, null = loop until met = unchanged behavior).
- gateAndCloseRun uses per-project DoD + cap, counting consecutive prior partial
  closes (from the outcomes the handler already fetched) as the turn count.
- POST /api/control/goal sets both attributes; GoalEditor (in the project
  dossier Now section) is the UI to set/clear the goal + cap.

tsc + lint + design-system + dod-gate tests all green. On a branch (no deploy).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 10:02:52 +02:00
Mao NakamotoandClaude Opus 4.8 ca2150fc08 chore(devops): draft dedicated-fcrunner migration (thorough #1)
The stronger version of the blast-radius fix, beyond the InaccessiblePaths
drop-in: run the box-runner as an unprivileged `fcrunner` that owns only its own
dir instead of `ubuntu` (which owns every app's files).

- scripts/hetzner/migrate-box-runner-to-fcrunner.sh: creates fcrunner, copies the
  agent runtime (.claude auth + credentials.json, the claude CLI in .local, .npm,
  .gitconfig, runner token) from /home/ubuntu → /home/fcrunner (NOT .ssh), chowns
  the runner dir, and installs a systemd drop-in (User=fcrunner + HOME/PATH
  repointed + InaccessiblePaths hiding ALL of /home/ubuntu and every co-tenant
  /opt/<app>). --dry-run / --revert. Idempotent. Prints the claude-auth
  verification + creds-copy fallback.
- deploy-hetzner.sh + install-box-runner.sh now honor FLEETCROWN_RUNNER_OWNER
  (default ubuntu, so no change until you migrate) — otherwise the per-deploy
  runner chown would silently revert ownership to ubuntu.
- Apply guide updated with the migration steps + the coupling reminder.

Still NOT applied. bash -n clean; dry-run verified against the box.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 20:49:36 +02:00
Mao NakamotoandClaude Opus 4.8 cc4c58fcbf chore(devops): prepare blast-radius containment (#1) + CI-gated deploy (#2)
Both prepared, NOT applied. Inert until you act — see
docs/development/devops-prep-apply-guide.md.

#1 — box-runner blast radius:
- scripts/hetzner/harden-box-runner.sh installs a systemd drop-in that makes the
  co-tenant /opt/<app> dirs, /opt/backups, and /home/ubuntu/.ssh kernel-
  inaccessible to the runner AND every agent PTY it spawns. Keeps User=ubuntu
  (the claude CLI lives in /home/ubuntu, so no user migration needed). Safe: the
  runner only touches its own dir + fresh clones under /home/ubuntu/dev, never a
  co-tenant /opt (verified in box-workspace.ts). --dry-run / --revert supported.
- install-box-runner.sh bakes the same InaccessiblePaths into the unit for fresh
  installs.

#2 — CI-gated deploy:
- .github/workflows/deploy.yml runs ONLY after CI succeeds on main, builds
  (schema-only Postgres service), and ships via deploy-hetzner.sh --no-build so
  the flock/rollback/verify logic carries over. A red CI → no deploy. Needs a
  HETZNER_SSH_KEY secret; the local push-deploy hook must be disabled to avoid
  double deploys (documented).
- scripts/setup-branch-protection.sh (opt-in, separate) requires the CI check
  before merge — rejects direct pushes to main, so only for a PR-based flow.

bash -n + deploy.yml structural checks clean; drop-in dry-run verified.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 20:49:36 +02:00
Mao NakamotoandClaude Opus 4.8 0ba0680178 chore(infra): version-control handcrafted box units + SSE guard
Addresses the Infra/SRE S2 "prod unit + Caddy blocks are handcrafted on the box,
unauditable and unrecoverable":

- scripts/hetzner/box-units/ captures the live fleetcrown-app.service and the
  fleetcrown + bridge Caddy blocks (reference copies, with apply instructions),
  so a disk loss doesn't take the only copy. Repo unit adds StartLimitIntervalSec=0.
- verify.sh now asserts the bridge SSE block stays `encode`-free (compression
  buffers the stream → disconnect never fires → stale presence). Verified green
  against the live box.

Ground-truth corrections from inspecting the box (memory was stale):
- Off-box backups are LIVE: pg-backup.sh pushes encrypted restic snapshots to
  Backblaze B2 (b2:orangecat-restic), 6 snapshots, latest today, fail=0. The
  panel's S1 "single-disk total loss" was based on a stale 'restic pending' note.
- Alerting is NOT dormant: HEARTBEAT_URL (healthchecks.io dead-man's-switch) is
  set and the watchdog timer is active. Telegram push is optional-not-wired.
- Caddy SSE: the load-bearing bridge block is correctly encode-free (deliberate,
  commented); the 4002 app encode is an intentional keep (compressible pages +
  flush_interval -1). Lower risk than flagged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 19:13:30 +02:00
Mao NakamotoandClaude Opus 4.8 bf97bb90aa fix(infra): harden env-gen + systemd units (in-repo)
Addresses the Infra/SRE + Security panel findings that don't need box access:

- gen-env.sh stripped only ONE trailing literal \n; the prior secret-corruption
  incident (broke all email + the private-zone PIN) had MULTIPLE embedded \n.
  Now strips all \n/\r sequences and real CR/LF anywhere in a value. Verified
  against the multi-\n case.
- StartLimitIntervalSec=0 on the generated app units (sync-infra.sh) and the
  embeddings unit (install-fleet-rag.sh) so a crash-loop keeps retrying instead
  of locking to "failed" until a manual `systemctl reset-failed` — the observed
  historical failure mode. (box-runner already sets it.)
- RandomizedDelaySec=300 on the fixed-time timers (app-crons, pg-backup,
  reindex) so the herd of 08:00/02:30/03:30 jobs doesn't fire builds+curls
  simultaneously on the shared 8-vCPU box.

These take effect on the next install/sync of each unit. bash -n clean.

NOT done (flagged — needs your input): MemoryMax/CPUQuota needs real usage
numbers to avoid OOM-killing legit builds; the dedicated box-runner user
(fcrunner + secret broker) is a box migration that could break the always-on
builder — both are box-apply changes deferred to your review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 19:08:48 +02:00
Mao NakamotoandClaude Opus 4.8 f63315ace7 test(ci): glob-discover unit tests; converge CI and pre-push
Addresses the Test/Quality panel finding that only ~12 of ~32 test:* scripts
ran automatically and a newly-added test:* was born dead (never in CI):

- scripts/test-unit.ts globs scripts/test/*.ts and runs every pure test in
  parallel. New pure tests are picked up for free. Infra-dependent tests are
  skipped with an explicit reason (server/DB/Groq/embeddings). Classification
  was verified under true CI conditions (.env.local hidden + dead DATABASE_URL,
  since dotenvx otherwise injects a live DB and masks the dependency): 29/29
  pure tests green, 6 correctly skipped.
- ci.yml and .husky/pre-push both now run `npm run test:unit` (+ test:home), so
  a green push and a green CI run the same suite and can't diverge.
- Runner avoids top-level await (tsx→CJS rejects it), uses the local tsx bin at
  concurrency 2 (esbuild-friendly on a 2-core box), and handles spawn errors.

NOT done (needs your decision — flagged): required-status-checks branch
protection would REJECT direct pushes to main, breaking the push-to-main-deploy
flow, unless the deploy also moves into CI (needs the box SSH key as a GitHub
secret — your call). `next build` in CI still needs a Postgres service to
pre-render; deferred (deploy-time build + the new rollback already gate it).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 18:58:22 +02:00
Mao NakamotoandClaude Opus 4.8 12e6ec3fca fix(deploy): serialize deploys, add rollback + result sink
Addresses the DevOps panel's release-engineering findings on scripts/deploy-hetzner.sh:

- flock(1) serialization around the whole deploy — two near-simultaneous main
  pushes each background a deploy; without a lock both run `next build` in the
  shared .next and collide ("Another next build process is already running"),
  and the older ref could win. Blocking lock (-w 900) serializes so the newest
  ref ships last; every step is idempotent so waiting is always safe.
- Rollback: snapshot the current box build to app.prev (excl. backups) before
  rsync; if the restart or post-deploy verification fails, restore app.prev and
  restart — a broken ship no longer strands the box.
- Deploy-result sink: a trap on EXIT reports every outcome (success/failure) as
  a final status line, a desktop notification, and a row in the box debug_logs
  (source=deploy) so a failed background deploy surfaces on /system instead of
  dying silently in /tmp with an exit code nobody reads.

bash -n clean; flock confirmed present. Not triggered against prod (would ship).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 18:41:39 +02:00
Mao NakamotoandClaude Opus 4.8 0a1be95c15 feat(agents): surface protocol message type as a feed badge
Realizes the message-taxonomy lesson from Anthropic's multi-agent orchestration
model: agents already agreed to echo a {type, status} schema in message bodies,
so lift `type` (task|result|question|escalation) and `status` and render `type`
as a coloured ui-tag in the comms feed — escalation negative (captain can't miss
it), result positive, question warning, task accent.

Extraction is a targeted regex over the two constrained fields (KISS — no
full-JSON parse), tolerant of pretty-printing and prose, and the body stays SSOT
(payload is not stripped). Degrades to no badge when a message carries no schema.
Verified against the live inbox: the t0-handshake result shows type=result
status=done; prose messages show none. +7 test cases (23 total).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 18:07:17 +02:00
Mao NakamotoandClaude Opus 4.8 136a97e2d6 refactor(agents): extract + harden inbox parser, add fixture tests
Grounded the comms parser against the real ~/.claude/cross-project/inbox-*.md
files, which surfaced three defects in the shipped version:

- `---` message delimiters leaked into message bodies (feed noise). A rule
  line now closes the current message instead of being appended.
- Plain `Re:` subject lines (not just `**Re**:`) were dropped into the body.
  Both forms are now parsed.
- The dedupe id `from->to@ts` collapsed distinct same-day messages when a
  header carried a date with no time. The id now includes a content hash, so
  distinct bodies stay separate while byte-identical copies still dedupe.

Moved the pure parser out of the HTTP route into src/lib/agent-comms.ts
(SoC + testable), re-exported the AgentMessage type there as SSOT (AgentsCockpit
now imports it), and added scripts/test/agent-comms.ts (16 cases, inline
assertions per house convention) + a test:agent-comms npm script. Verified
against the live inbox files end-to-end.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 18:03:24 +02:00
Mao NakamotoandCursor 7656e45247 chore(dogfood): auto-load SMOKE_PRIVATE_PIN from .env.local on push
Pre-push prod dogfood and headless dogfood scripts source .env.local so
git push runs the full prod suite without exporting the PIN manually.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-05 01:57:59 +02:00
Mao NakamotoandCursor 53014acaca test(dogfood): M04/ST02/CH04 probes and fix settings Account tab
Extend authenticated smoke to 115 probes (billing SSOT, Stripe webhook
validation, ME02 chunk count) and UI dogfood for money links + settings
Account tab; update user-flow-audit grades.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-05 01:49:15 +02:00
Mao NakamotoandCursor 5304ebef88 feat(api): memory rag-stats probe and Fleet Runner dogfood
Expose GET /api/memory/rag-stats for ME02 smoke, add local-builder
open-tabs/peek probes when Fleet Runner is connected, and skip machine
dogfood cleanly when only the cloud builder is online.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 22:15:12 +02:00
Mao NakamotoandCursor 7abcb56ad6 fix(lint): drop unused APP_URL from agent install route
Extend Loki dogfood to verify the Terminal This computer shell after
dispatch, and grade X05 as partial when Fleet Runner is not connected.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 22:00:53 +02:00
Mao NakamotoandCursor ef7f04bef0 test(dogfood): run authenticated smoke in prod push checks
Extend the opt-in pre-push prod dogfood path to include authenticated smoke,
verify goal-card dispatch when a builder is online, and document manual
runbooks for third-party flows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 21:23:38 +02:00
Mao NakamotoandCursor 7863ea8d2e chore(hooks): optional prod UI dogfood on push when PIN set
Run ui-flow-dogfood on every push with SMOKE_PRIVATE_PIN; run loki dogfood
only when the builder is online (or DOFOOD_LOKI_ON_PUSH=1).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 21:01:16 +02:00
Mao NakamotoandCursor 71ee0263ee test(dogfood): UI flows for People, habits, goals, prompts
Add headless Playwright dogfood covering Ask Loki from card, habit
heatmap, goal Control prefill, prompt fork, and Run with Loki modal.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 20:56:20 +02:00
Mao NakamotoandCursor f3a2364b6c test(smoke): settings, cron, and agent-token API probes
Extend authenticated smoke to 112 probes covering profile, notifications,
fleet lifecycle, beacon, agent tokens, scheduled jobs, and frontier
validation without mutating open proposals.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 20:50:51 +02:00
Mao NakamotoandCursor de1db42ceb test(smoke): execution API probes and headless Loki dogfood CI
Add X01–X09 API probes to authenticated smoke (97 total), print-session-token
helper, dogfood:loki:ci with JWT mint, and grade execution flows in the audit doc.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 20:18:58 +02:00
Mao NakamotoandCursor e3a92f8f81 test(smoke): add private-zone CRUD probes to authenticated smoke
Round-trip POST/PATCH/DELETE for people, goals, habits, events,
subscriptions, and prompts when SMOKE_PRIVATE_PIN is set. Updates
user-flow-audit checkboxes (89/89 on prod).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 20:01:35 +02:00
Mao NakamotoandCursor f887f220b6 feat(qa): flow audit SSOT, honesty labels, and prod smoke harness
Add user-flow-audit checklist, authenticated smoke with PIN unlock, builder
presence API, executor honesty chips on Control/Loki/Terminal, setup auto
sign-in, workspace gate on hosted, and fleetcrown brand-storage migration.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 19:35:25 +02:00
Mao Nakamoto 1a33cbad42 feat(execution): add sandbox executor substrate 2026-07-03 21:36:31 +02:00
Mao NakamotoandClaude Fable 5 9ee86d29c6 fix(runner): verify dispatch against the CLI's own live session status
Claude Code writes live per-PID status to ~/.claude/sessions/<pid>.json
(status idle|working, cwd). Three fixes hang off it:

- Dispatch verify: isPtyBusy was fooled by boot-screen redraw — on a
  fresh clone the trust-folder dialog ate the injected paste and six
  agents were acked 'launched + injected' while idle at an empty
  composer. waitForAgentGenerating() now polls the CLI's own status
  (fallback to isPtyBusy for agents without live status files) and
  re-injects once when verifiably idle.
- Pusher lifecycle: readFastState synthesizes the direct_terminal
  observation from live status, so headless PTY agents mid-task read
  as Working instead of 'process detected, no lifecycle signal'
  (the producer the presenter test always described but nothing built).
- Deploy hardening: the restart ssh runs under timeout 180 +
  keep-alives after hanging 47 minutes post-restart and freezing the
  deploy before verification and the runner sync.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 00:04:22 +02:00
Mao NakamotoandClaude Fable 5 5fc3333f9a fix(control): fleet truth pass — honest hero, live janitors, actionable streaks
Dogfood session drove FleetCrown against production and found the fleet
had been silently dead for 2 days behind a green light:

- nudge-idle raw-queried beacon_settings WHERE mode != 'off', so users
  with NO row (missing row = default 'on') were invisible to the
  scheduler — autopilot dispatched nothing while the hero said
  'Autopilot on'. New SSOT getFleetAutopilotUserIds() decides
  enrollment for schedulers; missing rows count as on.
- The stale-run reaper only ran on /api/control page loads: 16 runs sat
  'waiting' for 51h until a human looked, then got stamped with
  fabricated 51h durations. New hourly reap-stale-runs cron reaps all
  users; finishedAt = startedAt + STALE_RUN_MINUTES (truthful).
- Hero headline was mode-derived ('Building' + pulsing green with 0
  working and 16/16 failed runs). deriveFleetPulse() (pure, tested)
  now derives Building / Waiting to dispatch / Stalled(+Review
  failures link) / Paused from live counts + latest outcomes.
- OutcomeStreak ✗ glyphs were unlabeled dead-ends; the streak now
  deep-links to /activity?window=week&project=<key>.
- box-runner logged 'connected · last poll 0s ago' every 2s to journald
  (~40k lines/day); now logs on state change + 15-min heartbeat.

Presenter tests 25/25 (6 new fleet-pulse cases).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 22:00:50 +02:00
Mao NakamotoandClaude Fable 5 d9b784d33f feat(bridge): promote backfill cron + settings Connect OrangeCat
Closes the two operational gaps in bridge Parts A/C (FC master plan
Phase 0.4/0.5):

- /api/crons/orangecat-promote-backfill re-emits project_published +
  recent devlog promotes for every OC-linked project daily (09:00 UTC
  timer added to install-hetzner-crons.sh). Deterministic external ids
  make re-posting idempotent — 'best-effort must not mean silently
  lossy' is now true.
- promoteMomentToOrangeCat/promoteDevLogEntry return a PromoteOutcome
  so the janitor can count posted/skipped/failed (user-action call
  sites still fire-and-forget via void).
- Settings → Account gains a Connect OrangeCat row for existing users
  (env-gated like the sign-in button); links via the same OIDC flow,
  which also unlocks Publish to OrangeCat.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 19:40:15 +02:00
Mao Nakamoto bd5da41132 fix(loops): surface readiness and auth labels 2026-07-01 04:20:42 +02:00
Mao Nakamoto cf45aa9be5 fix(loops): route idle nudges through dispatch spine 2026-07-01 02:52:21 +02:00
Mao Nakamoto 66e3ac55dc feat(multitenancy): gate shared cloud execution 2026-06-30 19:07:54 +02:00
Mao Nakamoto d908145a1f feat(loki): refine command composer UX 2026-06-30 18:09:49 +02:00
Mao Nakamoto 033b780326 feat(control): complete terminal and orchestration trust pass 2026-06-30 14:53:06 +02:00
Mao NakamotoandClaude Opus 4.8 23ae8b6c80 feat(dogfood): handle Loki Send hang/failure gracefully in self-dogfood
Wrap the dispatch-footer wait in a non-throwing gotDispatch check (local +
prod paths). On timeout, record a high-severity weakness and a timeout
screenshot instead of throwing on waitForSelector, so a hung Send produces a
report rather than aborting the whole run. Also force-click the owner-key tab
with a bounded timeout. (Concurrent-session edit, committed to keep the tree
clean — see pattern-concurrent-autopilot-worktree-race.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 01:10:26 +02:00
Mao NakamotoandClaude Opus 4.8 ae88653d9e chore(dogfood): add self-dogfood script driving fleetcrown via its own UI
npm run dogfood:self drives Control → Loki "Move forward" → Terminal Cloud →
Projects against local or prod (fleetcrown.orangecat.ch), screenshots each
step, and emits a weakness report. Mirrors dogfood:loki (same playwright/
chromium convention, undeclared dep shared by both — tracked as follow-up).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 00:50:06 +02:00
Mao NakamotoandCursor f755b4f134 fix(loki,control): show builder-online copy for cloud queue dispatches
Cloud inject always queues even when box-runner is connected; distinguish
runnerConnected in Loki footer, Control toasts, and dispatch-status SSOT.
Add prod dogfood script and dispatch-status tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 00:08:43 +02:00
Mao NakamotoandCursor a491e9e487 feat(loki,control): unified builder UX and move-forward dispatch
Browser-first onboarding and executor-copy SSOT; Loki imperatives and move-forward
route to the same builder queue as Control with cloud-first Terminal links; fleet-kick
queues when offline; deploy script syncs box-runner.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 22:58:32 +02:00
Mao NakamotoandCursor 480294fa15 feat(control,loki): subset loops and screenshot dispatch
Add Build/Pause selected on Control, multi-project command fan-out in Loki,
and route scoped screenshots to dispatch with vision preflight instead of chat.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 19:45:42 +02:00
Mao NakamotoandCursor 9f0d170484 feat(control): fleet-kick on Start building and fix nudge-idle cron
Start building now batch-dispatches next_best on eligible idle projects
(capped at three concurrent) and Loki accepts develop-all phrasing; restore
the daily idle nudge for users with autopilot on after the mode collapse.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 18:58:10 +02:00
Mao NakamotoandCursor 5ac16ea023 feat(loki): consolidate on /loki as single command surface
Route shell FAB and loki:open to /loki with composer prefill; retire the
chat-only modal. Add fleet list/create NL fast paths, project picker chips
for ambiguous dispatches, and a db helper to inspect recent conversations.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 14:45:06 +02:00
Mao NakamotoandCursor f62565e9b8 feat(control): ship Phase 1 fleet play/pause hero UX
Prominent ui-control-hero autopilot card with Building/Paused status, large
Start/Pause CTA, per-project toggles, rail override chips, and refresh sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 11:09:33 +02:00
Mao NakamotoandCursor 308f32c833 chore(projects): retire swiss-longevity-hub and link Bitbaum runtime
Merge SLH into surf-your-life on prod, drop orphaned box DB, remove SLH from
hetzner manifest, and wire Bitbaum user_projects dir for local dispatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 10:39:39 +02:00
Mao NakamotoandCursor 3b94efbb67 chore(db): retire stale prod projects and add cleanup tooling
Merge Cockpit and empty dupes into canonical entities, delete infra/stub
rows, and ship retire-stale-projects.ts plus merge helpers for future hygiene.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 09:59:27 +02:00
Mao NakamotoandCursor 826dc5c92b fix(profiles): batch applyProjectProfile writes for prod enrich
Transaction upsert prevents remote DB timeouts. Replace placeholder
descriptions on enrich. Backfilled petvity, sbb-lost-found, Bitbaum.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 20:43:39 +02:00
Mao NakamotoandCursor 36d1802469 chore(profiles): backfill prod build-contract attrs from local repos
Re-ran enrich-prod-profiles against Hetzner — 16 projects now have
architecture/conventions/DoD. Add Groq retry for transient fetch failures.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 20:05:23 +02:00
Mao NakamotoandCursor 50b52301e1 feat(rag): Memory index health and Hetzner install SSOT
Surface fleet-knowledge chunk counts on /memory, document box RAG ops via
install-fleet-rag.sh, and add rag-retrieval test script. Reindex on production
already active (24 chunks across 21 project profiles).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 18:39:47 +02:00