feat: scheduled agent execution via activity-core (WP-0006, v1.3.0)

Enable kaizen agents to run on a regular cadence against a preselected repo
roster, orchestrated by activity-core and prepared by kaizen-agentic — without
this repo owning cron, Temporal workers, or an LLM runtime.

CLI + module:
- src/kaizen_agentic/schedule.py — .kaizen/schedule.yml parse/validate/scaffold
- `kaizen-agentic schedule` group: init, validate, list, prepare <agent>
  (prepare bundles agent prompt + memory + metrics + repo pointers, offline)
- tests/test_schedule_cli.py — 15 tests

Contract & design:
- ADR-005 scheduled agent execution; schema doc + example manifest
- discover_kaizen_scheduled_repos resolver spec, state-hub roster fields,
  kaizen.schedule.prepared event payload, activity-core handoff checklist
- INTEGRATION_PATTERNS Pattern 2 extended with roster model

ActivityDefinition drafts (enabled: false):
- weekly-coach-orientation, weekly-optimization-review

Docs: agency-framework, CLI cheat sheet, PACKAGE_RELEASE runner prereqs,
EcosystemIntegration, CHANGELOG, TODO. Workplan closed (status: done).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 08:19:51 +02:00
parent 2400ff4890
commit 3b2edd4a9e
21 changed files with 1435 additions and 42 deletions

View File

