Public: anyone can read this; the crew can change it.
The agent stars the leads they want to keep close, and starred leads lead the desk #87
Check · Review · Land · Live done — Landed and live in production.
The agent can now star a lead, and starred open leads sort first on the desk. I ran bun test (423 pass, 0 fail) and bun run lint:design (clean). There is no scripts/gate.ts, scripts/fast.ts or scripts/design-lint.ts in this repo.
shipped production is serving it deploy aba151a
1 earlier comment · 1 event
The agent can now star a lead, and starred open leads sort first on the desk. I ran bun test (423 pass, 0 fail) and bun run lint:design (clean). There is no scripts/gate.ts, scripts/fast.ts or scripts/design-lint.ts in this repo. bun x tsc --noEmit can't run because there is no tsconfig. I didn't look at the pages in a browser.
What changed
- Storage: a new last migration adds
lead.starred INTEGER NOT NULL DEFAULT 0 CHECK (0,1). Existing leads stay as they were, unstarred. A test builds a database at the previous version with a lead in it, migrates it, and checks the lead is intact. - Action:
setStarredinsrc/actions.tsgoes throughpermit(lead, update)andaudited. A bad value gets a 422. Starring an already-starred lead succeeds and changes nothing.contract.jsonis not touched. - Desk:
show=starredis a new filter, which holds open starred leads only.starredFirstlifts starred open leads to the top of every view and keeps recency order inside each group. - Overdue first replies: a first reply that has waited past the green clock (5 minutes) stays ahead of the stars, so a star never hides a lead who is owed an answer. When nobody is starred, the order is unchanged.
- Page:
- The star is a form with a button, so it works without JavaScript and goes through the existing same-origin check.
- It sits beside each desk row and under the name on a lead's page. A button can't live inside a link, so the row <li class="lead-item"> is now a two-column grid.
- The button is 44px square on every screen.
- The form's back field is checked against a strict pattern, so it only returns to the desk (with its filter) or the lead's page.
- The new classes are documented in docs/design/areas/desk.md.
- API and CSV:
- starred appears in a lead's JSON.
- PATCH /leads/:id accepts {starred: true|false}, and /openapi.json is regenerated.
- The CSV gets a starred column, yes or no.
- MCP and terminal: MCP has a
star_leadtool, andlist_leadstakesshow=starred. In the terminal,*stars from the desk and from a lead's screen,fcycles through the Starred view, and starred leads show ★. - Activity: it reads "starred …" and "took the star off …", and refused attempts are audited too.
- Docs: README and AGENTS.md describe the star.
- Tests:
src/star.test.tscovers star/unstar, ordering, the overdue case, anon refused, the CSV column, the migration, and the page, API, MCP and terminal.
Existing tests I changed
- Tests pinned to the old shape:
- The view counts, the view cycle, the CSV row, and the MCP tool list in server.test.ts needed the new starred view, column and tool.
- lost.test.ts read lost_reason as the last CSV column. It now finds it by header name, because starred is the new last column.
- Appended CSV column: I put
starredat the end rather than beforelost_reason, so existing consumers keep their column positions.
What I chose not to do
- Closed leads: they can be starred, but they never lead the desk and are not in Starred.
- Reordering by hand: a star is a flag, not a ranking.
- Cadence: the star doesn't touch it, and it doesn't bump
updated_at, so lost-lead reporting is unaffected.
To try it: open / and tap ☆ on a row, then try /?show=starred, /leads.csv, and * in the terminal.
🤖 Generated with Claude Code
Solid change overall: the star goes through permit and audited, back is validated against a strict pattern, the POST is same-origin checked, contract.json is untouched, and the tests are thorough. Two things to fix before this lands.
- (fix first) The new door has no row in
src/contract.test.ts. That test walks every door against the policy table (see the put-away, note and skip rows). Add one that callssetStarred, thestar_leadtool and the page route as anon, user and admin, and expects the result to matchlead update. - Misplaced doc comment in
src/terminal.ts.mayStarwas inserted between the/** Whether the private note ... */comment andmayNote, so the note comment now sits onmayStar. MovemayStarabove that comment and give it its own one-line comment.mayStarandmayNoteare now identical, so consider having one use the other.
Preview: the desk answers 200 with the bearer token alone, but it shows no star buttons, because that request carries no signed identity and the desk hides the star from anon. I could not see the star working in the preview as a signed-in person; I checked it in the tests instead.
Box 6: I could not confirm design-lint here. The builder says the script is absent (they ran bun run lint:design). The CSS uses --size-tap (44px) on the button.
I've fixed both review points and pushed them to the same branch. bun test on contract.test.ts, star.test.ts and terminal.test.ts passes (41 tests, 0 failures). I didn't re-run the full suite after this change.
- Contract test:
src/contract.test.tsnow has a row in thelead updatedoor. It callssetStarredand thestar_leadtool as anon, user and admin, and checks each result matches what the policy table allows forlead update. - Page route: I didn't add a separate
POST /leads/:id/starcheck to the contract test. That route is a thin wrapper oversetStarred, so the contract row covers its permission, and the guest and cross-origin cases for the route are already insrc/star.test.ts. If you want the route walked incontract.test.tsas well, say so. - Comment: in
src/terminal.ts,mayNoteis back under its own comment.mayStarnow follows it with its own one-line comment and is defined asmayNote, since both ask the samelead updatecell. - Design lint: the script is
bun run lint:design(scripts/lint-design.ts). It passed and printed nothing. The task text calls itscripts/design-lint.ts, which doesn't exist in this repo.
Both earlier asks are met: the lead update door in contract.test.ts now walks setStarred and the star_lead tool across anon, user and admin, and mayStar has its own comment. No cell in contract.json is loosened. The preview serves the Starred view. Non-blocking: the POST /leads/:id/star route is not walked in contract.test.ts itself, though it wraps setStarred and star.test.ts covers its guest and cross-origin cases.
The agent can now star a lead, and starred open leads sort first on the desk. I ran
bun test(423 pass, 0 fail) andbun run lint:design(clean). There is noscripts/gate.ts,scripts/fast.tsorscripts/design-lint.tsin this repo.bun x tsc --noEmitcan't run because there is no tsconfig. I didn't look at the pages in a browser.What changed
lead.starred INTEGER NOT NULL DEFAULT 0 CHECK (0,1). Existing leads stay as they were, unstarred. A test builds a database at the previous version with a lead in it, migrates it, and checks the lead is intact.setStarredinsrc/actions.tsgoes throughpermit(lead, update)andaudited. A bad value gets a 422. Starring an already-starred lead succeeds and changes nothing.contract.jsonis not touched.show=starredis a new filter, which holds open starred leads only.starredFirstlifts starred open leads to the top of every view and keeps recency order inside each group.- The star is a form with a button, so it works without JavaScript and goes through the existing same-origin check. - It sits beside each desk row and under the name on a lead's page. A button can't live inside a link, so the row
<li class="lead-item">is now a two-column grid. - The button is 44px square on every screen. - The form'sbackfield is checked against a strict pattern, so it only returns to the desk (with its filter) or the lead's page. - The new classes are documented indocs/design/areas/desk.md.-
starredappears in a lead's JSON. -PATCH /leads/:idaccepts{starred: true|false}, and/openapi.jsonis regenerated. - The CSV gets astarredcolumn,yesorno.star_leadtool, andlist_leadstakesshow=starred. In the terminal,*stars from the desk and from a lead's screen,fcycles through the Starred view, and starred leads show ★.src/star.test.tscovers star/unstar, ordering, the overdue case, anon refused, the CSV column, the migration, and the page, API, MCP and terminal.Existing tests I changed
- The view counts, the view cycle, the CSV row, and the MCP tool list in
server.test.tsneeded the newstarredview, column and tool. -lost.test.tsreadlost_reasonas the last CSV column. It now finds it by header name, becausestarredis the new last column.starredat the end rather than beforelost_reason, so existing consumers keep their column positions.What I chose not to do
updated_at, so lost-lead reporting is unaffected.To try it: open
/and tap ☆ on a row, then try/?show=starred,/leads.csv, and*in the terminal.🤖 Generated with Claude Code
Closes #82