feat(agency): complete WP-0002 Part 3 — E2E tests, docs, sys-medic cross-refs, bugfix

T25: add tests/test_e2e_agency_framework.py — 16 E2E tests covering the full
memory lifecycle (init, show, brief, clear) and protocol list/show commands.

T26: replace agency-framework.md protocols placeholder with full documentation —
location convention, frontmatter schema, CLI reference, sys-medic memory
extensions, and protocols table.

T27: add Related Documents footer to agent-sys-medic.md linking to the k3s
protocol runbook, ADR-002, ADR-003, and agency-framework.md.

Fix: rename CLI command function list() → list_agents() to stop it shadowing
Python's built-in list(). The shadow caused memory_brief() to invoke the
agent-list command instead of constructing a list from dict keys, producing
the agent list as output on every `memory brief` invocation.

All 27 WP-0002 tasks complete. Test suite: 51 passed, 1 skipped.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 00:27:39 +00:00
parent 53dfd55916
commit 07c4a70907
6 changed files with 406 additions and 23 deletions

View File

@@ -146,17 +146,76 @@ kaizen-agentic memory show project-management
---
## Protocols (Part 3 — coming in WP-0002 Part 3)
## Protocol Runbooks
A future extension adds **protocol runbooks** — structured, human-readable procedural checklists that agents can reference during structured assessments:
Agents can reference **protocol runbooks** — structured, human-readable procedural checklists for structured assessments or remediation work. Protocols are distinct from agent prompts:
- **Agent prompts** (`agents/agent-*.md`) shape AI behaviour
- **Protocols** (`agents/protocols/<agent>/<slug>.md`) are procedural documents for humans and agents to execute
### Location Convention
```
agents/protocols/<agent-name>/<slug>.md
agents/protocols/
<agent-name>/
<slug>.md ← one file per protocol
```
The sys-medic k3s health assessment protocol is the first planned example. CLI commands `kaizen-agentic protocols list` and `protocols show` will expose them.
### Protocol Frontmatter
See [WP-0002](../workplans/kaizen-agentic-WP-0002-agency-framework.md) Part 3 for the full specification.
Each protocol file has a YAML frontmatter block:
```yaml
---
agent: <agent-name>
slug: <slug>
title: <human-readable title>
version: 1.0.0
last_updated: "<ISO date>"
---
```
### Referencing Protocols from Agents
Agents with `memory: enabled` check for relevant protocols at session start and reference them in their session-start protocol block. For example, sys-medic's session-start protocol instructs:
> *"If a structured assessment is requested, check for `agents/protocols/sys-medic/k3s-node-health-assessment.md` and use it as your procedure."*
### CLI Reference
```bash
kaizen-agentic protocols list # List all protocols
kaizen-agentic protocols list sys-medic # Filter by agent
kaizen-agentic protocols show sys-medic k3s-node-health-assessment
```
### sys-medic Memory and Protocols Integration
sys-medic extends the base memory template with three additional sections for operational continuity across sessions:
```markdown
## Node Profiles
<!-- Per-node operational baseline established over sessions -->
<!-- hostname | typical load | known quirks | last assessment date -->
## Recurring Findings
<!-- Issues seen more than once: pattern · first seen · frequency -->
## Cleared Issues
<!-- Issues that were resolved: what was done · when · outcome -->
```
These sections are maintained automatically by the sys-medic session-close protocol.
The **k3s Node Health Assessment** (`agents/protocols/sys-medic/k3s-node-health-assessment.md`) is the first protocol runbook — a step-by-step procedure covering OS baseline, process hygiene, memory, CPU, disk, network, Kubernetes node state, and k3s runtime health.
### Available Protocols
| Agent | Protocol | Description |
|-------|----------|-------------|
| sys-medic | [k3s-node-health-assessment](../agents/protocols/sys-medic/k3s-node-health-assessment.md) | Structured k3s node health check |
See [ADR-003: Protocols Artifact Convention](adr/ADR-003-protocols-artifact-convention.md) for the full specification.
---