Files
kaizen-agentic/docs/integrations/kaizen-metrics-recorded-event.md
tegwick 50aa553cea
Some checks failed
ci / test (push) Has been cancelled
Register kaizen.metrics.recorded event type for activity-core catalog (T03)
Producer-owned event-types/kaizen.metrics.recorded.md unblocks ACTIVITY-WP-0011
registry gate. Documents schema ownership and sync path for activity-core.
2026-06-18 14:06:05 +02:00

74 lines
2.2 KiB
Markdown

# Event Payload: `kaizen.metrics.recorded`
**Status:** implemented — `kaizen-agentic metrics record --emit-event`
**Registry:** `event-types/kaizen.metrics.recorded.md` (producer-owned, synced via
activity-core `make sync-event-types` with `ACTIVITY_DEFINITION_DIRS` including
this repo)
Emitted after a successful metrics append when `--emit-event` is set. Default
off for backward compatibility.
## Subject
```
activity.kaizen.metrics.recorded
```
Published to NATS (activity-core `EventEnvelope` format). Consumed by
activity-core event router and definitions such as `low-success-rate-review`.
## Envelope
```json
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"type": "kaizen.metrics.recorded",
"version": "1.0",
"timestamp": "2026-06-18T12:00:00Z",
"publisher": "kaizen-agentic",
"attributes": {
"agent": "coach",
"project": "kaizen-agentic",
"summary": {
"success_rate": 0.75,
"execution_count": 12,
"avg_quality": 0.81
}
}
}
```
### Attribute fields
| Field | Type | Notes |
|-------|------|-------|
| `agent` | string | Agent name from `metrics record <agent>` |
| `project` | string | Repo slug — `KAIZEN_PROJECT_SLUG` env or directory basename |
| `summary.success_rate` | float | Rolling rate from `summary.json` after append |
| `summary.execution_count` | int | Total executions |
| `summary.avg_quality` | float | Maps from `avg_quality_score` in ADR-004 summary |
## CLI
```bash
kaizen-agentic metrics record coach --success --time 120 --quality 0.9 --emit-event
```
Requires `nats-py` (`pip install 'kaizen-agentic[events]'`). Configure broker via
`NATS_URL` (default `nats://localhost:4222`).
Events are **not** emitted when append is skipped (duplicate idempotency key).
## Consumers
- **activity-core** — `trigger.type: event` with `event_type: kaizen.metrics.recorded`
- **coulomb-loop** — `low-success-rate-review` (LOOP-WP-0002); replaces hourly
health sweep when event path is stable
## Related
- [low-success-rate-review](activity-definitions/low-success-rate-review.md)
- [INTEGRATION_PATTERNS.md Pattern 2](../INTEGRATION_PATTERNS.md)
- coulomb-loop `loops/quality-escalation/event-payload.md` (customer contract)