feat: agent authoring & doc generation (WP-0007, v1.4.0)
Some checks failed
ci / test (push) Failing after 40s
Publish Python package / publish (push) Successful in 4m46s

New authoring tooling and a fix for the doc-regeneration defect it exposed.

Added:
- src/kaizen_agentic/agent_docs.py — render + idempotent upsert of the
  CLAUDE.md "## Installed Agents" section (shared by installer and CLI)
- `kaizen-agentic docs generate [--check]` — idempotent doc refresh / CI gate
- `kaizen-agentic create-agent` — scaffold a schema-valid agent
- Frontmatter schema validation in `kaizen-agentic validate`
  (required name/description/category, known category, valid memory/model)
- tests: test_agent_docs, test_validate_schema, test_create_agent

Fixed:
- _update_documentation regex duplicated the Installed Agents block on every
  run (stopped at the first ### subheading) — now idempotent
- declared frontmatter `category` is authoritative (heuristic is fallback)
- list_installed_agents reads the frontmatter name, not the filename
- renamed agent-project-management.md -> agent-project-assistant.md to satisfy
  the agent-<name>.md convention (eliminates a name/filename collision that
  caused install/update to write a divergent duplicate)
- test_cli_error_handling no longer installs into the repo root (uses tmp)

Version 1.4.0; CHANGELOG, CLI cheat sheet, agency-framework, TODO updated.
Workplan KAIZEN-WP-0007 closed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 02:06:14 +02:00
parent 7058859e5c
commit 843cf4eee0
19 changed files with 847 additions and 90 deletions

View File

@@ -52,9 +52,28 @@ kaizen-agentic remove old-agent-name
# Project status
kaizen-agentic status # Show current project status
kaizen-agentic validate # Validate agent installation
kaizen-agentic validate # Validate agents (incl. frontmatter schema)
```
### Authoring & Docs (WP-0007)
```bash
# Scaffold a new schema-valid agent (agents/agent-<name>.md)
kaizen-agentic create-agent my-agent -c testing -d "What it does"
kaizen-agentic create-agent my-agent # prompts for category + description
kaizen-agentic create-agent my-agent --force # overwrite existing
# Refresh the CLAUDE.md "Installed Agents" section from agent metadata
kaizen-agentic docs generate # idempotent rewrite
kaizen-agentic docs generate --check # CI gate: non-zero if out of date
# validate enforces required name/description/category, valid category,
# and valid memory/model values
kaizen-agentic validate
```
After adding or editing agents, run `make agents-sync-package` so the packaged
`data/agents/` copies stay in parity (release-check gate).
### Project Metrics (ADR-004)
```bash
# Record outcome at session close

View File

@@ -80,6 +80,23 @@ memory: enabled # or: disabled
The `memory` field defaults to `enabled`. Set `memory: disabled` for agents that are stateless by design (e.g. `wisdom-encouragement`).
The file name must follow `agent-<name>.md` where `<name>` equals the frontmatter
`name`. `kaizen-agentic validate` enforces the frontmatter schema (required
fields, known `category`, valid `memory`/`model`).
### Authoring and doc sync (WP-0007)
```bash
kaizen-agentic create-agent <name> -c <category> -d "<description>"
kaizen-agentic validate # schema + dependency checks
kaizen-agentic docs generate # refresh CLAUDE.md Installed Agents
make agents-sync-package # keep packaged data/agents/ in parity
```
`create-agent` writes a schema-valid skeleton; `docs generate` rewrites the
project `## Installed Agents` section **idempotently** (use `--check` as a CI
gate). The section is grouped by the declared frontmatter `category`.
---
## The Coach Meta-Agent