Self-improving skills¶
Every agent turns its own work into new skills and memory with nobody authoring them. A
cheap per-turn hook writes candidates — an idea plus pointers into the session. The
nightly dream-cycle follows those pointers and composes the real SKILL.md or memory.
| stage | fires | writes |
|---|---|---|
| notice | turn-review Stop hook (claude), every 10 turns per session / agent_end extension (pi), on every turn a configured decision model judges worth mining, else the same 10-turn cadence; on the small skill_model |
candidates to ~/.cache/agentctl/turn-review-candidates.jsonl |
| compose | the nightly dream-cycle, per candidate |
the real SKILL.md or memory entry, stamped created_by: agent |
| age out | the nightly dream-cycle, on real usage |
the lifecycle state of agent-composed skills |
The notice hook is detached, recursion-guarded, and work-gated on at least 3 tool calls in the turn; it never blocks the session. A candidate carries a session id, a verbatim grep anchor and the files touched. The compose stage follows those pointers with the introspection verbs and pulls only the evidence it needs.
CLAUDE_SKILL_REVIEW_INTERVAL (or PI_SKILL_REVIEW_INTERVAL on pi) changes the cadence.
A pi agent with a decision model configured does not use that cadence at all: it asks the
decision model one worth_mining question per turn instead, so a session shorter than any
interval is still reviewed. Each candidate it files then also carries a category (skill,
memory, knowledge-base or drop), a duplicate_of naming an existing skill or memory,
and a confidence; a confident drop or duplicate_of is discarded into
~/.cache/agentctl/turn-review-candidates.archive.jsonl with its reason rather than written
to the queue.
With no decision model configured, a pi agent keeps the 10-turn cadence and writes candidates with none of those three fields — the same behaviour, and the same records, as before the feature existed.
Ageing¶
The dream-cycle curates the skills it composed. Use is measured in one pass over the agent's last 90 days of transcripts — path reads and tool invocations — not per skill.
| state | condition |
|---|---|
active |
on compose |
stale |
zero path references over 90 days, zero invocations, and no memory pin. A skill under 30 days old is never flagged: it has no 90-day window yet |
archived |
still stale on a re-check 90 or more days later. Moved under an archived/ directory and every pointer to it dropped |
Three exemptions, checked before any ageing decision:
- A skill that is a symlink is skipped — that is a shipped skill, and archiving one only
gets reconciled back on the next
apply. - A skill referenced by a cron is exempt regardless of its usage count.
- A skill pinned in memory is exempt.
Only skills stamped created_by: agent age at all; hand-written skills are never touched.
Steering the review model¶
sudo agentctl agents set <name> skill_model <model>
sudo agentctl apply <name>
| runtime | env var | default |
|---|---|---|
| claude | CLAUDE_SKILL_MODEL |
claude-haiku-4-5, back-filled into the ledger |
| pi | PI_SKILL_MODEL |
none — an empty value reviews on the agent's PI_MODEL |
skill_model is a model-only override on the agent's own account and key; see
Which model runs where. pi crons carry the
same per-job override as PI_CRON_MODEL, the analog of claude's CLAUDE_CRON_MODEL.
Introspection verbs¶
Seven read-only JSON verbs over an agent's own sessions, memory, skills, candidate store and
workspace. This is the layer the dream-cycle composes from, and candidates is how you watch
what is being proposed fleet-wide.
agentctl sessions <agent> grep <pattern> [--role …] [--tool …] [--since …]
agentctl sessions <agent> perms [--lane <lane>] [--all]
agentctl mem <agent> [--type …] [--grep <re>] [--since …]
agentctl skills <agent> [--since …]
agentctl candidates <agent> [--kind skill|memory] [--status …] [--since …]
agentctl ws changes <agent> [--since …]
agentctl ws search <agent> <query> [--limit <n>]
sessions carries three more reads beside those two: pending [--lane], list [--since]
[--limit] and timeline <session-id>.
| caller | may query |
|---|---|
| any agent | itself |
| an admin agent | any agent, through the agentd read-proxy |
sessions grep is a live grep with no pre-built index. skills is runtime-aware per agent:
| runtime | skills lists |
|---|---|
| claude | ~/.claude/skills/ |
| pi | ~/.pi/agent/skills/ |