npx skills add ...
npx skills add zhaono1/agent-playbook --skill self-improving-agent
Use after a failure, user correction, repeated workflow problem, or validated success reveals a reusable lesson. Captures bounded redacted candidates, runs executable behavior evals, and separates validation from application in durable guidance.
npx skills add zhaono1/agent-playbook --skill self-improving-agent
Turn evidence from completed work into a small, auditable behavior change. The default result is a candidate or no change—not an automatic rewrite of skills.
Do not use it for routine session summaries, raw transcript storage, speculative ideas without evidence, or project facts that belong in project documentation.
Every run ends in exactly one state:
candidate: reusable but not yet validated.validated: representative evidence supports the lesson, but no owner change is claimed yet.applied: the validated lesson was installed in one named durable owner with a change reference.rejected: disproved, unsafe, too specific, or obsolete.superseded or rolled_back: an applied/validated lesson was replaced or reverted.no-delta: no reusable behavior change was found.open-question: evidence is insufficient and the missing proof is named.An artifact is not proof of improvement. An applied lesson must change future behavior and have a representative check that demonstrates the change.
Before editing durable guidance, state:
If any item is unknown, capture a candidate and stop before validation or application.
Prefer facts over interpretation. Record only the minimum reusable summary; do not copy transcripts, tool inputs, credentials, private paths, or customer data.
Claude Code failure hooks explicitly enabled with apb init --hooks can call:
Manual corrections or successes use an explicit summary and evidence label:
The CLI stores redacted events and deduplicated candidates under
~/.agent-playbook/self-improvement/. Override the root with
AGENT_PLAYBOOK_DATA_DIR or --data-dir.
Keep a candidate only when all are true:
Use apb behavior inbox to inspect the prioritized queue. Repeated evidence
increases occurrence count; it does not automatically increase truth. Use
apb behavior owners <candidate-id> --repo . for local suggestions, but treat
every result as a review candidate rather than an ownership decision.
Choose the smallest proof that can falsify the candidate, encode it as an
executable artifact, and run it with apb self-improve eval. See
references/eval-artifact.md for the schema and safety boundary.
| Candidate | Minimum proof |
|---|---|
| Prompt or workflow rule | Representative prompt plus rubric |
| CLI/runtime behavior | Focused automated test |
| External integration | Live capability check against current docs/runtime |
| Safety rule | Negative test showing the unsafe path is blocked |
| Repeated heuristic | Multiple independent episodes or explicit human confirmation |
Separate facts, hypotheses, and missing evidence. Structural validation alone does not prove that guidance is semantically current or executable by the host.
Run the artifact first. A baseline scenario is recommended when the previous behavior can be reproduced safely; at least one candidate scenario is required:
Validation accepts only a passing CLI-generated eval result for the same candidate. It does not claim runtime behavior changed.
Generate a local Behavior Change Proposal before editing the owner:
The proposal contains the behavior diff intent, eval proof, acceptance criteria, privacy boundary, and rollback plan. It does not edit the owner or create a remote pull request.
After changing exactly one durable owner, record the application separately:
Other decisions:
Apply into the narrowest owner:
Never silently modify repository rules, publish packages, or trigger external actions as a side effect of capture.
Run the representative task after application. Report:
If the new rule does not change the representative behavior, revert or reject it.
Export applied rules and open candidates as Markdown for Obsidian or another local knowledge system:
The export is a sink, not the source of truth. Candidate and active-rule state remain structured and auditable in the CLI data directory.
Skills describe judgment; host adapters provide events and actions. Check the current host before claiming support:
apb init --hooks.Use apb conformance to inspect local-static contracts. A proven distribution
or hook configuration does not prove host discovery or runtime invocation; those
remain unverified until an observed host run supplies bounded evidence.
See references/learning-lifecycle.md for schemas and adapter contracts. Use
evals/cases.json with evals/rubric.md when changing this skill.
apb self-improve eval cand-123 --artifact behavior-eval.json
apb self-improve review cand-123 \
--decision validate \
--reason "baseline reproduced and candidate scenarios passed" \
--eval-result /path/printed/by/the/eval/command.jsonapb behavior proposal cand-123 \
--owner "skill:self-improving-agent" \
--output behavior-proposal.mdapb self-improve review cand-123 \
--decision apply \
--reason "installed after the focused test passed" \
--owner "skill:self-improving-agent" \
--change-ref "commit:abc123"apb self-improve review cand-123 --decision observe --reason "needs a second episode"
apb self-improve review cand-123 --decision reject --reason "project-specific exception"apb self-improve export --output /path/to/vault/Agent/Learning.md