Public: anyone can read this; the crew can change it.
The agent chooses the days their follow-ups go out (default 1, 3, 7, 14, 30) from their profile, and new leads follow it #75
Check · Review · Land · Live done — Landed and live in production.
An admin can now set the follow-up days on the profile page, and leads answered after the change get their touches on those days. The full bun test run passes (346 tests) and design-lint is clean. I could not run bun x tsc --noEmit: the repo has no tsconfig.json, so tsc only prints its help.
shipped production is serving it deploy aba151a
1 earlier comment · 1 event
An admin can now set the follow-up days on the profile page, and leads answered after the change get their touches on those days. The full bun test run passes (346 tests) and design-lint is clean. I could not run bun x tsc --noEmit: the repo has no tsconfig.json, so tsc only prints its help. There is no scripts/gate.ts or scripts/fast.ts here.
- Profile page: a "Follow-up days" field shows
1, 3, 7, 14, 30until changed. Everyone signed in can read it; saving it goes through the existingpermit(profile, update), so only an admin can. No cell ofcontract.jsonchanged. - Validation:
readCadenceinsrc/actions.tsaccepts 1 to 8 whole days, each 1–90, strictly increasing. It takes text from the form (1, 3, 7) or a list from the API.
- Anything else is refused with a plain-English message and nothing changes. The JSON API returns 422.
- The form's refusal is a redirect back to /profile with the message shown, the same way the profile form already reports errors. The typed value is not kept.
- Storage: a new nullable
cadencecolumn onprofile(JSON, migration appended) holds the days. Null means the default. They survive a restart. - Scheduling:
startCadenceinsrc/leads.tsuses the saved days. Leads already in their follow-ups keep their scheduled rows and sent history, because those rows carry their own day numbers.CADENCEstays insrc/drafts.tsas the default. - Day collisions: the 90-day cap keeps every day clear of the after-showing (500+) and answer (1000+) offsets.
- Wording for new days:
draft()only had text for days 1, 3, 7, 14 and 30, and anything else fell back to the "about a month" wording. A day-2 touch would have said "yesterday" and a day-60 one "about a month". The newwordingDayinsrc/drafts.tsmaps each day to the nearest fitting wording: "yesterday" only for day 1, "about a month" only for 28–45, and the open-ended "still here" wording for later days. - Activity: a new audit act
cadencereads "changed the follow-up days: follow-up days “1, 3, 7, 14, 30” → “2, 5”". If one save changes both days and openers, it is logged underopeners, and the detail still lists both changes. - Docs and other doors:
README.md"Your profile" explains the field. The OpenAPI schema and the regeneratedcontract/openapi.jsondescribe it, and MCPset_profileacceptscadence. - Tests:
src/cadence.test.tscovers the new days, existing leads untouched, a restart, each invalid input, non-admins, Activity wording,wordingDayand MCP.src/server.test.tscovers the form, the 422 and the unchanged state after a refusal.
Not done: the terminal's profile editor does not edit the days. Saving from the terminal leaves them as they are, and the terminal's profile screen doesn't list them.
To try it: sign in as admin, open /profile, set the field to 2, 5, 10 and save. Answer a new lead, and its plan shows days 2, 5 and 10. Leads already in follow-ups are unchanged. Try 3, 3 and the form shows the error.
🤖 Generated with Claude Code
One change needed (high): the terminal is a door like the page, and it cannot set or show the follow-up days. The pull description says so itself: "the terminal's profile editor does not edit the days ... and the terminal's profile screen doesn't list them." What an admin can do on /profile they must be able to do in src/tty.ts, and a non-admin must see the days there too, as on the page.
Fix, in one round:
- src/tty.ts: show the follow-up days on the profile screen. Add a field to the profile editor so an admin can edit them. It must go through the same saveProfile/permit path and readCadence validation, and show the plain-English error on refusal. A save from the terminal must not reset the days. Because the write goes through saveProfile, it emits lead.changed, so web viewers see it live.
- Add a tty test: the screen lists the days, an admin edit changes them, a bad list is refused and changes nothing, and a non-admin cannot save.
- README: add one line to the "Follow-up days" paragraph saying how to do this in the terminal.
Smaller points, to fix in the same round:
- When one save changes both the days and the openers, the audit act is recorded as
openers, so Activity files the change under the wrong act. Record one row per kind of change, or name the act for what changed. - The limits 8 and 90 are written as literals in routes.ts (CADENCE_FIELD) and mcp.ts. Import CADENCE_MAX_TOUCHES and CADENCE_MAX_DAY so the schemas cannot drift from the validator.
- profile.ts and actions.ts each define a function named readCadence with different jobs. Rename one (for example
keptCadence). - A refused form save drops what the agent typed. Keep the typed value in the re-rendered field if that is cheap.
Checked and fine: no contract.json cell is loosened; saving goes through permit; the input is validated; the output is escaped; the migration is appended; existing leads keep their scheduled rows; the Activity wording, openapi and MCP are all covered.
I've pushed the fixes for all five review points to the same branch. The full bun test run passes (348 tests) and design-lint is clean. tsc still can't run here because the repo has no tsconfig.json.
- Terminal: the terminal's code is in
src/terminal.ts;src/tty.tsonly starts it, so the change is there.
- The p screen now lists "Follow-up days" for everyone who can read the profile.
- An admin's e editor gets a final "Follow-up days" step, prefilled with the current days.
- Saves go through the same saveProfile and permit path with the same validation, so the plain-English refusal shows and nothing changes. Saving other fields keeps the days.
- A non-admin gets "Only an admin can change the profile." A save still emits lead.changed.
- Terminal tests: the new test in
src/terminal.test.tscovers all three cases you asked for:
- the screen lists the days; - an admin edit changes them, and a bad list is refused with nothing changed; - a non-admin cannot save.
- Existing tests changed: because the new step sits last in the editor, I added one Enter to the two existing editor tests and raised the loop count in the blank-license test. They step through the editor by position, and the behaviour they check is unchanged.
- Audit: a save that changes both the days and an opening now records two rows, one
cadenceand oneopeners, each with only its own detail. A test insrc/cadence.test.tscovers this. - Limits:
routes.tsandmcp.tsimportCADENCE_MAX_TOUCHESandCADENCE_MAX_DAY, so the schemas and descriptions follow the validator. - Rename: the validator in
actions.tsis nowparseCadence, and the one inprofile.tsiskeptCadence. - Form refusal: a refused browser save now re-renders
/profilewith status 422, the message, and what was typed. That covers the profile fields, the days and the openers. JSON requests are unchanged. The server test checks the typed value is kept. - README: the "Follow-up days" paragraph now says how to use the days in the terminal.
Earlier asks are met: the terminal shows and edits the follow-up days through saveProfile/permit, with tests; a refused browser save re-renders the form with 422, the message and what was typed (escaped); one save that changes days and openers is audited as two rows; the validator is parseCadence and the limits are shared. No contract.json cell is loosened. I read the diff and the surrounding route helpers; I did not run the tests or the preview. Non-blocking: the repo has no tsconfig, so tsc cannot run.
An admin can now set the follow-up days on the profile page, and leads answered after the change get their touches on those days. The full
bun testrun passes (346 tests) anddesign-lintis clean. I could not runbun x tsc --noEmit: the repo has notsconfig.json, sotsconly prints its help. There is noscripts/gate.tsorscripts/fast.tshere.1, 3, 7, 14, 30until changed. Everyone signed in can read it; saving it goes through the existingpermit(profile, update), so only an admin can. No cell ofcontract.jsonchanged.readCadenceinsrc/actions.tsaccepts 1 to 8 whole days, each 1–90, strictly increasing. It takes text from the form (1, 3, 7) or a list from the API.- Anything else is refused with a plain-English message and nothing changes. The JSON API returns 422. - The form's refusal is a redirect back to
/profilewith the message shown, the same way the profile form already reports errors. The typed value is not kept.cadencecolumn onprofile(JSON, migration appended) holds the days. Null means the default. They survive a restart.startCadenceinsrc/leads.tsuses the saved days. Leads already in their follow-ups keep their scheduled rows and sent history, because those rows carry their own day numbers.CADENCEstays insrc/drafts.tsas the default.draft()only had text for days 1, 3, 7, 14 and 30, and anything else fell back to the "about a month" wording. A day-2 touch would have said "yesterday" and a day-60 one "about a month". The newwordingDayinsrc/drafts.tsmaps each day to the nearest fitting wording: "yesterday" only for day 1, "about a month" only for 28–45, and the open-ended "still here" wording for later days.cadencereads "changed the follow-up days: follow-up days “1, 3, 7, 14, 30” → “2, 5”". If one save changes both days and openers, it is logged underopeners, and the detail still lists both changes.README.md"Your profile" explains the field. The OpenAPI schema and the regeneratedcontract/openapi.jsondescribe it, and MCPset_profileacceptscadence.src/cadence.test.tscovers the new days, existing leads untouched, a restart, each invalid input, non-admins, Activity wording,wordingDayand MCP.src/server.test.tscovers the form, the 422 and the unchanged state after a refusal.Not done: the terminal's profile editor does not edit the days. Saving from the terminal leaves them as they are, and the terminal's profile screen doesn't list them.
To try it: sign in as admin, open
/profile, set the field to2, 5, 10and save. Answer a new lead, and its plan shows days 2, 5 and 10. Leads already in follow-ups are unchanged. Try3, 3and the form shows the error.🤖 Generated with Claude Code
Closes #58