Commit Graph
8 Commits
Author SHA1 Message Date
CatoandClaude 511d1b1d17 feat(feedback): Loki looks at a picture when words cannot tell (#1139)
Page text could not say whether a layout, a colour or an overlap was
fixed, so those fixes were still sent to the owner's eyes. Now, when the
text look leaves the question open, Loki takes a phone-sized picture of
the live page (Playwright on the server, scrolled to what the reporter
pointed at) and puts it to the vision chain with the same question.

- lib/feedback/page-picture.ts: one browser at a time; CHROME_PATH, then
  Playwright's own, then a system Chromium; none → "no-browser", said on
  the card in words.
- verify-live.ts: two looks in order, text then picture; the verdict
  records `via`; the picture is kept on the run (payload.fixPicture, never
  in the inbox list) and served by /api/feedback/[id]/looked. No AI budget
  means no model call, not no look: the picture is still taken for the
  owner.
- recommend/row-story: "Loki read /pricing" vs "Loki looked at a picture
  of /pricing".
- LookedPicture: the picture on the LOOK card (crop first, whole page on a
  tap) and in every row's details, so "It worked / Not fixed" can be
  answered from the card.
- next.config: playwright is a server external, like node-pty.


Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 14:39:23 -07:00
CatoandClaude 31940ed00e feat(feedback): Loki looks before it asks — a live fix is read against the report (#1134)
Owner, 2026-10-10: "How am I supposed to confirm if it worked or not? I have
to go and test it." "Confirm it worked" asked the owner to assert what only
a look could tell — and Loki had not looked.

Now, once a fix is deployed, Loki reads the live page as text and answers
the report's question itself, once per fix, on the owner's AI budget, from
the inbox read a person made (never a timer — no-free-background-ai walks
the call graph):
  looks_fixed → the card says "Close it" with what Loki saw
  not_visible → "Try again", with what is missing
  cannot_tell → (layout, colour, a flow) the card leads with "See it on the
                site" and "It worked" / "Not fixed" sit beside it; "Do all"
                leaves these for the owner's eyes and says how many

- src/lib/feedback/verify-live-rules.ts (pure, tested): the page as text,
  the question, the verdict, who is due.
- src/lib/feedback/verify-live.ts: fetch, ask, stamp the verdict on the
  run's fix ledger (FixShipping.verify).
- /api/feedback/inbox calls it after attachFeedbackWork, two per load.
- recommend.ts: CONFIRM only on a looks_fixed verdict; new LOOK kind, not
  taken by "Do all"; doAllLabel says "closes"; looksLine for the banner.
- DecisionCard: a LOOK renders the walkthrough + It worked + Not fixed.
- row-story: the full row says what Loki saw.
- docs/paths.md and CHANGELOG.


Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-10 08:17:50 -07:00
CatoandClaude c0a718f7ca feat(feedback): Loki decides each report; the page is the yes (#1133)
Owner, 2026-10-10: "If my involvement is needed, it shouldn't take me more
than 10 milliseconds. I should be able to tap once and have some
confidence that this tap will lead to the correct improvement, because all
the analysis, contemplation and evaluation will be done before that one
option I can tap is given to me." A page whose rows explained themselves
well was still a page that made the owner decide. So the deciding moves
into one pure module and the page becomes a queue of yeses.

- src/lib/feedback/recommend.ts (pure, tested): one recommendation per
  report from the honest phase and the report's own facts — live + the
  agent's success → Confirm (free); a fresh report on a runnable project →
  Build (one run); untouched for 21 days (7 for Loki's own findings) →
  File away with the reason written on the row; stuck on a shut laptop with
  the cloud up → Run it in the cloud; failed or quiet → Try again; a closed
  pull request → File away; merged / deploying / open PR → no decision, it
  is under way. summarizeDecisions + doAllLabel say what "Do all" spends.
- FeedbackInbox rebuilt: the heading is the count and the scope ("6
  decisions · all projects ▾" — the picker that changes the number sits
  beside it); one "Do all N · starts 5 runs, confirms 1, files 2 away"
  button; each decision a DecisionCard (kicker "CONFIRM · FREE", the reason
  in one sentence, the report beneath in smaller type, one filled button,
  "Something else" opens the full row). Under way, Done and Filed away are
  three collapsed lines. The sources filter and the lens strip are gone.
- PATCH /api/feedback/[id] takes `reason` with `archived` so a filed-away
  row carries Loki's sentence; use-feedback-actions passes it.
- inbox-groups.ts (failure folds) retired with the lenses.
- docs/paths.md §6 and CHANGELOG.


Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-10 05:31:43 -07:00
CatoandClaude cb6af7ab95 feat(feedback): every row says what it is and what happens now — rebuilt from the owner's reading (#1130)
Owner, 2026-10-10, on a phone: "It says live check it or needs you. It
doesn't explain why it needs me and what exactly I need to do … Watch
what? Where would I be taken? … I don't know what the star is, and I
don't know what that arrow is." The row showed a status WORD, the report
and a set of buttons, and left every sentence between them to the reader;
"Watch" and "Watch the fix" meant different places on different lenses.

Every row is now one paragraph, in a fixed order:
  1. what the state IS — one bold sentence, coloured by whose move it is
     ("The fix is live on /pricing.", "An agent is working on it — 4 min so
     far.", "The attempt failed.", "Fixed — you confirmed it 2d ago.")
  2. the report
  3. where and when — project · page · from whom · when
  4. what happens now — "Look at it, then say whether it worked." /
     "Nothing to do; it starts by itself." / the refusal, in the row's own
     words
  5. the moves — every control a verb naming its destination: See the fix
     on the site, It worked, Not fixed, Watch in Terminal, Agent's chat,
     Build it, Add a note first, Try again, Run it in the cloud, File away,
     Show on the public strip, Not fixed after all. No bare icons.

- src/lib/feedback/row-story.ts: the sentences, pure, from the honest
  phase (work-phase.ts); inOwnersWords maps the phase layer's "Retry /
  Resolve / Open Terminal" onto the moves the row offers; LENS_MEANING is
  the one line under each lens. Tested in scripts/test/feedback-row-story.ts.
- FeedbackItemRow rebuilt around it; the Watch toggle panel
  (FeedbackWatch.tsx) is retired — the run's terminal and chat are two
  labelled links. Technical detail (agent's line, PR, raw error,
  screenshots) sits behind one "Details" disclosure after the moves.
- WatchFixButton: "See the fix on the site" / "Share the walkthrough".
- The morning note's refusal is one short clause, not a raw error.
- docs/paths.md §6 and CHANGELOG.


Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-10 04:47:17 -07:00
CatoandClaude Fable 5.1 e2884193fb feat(autopilot,widget): the night asks first; one Loki on the owner's site (#1128)
* feat(autopilot): the night asks first — evening plan with its price, approve or allow

Nothing runs at night that the owner has not seen. Every evening (19:00 UTC,
crons/autopilot-plan) Loki makes tonight's plan with names and a price on it
— which fixes, which site, how many runs, what it would cost from the owner's
own last runs — and puts it in the approval queue as one autopilot_plan row:
Approve / Reject on Control (TonightCard), Telegram and /approvals. The night
(02:30 UTC) claims the approved plan and runs exactly that, re-checked;
undecided at 02:30 it expires and the morning note says nothing was built.

The one way a night runs unasked is an allowance set in Settings → Agent:
"Nights run without asking" for a week, a month or three months, optionally
under a dollar cap a night (beacon_settings.night_allow_until /
night_cost_cap_usd, migration 0087). Under it the row is approved on the
owner's behalf and they are told the evening before. A night over the cap
asks again.

Free things stay free: filing away stale reports and moving stuck rows to the
cloud spend nothing, undo in one tap, and happen with or without a yes. The
plan and the note are assembled from counts — no model call in a timer.

- src/config/autopilot-night.ts: NightProposal, estimateNightCost,
  nightProposalText, nightAllowance, NIGHT_APPROVAL, nightRunAt,
  upcomingNight, allowanceDaysLeft (all pure, tested)
- src/lib/autopilot-night.ts: proposeNightFor / proposeAutopilotNight;
  runNightFor now claims the approved plan (claimApprovedActionsByType) and
  retires late-approved plans for past nights
- AUTOPILOT_PLAN action type, deferred on approval; the Telegram card drops
  Edit for it (a plan is yes or no)
- GET /api/autopilot/tonight + TonightCard replace the late-night
  "go to sleep" strip (LateNightAutopilot, lib/late-night retired)
- docs: paths.md, telegram-notifications.md, CHANGELOG

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

* feat(widget): one Loki on the owner's site — the launcher never hides, ◎ is its other half, "This screen" marks the view

Owner, 2026-10-10, on a phone: "when it says Loki is watching, and then
there is another widget … where the aim symbol is … I don't know when one
appears and when the other appears. Are they competing elements?" They
were: the owner's launcher ("Loki · watching" + a ◎ beside it) hid whenever
the avoid pass found every corner busy — on a phone, most scrolls — and a
"Loki is watching" bar took its place at the top, without the ◎.

Now the owner has exactly one of it:
- the owner's launcher is never hidden by the avoid pass (their site, their
  corner — long-press moves it) and never fades on scroll;
- the ◎ is the launcher's other half, flush against it with the shared edge
  squared, and present whether Loki watches or is paused;
- the top bar remains only for a page that hides the launcher outright
  (data-fc-place="hidden") and carries the same ◎.

Show Loki this screen: the pick bar offers "This screen" beside tapping an
element — it marks the blocks in the viewport (picker.ts visibleBlocks), the
way a screenshot would frame them, and the conversation opens with them
attached: say what to change, ask Loki, or build it.

Browser test (widget-watch-browser): the ◎ is flush, stays while paused, the
launcher stays with every corner blocked and no bar appears, This screen
marks and attaches. README, architecture doc and CHANGELOG say so.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-10 03:17:05 -07:00
CatoandClaude Fable 5.1 a508c1ed16 feat(away): "back in 30 minutes" — the next screen says what happened; fewer things thrown together (#1126)
* feat(away): "back in 30 minutes" — the next screen says what happened; fewer things thrown together

"Back in 30 minutes"
- Say it to Loki and set_away records when you left and when you said
  you would be back (user_preferences.away_since/away_until, migration
  0086). Nothing is recorded during the absence.
- On return, Control and the chat's start screen lead with one card:
  what needs you, what went live, what finished (ok / failed, on which
  projects), what still runs, what arrived — each line a link to where
  it is acted on, gone in one tap. While still away, one quiet line.
  Derived at read time from the runs and the feedback that moved
  (lib/away.ts); the rules and the lines are pure and tested
  (lib/away-rules.ts, scripts/test/away.ts). GET/POST/DELETE /api/away.

Fewer things thrown together (owner's screenshots, 2026-10-10)
- A feedback row's context is one sentence that wraps like one: the
  project link wrapped onto its own line above "· home · today".
- The pickers under the lens strip are words with a chevron, not a third
  bordered box between the bordered strip and the bordered list.
- "Pointed at “Welcome to Kestrel”" instead of a mono tag beside a quote.
- The thumbs-down form in the chat is part of the thread: no second box
  with its own border and fill, no filled call to action.
- A review files the mobile screenshot it judged with its first finding,
  so the owner reads the finding beside the picture it came from.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

* chore(demo): classify /api/away for the demo sandbox

Own-tenant data only: two timestamps on the caller's preferences and a
summary derived from their own runs and feedback.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-10 01:52:13 -07:00
CatoandClaude Fable 5.1 6c20cd4e0a feat(autopilot): the night works from what you said, and no further than you allow (#1123)
* feat(autopilot): the night works from what you said, and no further than you allow

The night used to be `nudge-idle`: wake three idle projects at 04:00 with a
generic "pick the highest-impact action" prompt, with no limit on what that
spent and no record the owner could read in the morning. A run with no brief
is where the queue of things nobody asked for came from.

The night now
- builds from the feedback inbox — one fix per project, the owner's own
  notes first, then what most visitors hit — through the same Implement
  path as the button, so a night's run is a person's run: same prompt,
  same auto-ship rules, same ledger;
- is capped by a per-account budget counted in RUNS (beacon_settings
  .night_runs, default 4, max 20, 0 = file away but build nothing). A run
  is the unit that spends the owner's agent credits, and a run cap holds
  whether or not the runner reports a price;
- reads one site not read this week, when there is budget left, through
  the same review prompt as "AI review this page" (now shared in
  lib/feedback/ai-review-prompt.ts), filing findings into the inbox;
- files away reports nobody started in 21 days, with the reason on the row
  (site_feedback.archive_reason, cleared on reopen);
- hands rows waiting for a shut laptop to the cloud builder;
- writes one row per (user, night) to autopilot_nights and leaves one line
  on /feedback, Telegram and push — nothing when it did nothing.

Decisions are one pure planner (src/config/autopilot-night.ts, tested in
scripts/test/autopilot-night.ts); the lib gathers facts and carries the plan
out; the same dispatch gates as Control refuse a working, blocked or failing
project; a project paused on Control takes nothing. No model is called from
the timer — every night action is an agent run on the owner's builder or a
count — so no-free-background-ai stays green.

Settings → When an agent finishes gains "Overnight: up to N runs a night";
the autopilot copy on Settings and the Control sheet says what On means now.
docs/paths.md path 3 and CHANGELOG record it; effective-loop-operations.md
names the night in place of the idle cron.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

* docs(telegram): register the night's morning note

The registry gate found the one new path that can reach the phone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-10 01:22:23 -07:00
CatoandClaude 7e5b9e1506 feat(watch,feedback): Loki reads the page, and /feedback speaks one language (#1120)
Watch reads the page
- The page checks measure (type size, targets, labels). They cannot see
  that a page says nothing first, that two controls mean one thing, or
  that its parts were thrown together — the owner saw exactly that on
  their own pages and asked why Loki had not. Watch now also READS each
  page once per visit, unasked, as a first-time visitor on a phone:
  purpose, hierarchy, content, fit, function (READ_RUBRIC in
  widget-advise/advisor.ts; the server applies it, the widget only sets
  `read: true`). At most three findings, each quoting the page; silence
  when fine, said in the notes as "read it — nothing stands out". The
  findings land as a notice with the same "Fix this" as any other.
- The review starter reads "Review my last few minutes": it is the review
  of the taps trail, which the page read is not.

/feedback: one vocabulary
- Lenses: Needs you · Under way · Done (was "Shipped" — the rows in it
  said "Done").
- A deployed fix awaiting the owner's look is "Live — check it", in the
  warning tone, never green: a green "Shipped · confirm" chip under the
  "Needs you" heading beside the Done lens's green chips was the page
  saying two things with one colour. Badge colour now follows who acts,
  like the lenses: amber yours, red broke, green nothing waits on you.
- "41 done" in the metrics line, "Show all N done".

docs/paths.md
- Who comes, what they want, the fewest taps — six paths, each with what
  broke it and what is still owed, and the rules they impose. The product
  contract the screens are held to; user-flow-audit.md stays the
  route-by-route health matrix beneath it.


Claude-Session: https://claude.ai/code/session_011L2dmcydDLYAiNQwK4XcF4

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-10 00:21:35 -07:00