Files
loki/docs/paths.md
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

10 KiB

The paths

Who comes to Loki, what they came to do, and the fewest taps that do it. This is the product contract the screens are held to; user-flow-audit.md is the route-by-route health matrix underneath it. When a screen and this file disagree, one of them is wrong — fix the screen or correct the path.

The test for every path, in the owner's words (2026-10-10): a 65-year-old who owns a farmhouse in Canton Schwyz or West Virginia says what they want built and for what, puts the phone away, picks it up when it is done, sees exactly what was done and why, shares that with whoever, and says what to change. Fewer taps, fewer page loads, less to hold in the head, and the feeling of having done it themselves.

The one loop

say it  →  it builds  →  it tells you it is done  →  you look (walkthrough)
   ↑                                                        │
   └──────────────  you say what is still wrong  ◄──────────┘

Every surface is one step of this loop or it does not belong. A screen that cannot say which step it is — Control's old "Stalled · restart the desktop app", the feedback page's green "Shipped" under "Needs you" — is where people stopped.

The paths

1. On my own site, something looks wrong → fixed, live

Who: the owner, on their phone, using their site. The widget is on.

Taps
Today Loki noticed it (or they tap ⊚ and point) → Fix this → it builds, merges, deploys → Telegram "live" → Watch the fix on the page.
What broke it "Fix this" queued the work for a laptop that was shut; the hero and the feedback card then asked a person on a phone to open a desktop app. Fixed 2026-10-09 (#1119): the cloud takes it, and says so.
Still owed The site's own text and layout faults were invisible to the watcher — see path 2.

2. Loki should notice what a visitor would feel, not only what a ruler measures

Who: the owner, same place. They saw a page that said nothing first, two controls for one thing, parts thrown together — and Loki said "4 pieces of text under 12px".

Today The page checks measure (type size, targets, labels, contrast, jumps). From this change, Watch also reads each page once per visit as a first-time visitor on a phone — purpose, hierarchy, content, fit, function — and says at most three things, each quoting the page, or nothing. Same "Fix this" as any notice.
Rule Silence when fine. A read that lists five polish items with a button each is the noise the review rubric already forbids; the read is held to the same bar.
Next A read of the flow across pages (the taps trail already exists; the review uses it on request — "Review my last few minutes"). Make that unasked too once the per-page read has earned trust.

3. I want something built → built, without me

Who: anyone who owns a project. From Loki's chat, the widget, or a site hand-off.

Today Say it (typed or spoken) → one agent run → PR → auto-merge → deploy → "done" with a link. The chat says where it runs and that nothing is needed.
What broke it A hand-off from the site was dispatched as work instead of answered (#1118); a voice turn heard "Thank you." in silence (#1118); a preference for a shut laptop parked the work (#1119).
Overnight The night asks first (owner, 2026-10-10: "nothing sneaky is done, nothing without the user's knowledge, unless the user is explicitly asked how much they allow and for how long"). Every evening at 19:00 UTC Loki makes tonight's plan with names and a price on it — "Tonight Loki would start 2 fixes (kestrel, harbourlight) and read ledgerpost — 3 of 4 runs, ~$1.80 (your last 3 runs averaged $0.60)" — and puts it in front of the owner as one Approve / Reject card on Control, Telegram and /approvals. Nothing that spends starts without that yes; a plan left undecided expires at 02:30 and the morning note says so. The one way a night runs without asking is an allowance the owner set in Settings → Autopilot: for a week, a month or three months, optionally under a dollar cap a night — a night over the cap asks again. Filing away old reports and moving stuck rows to the cloud spend nothing, undo in one tap, and always happen. With a yes, the night builds from the inbox — one fix per project, the owner's own notes first — under a per-account budget counted in runs, reads one site not read this week and files what it finds, files away reports nobody started in 21 days (reason on the row), hands rows waiting for a shut laptop to the cloud, and leaves one line on /feedback, Telegram and push: "Last night Loki started 2 fixes (kestrel, harbourlight), read ledgerpost, filed away 4 old reports · 3 of 4 runs · $1.20." Nothing when it did nothing. The old idle nudge — three projects a night on a generic "next best" guess — is retired; a guess with no brief is where the garbage in the queue came from. src/config/autopilot-night.ts.
Rule The night spends runs, never the free pool: a fix is an agent run on the owner's builder, a read is an agent run that files through the widget API, the note is counts. A paused project takes nothing. 0 runs keeps the filing and stops the building.

4. It is done → I look, I understand why, I share it

Who: the owner, later, picking the phone back up.

Today Telegram says it is live → Watch the fix walks the live page: what was wrong, the change shown on the page, "Why this way", the alternatives not chosen → Share gives anyone the same walkthrough.
Away "Back in 30 minutes" said to Loki (set_away): Control and the chat start then lead with what happened — what needs you, what went live, what finished, what still runs, what arrived — each line a link, gone in one tap. Derived from what moved, never recorded, so nothing can be missed (src/lib/away-rules.ts).
Rule The walkthrough is the receipt. A row that says "Done" with no way to see what was done is a bank statement without the amount. Done rows keep Watch the fix and Share.

5. It is done but not right → I say so, it changes

Who: the owner, or whoever they shared the walkthrough with.

Today Last card of the walkthrough: Not quite → say what is still wrong (typed or recorded) → Show me previews it on the page, Send to Loki builds it. No page load, no chat to open.
Rule Steering lives where the work is seen. Never route a correction through a different page than the one showing the result.

6. What needs me? (the feedback page)

Who: the owner checking in. One question: is anything waiting on me?

Today A queue of decisions Loki has already made. The heading is the count and the scope ("6 decisions · all projects ▾"); under it one button takes every yes and says what it spends ("Do all 6 · starts 5 runs, confirms 1"). Each decision is a card: the tap as a kicker ("CONFIRM · FREE", "BUILD · ONE AGENT RUN"), the reason in one sentence ("Live on /pricing; the agent reported success and the deploy went through."), the report beneath in smaller type, one filled button. Reading is optional; "Something else" opens the full row with every other move. Agents at work, fixes confirmed and reports filed away are three collapsed lines under the queue. src/lib/feedback/recommend.ts decides (pure, tested): a live fix is looked at by Loki first (verify-live.ts: the live page as text, asked against the report; when text cannot tell, a phone-sized picture of the page (page-picture.ts, Playwright on the server) is put to the vision chain with the same question — once per fix, on the owner's budget, from the inbox read — never a timer) — the page shows it → Close it with what Loki saw, and the card says whether it read the text or looked at a picture; the change is not there → try again; neither look can tell (a flow, a page behind a login, no browser on the server) → See it on the site is the tap, the picture Loki took sits on the card so the owner can often answer from there, "It worked / Not fixed" sit beside it, and "Do all" leaves those for your eyes and says so; fresh report on a runnable project → build; untouched for 21 days (7 for Loki's own findings) → file away with the reason; stuck on a shut laptop → run in the cloud; failed → try again; merged or deploying → no decision, it is under way.
What broke it Rebuilt twice on 2026-10-10. First the rows learned to say what they were; the owner's answer: "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 leads to the correct improvement, because all the evaluation was done before that one option was given to me." A page that explains well is still a page that makes you decide. So the deciding moved into recommend.ts, and the page became the yes. Also: the lens counts changed with a project filter that sat below them ("56 need me here, 6 there") — the scope now lives in the heading beside the number.
Still owed "Do all" runs the taps one after another with no undo for the batch (each row still has its own). Loki reads a live page as text only — a layout or colour fix always comes back "cannot tell" and waits for the owner's eyes; a screenshot read would settle those too.

Rules these paths impose

  • One vocabulary per surface. Lens, badge and button use the same family of words. "Shipped" is a deploy's word, not a person's.
  • Colour means who acts, never what happened. Green = nothing waits on you.
  • One Ask per page. The floating pill is it; a second "Ask" in a hero is a second door to the same room.
  • Silence when fine. The watcher, the read, the review: nothing to say is an allowed answer and is said as "nothing stands out", in the notes, not as a card.
  • No step asks for a different device. A phone started it; a phone finishes it. The cloud builder takes work a shut laptop cannot.
  • Steer where you see. Corrections start on the page that shows the result.
  • A done thing can be shown. Every Done keeps its walkthrough and its Share link.