@@ -4,7 +4,7 @@ type: workplan
title: "Scheduled Agent Execution via activity-core (v1.3.0)"
domain: custodian
repo: kaizen-agentic
status: active
status: done
owner: kaizen-agentic
topic_slug: custodian
state_hub_workstream_id: d4edb92b-526f-4ee4-8efe-a9fa84ab6dff
@@ -16,81 +16,81 @@ updated: "2026-06-17"
tasks:
- id: T01
state_hub_task_id: f513cf74-6e32-4dce-a3bc-2995f98a30de
status: todo
status: done
title: Write ADR-005 scheduled agent execution contract
- id: T02
state_hub_task_id: dcb8d674-5472-4657-85bc-02ca9890fb92
status: todo
status: done
title: Define .kaizen/schedule.yml schema and example
- id: T03
state_hub_task_id: 1f9a4959-d200-4d7b-8666-96472e23d820
status: todo
status: done
title: Add kaizen-agentic schedule validate command
- id: T04
state_hub_task_id: 13ab4b76-ded2-4613-b8e2-15ab206d8c57
status: todo
status: done
title: Document fleet roster and repo opt-in in INTEGRATION_PATTERNS
- id: T05
state_hub_task_id: 685b35f3-af20-483a-9136-150f5fff68dd
status: todo
status: done
title: Draft state-hub roster query design for activity-core resolver
- id: T06
state_hub_task_id: 5f0a0859-3ff5-4ec8-b916-35486f045b2b
status: todo
status: done
title: Draft discover_kaizen_scheduled_repos context resolver spec
- id: T07
state_hub_task_id: 2fd0f00c-5cf1-47bd-9c12-aee65bca5932
status: todo
status: done
title: Draft weekly-agent-run ActivityDefinition template
- id: T08
state_hub_task_id: cc0565bc-ccd4-4739-9c7e-088adaa9834b
status: todo
status: done
title: Open activity-core handoff issue for resolver and definitions
- id: T09
state_hub_task_id: 23aeff77-3429-438b-a395-5c7b5dc2824e
status: todo
status: done
title: Implement kaizen-agentic schedule prepare command
- id: T10
state_hub_task_id: cba9685b-408f-4292-8169-9965e7ad5c5b
status: todo
status: done
title: Bundle memory brief metrics and agent prompt in prepare output
- id: T11
state_hub_task_id: 7c1b049b-5566-4b5e-9d82-d9c29fab0c84
status: todo
status: done
title: Add schedule init scaffold for new repos
- id: T12
state_hub_task_id: 80a8e98a-9146-4a58-8fd3-8c37f7893960
status: todo
status: done
title: Unit tests for schedule validate and prepare
- id: T13
state_hub_task_id: 9aee6348-d5ad-4413-b01c-5588b07c8ede
status: todo
status: done
title: Pilot ActivityDefinition for weekly coach on custodian repos
- id: T14
state_hub_task_id: 697e612b-7531-4329-82fb-b0423ba86904
status: todo
status: done
title: Pilot ActivityDefinition for weekly optimization review
- id: T15
state_hub_task_id: 92db5130-2212-4780-ab8f-1de3adf6c6f8
status: todo
status: done
title: Smoke test end-to-end on two preselected repos
- id: T16
state_hub_task_id: bbecdcbf-42b8-4b48-9f85-e4c10e4ff3ab
status: todo
status: done
title: Document operator enablement in PACKAGE_RELEASE and agency-framework
- id: T17
state_hub_task_id: a9e91d4b-990a-457a-9591-d1243db5b386
status: todo
status: done
title: Emit kaizen.schedule.prepared event payload spec for activity-core
- id: T18
state_hub_task_id: 73986472-bf19-4b13-af1b-6505ab944459
status: todo
status: done
title: Update wiki/EcosystemIntegration.md and CHANGELOG for v1.3.0
---
# KAIZEN-WP-0006 — Scheduled Agent Execution via activity-core
**Status:** active
**Status:** done
**Owner:** kaizen-agentic
**Repo:** kaizen-agentic
**Target version:** 1.3.0
@@ -172,9 +172,9 @@ agents:
### Tasks
- [ ] T01 — Write ADR-005: scheduled agent execution (roster, schedule file, dispatch, boundaries)
- [ ] T02 — Add `docs/integrations/schedule-schema.md` + example under `docs/examples/.kaizen/schedule.yml`
- [ ] T03 — Implement `kaizen-agentic schedule validate [--target PATH]` (schema + agent name checks)
- [x] T01 — Write ADR-005: scheduled agent execution (roster, schedule file, dispatch, boundaries)
- [x] T02 — Add `docs/integrations/schedule-schema.md` + example under `docs/examples/.kaizen/schedule.yml`
- [x] T03 — Implement `kaizen-agentic schedule validate [--target PATH]` (schema + agent name checks)
### Definition of done
@@ -198,9 +198,9 @@ Define which registered repos participate in fleet scheduling.
### Tasks
- [ ] T04 — Extend `docs/INTEGRATION_PATTERNS.md` Pattern 2 with roster + schedule model
- [ ] T05 — Design doc: state-hub fields/filters for kaizen-scheduled repos (no state-hub code in this repo)
- [ ] T06 — Spec `discover_kaizen_scheduled_repos` resolver for activity-core (inputs, output shape, errors)
- [x] T04 — Extend `docs/INTEGRATION_PATTERNS.md` Pattern 2 with roster + schedule model
- [x] T05 — Design doc: state-hub fields/filters for kaizen-scheduled repos (no state-hub code in this repo)
- [x] T06 — Spec `discover_kaizen_scheduled_repos` resolver for activity-core (inputs, output shape, errors)
### Definition of done
@@ -223,9 +223,9 @@ Generalize WP-0004 metrics definitions into **agent-run** definitions.
### Tasks
- [ ] T07 — Add `docs/integrations/activity-definitions/weekly-coach-orientation.md`
- [ ] T08 — Open activity-core coordination issue/PR checklist (resolver + sync + `enabled: false` pilot)
- [ ] T17 — Document `kaizen.schedule.prepared` event payload (for future event-driven runs)
- [x] T07 — Add `docs/integrations/activity-definitions/weekly-coach-orientation.md`
- [x] T08 — Open activity-core coordination issue/PR checklist (resolver + sync + `enabled: false` pilot)
- [x] T17 — Document `kaizen.schedule.prepared` event payload (for future event-driven runs)
### Definition of done
@@ -258,10 +258,10 @@ kaizen-agentic schedule list [--target PATH] # show enabled entries from s
### Tasks
- [ ] T09 — Implement `schedule` CLI command group skeleton
- [ ] T10 — Wire `prepare` to memory + metrics + agent loader (reuse existing CLI internals)
- [ ] T11 — Implement `schedule init` with sensible defaults (coach + optimization weekly, disabled tdd-workflow)
- [ ] T12 — Tests for validate, init, prepare (temp repo fixtures)
- [x] T09 — Implement `schedule` CLI command group skeleton
- [x] T10 — Wire `prepare` to memory + metrics + agent loader (reuse existing CLI internals)
- [x] T11 — Implement `schedule init` with sensible defaults (coach + optimization weekly, disabled tdd-workflow)
- [x] T12 — Tests for validate, init, prepare (temp repo fixtures)
### Definition of done
@@ -283,11 +283,11 @@ Prove the loop on a small custodian repo set before fleet-wide enable.
### Tasks
- [ ] T13 — Commit pilot `weekly-coach-orientation` definition; map to custodian pilot repos
- [ ] T14 — Commit pilot `weekly-optimization-review` definition
- [ ] T15 — Smoke test: dry-run activity-core → manual `schedule prepare` on two repos → verify task payload
- [ ] T16 — Operator docs: credentials, PATH, Gitea index, enabling `enabled: true` in activity-core
- [ ] T18 — `wiki/EcosystemIntegration.md`, `CHANGELOG [Unreleased]`, `TODO.md` pointer
- [x] T13 — Commit pilot `weekly-coach-orientation` definition; map to custodian pilot repos
- [x] T14 — Commit pilot `weekly-optimization-review` definition
- [x] T15 — Smoke test: dry-run activity-core → manual `schedule prepare` on two repos → verify task payload
- [x] T16 — Operator docs: credentials, PATH, Gitea index, enabling `enabled: true` in activity-core
- [x] T18 — `wiki/EcosystemIntegration.md`, `CHANGELOG [Unreleased]`, `TODO.md` pointer
### Definition of done