What is Learning?
Learning lets reviewers deliberately teach an agent from real work. Leave a comment at review time and check Learn from this comment when the feedback should help in similar future situations. An unchecked comment revises the current run only. AgentUse turns checked feedback into concise, appropriately scoped guidance, stores it in a readable markdown file, and applies it to later runs when relevant. A learning is durable guidance, not an unconditional rule: the current task and the agent’s authored instructions still take precedence. That deliberate human choice is the default. Automatic observation of a run is advanced capability and remains available through explicit capture channels, but it is never enabled merely by writinglearning: true.
Everything a channel produces then passes a vet against the agent’s complete
instructions before it can reach a future run, and everything that reaches a
future run is stamped with the version of those instructions it was checked
against.
Quick Start
A single switch applies deliberate human learnings on future runs:--remember in the CLI. AgentUse grounds the
comment in the work being reviewed, vets it against the agent’s instructions,
and stores it. Unchecked comments are never added to durable memory.
learning: true is sugar for { capture: true, apply: true }: it applies
explicitly saved human learnings, while automatic observation remains off.
Learnings accumulate in a
learnings file inside the AgentUse state directory, not in your repository.
agentuse learnings ./blog-writer.agentuse --path prints where; see
Storage.
capture: true used to mean free-form auto-capture. As of v0.19.0 it enables
no automatic observation channels. Human feedback is saved through the Learn
checkbox, --remember, or manual add. See
Upgrading an existing agent.Store Without Applying
To collect explicitly selected human learnings without putting them into future prompts yet:--remember still save guidance. apply: false only
keeps it out of future prompts until you turn application back on.
Advanced: Automatic Capture Channels
Most agents should stop atlearning: true. Use capture channels only when you
also want AgentUse to learn without a reviewer checking Learn on a comment.
capture: {} is the same as capture: true. This mirrors the
verify schema deliberately: custom plays the role of
verify.criteria (tune the built-in), agent plays the role of verify.judge
(replace it), and setting both is a parse error with the same message style.
deliberate human learning
The Learn checkbox,--remember, and manual add are the standard human path.
They are not automatic capture channels: the reviewer explicitly decides which
comments become durable. Ordinary approval comments affect the current run only.
tool-errors (addon)
(tool, failure signature) and supersede structurally (one record per failure
mode, replaced when a better recovery is observed), and they never go through
the free-text merge path in tidy.
custom (scoped free-form)
agent (evaluator replacement)
.agentuse file replaces the built-in evaluator for free-form capture, the
same pattern as verify.judge. The path resolves relative to the agent file
that declares it. The capture agent receives the run’s evidence and the
learnings the agent already carries with their ids, and records its result by
calling submit_learnings once with 0-5 candidates:
--remember path either way; it never
depends on a user-supplied capture agent behaving.
A nested learning: or verify: block on the capture agent is ignored (a
helper pass must not recurse into a tree of helper passes), and a capture agent
that suspends on an approval gate is an error.
learning: true makes no post-run evaluator call. The built-in evaluator runs
only when capture.custom is configured; use capture.agent when that
automatic judgment is genuinely domain-specific.Configuration Options
Two keys were removed in v0.17.0 and remain rejected by name:
evaluate (long
deprecated) and file (a custom learnings path, now that learnings live
outside your repository, see Storage). An agent file still
carrying one fails loudly rather than quietly ignoring it.Every candidate is vetted
Nothing becomes active on the strength of having been extracted. Every free-form candidate, corrections included, is checked against the agent’s complete instructions, the rules already in force, and the run’s own trace, before it can be injected into anything.
Two properties are worth stating plainly:
- Human corrections are never dropped. A reviewer’s rule that fails the vet is quarantined with the reason, not discarded. If the vet call itself fails, corrections are stored active and observation candidates are dropped. Free-form capture’s entire safety case is the vet, so it fails closed while human input fails open.
- The vet sees the whole contract. The fixed 3,000-character truncation that used to hide every rule past the cut is gone. On any real agent that truncation is what let the evaluator “rediscover” an explicit instruction as a brand-new learning.
Quarantine
A quarantined entry is set aside, never injected, and never deleted. It stays visible with its reason inagentuse learnings <file>, the serve UI’s Learnings
panel, and agentuse doctor:
tool-errors records skip this step. They are verified structurally in
code, and they describe mechanics rather than policy, so there is nothing for
them to contradict.
Rules are stamped with the instructions they were checked against
Every stored learning records the hash of the agent instructions it was captured (or last re-vetted) against, alongside its channel, source session, and evidence. The hash covers your own instructions with the machine-managed graduated block excised, so a rule graduating never marks every other rule stale. When you rewrite the agent file, the hash no longer matches and the affected rules go stale:- Stale rules are held out of injection. A rule vetted against instructions that no longer exist does not get to keep applying unexamined.
- The next capture or
agentuse learnings tidyre-vets them against the current instructions: passes are re-stamped and start injecting again, failures are quarantined with the reason. Nothing is deleted. - Rules with no hash at all, anything captured before v0.19.0, are not stale. They stay injectable until the first capture or tidy backfills them.
agentuse doctor says so when it matters:
Storage
Learnings are stored in the AgentUse state directory, alongside session logs, not in your repository:$AGENTUSE_DATA_DIR defaults to ~/.local/share/agentuse; when it is unset, $XDG_DATA_HOME/agentuse remains the standards-compatible fallback. {project-hash} is a digest of your git root, so two repositories that both contain agents/blog/write.agentuse keep separate learnings, and one agent resolves to one file whichever directory you run it from. The file itself is named after the agent’s path relative to the project root, so subdirectories are preserved.
That path is not one you can type from memory, so nothing asks you to:
agentuse doctor ./blog-writer.agentuse prints it too, as does agentuse learnings ./blog-writer.agentuse --json in its file field. Every learnings file also records which agent it belongs to, on the line under its heading:
Why it is not next to your agent file
Every run rewrites this file, not only the runs that capture something: injecting a learning updates its counters. Kept in the repository, that is a permanently dirty working tree and a stream of commits carrying no decision. The file was never meant to be the durable artifact. It is a staging buffer; your agent file is the thing that gets diffed and reviewed, and graduation is how a proven learning crosses over into it.Moving learnings from before v0.17.0
Learnings used to live beside the agent file, named after it:blog-writer.agentuse paired with blog-writer.agentuse.learnings.md. That location is no longer read, not as a fallback, not once. Move them:
--all to walk every .agentuse file under the project root.
It copies first and asks before deleting anything. Once the copies are on disk it lists the originals and asks once whether to remove them; anything other than an explicit yes leaves them alone. Deleting files out of your repository is not something a migration should do on its own, so the destructive half is always yours to confirm. --delete-source answers yes up front (for scripts and non-interactive shells, where nothing is ever deleted without it), --keep-source answers no, and --dry-run reports what would be copied without writing anything.
It refuses rather than merges when the destination already holds learnings, and it lists any *.learnings.md with no agent file of that name as orphaned, not migrated. Those are usually left behind by a rename, and this is the only place they are ever mentioned.
If you skip the migration, the agent simply starts with an empty learnings store. Graduated rules are unaffected. The old files sit inert until you delete them, which is itself the point: inert means they stop churning.
A run that finds learnings stranded at the old location says so once, and so do agentuse doctor and the learnings panel in the serve web UI:
How capture works
After a run finishes with an automatic channel configured:- Gather candidates per channel.
customuses the built-in evaluator,agentruns the replacement evaluator, andtool-errorsscans the run’s tool traces in code. Deliberate human learnings are saved immediately by the Learn/--rememberpath rather than inferred here. - Vet the free-form candidates against the complete contract, the rules in force, and the trace. Passes become active, contradictions and failed human corrections are quarantined, and model-authored duplicates and ungrounded claims are rejected.
- Stamp provenance (channel, source session, evidence, and the instruction
hash) and write to the store, enforcing
max(the cap). - Re-vet stored rules the contract has moved out from under: anything stale, and anything with no hash at all, is checked against the current instructions and either re-stamped or quarantined. This is what backfills a pre-v0.19.0 store the first time capture runs after an upgrade.
Deliberate Learning from Review Comments
At an Approval Gate, a comment normally revises the current run and nothing more. Check Learn from this comment when AgentUse should remember the feedback for similar future situations. That explicit choice is what makes the comment durable.learning.apply is enabled.
Explicit human learnings are stored as src:manual and rank ahead of automatic
observations. The CLI equivalent is:
--remember is what you reach for when
you are correcting an earlier note of your own. Left unreconciled, the rule and
its own correction both stay in force, and the agent has to satisfy two
instructions that disagree.
A note can also collide with the agent file itself rather than with another
rule. It is saved either way, but quarantined rather than injected, and the run
says which instruction it conflicts with:
How Application Works
On next run or approval resume (whenapply: true):
- Loads the agent’s active rules from storage, skipping quarantined and stale ones
- Injects the top
maxof them (15 by default) as a## Relevant Learningssection - Counts the injection against each rule’s
injectedCount
## Learned Guidance block. Graduation changes storage and reviewability, not
these contextual semantics.
injectedCount counts cost, not value. It is how many runs a rule was
paid for on, and it is never evidence the rule worked. The effectiveness
signal is approvedRuns (runs the rule was in force for that ended in an
approval with no comment), and that is what
graduation is gated on. The store field was named applied: before v0.19.0 and is read
as an alias; files are rewritten with injected: on the next save.An agent keeps 15 rules, not 15 of many
max is how many rules an agent keeps, not how many of a larger pile get
injected. Capture enforces it when it writes, so the set stays small enough that
every rule in it has been weighed against every other one.
That last part is the reason for the cap, and it matters more than the token
cost. While the store could grow without limit and only the top slice was
injected, nothing ever compared one rule against another. An agent could hold
two corrections that could not both be satisfied - captured weeks apart, from
separate rejections, each perfectly reasonable alone - and nothing would notice.
So when the set is full, a new learning has to be paid for. In order:
- Fold. The evaluator sees every rule the agent already carries, each with its id, and is asked to reconcile rather than merely avoid duplicating. If its new learning restates, sharpens, or contradicts an existing rule, it returns one rule that satisfies both, naming the id it replaces. The replaced rule is retired, not deleted.
- Trade. Nothing related in the set? The weakest auto-extracted rule is retired to make room - but only if the new rule is worth more than the one it displaces, so the set keeps the best rules rather than the last ones.
When a correction does not fit
If the capture model returns a correction without naming a rule to fold it into, and no auto-extracted rule is left to trade away, the correction is kept anyway, outside the cap. It is not dropped - losing a reviewer’s correction because a helper model failed to pick an id would be worse. But a rule outside the cap is never injected, so the run tells you plainly:A store written before the cap was enforced can hold far more than
max. The
first capture after upgrading drains the excess by retiring auto-extracted
rules from the bottom of the ranking - the ones that were not reaching the
model anyway. Nothing is deleted, and rules you wrote or repeated are never
touched, so the drain tends to promote a starved correction into force.Tidying up
When learnings outgrow the cap, or the agent file has been rewritten under them, one action gets them back in order:- re-vet every rule that is stale or was never vetted against the current instructions, re-stamping the ones that still hold and quarantining the ones that no longer do, with the reason
- merge near-duplicates into one rule
- rewrite a learning you have repeated, a repeat means the wording is not landing, so restating it sharply is the fix
- retire what has been superseded. A retired rule is removed, and re-asserting it later simply adds it back
- graduate the learnings that have proven themselves into the agent’s own instructions, where they apply on every run and cost no cap slot
- rewrite the permanent block in your agent file as one document, combining rules that overlap and dropping any another rule now fully states
- Nothing may vanish. Every rule that goes in must come back inside some rule, or be named as dropped with a reason. If one goes missing the whole rewrite is discarded rather than written.
- Nothing may be quietly summarised away. Each rewritten rule is then audited against the originals it claims, and asked what instructions it no longer carries, a case, a threshold, an exception, a worked example. Anything reported missing puts those originals back untouched, and the rest of the rewrite still applies.
agentuse learnings undo ./blog-writer.agentuse or the Undo button, which covers
the re-vet pass along with everything else.
Tidied up 5m ago, see what changed or undo it) for as long as it
is undoable, whether it was run from the browser or the terminal.
When it ends still over the cap
That is a normal ending for a well-used agent, not a failure, so the result says which rule kept each learning that is still in force:“You wrote it by hand” is not on that list, and used to be. A rule you typed
was once exempt from retirement entirely, which sounds protective and is not:
the only thing that can retire one of your rules is a later correction of your
own, and a veto put that out of reach. One agent reached 85 corrections it
could neither apply nor consolidate. Authorship now weighs heavily in the
judgement instead of ending it. What still cannot be retired is a rule you have
repeated, a repeat means the wording is not landing, so it gets sharpened
rather than dropped.
agentuse learnings ./blog-writer.agentuse (a list by status)
or agentuse learnings tidy ./blog-writer.agentuse --dry-run (the plan and both
diffs, nothing written).
What makes a learning permanent
Graduation is earned, not guessed. A learning qualifies when any of:- you repeated it (
re:above zero), saying the same thing twice is the clearest evidence a rule matters, or - it was in force across 3 runs you approved without leaving a comment. Approving with no notes is a vote for every rule that applied that run; a run you commented on credits nothing, because you had to correct something, or
- it has been in force for 10 runs. Surviving that long without ever being contradicted is weaker evidence than the other two, but it is evidence, and without it a rule nobody comments on either way waits forever.
## Relevant Learnings heading, so the two tiers never collide.
Graduation is skipped, and the result says so, when the agent file is not
writable. Nothing else can stop it: there is one learnings file per agent,
so making a rule permanent never affects another agent.
Seeing what capture is doing
“Capture is producing junk” should be measurable, not anecdotal. Three surfaces show the same numbers.agentuse learnings <agent-file> lists every rule by status, grouped:
agentuse doctor <agent-file> adds the per-channel breakdown and the token cost:
legacy in that breakdown is entries captured before channels existed.
The serve UI’s Learnings panel shows the same states with quarantine reasons
inline, and links to the last tidy-up.
Everything is agent-operable: agentuse learnings <agent-file> --json reports
cap, active, injected, dormant, stale, and quarantined counts at the
top level, and each entry carries its full record plus computed state,
injected, and stale flags. agentuse learnings tidy --dry-run prints the
plan without writing. No step in the lifecycle needs a human at a terminal, so a
scheduled maintenance agent can do the cleanup.
Learning Categories
Learnings are categorized for context:- tip - General best practices
- warning - Things to avoid
- pattern - Successful approaches
- tool-usage - How to use specific tools
- error-fix - Solutions to known errors (the
tool-errorschannel always uses this one)
How long a learning should be
A captured rule is written as an order, not an explanation: one behaviour, a few sentences, and under 800 characters. It keeps the specifics that change what the agent does - a threshold, a trigger, an exception, the one example that shows what the rule means - and drops the incident it came from. Dates, session ids, names and quoted complaints are almost never load-bearing. This matters more than it looks. A rule too long to hold beside its peers cannot be compared against them, and comparison is what stops two contradicting rules being in force at once. If a rule needs headings or numbered sections, it is more than one rule.Storage Format
Learnings are stored as readable markdown:src:records who authored it,auto(an evaluator),approval(promoted from a reviewer comment), ormanual(explicitly saved by a reviewer). Files without it load asauto.ch:records the capture channel, one ofcorrections,tool-errors,custom,agent. Absent on entries written before channels existed.ih:is the instruction hash the rule was last vetted against. Absent on entries that predate it; those count as fresh, not stale, until a capture or tidy backfills them.injected:counts injections into a run’s prompt.applied:is the pre-v0.19.0 name and reads as an alias; the file is rewritten withinjected:on the next save.tool:andsig:are thetool-errorsdedupe key, the tool and its normalized failure signature.sess:is the session the rule was captured in.state:graduatedmeans the rule now lives in the agent file and this staged copy is on its way out.state:quarantinedmeans it failed the vet and is never injected; the reason is on the<!-- why: … -->line beneath. Absent means active. Astate:retiredentry in an older file is skipped on read and dropped on the next write, so retired rules do not accumulate.re:counts how many times a human repeated the learning;ok:counts the approved, uncommented runs it was in force for. These are the evidence the tidy-up uses to decide what to rewrite and what to make permanent.<!-- evidence: … -->carries the one-line evidence trail, fortool-errorsthe failed and corrected calls.
<!-- agent: … --> line under the heading is a breadcrumb, so a file sitting in the state directory can be traced back to the agent that wrote it. Nothing reads it back; it is there for you.
Upgrading an existing agent
No migration is needed and no file moves. Existing learnings files load as they are; the first capture or tidy after the upgrade backfills the instruction hash and vets the entries it finds, quarantining rather than deleting anything that no longer holds.undo covers that pass like any other.
The dividing rule for config: hard-error and quit when honoring the key would
resurrect risky behavior or the config contradicts itself; warn once and
continue when the faithful mapping is strictly safer than what you had.
Nothing is ever silently ignored.
If you were relying on free-form capture and want it back, the one-line answer
is a
custom block naming what is worth keeping:
apply: false to stop bad auto-captured rules from reaching
the agent, try turning it back on. The vet is what apply: false was standing
in for, and it discriminates: it drops the junk instead of throwing away the
valid corrections along with it.
Example: Manual Review Workflow
agentuse learnings ./blog-writer.agentuse (a list by status) or agentuse learnings ./blog-writer.agentuse --edit (the file itself):
Best Practices
Start with corrections
The default channel is the one a human authored. Run on it for a while before opening free-form capture with
custom or agentScope free-form capture
When you do enable
custom, say what is worth keeping and what to ignore. An unscoped evaluator finds something every runRead the quarantine
A quarantined rule names the instruction it collided with. That is usually a defect in the agent file worth fixing, not just a bad rule
Tidy after you edit the agent
Rewriting instructions makes rules stale and holds them out of injection.
agentuse learnings tidy re-vets them and graduates the proven onesNext Steps
Store Guide
Persistent data storage for agents
Manager Agents
Orchestrate teams of learning agents