Files
kaizen-agentic/docs/integrations/kaizen-schedule-prepared-event.md
tegwick 5cd5d99198
Some checks failed
ci / test (push) Has been cancelled
chore: retire TODO.md in favour of workplans
Drop the repo-level Todofile; active work lives in workplans/ and State
Hub per ADR-001. Schedule prepare now surfaces workplans/ instead of
TODO.md. Gitignore .kaizen/agents/ and .kaizen/metrics/ runtime state.
2026-06-19 21:10:27 +02:00

91 lines
3.1 KiB
Markdown

# 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", "workplans"],
"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`, `workplans`) |
| `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)