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:
90
docs/integrations/kaizen-schedule-prepared-event.md
Normal file
90
docs/integrations/kaizen-schedule-prepared-event.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Event Payload: `kaizen.schedule.prepared`
|
||||
|
||||
**Status:** design — for **future event-driven runs**. v1 of WP-0006 is
|
||||
cron-driven (activity-core fires the schedule). This event lets a runner or
|
||||
activity-core react when a `schedule prepare` bundle has been assembled, without
|
||||
polling.
|
||||
|
||||
kaizen-agentic does **not** publish this event today; the `prepare` command
|
||||
writes to stdout. This spec fixes the contract so an emitter (a runner wrapper
|
||||
or a thin `--emit` flag in a later iteration) and consumers agree on the shape.
|
||||
|
||||
## Subject
|
||||
|
||||
```
|
||||
kaizen.schedule.prepared
|
||||
```
|
||||
|
||||
NATS/event-bus subject, sibling to the existing `kaizen.metrics.recorded` and
|
||||
`kaizen.agent.installed` subjects (Pattern 2).
|
||||
|
||||
## Payload
|
||||
|
||||
```json
|
||||
{
|
||||
"event": "kaizen.schedule.prepared",
|
||||
"version": "1",
|
||||
"occurred_at": "2026-06-17T09:00:12Z",
|
||||
"repo": "kaizen-agentic",
|
||||
"root": "/home/worsch/kaizen-agentic",
|
||||
"agent": "coach",
|
||||
"cadence": "weekly",
|
||||
"prepare_command": "kaizen-agentic schedule prepare coach --target /home/worsch/kaizen-agentic",
|
||||
"bundle": {
|
||||
"format": "markdown",
|
||||
"agent_prompt_found": true,
|
||||
"has_memory": true,
|
||||
"has_metrics": true,
|
||||
"pointers": ["scope", "todo"],
|
||||
"bytes": 8421
|
||||
},
|
||||
"session_close": [
|
||||
"kaizen-agentic metrics record coach --success --time <s> --quality <0-1>"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Fields
|
||||
|
||||
| Field | Type | Notes |
|
||||
|-------|------|-------|
|
||||
| `event` | string | Always `kaizen.schedule.prepared` |
|
||||
| `version` | string | Payload schema version |
|
||||
| `occurred_at` | RFC3339 | When the bundle was assembled |
|
||||
| `repo` | string | State Hub slug |
|
||||
| `root` | string | Absolute checkout path |
|
||||
| `agent` | string | Agent the bundle orients |
|
||||
| `cadence` | string | `daily` \| `weekly` \| `monthly` |
|
||||
| `prepare_command` | string | Exact CLI that produced the bundle |
|
||||
| `bundle.format` | string | `markdown` \| `json` |
|
||||
| `bundle.agent_prompt_found` | bool | Mirrors `schedule prepare --format json` |
|
||||
| `bundle.has_memory` | bool | Memory file present |
|
||||
| `bundle.has_metrics` | bool | Metrics summary present |
|
||||
| `bundle.pointers` | string[] | Repo pointer labels found (`scope`, `todo`) |
|
||||
| `bundle.bytes` | int | Rendered bundle size |
|
||||
| `session_close` | string[] | Suggested close commands |
|
||||
|
||||
The `bundle.*` flags map 1:1 to the JSON output of
|
||||
`kaizen-agentic schedule prepare <agent> --format json`, so an emitter can build
|
||||
this payload from the existing command without new computation.
|
||||
|
||||
## Consumers (illustrative)
|
||||
|
||||
- **activity-core** — close the loop: mark the scheduled task `in_progress` when
|
||||
a bundle is prepared.
|
||||
- **artifact-store** — archive large bundles by reference.
|
||||
- **dashboards** — fleet view of which scheduled runs have been prepared vs.
|
||||
executed.
|
||||
|
||||
## Boundary
|
||||
|
||||
- The payload carries **metadata and a command**, never secrets or full repo
|
||||
contents.
|
||||
- kaizen-agentic owns the schema; emission wiring (NATS publish) is a future
|
||||
iteration and belongs to the runner / activity-core integration.
|
||||
|
||||
## Related
|
||||
|
||||
- [discover-kaizen-scheduled-repos.md](discover-kaizen-scheduled-repos.md)
|
||||
- [INTEGRATION_PATTERNS.md Pattern 2](../INTEGRATION_PATTERNS.md)
|
||||
- [ADR-005](../adr/ADR-005-scheduled-agent-execution.md)
|
||||
Reference in New Issue
Block a user