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

@@ -73,6 +73,45 @@ test -f .kaizen/metrics/optimizer/analysis.json && echo OK
**Boundary:** kaizen-agentic does not run Temporal schedules.
### Scheduled agent execution (WP-0006, ADR-005)
Beyond the metrics-only definitions above, agents themselves run on a cadence
against a **preselected repo roster**. The roster combines three sources:
| Source | Purpose |
|--------|---------|
| State Hub `GET /repos/` | Canonical slug list + `host_paths` |
| Repo opt-in: `.kaizen/schedule.yml` exists with `version` set | Per-repo enablement |
| Optional hub flag `kaizen_schedule_enabled: true` (future) | Operator override |
A repo is **schedule-eligible** when it is registered with reachable
`host_paths` **and** carries a valid `.kaizen/schedule.yml`. The activity-core
resolver `discover_kaizen_scheduled_repos` intersects these and emits
`context.scheduled_runs` (one entry per `(repo, agent)`); definitions `for_each`
over that output.
| Definition | Trigger | Agent | Prepare command |
|------------|---------|-------|-----------------|
| [weekly-coach-orientation](integrations/activity-definitions/weekly-coach-orientation.md) | Cron Mon 09:00 | `coach` | `schedule prepare coach` |
| [weekly-optimization-review](integrations/activity-definitions/weekly-optimization-review.md) | Cron Mon 10:00 | `optimization` | `schedule prepare optimization` |
**Listing schedule-eligible repos** (operator, no activity-core code):
```bash
# In each candidate repo on a host listed in state-hub host_paths:
kaizen-agentic schedule validate && kaizen-agentic schedule list
```
**Design docs (no state-hub / activity-core code in this repo):**
- [schedule-schema.md](integrations/schedule-schema.md) — `.kaizen/schedule.yml`
- [state-hub-roster-fields.md](integrations/state-hub-roster-fields.md) — hub fields/filters
- [discover-kaizen-scheduled-repos.md](integrations/discover-kaizen-scheduled-repos.md) — resolver spec
- [kaizen-schedule-prepared-event.md](integrations/kaizen-schedule-prepared-event.md) — event payload
**Boundary:** kaizen-agentic declares and prepares; activity-core schedules;
state-hub owns the roster.
---
## Pattern 3 — artifact-store evidence retention