Closes #312. This is slice 3. With the project home (#343), the new item page (#351) and cycles shipped, #312's "Done when" is met. Slices 4–12 move to a follow-up item.
Data: migration 0062_cycles.sql, additive only. It adds:
cycle_settingsandcycles, with a unique index allowing one open cycle per workspace;cycle_carries;- nullable
work_items.cycle_numberandcycle_added_at.
Rules (the design's recommendations):
- Cycles are off by default. When on, they're 2 weeks long, start Monday (UTC) and have no cooldown. They are per workspace.
- With cycles on, Now is the current cycle: moving an item into Now puts it in the cycle, and taking it out takes it out of the cycle. Next can be planned into the coming cycle.
- Agents can't commit the cycle while cycles are on.
- With cycles off, Work behaves exactly as before.
Roll-over: settle_cycles runs on the existing 5-minute cron.
- Each ended cycle is closed in one D1 batch. That batch records carries, moves open Now items on, pulls in planned Next items, and opens the next cycle.
- It is guarded by "still open" and
OR IGNORE, so a repeated or concurrent run changes nothing more. - A late cron closes each missed cycle in order.
- 9 tests run this SQL against the migrated schema, including running twice and a five-week-late cron.
Interfaces:
- RPCs
list_cycles,get_cycle(current or by number, with the report),configure_cycles(Write) andcycle_work_item. - REST routes and MCP actions for the same.
cycleon item lists and filters.g1t cycle view|list|add [--next]|remove|settings.- OpenAPI and the CLI reference are regenerated.
Web:
-/work/cycle: days left; scope, done and carried; a burn-up (one hue, keyboard readout, table fallback); stages; and work by person and by agent.-/work/cycles/:n: the report.-/work/cycle/plan: Next beside the coming cycle, with Y.- A Cycle row in the sidebar.
-/settings/workto turn cycles on and set them up.- A Cycle (Y) picker on the item page, and Shift+Y for the next cycle.
- With cycles on, the plan labels Now as "Cycle N".
Docs: a new work/cycles.md, plus updates to the Work index, plan, work-items, workspaces, mcp and architecture docs.
Validation:
cargo testpasses for g1t-work (343), contracts, api and cli; the workspace and wasm32 checks pass.- The contracts package passes.
- Web: typecheck and tests (including
lib/cycles.test.ts) pass, and the build passes with load-check and deploy-check. - Conformance, test:deploy, astro, prettier and
git diff --checkpass. - Screenshots: the cycle page (light, dark, phone), the sidebar row and the item picker.