A missing newline fused the closing delimiter onto the last frontmatter value, or fused a value onto the following key. Either way the frontmatter never terminates and the whole body is swallowed. Because workplan files are selected by 'type: workplan', such a file is not invalid but invisible: it appears in no projection, raises no error, and is reported as neither a workplan nor a problem. A forge-derived reset would read its correct hub record as no longer deriving and propose retiring live work. Only the missing newline is inserted; no value is altered. Refs STATE-WP-0083-T08 Assistant: claude-code Assistant-Model: opus Assistant-Process: 2583210@bnt-lap001 Assistant-Session: f2bff2d5-e9b2-4338-92ca-10282a927006
5.3 KiB
| id | type | title | domain | repo | status | owner | topic_slug | state_hub_workstream_id | depends_on | created | updated | tasks | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| KAIZEN-WP-0007 | workplan | Agent Authoring & Doc Generation (v1.4.0) | agents | kaizen-agentic | finished | kaizen-agentic | custodian | a8bc88a4-0ee3-44c6-aff5-9d7f54a316f5 |
|
2026-06-18 | 2026-06-18 |
|
KAIZEN-WP-0007 — Agent Authoring & Doc Generation
Status: finished Owner: kaizen-agentic Repo: kaizen-agentic Target version: 1.4.0 Depends on: WP-0006 (scheduled agent execution)
Goal
Close the WP-0005/WP-0006 deferrals — agent selection/authoring, template schema enforcement, and doc generation — and fix the doc-generation defect they exposed. After this workplan, authoring a new agent and keeping project docs in sync is a first-class, idempotent, validated CLI flow.
Background
AgentInstaller._update_documentation() regenerates the ## Installed Agents
block in a project's CLAUDE.md, but its regex
(## Installed Agents.*?(?=##|\Z)) is non-greedy and the (?=##) lookahead
matches ### Category subheadings inside the section — so each run leaves the
old category lists and footer in place and appends a fresh copy. The block
duplicates and grows unbounded (reported to state-hub; the corrupting write is
ours). validate only checks dependencies and file existence — it does not
enforce the agent frontmatter schema — and there is no scaffolding command for
new agents.
Tasks
T01 — Fix idempotent doc regeneration
- Anchor the replace to a top-level heading:
(?=\n## (?!#)|\Z). - Add a regression test that runs regeneration twice and asserts exactly one
## Installed Agents, one footer, one block per category. - Clean the existing baseline duplication in this repo's
CLAUDE.md.
T02 — Reusable agent-docs module + docs generate
- Extract the "Installed Agents" rendering into a pure function
(
render_installed_agents_section) and an idempotentupsert_installed_agents_section(content, section). _update_documentationreuses them (no behavioral fork).- New
kaizen-agentic docs generate [--target PATH] [--check]refreshes the section for installed agents;--checkexits non-zero if it would change (CI-friendly).
T03 — Enforce agent frontmatter schema in validate
- Add
validate_frontmatter_schema()to the registry: requiredname,description,category;category∈AgentCategory;memory∈ {enabled,disabled} when present;modela non-empty string when present. - Surface schema errors in
kaizen-agentic validatealongside dependency errors, with actionable messages.
T04 — create-agent scaffold
kaizen-agentic create-agent <name> [--category] [--description] [--memory] [--target] [--force]writes a schema-validagents/agent-<name>.mdwith frontmatter + section skeleton.- Missing
--category/--descriptionfall back to interactive prompts. - Refuses invalid category; refuses overwrite without
--force; output passes T03 validation.
T05 — Tests
tests/test_agent_docs.py— idempotency,docs generate --check.tests/test_validate_schema.py— schema pass/fail cases.tests/test_create_agent.py— scaffold + round-trips through registry.
T06 — Docs
docs/CLI_CHEAT_SHEET.md—docs generate,create-agent, schema validate.docs/agency-framework.md— authoring + doc-sync note.CHANGELOG.md[Unreleased];TODO.mdpointer.
Definition of Done
- Doc regeneration is idempotent (N runs == 1 run); baseline cleaned.
kaizen-agentic validatefails on malformed agent frontmatter with clear errors.kaizen-agentic create-agentproduces an agent that passesvalidate.kaizen-agentic docs generate --checkis green on a synced repo.- Full test suite +
make release-checkgreen.
Out of Scope
- Multi-file agent packages / protocol scaffolding (separate workplan).
- Publishing generated docs to external knowledge bases (info-tech-canon).
- Changing the agent frontmatter schema itself (only enforcing the current one).
Notes
- Boundary: the doc-regeneration trigger (a state-hub routine invoking the installer mid-session) is tracked separately in the state-hub inbox; this workplan fixes the write so the trigger becomes harmless/idempotent.
create-agentwrites toagents/; remembermake agents-sync-packagebefore release so packageddata/agents/parity holds (existing release-check gate).