Skip to content

workstreams: the watching agent (morning and job-event wakes, undoable small changes, wake.* methods) - #2319

Merged
AbirAbbas merged 10 commits into
workstreams/mainfrom
workstreams/wp11-watch
Nov 3, 2026
Merged

AbirAbbas merged 10 commits into
workstreams/mainfrom
workstreams/wp11-watch

Conversation

@AbirAbbas

Copy link
Copy Markdown
Collaborator

The Workstreams plan, WP-11: the workstream agent watches. It wakes only each morning (when the workstream asked for it) and on a member job's event, runs one model turn with the event as context, and leaves one batched result per event: a summary, the small changes it applied (each undoable) and what it proposes.

What it does

  • Wakes. Morning: 08:00 local via automation.Schedule, checked every minute while the app is open, once per day per workstream. Job events: WorkstreamJobEvent hook (finished, merged, failed, needs you), resolved by factory_job membership; nothing calls it yet (the Factory's event source will). Never for a done workstream, autonomy Off, or wake.morning off. A unique (workstream, event key) row is inserted before the model call, so a repeated event or a second app process never makes a second turn. Caps: 24 wakes per workstream and 200 per home per day; one worker; 3-minute timeout.
  • Settling. Propose only: everything is proposed. Small changes: applies only moves into manual waves without an active wave go-ahead, follow-up drafts under $5 into manual waves, and agent-page writes; decisions and questions are always proposed. A page item naming a person's page is dropped. A wake never calls a Factory door.
  • Wire (contract v0.3). wake.list, wake.apply (one or all), wake.undo (one or all, only while unchanged), wake.not_now; wakes change part; idempotent (no write, no event when nothing changes).
  • Cost. Each wake's cost_usd (absent when unknown) is recorded and counted in spend_usd.
  • Storage. Schema 4 adds workstream_wakes and workstream_wake_items by an additive migration on the first write; an older engine refuses a schema-4 file as before.

Validation contract

(a) morning once per day, Off/morning-off none · (b) one hook call → one wake with one batch, duplicates and non-members none · (c) Propose only applies nothing · (d) Small changes applies only the allowed kinds, each undoable · (e) no Factory start, no person's page written · (f) cost recorded and in spend · (g) apply/undo/not now idempotent, one write each · (h) done never wakes · (i) schema 3→4 migration · (j) conformance for the four methods. Tests: cmd/codeaf/appworkstreams_wake_test.go, internal/workstream/wakes_test.go, internal/workstream/wake_answer_test.go, internal/session/workstream_wake_test.go, internal/workspace/schema4_test.go, the conformance test.

Left out

  • Related-issue wakes: no cheap existing mechanism notices new issues; wake.related_issues stays stored without behaviour.
  • Job events: the hook waits for the Factory's job event source.

🤖 Generated with Claude Code

AbirAbbas and others added 10 commits November 3, 2026 10:31
…; wake costs count toward spend

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es only for today's slot; wake calls carry their purpose

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rder; replay knows the wake's role

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AbirAbbas
AbirAbbas force-pushed the workstreams/wp11-watch branch from fae1bf8 to 04d0224 Compare November 3, 2026 15:31
@AbirAbbas
AbirAbbas merged commit 27a989e into workstreams/main Nov 3, 2026
4 of 8 checks passed
@AbirAbbas
AbirAbbas deleted the workstreams/wp11-watch branch November 3, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant