feat: instance manifest, tool profiles, metrics, and budget enforcement
Land HARNESS-WP-0001 T01/T02/T04/T05: extend ADR-005 schedule.yml with harness fields, named tool-profile registry, ADR-004 metrics writes, and BudgetTracker wiring. CLI gains validate/profiles; task-file path kept.
This commit is contained in:
parent
16f5c29c08
commit
4144eba160
17 changed files with 1387 additions and 60 deletions
105
docs/instance-manifest.md
Normal file
105
docs/instance-manifest.md
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
# Instance manifest
|
||||
|
||||
> Contract for declarative agent instances in consuming repos.
|
||||
> Companion to ADR-001, ADR-005 (kaizen-agentic), and HARNESS-WP-0001-T01.
|
||||
|
||||
## Location
|
||||
|
||||
```
|
||||
<project-root>/.kaizen/schedule.yml
|
||||
```
|
||||
|
||||
**Same file as ADR-005.** kaizen-agentic owns the base schedule keys;
|
||||
agent-harness owns the extension keys below. A sibling file is reserved
|
||||
only if kaizen owners later prefer hard separation — until then, one
|
||||
manifest keeps cadence and runtime policy colocated.
|
||||
|
||||
Validate:
|
||||
|
||||
```bash
|
||||
kaizen-agentic schedule validate --target <repo> # base ADR-005 keys
|
||||
agent-harness validate --target <repo> # base + harness extensions
|
||||
agent-harness validate --target <repo> --strict # require harness fields on enabled agents
|
||||
```
|
||||
|
||||
## Schema
|
||||
|
||||
| Key | Owner | Required | Type | Notes |
|
||||
|-----|-------|----------|------|-------|
|
||||
| `version` | kaizen | yes | string | Must be `"1"` |
|
||||
| `timezone` | kaizen | no | string | IANA tz |
|
||||
| `harness` | harness | no\* | int | Pinned harness **major** for the repo |
|
||||
| `agents` | both | yes | mapping | `name → settings` |
|
||||
| `agents.<name>.cadence` | kaizen | yes | enum | `daily` \| `weekly` \| `monthly` |
|
||||
| `agents.<name>.cron` | kaizen | no | string | 5-field cron override |
|
||||
| `agents.<name>.enabled` | kaizen | no | bool | Default `true` |
|
||||
| `agents.<name>.blueprint` | harness | no | string | Defaults to agent name (kaizen blueprint) |
|
||||
| `agents.<name>.lane` | harness | no\* | enum | `green` \| `blue` |
|
||||
| `agents.<name>.tool_profile` | harness | no\* | string | Named profile in the harness registry |
|
||||
| `agents.<name>.budget` | harness | no | int | Token cap per run (positive) |
|
||||
| `agents.<name>.harness` | harness | no | int | Per-agent major pin; overrides top-level |
|
||||
|
||||
\* Required for enabled agents under `agent-harness validate --strict`.
|
||||
|
||||
## Example (tenant-ready)
|
||||
|
||||
```yaml
|
||||
# .kaizen/schedule.yml — ADR-005 + agent-harness extensions
|
||||
version: "1"
|
||||
timezone: Europe/Berlin
|
||||
harness: 0
|
||||
agents:
|
||||
coach:
|
||||
cadence: daily
|
||||
cron: "0 7 * * 1-5"
|
||||
enabled: true
|
||||
lane: green
|
||||
tool_profile: green-commit-only
|
||||
budget: 80000
|
||||
mail-triage:
|
||||
cadence: weekly
|
||||
cron: "0 8 * * 1"
|
||||
enabled: true
|
||||
blueprint: coach
|
||||
lane: blue
|
||||
tool_profile: blue-mail-triage
|
||||
budget: 40000
|
||||
review-prep:
|
||||
cadence: weekly
|
||||
cron: "0 9 * * 5"
|
||||
enabled: true
|
||||
lane: green
|
||||
tool_profile: green-commit-only
|
||||
budget: 60000
|
||||
```
|
||||
|
||||
## Tool profiles
|
||||
|
||||
Defined **only** in agent-harness (see `agent_harness/profiles.py`).
|
||||
Manifests reference them by name; unknown names refuse to run.
|
||||
|
||||
| Name | Lane | Session tools |
|
||||
|------|------|---------------|
|
||||
| `green-commit-only` | green | Read/Write/Edit/Glob/Grep + local git add/commit/status/log/diff (+ date, ls) |
|
||||
| `blue-mail-triage` | blue | Same session tools; credentialed IMAP scan is a deterministic pre-step outside the session |
|
||||
|
||||
No push, no network, no arbitrary shell in either profile.
|
||||
|
||||
## Budget
|
||||
|
||||
`budget` is tokens per run. The runner wires llm-connect `BudgetTracker`
|
||||
when set; exhaustion refuses or truncates the run and is reported to the
|
||||
State Hub (token events feed the Token Cost dashboard).
|
||||
|
||||
## Harness pin
|
||||
|
||||
Instances pin a harness **major**. This runtime implements major `0`
|
||||
(package `0.x`). A mismatched pin fails `validate` so upgrades are
|
||||
deliberate.
|
||||
|
||||
## Relationship to task files
|
||||
|
||||
Local development may still use JSON task files (`agent-harness run
|
||||
--task-file …`). When the target repo has a matching agent entry, the
|
||||
runner resolves `tool_profile`, `budget`, and `lane` from the manifest;
|
||||
otherwise it defaults to `green-commit-only` with no budget cap.
|
||||
Loading…
Add table
Add a link
Reference in a new issue