Repository navigation
Run read-only routines on a timer - #267
Merged
Merged
Conversation
Routines Phase 1. A routine runs a read-only Chat or Plan turn in one project, once or every N minutes, hours or days, while Modex is running with or without a window, and writes the reply to a Space page. - routines.ts: app/routines.json storage, validation (Chat or Plan only, 5-minute minimum), grid scheduling (days in local calendar days) with a 30 s check, a precise next-due timer and a check on wake. Missed due times run once and the next due time moves on before a run starts, so a crash never repeats one. A run checks its routine again when it starts, holds a fence so only its owner may finish it, ends failed after 30 minutes, and on the next start a run left running is marked interrupted, or completed when its page revision was already written. The run id is the page write's idempotency key. A turn that was stopped, failed or silent writes no page. - Pages: the reply becomes a revision of the routine's page in the project's notes, under Routines/, written by Modex through the revision-checked notes store, because a read-only turn's Pages tools are read-only. - Runner: createRoutineThread (Chat, Plan when asked, Auto off, marked with the run), sendUnattended (refuses a thread that is not read-only, answers every approval "no" with a policy:routine receipt, and reports whether the turn completed), addNotice for transcript receipts. A thread made in main reaches an open window as a thread event. - Routines in the rail: create, edit, pause, delete and run now, plus an Activity list with each run's trigger, times, status, thread and page revision. A power-save blocker is held while a run works. - iPhone companion: the snapshot lists recently ended runs and names routine threads; the app shows one banner for runs that ended since it last looked, and labels refused routine approvals. Exit tests: e2e/routines.spec.ts runs a routine with the window closed and finds it in Activity on reopening, kills Modex mid-run and finds the run interrupted with no page revision, and shows a refused edit with an untouched checkout. test/routines.test.ts checks the routine turns' real options on both CLIs against their read-only mappings. Coven-Harness: Claude Code / claude-opus-5-5
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Code coverage overviewLanguages: TypeScript TypeScript / code-coverage-agent
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
This was referenced Oct 18, 2026
BunsDev
added a commit
that referenced
this pull request
Oct 19, 2026
… and the routines spec (#310) v0.2.0 was published on 2026-10-18 (23:14Z) from the signed tag on 01b1b8a. This follows Val's status layout (#290): - Shipped gains a v0.2.0 row linking its release and its review. - The 13 "On main, unreleased" items move unchanged to a new "Status summary" at the end of the v0.2.0 review, along with the old In flight entry. Each one was introduced by a commit in the tag (#248, #253, #254, #257 to #261, #263, #264, #266, #267, #269). The CF slices and #283's Markdown parser came after the tag, so they stay. - In flight keeps a short follow-ups entry for the gates no receipt records yet: the independent download checks, the banner upgrade on the release Mac, and the Companion 0.2.0 (7) TestFlight upload. - The routines spec and the README now say Phase 1, and most of Phase 0, ship from v0.2.0. Unchanged: the website's static fallback (apps/site/release.json) and the release evidence, which stay with the release owner. Claimed on #290. Coven-Harness: Claude Code / claude-opus-5-5
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Routines Phase 1 of the routines spec: read-only routines with all three exit tests. Routines that change code (Phase 2), the approval gate decision and launch at login are out of scope. Full description: docs/routines.md.
What a routine is
A saved record holds a name, a project, instructions, Chat or Plan, a provider and model, and a trigger: once, or every N minutes, hours or days (at least 5 minutes) from a start time. Routines live in a new Routines rail surface, where you can create, edit, pause, resume, delete and run them now. An Activity list shows each run's trigger, start and end, status, thread and page revision.
What a run does
runner.sendUnattendedrefuses a thread that is not read-only, and answers every approval "no" with apolicy:routinereceipt card. Nobody is there to answer, and the turn is read-only anyway.Routines/, one revision per run. A notice in the transcript gives the page title and revision.Why Modex writes the page. The spec says "through the Pages MCP", but a Chat or Plan turn only gets the read-only Pages tools. So Modex writes the reply itself, through the same revision-checked notes store the Pages MCP uses, with the routine as actor and
Routine run <id>as the revision summary. This also keeps the crash guarantee below simple.Scheduling, crashes and the fence
powerMonitorresume.prevent-app-suspensionpower-save blocker is held while a run works, so App Nap can't suspend a windowless Modex.app/routines.jsoncan't be read it is left untouched, and the view says so.iPhone companion
Also in this PR
threadevent for it, and the renderer adds threads it didn't know.Exit tests
e2e/routines.spec.ts(closes the macOS window, waits for the run,activate, checks Activity, opens the thread)e2e/routines.spec.ts(SIGKILLwhile the reply streams, relaunch, Activity shows Interrupted with no page, the next run writes revision 1) andtest/routines.test.ts(crash before and after the page write)test/routines.test.tsruns routines through the runner on Claude and Codex and checks each turn's real options withClaudeBackend.argsandCodexBackend.policy. Every approval is refused.e2e/routines.spec.tsshows a refused edit and an untouched checkout.There are 20 unit tests in all, covering scheduling, missed runs, the fence, failures, resume, the unreadable file and the companion snapshot.
CompanionModelTestscovers the banner.Fixed from an independent review
Verification
pnpm build && pnpm test, rebased on main with Ask Jev through one decision service #257: all packages pass (desktop 1,465 passed, 0 failed).pnpm --filter @modex/desktop test:e2ebefore the rebase onto Ask Jev through one decision service #257: 314 passed, 3 skipped (the real Open Knowledge tests). After it, the routines, approvals, approval-policy and notes specs: 11 passed.Coven-Harness: Claude Code / claude-opus-5-5