docs: consolidate agent execution and custody
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s
ci / test (push) Successful in 52s

This commit is contained in:
tegwick 2026-08-20 22:43:55 +02:00
parent 6ed5708c21
commit d691135c4a
19 changed files with 372 additions and 64 deletions

View file

@ -119,8 +119,10 @@ kaizen-agentic schedule prepare coach # markdown bundle
kaizen-agentic schedule prepare optimization --format json
```
activity-core fires the schedule and creates a task per (repo, agent); the task
runs `schedule prepare`. kaizen-agentic does not run cron or invoke Claude.
activity-core fires the schedule and creates durable `ops_run` work per
(repo, agent). rein-aharness claims that work and runs the governed
`agent-session`, including `schedule prepare`. kaizen-agentic does not run cron,
own the queue, resolve credentials, or invoke an LLM.
### Forward-deployed engagements (WP-0009 / DEC-FDA-001)
```bash

View file

@ -56,9 +56,9 @@ invoke kaizen-agentic CLI commands.
**kaizen-agentic maintainer checklist:**
- [ ] Three definition files committed under `docs/integrations/activity-definitions/`
- [ ] activity-core PR or issue opened to register definitions
- [ ] Smoke test commands documented below pass on a pilot repo
- [x] Three definition files committed under `docs/integrations/activity-definitions/`
- [x] activity-core handoff completed for the resolver and pilot definitions
- [x] Smoke test commands documented below passed on the pilot roster
**Smoke test (manual):**
@ -71,7 +71,7 @@ kaizen-agentic metrics optimize
test -f .kaizen/metrics/optimizer/analysis.json && echo OK
```
**Boundary:** kaizen-agentic does not run Temporal schedules.
**Boundary:** kaizen-agentic does not run Temporal schedules or own durable work.
### Scheduled agent execution (WP-0006, ADR-005)
@ -109,8 +109,26 @@ kaizen-agentic schedule validate && kaizen-agentic schedule list
- [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.
### Current automated runtime
The original WP-0006 resolver and manual prepare smoke established the supplier
contract. Current unattended execution composes it as follows:
| Stage | Owner | Contract |
|-------|-------|----------|
| Schedule/event and eligibility | activity-core | Temporal definition/rule plus repo/agent context |
| Durable work | activity-core | Unique idempotency key, `ops_run` state, lease, retry, result |
| Claim and execution | rein-aharness | Claim loop, `agent-session` approach, policy/profile/runtime resolution |
| Agent orientation | kaizen-agentic | `schedule prepare <agent>` offline bundle |
| Coordination evidence | State Hub | Roster, workplan/progress references; never prompts or secrets |
| Improvement evidence | kaizen-agentic / artifact-store | Project metrics and optional durable artifacts |
Manual invocation remains supported for smoke tests and operator-controlled
work. The automated path should keep prompts, secrets, and raw model output out
of `ops_run` and State Hub records.
**Boundary:** kaizen-agentic declares and prepares; activity-core schedules and
queues; rein-aharness executes; State Hub owns the roster and coordination view.
---

View file

@ -37,14 +37,36 @@ end-to-end flow:
```
activity-core cron
→ context resolver (roster ∩ repos with schedule.yml)
task per (repo, agent)
coding-agent session runs `kaizen-agentic schedule prepare <agent>`
durable work per (repo, agent)
governed runner executes `kaizen-agentic schedule prepare <agent>`
→ session executes the agent instructions in that repo
```
kaizen-agentic's responsibilities are exactly two: **declare** the schedule
(`.kaizen/schedule.yml`) and **prepare** an orientation bundle for a run. It
does **not** fire cron, create tasks, or invoke Claude.
does **not** fire cron, own the durable work queue, or invoke an LLM.
### Current runtime realization (2026-08-20)
The initial contract above remains valid, but the generic word “task” now has a
specific durable implementation:
```
activity-core Temporal schedule/event
→ rule evaluation and eligibility
→ unique, idempotent ops_run with lease/retry state
→ rein-aharness claim loop
→ agent-session approach and governed runtime/profile resolution
→ kaizen-agentic schedule prepare <agent>
→ bounded coding-agent session
→ ops_run result + State Hub progress + .kaizen metrics/artifact evidence
```
`activity-core` owns schedule and durable work state. `rein-aharness` owns
claiming, execution policy, credential routing, runtime selection, and bounded
session operation. Kaizen Agentic continues to own declaration, agent craft,
preparation, and improvement evidence. A human-started coding-agent session
remains a supported execution mode and reference smoke path.
### 1. Schedule manifest — `.kaizen/schedule.yml`
@ -123,10 +145,13 @@ kaizen-agentic schedule prepare <agent> [--target PATH] [--format markdown|json]
## Boundaries
- **No scheduling code** in kaizen-agentic. Cron and task creation belong to
activity-core; the roster query belongs to state-hub.
- **No scheduling or durable-queue code** in kaizen-agentic. Temporal schedules,
rule evaluation, and `ops_run` state belong to activity-core; the roster query
belongs to State Hub.
- **No LLM invocation.** `prepare` produces a runner-agnostic bundle; a human or
automated coding-agent session executes it.
rein-aharness-governed coding-agent session executes it.
- **No runtime authority or credentials.** Those remain with rein-aharness and
the ecosystem credential/authorization owners.
- **State-hub schema changes** (roster opt-in flag) are designed here but
implemented in `the-custodian` (repo boundary).
@ -134,7 +159,7 @@ kaizen-agentic schedule prepare <agent> [--target PATH] [--format markdown|json]
- Operators declare per-repo schedules and a fleet roster without tribal
knowledge.
- activity-core can fire recurring tasks referencing `schedule prepare`.
- activity-core can fire recurring durable work referencing `schedule prepare`.
- A scheduled session opens with full orientation (prompt + memory + metrics).
- The existing `weekly-metrics-optimize` definition (ADR-004 / WP-0004) remains
complementary; an `optimization` agent run may chain `schedule prepare

View file

@ -127,16 +127,21 @@ should amend this ADR (or a successor), not re-open DEC-FDA-001 silently.
### Negative / trade-offs
- Pilot vault currently sits in the supplier repo (`engagements/pilots/`) — must
still be treated as client confidential; export to client repo is recommended
before multi-tenant growth
- activity-core automation for host duties is optional Phase 3 (manual prepare OK)
- Pilot vault currently sits in the supplier repo (`engagements/pilots/`) under
transitional custody. The Railiance01 receiving authority is
`railiance-infra`; transfer requires explicit receiver acceptance before the
supplier copy is removed or reduced to a pointer.
- Manual preparation remains supported. Unattended host duties require an
engagement-specific activity-core definition and a rein-aharness execution
profile in addition to the generic `ops_run`/`agent-session` path.
- Kai is not a payment processor; EUR path remains future work
### Follow-ups
- Export pilot vault to client-owned path when railiance ops repo is ready
- Optional activity-core ActivityDefinitions for daily host-operator prepare
- Complete the proposed pilot transfer to the client-owned `railiance-infra`
evidence path and record its accepted commit
- Register engagement-specific activity-core definitions and rein-aharness
profile for daily host-operator preparation when unattended operation is desired
- EUR commercial FX after 23 engagement calibration cycles
## Pilot evidence

View file

