Public: anyone can read this; the crew can change it.

The agent can decline a reminder with a reason, so a message they chose not to send stops asking and the record says why #24

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

An agent can now decline a reminder with a reason, at every door, and undo it later. The full suite passes (97 tests) and lint:design is clean. I did not run tsc --noEmit: the repo has no tsconfig and no TypeScript dependency, so bun x tsc only printed its help.

Notes

shipped production is serving it deploy d2eada7

opened this

An agent can now decline a reminder with a reason, at every door, and undo it later. The full suite passes (97 tests) and lint:design is clean. I did not run tsc --noEmit: the repo has no tsconfig and no TypeScript dependency, so bun x tsc only printed its help. There is no scripts/gate.ts or scripts/fast.ts. I did not look at the sheet at 360px, so the two-forms-per-draft layout is untested by eye.

What changed

  • Record: migration 11 in src/db.ts adds a reminder_declined table. It holds the reason (1–200 characters), who declined, when, and the date's and party's words, so it outlives both. It is written to be safe to re-run.
  • Actions: declineReminder and undoDecline in src/deals.ts ask permit(who, "deal", "update", deal), are audited against the deal's id, and emit deal.changed. DealView gains declined, and each Draft gains declined: {reason, by_name} | null.
  • Out of the lists: the new unsent() in src/reminders.ts keeps a declined reminder out of dueOn (so /tick and reminders_today), the "N to send" count, and the terminal's late list.
  • Refusals: a reminder that was declined cannot be sent until it is undone, and one that was already sent cannot be declined.
  • Page: src/pages/sheet.ts puts a Don't send form (required reason, 200-character limit, no script) under the Send form, both in a date's sheet and in Reminders for today. A declined draft shows "Not sent: <reason> · <who>", escaped, and anyone who may change the deal gets an Undo button. Routes are POST /reminders/decline and /reminders/undo.
  • API: POST /api/deals/:id/reminders/decline and .../undo, described in contract/openapi.json (re-emitted).
  • MCP: decline_reminder and undo_decline_reminder.
  • Terminal: on the reminders list, n asks for the reason and u undoes. n still opens a new deal everywhere else.
  • Docs: the README says an agent can decline a message and the reason is kept, and adds a step to the walk. docs/TECHNICAL.md has the technical detail.

Tests

  • src/deals.test.ts: a declined reminder leaves the unsent count and /tick; an empty, blank, non-string or 201-character reason is refused as invalid; undo returns it to the draft list; anon is refused with signin_required.
  • src/terminal.test.ts: n and u, an empty reason, and anon.
  • src/server.test.ts: the API statuses, the escaped page text, and the new MCP tools.

Please look at

  • Door change (src/security.ts): doorOf only treated PATCH and DELETE inside a row (/api/deals/:id/x/:y) as an update of that row. I made it treat POST the same, so the new routes are checked against the deal's update cell. It only decides which cell a request is checked against, and no contract.json cell changed.
  • Not done: I left alone the existing behaviour that moving a date makes its reminders unsent again. A decline is tied to the date it was made for, like a send.

I haven't rebased on #17 or #13. Any conflict in src/mcp.ts or src/pages/clock.ts will be small.

To try it: open a date's sheet or Reminders for today, tap a draft, enter a reason and press Don't send. In the terminal, press r, then n and the reason.

🤖 Generated with Claude Code

Closes #21

commented

An agent can now decline a reminder with a reason, at every door, and undo it later. The full suite passes (97 tests) and lint:design is clean. I did not run tsc --noEmit: the repo has no tsconfig and no TypeScript dependency, so bun x tsc only printed its help. There is no scripts/gate.ts or scripts/fast.ts. I did not look at the sheet at 360px, so the two-forms-per-draft layout is untested by eye.

What changed

  • Record: migration 11 in src/db.ts adds a reminder_declined table. It holds the reason (1–200 characters), who declined, when, and the date's and party's words, so it outlives both. It is written to be safe to re-run.
  • Actions: declineReminder and undoDecline in src/deals.ts ask permit(who, "deal", "update", deal), are audited against the deal's id, and emit deal.changed. DealView gains declined, and each Draft gains declined: {reason, by_name} | null.
  • Out of the lists: the new unsent() in src/reminders.ts keeps a declined reminder out of dueOn (so /tick and reminders_today), the "N to send" count, and the terminal's late list.
  • Refusals: a reminder that was declined cannot be sent until it is undone, and one that was already sent cannot be declined.
  • Page: src/pages/sheet.ts puts a Don't send form (required reason, 200-character limit, no script) under the Send form, both in a date's sheet and in Reminders for today. A declined draft shows "Not sent: <reason> · <who>", escaped, and anyone who may change the deal gets an Undo button. Routes are POST /reminders/decline and /reminders/undo.
  • API: POST /api/deals/:id/reminders/decline and .../undo, described in contract/openapi.json (re-emitted).
  • MCP: decline_reminder and undo_decline_reminder.
  • Terminal: on the reminders list, n asks for the reason and u undoes. n still opens a new deal everywhere else.
  • Docs: the README says an agent can decline a message and the reason is kept, and adds a step to the walk. docs/TECHNICAL.md has the technical detail.

Tests

  • src/deals.test.ts: a declined reminder leaves the unsent count and /tick; an empty, blank, non-string or 201-character reason is refused as invalid; undo returns it to the draft list; anon is refused with signin_required.
  • src/terminal.test.ts: n and u, an empty reason, and anon.
  • src/server.test.ts: the API statuses, the escaped page text, and the new MCP tools.

Please look at

  • Door change (src/security.ts): doorOf only treated PATCH and DELETE inside a row (/api/deals/:id/x/:y) as an update of that row. I made it treat POST the same, so the new routes are checked against the deal's update cell. It only decides which cell a request is checked against, and no contract.json cell changed.
  • Not done: I left alone the existing behaviour that moving a date makes its reminders unsent again. A decline is tied to the date it was made for, like a send.

I haven't rebased on #17 or #13. Any conflict in src/mcp.ts or src/pages/clock.ts will be small.

To try it: open a date's sheet or Reminders for today, tap a draft, enter a reason and press Don't send. In the terminal, press r, then n and the reason.

🤖 Generated with Claude Code

Approved

Read in full. Decline and undo are update of deal through permit (via deadlineFor), on all four doors: page, JSON API, MCP and terminal. Reason is validated at 1 to 200 characters in code and in the DB CHECK, output is escaped, and the existing body cap and same-origin path are reused. Declined reminders leave /tick, reminders_today and the to-send count, and cannot be sent until undone. Tests cover the behaviour, including guest refusal and escaping. No contract cell is loosened, no dependency added, and README and TECHNICAL are updated. The doorOf change maps POST on api/:id/x/:y to update, which is consistent with the rest. I did not exercise the preview.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs