Bootstrap coulomb-loop engagement: governance, loops, and activity definitions.

Register with state-hub, accept DEC-001–004 and ADR-004 rotation policy, scaffold
pilot roster, hourly ActivityDefinition copies, and bootstrap log after schedule
init on three custodian pilot repos.
This commit is contained in:
2026-06-18 04:53:51 +02:00
parent d09a5722d5
commit e783dc9a2b
40 changed files with 2783 additions and 0 deletions

View File

@@ -0,0 +1,150 @@
---
id: LOOP-WP-0000
type: workplan
title: "Engagement bootstrap (registration, assessment, governance)"
domain: coulomb_social
repo: coulomb-loop
status: active
owner: coulomb-loop
topic_slug: coulomb_social
supplier: kaizen-agentic
created: "2026-06-18"
updated: "2026-06-18"
depends_on: []
tasks:
- id: T01
status: done
title: Register coulomb-loop in state-hub under coulomb_social
- id: T02
status: done
title: Persist initial codebase assessment in history/
- id: T03
status: done
title: Accept ADR-001 ADR-002 ADR-003 and publish decision proposals
- id: T04
status: done
title: Sync workplans to state-hub via fix-consistency
- id: T05
status: done
title: Open supplier track KAIZEN-WP-0008 in kaizen-agentic
- id: T06
status: done
title: Resolve DEC-001 through DEC-004 operator decisions
- id: T07
status: done
title: Fill SCOPE.md and .claude/rules integration stubs
- id: T08
status: todo
title: Register reuse-surface capability entry for loop orchestration
state_hub_workstream_id: "0df6df54-4313-4c2d-93f2-dc6844fe47ec"
---
# LOOP-WP-0000 — Engagement Bootstrap
**Status:** active
**Owner:** coulomb-loop
**Purpose:** One-time (and ongoing governance) setup before loop automation runs.
## Goal
Establish `coulomb-loop` as a registered, governed customer engagement repo with
documented assessment, ADRs, pending decisions, and hub-indexed workplans — minimal
manual steps, maximum automation downstream.
## Register and assess (done 2026-06-18)
```task
id: LOOP-WP-0000-T01
status: done
priority: high
state_hub_task_id: "0d29d8a3-5326-4da2-8e5b-d78af13d7388"
```
`register_project.sh coulomb_social /home/worsch/coulomb-loop`; topic_id and description patched.
```task
id: LOOP-WP-0000-T02
status: done
priority: high
state_hub_task_id: "1ebb94ed-7a44-425f-bd32-862602d77817"
```
`history/2026-06-18-initial-codebase-assessment.md` committed.
```task
id: LOOP-WP-0000-T03
status: done
priority: high
state_hub_task_id: "5c300ba3-7bdf-4db7-96f5-cc3d5454eac1"
```
ADR-001003 accepted; DEC-001004 published under `docs/decisions/`.
```task
id: LOOP-WP-0000-T04
status: done
priority: high
state_hub_task_id: "f45e0ea8-ce58-4fee-8d30-f145b0c5beea"
```
`make fix-consistency REPO=coulomb-loop` — LOOP-WP-00010004 indexed.
```task
id: LOOP-WP-0000-T05
status: done
priority: high
state_hub_task_id: "0cb1f5be-26ea-4d85-9bd1-b30bb69ea127"
```
`kaizen-agentic/workplans/kaizen-agentic-WP-0008-coulomb-loop-supplier-engagement.md` created and synced.
## Completed (2026-06-18)
- state-hub registration (`coulomb_social`, topic `coulomb-social`)
- Repo description and topic_id patched via API
- `history/2026-06-18-initial-codebase-assessment.md`
- ADR-001 (LOOP-WP prefix), ADR-002 (boundary), ADR-003 (cadence ramp)
- DEC-001DEC-004 decision proposals
- LOOP-WP-00010004 synced (4 workstreams, 30 tasks)
- KAIZEN-WP-0008 opened in kaizen-agentic (supplier)
## Resolve operator decisions
```task
id: LOOP-WP-0000-T06
status: done
priority: high
state_hub_task_id: "97509454-9a93-4a80-a12b-e459f3cd01c5"
```
Accepted option A for DEC-001004 (2026-06-18). ADR-004 records diminishing-returns
repo rotation for later implementation (LOOP-WP-0004 T09). `loops/kaizen-stack/roster.yaml` created.
## Fill orientation files
```task
id: LOOP-WP-0000-T07
status: done
priority: medium
state_hub_task_id: "663661ef-ee8c-4fc6-a552-845d22163012"
```
SCOPE.md and `.claude/rules/{repo-identity,architecture,repo-boundary,stack-and-commands,workplan-convention}.md` filled.
## reuse-surface capability entry
```task
id: LOOP-WP-0000-T08
status: todo
priority: low
state_hub_task_id: "54f5e683-0081-4db1-abdb-4f57323f840e"
```
Add capability row for fleet loop orchestration engagement (D0 scaffold).
Run `reuse-surface validate` when entry drafted.
## Definition of done
- All DEC-* resolved or explicitly deferred with owner date
- SCOPE and rules files non-stub
- LOOP-WP-0001 unblocked for roster + schedule scaffold

View File

@@ -0,0 +1,281 @@
---
id: LOOP-WP-0001
type: workplan
title: "Kaizen Improvement Stack (coach + metrics + optimization)"
domain: coulomb_social
repo: coulomb-loop
status: active
owner: coulomb-loop
topic_slug: coulomb_social
supplier: kaizen-agentic
created: "2026-06-18"
updated: "2026-06-18"
depends_on: []
tasks:
- id: T01
status: done
title: Register coulomb-loop in state-hub and sync workplans
- id: T02
status: done
title: Declare pilot roster for kaizen improvement stack
- id: T03
status: done
title: Scaffold .kaizen/schedule.yml on pilot target repos
- id: T04
status: done
title: Copy and tune ActivityDefinitions for hourly bootstrap cadence
- id: T05
status: todo
title: activity-core handoff — enable resolver and sync definitions
- id: T06
status: done
title: Hourly bootstrap smoke test on single pilot repo
- id: T07
status: todo
title: Expand pilot to three repos and record metrics at session close
- id: T08
status: todo
title: Promote cadence to daily after bootstrap exit criteria met
state_hub_workstream_id: "90a05147-7b95-4ce7-96bf-39cdb487b557"
---
# LOOP-WP-0001 — Kaizen Improvement Stack
**Status:** active
**Owner:** coulomb-loop (customer)
**Supplier:** kaizen-agentic
**Repo:** coulomb-loop
## Goal
Establish the **primary self-improvement loop** for the Coulomb fleet: a chained
sequence that turns project metrics into coach synthesis and optimization action.
```mermaid
flowchart LR
AC[activity-core hourly cron]
RES[discover_kaizen_scheduled_repos]
M[metrics optimize]
C[schedule prepare coach]
O[schedule prepare optimization]
AC --> RES --> M --> C --> O
```
This loop generalizes the supplier's Monday Stack (`weekly-metrics-optimize`
`weekly-coach-orientation``weekly-optimization-review`) into a **cadence-ramped**
engagement starting at **hourly** during bootstrap.
## Customer / supplier boundary
| coulomb-loop (customer) | kaizen-agentic (supplier) |
|-------------------------|---------------------------|
| Pilot roster, acceptance criteria, cadence policy | Agent prompts, `schedule` / `metrics` CLI, ADR-005 contract |
| ActivityDefinition copies under `activity-definitions/` | Reference definitions in `docs/integrations/activity-definitions/` |
| Loop health records in `loops/kaizen-stack/` | Customer-repo bootstrap learnings fed back to supplier |
Agents (`coach`, `optimization`) accumulate memory in **target repos**, not in
`coulomb-loop`. This repo holds contracts and operations only.
## Cadence ramp
| Phase | Cron (Europe/Berlin) | ActivityDefinitions |
|-------|----------------------|---------------------|
| Bootstrap | `0 * * * *` (hourly) | `hourly-metrics-optimize`, `hourly-coach-orientation`, `hourly-optimization-review` |
| Stabilize | `0 8 * * *` (daily 08:00) | rename/switch to daily variants |
| Operate | Mon 08:0010:00 (weekly) | align with supplier weekly templates |
Promotion from hourly → daily requires LOOP-WP-0004 regulator sign-off after
bootstrap exit criteria (see Part 4).
## Part 1 — Engagement bootstrap
## Register coulomb-loop in state-hub
```task
id: LOOP-WP-0001-T01
status: done
priority: high
state_hub_task_id: "c66d2e98-8f3e-4119-89e7-2b6f67b6596d"
```
Completed 2026-06-18: `register_project.sh coulomb_social`, topic_id patched,
`fix-consistency` indexed LOOP-WP-00010004. See LOOP-WP-0000.
## Declare pilot roster
```task
id: LOOP-WP-0001-T02
status: done
priority: high
state_hub_task_id: "65994889-2f41-46e3-9c47-00cedc59fd81"
```
DEC-001 option A accepted. `loops/kaizen-stack/roster.yaml` committed with
`active` (3 custodian pilots), `expansion_queue`, and `saturated` per ADR-004.
## Scaffold schedule opt-in on pilot repos
```task
id: LOOP-WP-0001-T03
status: done
priority: high
state_hub_task_id: "2293b8bd-20b1-4d54-bd1c-8311004e59f9"
```
Completed 2026-06-18: `schedule init`, `memory init coach|optimization`, bootstrap
hourly crons (`coach :15`, `optimization :30`) on kaizen-agentic, the-custodian,
activity-core. All `schedule validate` pass.
## Scaffold schedule opt-in on pilot repos (reference)
In each pilot **target repo** (not coulomb-loop):
```bash
kaizen-agentic schedule init --timezone Europe/Berlin
kaizen-agentic schedule validate
```
Override defaults for bootstrap:
```yaml
agents:
coach:
cadence: daily # schema enum; cron carries hourly during bootstrap
cron: "0 * * * *"
enabled: true
optimization:
cadence: daily
cron: "30 * * * *" # offset 30 min after metrics+coach chain
enabled: true
```
Commit `.kaizen/schedule.yml` in each pilot repo. Initialize metrics dirs:
`kaizen-agentic memory init coach` and `memory init optimization` (creates metrics scaffold).
## Part 2 — activity-core integration
## Copy and tune ActivityDefinitions
```task
id: LOOP-WP-0001-T04
status: done
priority: high
state_hub_task_id: "53025f59-f00a-4792-950a-878e867803b2"
```
Five definitions in `coulomb-loop/activity-definitions/` (hourly stack + quality).
Handoff doc: `docs/integrations/activity-core-handoff.md`.
Copy supplier templates into `coulomb-loop/activity-definitions/`:
| File | Based on | Bootstrap cron |
|------|----------|----------------|
| `hourly-metrics-optimize.md` | `weekly-metrics-optimize` | `0 * * * *` |
| `hourly-coach-orientation.md` | `weekly-coach-orientation` | `15 * * * *` |
| `hourly-optimization-review.md` | `weekly-optimization-review` | `30 * * * *` |
Set `owner: coulomb-loop`, `governance: coulomb_social`, `enabled: false` until
smoke test passes. Resolver params: `domain: custodian` for pilot, `cadence: daily`
(schema) with per-repo cron override from schedule.yml.
## activity-core handoff
```task
id: LOOP-WP-0001-T05
status: todo
priority: high
state_hub_task_id: "16c54902-a1c5-4e24-9bc3-5c7b8c30abe3"
```
Open coordination track with activity-core:
1. Implement `discover_kaizen_scheduled_repos` per supplier spec (if not done)
2. `make sync-activity-definitions` with coulomb-loop copies
3. Dry-run resolver against pilot roster
4. Enable one definition at a time (`hourly-metrics-optimize` first)
Reference: `docs/integrations/activity-core-handoff.md` (coulomb-loop) and
`kaizen-agentic/docs/integrations/activity-core-handoff-wp0006.md` (supplier).
## Part 3 — Pilot and promote
## Hourly bootstrap smoke test (single repo)
```task
id: LOOP-WP-0001-T06
status: done
priority: medium
state_hub_task_id: "a5ecda96-f299-421c-b393-ae54bfbf9ae0"
```
Smoke pass on all 3 pilots (prepare bundles 6.99.7 KB). Log:
`loops/kaizen-stack/bootstrap-log.md`. activity-core wiring still pending (T05).
On `kaizen-agentic` only:
```bash
kaizen-agentic schedule validate
kaizen-agentic schedule prepare coach
kaizen-agentic metrics optimize
kaizen-agentic schedule prepare optimization
```
Verify non-empty prepare bundles. Manually simulate activity-core task payload.
Record outcome in `loops/kaizen-stack/bootstrap-log.md`.
**Bootstrap exit (single repo):** 3 consecutive hours where all three steps complete
without manual intervention.
## Three-repo pilot with metrics
```task
id: LOOP-WP-0001-T07
status: todo
priority: medium
state_hub_task_id: "e60fa833-9407-460a-b1d1-7e08850fa291"
```
Enable activity-core definitions for full pilot roster. Each session close:
```bash
kaizen-agentic metrics record coach --success --time <s> --quality <0-1>
kaizen-agentic metrics record optimization --success --time <s> --quality <0-1>
```
**Bootstrap exit (fleet pilot):** 3 consecutive hourly cycles across all 3 repos.
## Promote to daily cadence
```task
id: LOOP-WP-0001-T08
status: todo
priority: low
state_hub_task_id: "7c77ec4f-594c-4122-9c64-af5c4071446d"
```
After LOOP-WP-0004 regulator approves:
1. Update pilot `schedule.yml` crons to daily (`0 8`, `0 9`, `0 10`)
2. Switch activity-core definitions to daily variants
3. Record promotion decision in state-hub
## Definition of done
- Hourly loop runs end-to-end on 3 pilot repos via activity-core task creation
- `schedule prepare` bundles are actionable in coding-agent sessions
- Metrics recorded for coach and optimization on each run
- Cadence promotion path documented and ready for regulator approval
## Out of scope
- Fleet-wide rollout beyond pilot (follows LOOP-WP-0004 approval)
- Implementing resolvers in coulomb-loop (activity-core owns runtime)
- Headless LLM invocation
## Supplier feedback (for kaizen-agentic)
Capture in `loops/kaizen-stack/supplier-notes.md`:
- friction from `schedule init` / `prepare` on customer engagement
- missing CLI flags for engagement repos
- template gaps for customer ActivityDefinition copies

View File

@@ -0,0 +1,233 @@
---
id: LOOP-WP-0002
type: workplan
title: "Reactive Quality Escalation (signal-driven improvement)"
domain: coulomb_social
repo: coulomb-loop
status: active
owner: coulomb-loop
topic_slug: coulomb_social
supplier: kaizen-agentic
created: "2026-06-18"
updated: "2026-06-18"
depends_on:
- LOOP-WP-0001
tasks:
- id: T01
status: done
title: Define escalation signals and thresholds
- id: T02
status: done
title: Draft low-success-rate ActivityDefinition for coulomb-loop
- id: T03
status: todo
title: Specify kaizen.metrics.recorded event emitter contract
- id: T04
status: todo
title: Hourly metrics sweep fallback until event bus is live
- id: T05
status: todo
title: Wire activity-core event trigger and smoke test
- id: T06
status: todo
title: Add test-maintenance escalation path for CI-degraded repos
- id: T07
status: todo
title: Promote sweep cadence from hourly to daily after stabilization
state_hub_workstream_id: "d4d3b624-dad3-4e1d-9db3-e84548d133de"
---
# LOOP-WP-0002 — Reactive Quality Escalation
**Status:** active
**Owner:** coulomb-loop (customer)
**Supplier:** kaizen-agentic
**Depends on:** LOOP-WP-0001 (metrics scaffold on pilot repos)
## Goal
Complement calendar-based improvement (LOOP-WP-0001) with **signal-driven**
escalation: when agent performance or test health degrades, activity-core creates
a high-priority task before drift compounds.
```mermaid
flowchart LR
REC[metrics record at session close]
EVT[kaizen.metrics.recorded]
RULE[low-success-rate-review]
TASK[high-priority hub task]
AGT[optimization / test-maintenance session]
REC --> EVT --> RULE --> TASK --> AGT
```
## Escalation signals
| Signal | Threshold | Agent | Priority |
|--------|-----------|-------|----------|
| Agent success rate | &lt; 0.8 over ≥ 5 executions | `optimization` | high |
| Agent quality trend | declining 3 consecutive records | `optimization` | medium |
| Test failure streak | ≥ 2 CI failures in 24h (pilot) | `test-maintenance` | high |
| Optimizer recommends action | `recommendations.jsonl` non-empty + unacted | `optimization` | medium |
Thresholds live in `loops/quality-escalation/thresholds.yml` (created in T01).
## Cadence ramp
| Phase | Mechanism | Cadence |
|-------|-----------|---------|
| Bootstrap | Hourly metrics **sweep** (poll `.kaizen/metrics/`) | `0 * * * *` |
| Stabilize | Event-driven `kaizen.metrics.recorded` primary; sweep daily backup | daily `0 6 * * *` |
| Operate | Event-only; sweep weekly health check | weekly |
Hourly sweep exists because the event emitter may lag LOOP-WP-0001 bootstrap.
The sweep is **temporary scaffolding**, not the long-term design.
## Part 1 — Signal contract
## Define escalation signals and thresholds
```task
id: LOOP-WP-0002-T01
status: todo
priority: high
state_hub_task_id: "f6f549e5-0d67-49b8-8165-346c64000696"
```
Create `loops/quality-escalation/thresholds.yml` and document each signal's
rationale. Align with supplier `low-success-rate-review` defaults (0.8, min 5).
## Draft low-success-rate ActivityDefinition
```task
id: LOOP-WP-0002-T02
status: todo
priority: high
state_hub_task_id: "a19c2ade-029d-4b1c-ba08-8fd82729e649"
```
Copy `kaizen-agentic/docs/integrations/activity-definitions/low-success-rate-review.md`
to `coulomb-loop/activity-definitions/low-success-rate-review.md`.
Adjust:
- `owner: coulomb-loop`
- `trigger.type: event` with `event_type: kaizen.metrics.recorded`
- task `labels` include `coulomb-loop`, `quality-escalation`
- `enabled: false` until smoke test
## Specify event emitter contract
```task
id: LOOP-WP-0002-T03
status: todo
priority: high
state_hub_task_id: "6dbdb335-9c1d-4db0-ad7d-4342c966cd47"
```
Document expected NATS payload in `loops/quality-escalation/event-payload.md`:
```json
{
"agent": "coach",
"project": "kaizen-agentic",
"summary": {
"success_rate": 0.75,
"execution_count": 12,
"avg_quality": 0.81
}
}
```
Supplier action item: emit event from `kaizen-agentic metrics record` when
`--emit-event` flag set (or always in engagement mode). Track in supplier-notes;
implementation stays in kaizen-agentic.
## Part 2 — Bootstrap sweep (hourly)
## Hourly metrics sweep fallback
```task
id: LOOP-WP-0002-T04
status: todo
priority: medium
state_hub_task_id: "604a9515-0f6b-47e4-8a37-6bfc374ca4f3"
```
Draft `coulomb-loop/activity-definitions/hourly-metrics-health-sweep.md`:
- Resolver: shell `discover_kaizen_projects` with marker `.kaizen/metrics`
- Filter: pilot roster from LOOP-WP-0001
- Condition: read `summary.json`; flag `success_rate < 0.8 && execution_count >= 5`
- Action: create review task with `metrics show` + `metrics optimize` commands
Cron: `45 * * * *` (offset from LOOP-WP-0001 hourly chain).
## Wire activity-core and smoke test
```task
id: LOOP-WP-0002-T05
status: todo
priority: medium
state_hub_task_id: "a5d8a6e1-9908-49a5-8976-900c433cd325"
```
1. Sync sweep definition to activity-core
2. Inject test metrics below threshold on one pilot repo
3. Verify task creation within one hourly cycle
4. Run optimization session; confirm metrics improve on next sweep
When event bus is ready, enable `low-success-rate-review` and keep sweep as
backup only.
## Part 3 — Test health path
## test-maintenance escalation for CI-degraded repos
```task
id: LOOP-WP-0002-T06
status: todo
priority: low
state_hub_task_id: "206d33c2-0a8a-4274-8361-f69291f11b94"
```
Draft `hourly-ci-health-escalation.md` (bootstrap) / `daily-ci-health-escalation.md`
(stabilize):
- Context: state-hub or shell resolver listing pilot repos
- Signal: open CI failure indicator (Gitea API or `make test` exit code in scheduled probe)
- Agent: `test-maintenance` via `schedule prepare test-maintenance`
- Scope: pilot repos only in bootstrap
Defer full fleet CI integration until daily phase.
## Promote sweep to daily
```task
id: LOOP-WP-0002-T07
status: todo
priority: low
state_hub_task_id: "fa4205f4-6058-495c-bcaa-40c20f27f9aa"
```
After LOOP-WP-0004 approval and event trigger proven:
1. Disable hourly sweep
2. Enable event-driven `low-success-rate-review`
3. Retain daily backup sweep at `0 6 * * *`
## Definition of done
- Below-threshold metrics on a pilot repo create a task within one bootstrap cycle
- Optimization session closes loop (success rate recovers or recommendation filed)
- Event payload spec handed to kaizen-agentic supplier
- Cadence promotion path documented
## Out of scope
- Full fleet CI integration in bootstrap phase
- Implementing NATS emitter in coulomb-loop (supplier + activity-core)
## Supplier feedback
Note whether `metrics record --emit-event` should become standard for customer
engagements. Feed into kaizen-agentic customer bootstrap playbook.

View File

@@ -0,0 +1,246 @@
---
id: LOOP-WP-0003
type: workplan
title: "Registry & Orientation Hygiene (fleet legibility)"
domain: coulomb_social
repo: coulomb-loop
status: active
owner: coulomb-loop
topic_slug: coulomb_social
supplier: kaizen-agentic
created: "2026-06-18"
updated: "2026-06-18"
depends_on:
- LOOP-WP-0001
tasks:
- id: T01
status: todo
title: Define hygiene signals and domain rollout order
- id: T02
status: todo
title: Create hourly registry gap sweep ActivityDefinition
- id: T03
status: todo
title: Create scope-analyst orientation task template
- id: T04
status: todo
title: Integrate state-hub SBOM staleness with hygiene roster
- id: T05
status: todo
title: Hourly bootstrap on custodian-domain pilot slice
- id: T06
status: todo
title: Expand to next domain batch after pilot exit
- id: T07
status: todo
title: Promote cadence to daily then weekly
state_hub_workstream_id: "f3a4b60a-7bc2-400d-bf8a-e7209a9e45c4"
---
# LOOP-WP-0003 — Registry & Orientation Hygiene
**Status:** active
**Owner:** coulomb-loop (customer)
**Supplier:** kaizen-agentic (`scope-analyst` agent)
**Partner:** reuse-surface (CLI), state-hub (SBOM status)
## Goal
Prevent **fleet legibility drift** across 56 state-hub repos and 53 reuse-surface
registries. Agents and planners can only improve what they can see; this loop
keeps `SCOPE.md`, capability entries, and SBOM metadata current.
```mermaid
flowchart LR
SH[state-hub repo roster]
RS[reuse-surface report gaps]
SBOM[repo_sbom_status]
SA[schedule prepare scope-analyst]
VAL[reuse-surface validate]
SH --> RS
SH --> SBOM
RS --> SA --> VAL
```
## Hygiene signals
| Signal | Source | Action |
|--------|--------|--------|
| Registry gap | `reuse-surface report gaps` | `scope-analyst` + `establish --publish-check` |
| Empty capability scaffold | federation roster `capability_count: 0` | draft capability entry or mark intentional |
| Stale SCOPE | `SCOPE.md` mtime &gt; 90d or missing | `scope-analyst` refresh |
| Stale SBOM | `sbom_age_days > 30` (state-hub) | flag + link to existing activity-core SBOM job |
| Publish check fail | `publish_check: fail` in federation roster | registry fix task |
Signals documented in `loops/registry-hygiene/signals.yml`.
## Domain rollout order
Bootstrap processes **small batches** to avoid task storms:
1. **custodian** (11 repos) — aligns with LOOP-WP-0001 pilots
2. **helix_forge** (4 repos) — reuse-surface home domain
3. **stack** (3 repos) — artifact-store, open-reuse
4. Remaining domains — one per weekly cycle after daily stabilization
## Cadence ramp
| Phase | Cron | Batch size |
|-------|------|------------|
| Bootstrap | `0 * * * *` (hourly) | 3 repos per run (round-robin) |
| Stabilize | `0 7 * * *` (daily) | 1 domain per day |
| Operate | `0 9 * * 1` (weekly Mon) | 12 domains per week |
Hourly bootstrap uses **round-robin** across custodian pilot slice (3 repos per
hour), not full fleet scan.
## Part 1 — Signal and template setup
## Define hygiene signals and rollout order
```task
id: LOOP-WP-0003-T01
status: todo
priority: high
state_hub_task_id: "cacc914e-85e6-4067-b39d-cf8a3ae91320"
```
Create:
- `loops/registry-hygiene/signals.yml`
- `loops/registry-hygiene/rollout.yaml` (domain order + repo slugs)
- `loops/registry-hygiene/round-robin-state.json` (cursor for hourly batching)
## Hourly registry gap sweep ActivityDefinition
```task
id: LOOP-WP-0003-T02
status: todo
priority: high
state_hub_task_id: "7c6b15cd-a5ac-4602-956f-61de72a55fef"
```
Create `coulomb-loop/activity-definitions/hourly-registry-hygiene-sweep.md`:
```yaml
trigger:
cron_expression: "20 * * * *"
context_sources:
- type: state-hub
query: repo_sbom_status
bind_to: context.repos
- type: shell
query: reuse_surface_report_gaps
params:
roster: coulomb-loop/loops/registry-hygiene/rollout.yaml
bind_to: context.gaps
```
Rule: for each repo in current hourly batch with any hygiene signal, create task:
```
kaizen-agentic schedule prepare scope-analyst
reuse-surface validate
reuse-surface establish --publish-check # when registry touched
```
`enabled: false` until shell resolver wrapper exists in activity-core.
## scope-analyst orientation template
```task
id: LOOP-WP-0003-T03
status: todo
priority: medium
state_hub_task_id: "e8eb2700-8ef5-43fb-8d2e-ec080fa86f6f"
```
Create `loops/registry-hygiene/session-template.md` — standard task description
for scope-analyst sessions: read SCOPE, compare to INTENT, update registry index,
file state-hub progress event.
## Part 2 — Integration
## Integrate SBOM staleness with hygiene roster
```task
id: LOOP-WP-0003-T04
status: todo
priority: medium
state_hub_task_id: "09cec748-0bfa-4870-b44f-50813f7ed626"
```
Document handoff with existing `activity-core/weekly-sbom-staleness`:
- Do not duplicate SBOM rescans in this loop
- Hygiene task **links** to SBOM job when `sbom_age_days > 30`
- Shared label: `fleet-hygiene`
Add cross-reference in `loops/registry-hygiene/signals.yml`.
## Hourly bootstrap on custodian pilot slice
```task
id: LOOP-WP-0003-T05
status: todo
priority: medium
state_hub_task_id: "76029879-01ed-4db2-afcf-3876db45b395"
```
Pilot batch: `kaizen-agentic`, `the-custodian`, `activity-core`.
Manual smoke test (before activity-core enable):
```bash
reuse-surface report gaps --roster <rollout.yaml>
kaizen-agentic schedule prepare scope-analyst --target /home/worsch/kaizen-agentic
reuse-surface validate # in target repo
```
**Bootstrap exit:** 3 hourly rounds complete without duplicate tasks for same repo+signal.
## Expand domain batch
```task
id: LOOP-WP-0003-T06
status: todo
priority: low
state_hub_task_id: "f6e5a9d5-2c32-439d-9e95-aa6d6fd3c6ab"
```
After regulator approval, add helix_forge domain to rollout. Increase batch size
when false-positive rate stays below 20%.
## Promote cadence
```task
id: LOOP-WP-0003-T07
status: todo
priority: low
state_hub_task_id: "5b6bb667-42e1-4e41-968e-4025ac2e72ce"
```
| Promotion | Condition |
|-----------|-----------|
| hourly → daily | bootstrap exit + LOOP-WP-0004 approval |
| daily → weekly | 2 weeks daily with &lt; 10% repeat tasks for same signal |
Update activity-core definitions and `loops/registry-hygiene/cadence.yml`.
## Definition of done
- Hygiene sweep creates actionable scope-analyst tasks on pilot repos
- reuse-surface validate passes after hygiene session on at least one repo
- SBOM staleness delegated to existing activity-core job (no duplicate work)
- Domain rollout order and cadence ramp documented
## Out of scope
- Implementing `reuse-surface report gaps` resolver in coulomb-loop
- Mandatory capability maturity promotion (planning-only in bootstrap)
- Full 56-repo hourly scan
## Supplier feedback
Document whether `scope-analyst` needs engagement-specific briefing template.
Feed reuse-surface + kaizen-agentic supplier playbook.

View File

@@ -0,0 +1,329 @@
---
id: LOOP-WP-0004
type: workplan
title: "Loop Regulator (second-order improvement)"
domain: coulomb_social
repo: coulomb-loop
status: active
owner: coulomb-loop
topic_slug: coulomb_social
supplier: kaizen-agentic
created: "2026-06-18"
updated: "2026-06-18"
depends_on:
- LOOP-WP-0001
- LOOP-WP-0002
- LOOP-WP-0003
tasks:
- id: T01
status: done
title: Define loop health model and cadence state machine
- id: T02
status: done
title: Create loops/ directory structure and cadence.yml per loop
- id: T03
status: todo
title: Draft hourly loop-health-collector ActivityDefinition
- id: T04
status: todo
title: Draft optimization-agent regulator session template
- id: T05
status: todo
title: Hourly bootstrap — collect metrics from all three primary loops
- id: T06
status: todo
title: First cadence promotion decision on LOOP-WP-0001
- id: T07
status: todo
title: Publish supplier customer-repo playbook draft to kaizen-agentic
- id: T08
status: todo
title: Promote regulator from hourly to daily after meta-loop stabilizes
- id: T09
status: todo
title: Implement diminishing-returns detection and repo rotation per ADR-004
state_hub_workstream_id: "08970648-dbd8-48f6-9b3a-72f196013089"
---
# LOOP-WP-0004 — Loop Regulator (Second-Order Improvement)
**Status:** active
**Owner:** coulomb-loop (customer)
**Supplier:** kaizen-agentic (`optimization`, `tooling-optimization`)
**Depends on:** LOOP-WP-0001, LOOP-WP-0002, LOOP-WP-0003
## Goal
Operate a **second-order control loop** that watches the three first-order loops,
decides when to promote or demote cadence, suppresses noisy jobs, and captures
supplier learnings so kaizen-agentic can onboard the next customer faster.
```mermaid
flowchart TB
L1[LOOP-WP-0001 kaizen stack]
L2[LOOP-WP-0002 quality escalation]
L3[LOOP-WP-0003 registry hygiene]
COL[hourly health collector]
REG[optimization regulator session]
CAD[cadence.yml updates]
SUP[supplier playbook feedback]
L1 --> COL
L2 --> COL
L3 --> COL
COL --> REG --> CAD
REG --> SUP
```
First-order loops improve **Coulomb's fleet**. The regulator improves **the loops
themselves** — and the **supplier engagement model**.
## Loop health model
Per loop, track in `loops/<id>/health.jsonl`:
| Metric | Source | Healthy range (bootstrap) |
|--------|--------|---------------------------|
| `tasks_created` | activity-core / state-hub | &gt; 0 per cycle when expected |
| `tasks_completed` | state-hub task status | ≥ 70% within SLA |
| `manual_rescues` | bootstrap-log.md entries | 0 for promotion |
| `false_positive_rate` | duplicate tasks / total | &lt; 20% |
| `agent_success_rate` | `.kaizen/metrics/<agent>/summary.json` | ≥ 0.8 |
| `mean_session_time_sec` | metrics executions | stable or decreasing trend |
| `cost_signal` | tasks per hour × session time | tracked, no hard limit in bootstrap |
Aggregate dashboard: `loops/regulator/dashboard.md` (regenerated each run).
## Cadence state machine
```
bootstrap (hourly) ──promote──▶ stabilize (daily) ──promote──▶ operate (weekly)
▲ │ │
└──────── demote (noise/SLA) ──┴────────────────────────────┘
```
Promotion rules (all must hold):
1. Bootstrap exit criteria from source workplan met
2. `false_positive_rate < 0.2` over last 7 cycles
3. `manual_rescues == 0` over last 3 cycles
4. Regulator session recommends promote (optimization agent)
Demotion triggers (any one):
- `false_positive_rate > 0.4` over 3 cycles
- `manual_rescues >= 2` in 24h
- Operator override
State stored in `loops/<id>/cadence.yml`:
```yaml
loop: kaizen-improvement-stack
phase: bootstrap # bootstrap | stabilize | operate
cron: "0 * * * *"
promoted_at: null
demotion_count: 0
regulator_approval: pending
```
## Part 1 — Infrastructure
## Define loop health model and state machine
```task
id: LOOP-WP-0004-T01
status: todo
priority: high
state_hub_task_id: "d3a9aa4c-ff72-4a09-a545-fa5171768126"
```
Write `loops/regulator/health-model.md` and `loops/regulator/state-machine.md`.
Cross-reference INTENT.md cadence ramp policy.
## Create loops directory structure
```task
id: LOOP-WP-0004-T02
status: todo
priority: high
state_hub_task_id: "3ae8f36f-6d6f-4db0-846c-d34a3c4010fe"
```
```
loops/
regulator/
health-model.md
state-machine.md
dashboard.md
session-template.md
kaizen-stack/
roster.yaml
cadence.yml
health.jsonl
bootstrap-log.md
supplier-notes.md
quality-escalation/
thresholds.yml
cadence.yml
health.jsonl
registry-hygiene/
signals.yml
rollout.yaml
cadence.yml
health.jsonl
```
Initialize `cadence.yml` for each loop at `phase: bootstrap`, hourly cron.
## Part 2 — Regulator automation
## Hourly loop-health-collector ActivityDefinition
```task
id: LOOP-WP-0004-T03
status: todo
priority: high
state_hub_task_id: "734c76b6-9d34-4fdf-b928-b678578a063a"
```
Create `coulomb-loop/activity-definitions/hourly-loop-health-collector.md`:
- Cron: `50 * * * *` (after other hourly loops)
- Collect: task counts from state-hub, metrics summaries from pilot repos,
bootstrap-log entries
- Append one JSON line per loop to `health.jsonl`
- If demotion trigger fired, create **urgent** regulator task
## optimization-agent regulator session template
```task
id: LOOP-WP-0004-T04
status: todo
priority: high
state_hub_task_id: "e417226b-4175-44b3-8284-7255569e956b"
```
Create `loops/regulator/session-template.md`:
```bash
kaizen-agentic schedule prepare optimization --target coulomb-loop
# Include: dashboard.md, all health.jsonl tails, all cadence.yml
```
Session outputs:
1. Promotion / hold / demote recommendation per loop
2. Noise sources to disable or throttle
3. Supplier friction items for `supplier-notes.md`
4. Updated `cadence.yml` proposals (human commits)
Record: `kaizen-agentic metrics record optimization --success ...`
## Part 3 — Operate the meta-loop
## Hourly bootstrap collection
```task
id: LOOP-WP-0004-T05
status: todo
priority: medium
state_hub_task_id: "9d4dc665-15e6-47e4-9f1c-aa9adff5783d"
```
Run collector manually for first 3 cycles before activity-core enable.
Verify `health.jsonl` entries and dashboard regeneration.
## First cadence promotion decision
```task
id: LOOP-WP-0004-T06
status: todo
priority: medium
state_hub_task_id: "e8fb9e66-2212-4c6d-b947-2c22d32f1c53"
```
When LOOP-WP-0001 bootstrap exit is met:
1. Run regulator session
2. If approved, update `loops/kaizen-stack/cadence.yml` to `stabilize`
3. Record decision in state-hub
4. Notify activity-core owners to switch definition crons
First promotion is the **proof of second-order value**.
## Supplier customer-repo playbook
```task
id: LOOP-WP-0004-T07
status: todo
priority: medium
state_hub_task_id: "9600bd31-5d85-4623-98f9-e50ec56cde3d"
```
Synthesize `loops/regulator/supplier-playbook-draft.md` covering:
- Minimal customer repo layout (INTENT, workplans, loops/, activity-definitions/)
- Engagement bootstrap checklist
- Cadence ramp policy template
- Supplier/customer boundary table
- Open supplier gaps (resolver, event emitter, CLI)
Open kaizen-agentic issue or `KAIZEN-WP-0008` workplan to absorb playbook into
supplier repo. **This is the reuse outcome of the entire engagement.**
## Promote regulator cadence
```task
id: LOOP-WP-0004-T08
status: todo
priority: low
state_hub_task_id: "e67820e4-8e4d-444b-9c3c-a8b3b23e0a11"
```
After 1 week of hourly regulator runs with stable recommendations:
- Collector: hourly → daily (`0 11 * * *`)
- Regulator session: daily → weekly (Mon 11:00)
- Emergency demotion remains event-driven (immediate task)
## Diminishing returns and repo rotation (ADR-004)
```task
id: LOOP-WP-0004-T09
status: todo
priority: medium
state_hub_task_id: "431ebe91-3a6f-475f-a862-a784dbbe29b4"
```
Implement saturation detection per `loops/regulator/rotation-policy.yml`:
1. Extend health collector to compute `saturation_score` per active repo
2. Regulator session recommends rotate when score exceeds threshold (3/4 signals)
3. Update `loops/kaizen-stack/roster.yaml`: move repo to `saturated`, promote from `expansion_queue`
4. Patch target repo `.kaizen/schedule.yml` (`optimization.enabled: false`)
5. Record state-hub decision
**Automation path:** manual recommendation during bootstrap; auto-rotate after
2 successful manual rotations prove signal accuracy. Supplier may add
`kaizen-agentic metrics rotation-signals` (KAIZEN-WP-0008 extension).
## Definition of done
- Health collector writes metrics for all three primary loops
- At least one promotion or hold decision documented with evidence
- `cadence.yml` updated for at least one loop based on regulator output
- Supplier playbook draft delivered to kaizen-agentic
## Out of scope
- Autonomous cadence changes without human commit to `cadence.yml`
- Disabling first-order loops without operator visibility
- Full activity-core implementation in coulomb-loop
## Success criteria (engagement-level)
The coulomb-loop engagement succeeds when:
1. First-order loops run reliably at bootstrap cadence
2. Regulator demonstrably prevents a noisy loop from scaling prematurely
3. kaizen-agentic can bootstrap a second customer repo from the playbook with
≤ 50% setup effort compared to this engagement