@ -158,7 +158,7 @@ kaizen-agentic memory brief tdd-workflow
# → paste output into Claude with agent-coach.md loaded
# Review accumulated memory for a specific agent
kaizen-agentic memory show project-management
kaizen-agentic memory show project-assistant
```
---
@ -242,7 +242,7 @@ All agents that do session-bound project work have `memory: enabled` in their fr
| Agent | Category | Notes |
|-------|----------|-------|
| project-management | process | Reference implementation of the session protocol pattern |
| project-assistant | process | Reference implementation of the session protocol pattern |
| tdd-workflow | testing | |
| requirements-engineering | process | |
| scope-analyst | process | |
@ -331,8 +331,10 @@ kaizen-agentic schedule prepare coach # orientation bundle for a scheduled run
`schedule prepare <agent>` bundles the agent prompt, project memory, metrics
summary, and repo pointers — offline, no State Hub required. kaizen-agentic does
**not** run cron or invoke Claude; activity-core fires the schedule and a
coding-agent session executes the prepared bundle.
**not** run cron, own durable work, or invoke an LLM. activity-core fires the
schedule and creates `ops_run` work; rein-aharness claims it and executes the
prepared bundle through a governed `agent-session`. Manual sessions remain a
supported fallback.
Schema: [integrations/schedule-schema.md](integrations/schedule-schema.md).

View file

@ -1,9 +1,15 @@
# activity-core Handoff — Scheduled Agent Execution (WP-0006)
> **Historical supplier handoff, completed for the initial resolver/pilot path.**
> The current production composition is activity-core durable `ops_run` work
> claimed by rein-aharness through its generic `agent-session` approach. The
> resolver and preparation contracts below remain compatible inputs.
Coordination checklist for the **activity-core** team to enable kaizen scheduled
agent runs. kaizen-agentic owns the schedule contract, the prepare CLI, and the
ActivityDefinition **drafts**; activity-core owns the resolver, the schedule
firing, and task creation (repo boundary, ADR-005).
ActivityDefinition **drafts**; activity-core owns the resolver, schedule firing,
and durable work creation (repo boundary, ADR-005); rein-aharness owns governed
execution.
Open this as an activity-core issue/PR titled *"Enable kaizen scheduled agent
execution (WP-0006)"* and track the boxes there.
@ -56,7 +62,7 @@ in kaizen-agentic drafts) when engagement moves beyond coulomb-loop bootstrap co
- [ ] Optional: add `kaizen_schedule_enabled` repo flag + `GET /repos/` filter
(v2 pre-filter; the repo file remains the source of truth).
## Smoke test (manual, runner-agnostic)
## Smoke test (manual reference path)
```bash
cd /path/to/pilot-repo
@ -68,6 +74,9 @@ kaizen-agentic schedule prepare coach # non-empty orientation bundle
Then in activity-core: run the resolver (dry-run) and confirm one
`scheduled_run` per enabled `(repo, agent)` with a correct `prepare_command`.
For unattended operation, confirm the resulting `ops_run` is claimable and the
rein-aharness worker selects the `agent-session` approach before enabling the
schedule broadly.
## Pilot roster

View file

@ -87,7 +87,10 @@ kaizen-agentic engagement close-session eng-... \
### 7. Operate cadence
- Enable entries in engagement `schedule.yml` (manual prepare until activity-core)
- Enable entries in engagement `schedule.yml`; they declare intent but do not
activate unattended work by themselves
- Continue manual prepare until an engagement-specific activity-core definition
and rein-aharness profile have passed a bounded smoke test
- Daily: health + load; weekly: OS/security pass (privileged changes still gated)
### 8. Ramp-down (when ending)
@ -116,7 +119,7 @@ Friction and resolutions from `eng-coulomb-railiance01-ho-001` / KAIZEN-WP-0009.
| `k3s kubectl` ServiceUnavailable under memory pressure | Record as finding; avoid hammering API; re-sample after capacity relief |
| Nested `.kaizen/metrics` under engagement is correct for custody | Root `.gitignore` `.kaizen/metrics/` only ignores repo-root metrics; pilot metrics are commit-able |
| Privileged work tempting on Critical host | RU-08 = **proposal dry-run only** until human approval table filled |
| Pilot vault in supplier repo | Treat as client confidential; export to client ops repo before multi-tenant scale |
| Pilot vault in supplier repo | Treat as client confidential; target `railiance-infra` for Railiance01 and require receiver acceptance before source cleanup |
| activity-core not required for Phase 1 | Manual `prepare` + `close-session`; schedule.yml documents intent |
| Kai charges felt real only after close-session | Always close-session after live duties; quote alone is not spend |
| High load makes remote `du`/`apt` slow | Prefer short command batches; timeout ≥60s for full assessments |
@ -152,14 +155,19 @@ ssh railiance01 "sudo ufw allow from <PUBLIC_IP> to any port 6443 proto tcp comm
---
## Optional activity-core wiring (Phase 3)
## Optional unattended wiring (Phase 3)
Not required for operate. When ready:
1. Customer or engagement repo owns ActivityDefinition copies that shell out to
`kaizen-agentic engagement prepare <id>` then start a coding-agent session
2. Resolver points at engagement id / host Target (new work — not WP-0009)
3. Keep privilege gates in the agent definition regardless of cron fire
1. Customer or engagement repo owns the ActivityDefinition that identifies the
engagement and emits idempotent, claimable `ops_run` work in activity-core.
2. The run carries `agent-session` approach metadata and a compatible
rein-aharness profile reference; it does not carry secrets or raw prompts.
3. rein-aharness claims the run, resolves credentials and policy, and executes
`kaizen-agentic engagement prepare <id>` inside the bounded session.
4. Completion links the `ops_run`, engagement report, metrics, and State Hub
progress without duplicating confidential content into coordination records.
5. Keep privilege gates in the agent definition regardless of schedule fire.
---