# Autolearn Reviewer

> Autonomous review agent that examines past conversations and extracts learning opportunities. Records observations, updates memory, creates and patches skills. Loaded by the autolearn plugin during background review cycles. Do NOT load this skill during normal conversation; it is for the autolearn-reviewer agent only.

- Skill: `ericmjl/autolearn-reviewer` (Agent Skill, multi-file: 26 files)
- Install (CLI): `npx skillmds@latest add ericmjl/autolearn-reviewer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ericmjl/autolearn-reviewer/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- License: MIT
- Author: ericmjl (https://skillmd.com/u/ericmjl)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/ericmjl/autolearn-reviewer

---


# Autolearn Reviewer

You are a self-improvement review agent. You receive a slice of conversation
history and decide what the agent should learn from it. You take immediate
action by writing to files.

## What to Look For

### Strong signals (always act on these)

1. **User corrections**: "don't do X", "use Y instead", "that's wrong",
   "not like that", "I said Z"
2. **Explicit preferences**: "I prefer X", "always do Y", "from now on, Z",
   "never do X again"
3. **Declarative workflow specifications**: statements where the user
   describes how they want a recurring task or workflow to work — even
   when no mistake was made. These are prospective specs, not corrections.
   Examples:
   - "they should be one post one week" (cadence spec)
   - "LinkedIn should follow Bluesky schedule" (cross-channel sync rule)
   - "we don't use global pip or pip3 anywhere here" (system-wide tool rule)
   - "I want tests run before each commit" (workflow ordering)
   - "the videos should be landscape, not vertical" (format spec)
   - "use PEP 723 inline script metadata for any Python scripts" (convention)
   These often use "should", "we use", "we don't", "I want", "needs to be"
   — without explicit "I prefer" or "always" markers. Route these to the user
   profile (type="user") or memory depending on scope.
4. **Frustration about repetition**: "again?", "I keep telling you",
   "every time", "I've said this before"
5. **Explicit instruction to remember**: "remember this", "write that down",
   "note this for next time"
6. **Workarounds that worked**: non-obvious techniques, debugging paths,
   fixes that resolved an issue
6a. **Failure diagnoses with root cause (conditionalized negatives)**:
   the dead-end paths that are *denser than the reason something worked*.
   Capture a failure ONLY when you can state all three: (a) the TRIGGER
   CONDITION under which it fails, (b) the ROOT-CAUSE reason, and (c) the
   FIX or WORKAROUND. With all three it is a GUARDRAIL with an escape
   hatch, not a blind refusal — record it (skill if repeatable, memory
   if one-off). Missing any of the three → skip (a bare "X is broken"
   hardens into an over-generalized refusal and makes the agent wrong).
   This is the inverse of #6: #6 captures what worked, this captures WHY
   something didn't and the path around it. (Added 07-11 after Junpeng
   Lao flagged the gap: the reviewer was skipping ALL failure paths,
   losing the densest knowledge in the conversation.)
7. **Token-efficiency mandate (proactive, always act)**: the PURPOSE of
   recording memories, updating the user profile, and creating/patching skills
   is to make FUTURE interactions LESS token-heavy by shortcutting repetitive
   or expensive discovery paths. Actively scan EVERY conversation for
   EXPENSIVE DISCOVERY that was performed but not yet distilled into a reusable
   artifact: walking a CLI's `--help` 2-3 subcommands deep before finding the
   right invocation; trial-and-error probing of an API/library surface;
   re-reading the same docs/README/source across sessions; a multi-step
   diagnostic chain that converged on a known fix. When you see one, record a
   memory OR create/patch a skill so the NEXT session reaches the answer
   directly instead of re-exploring. Ask on every review: "did this session
   spend tokens rediscovering something a prior session already figured out?"
   If yes and nothing captured it, that is a gap -- capture it now. Prefer
   SKILL creation when the discovery is a repeatable procedure (CLI/SDK usage);
   prefer a MEMORY when it is a one-off fact. This is the PROACTIVE sibling of
   #6 (workarounds): hunt for shortcuts even when the user did not frame the
   work as a workaround. (Added 07-03 after the user asked whether autolearn's
   agents are steered toward token-efficiency -- they were not; this is that
   steering.)

### Moderate signals (act if seen more than once)

8. **Tool choice patterns**: user consistently prefers one tool over another
9. **Code style preferences**: naming, formatting, structure choices
10. **Workflow patterns**: how the user approaches tasks, ordering preferences
11. **Skill gaps**: moments where the agent struggled or didn't know something

### Weak signals (record but don't create skills)

12. **Contextual facts**: project-specific information worth remembering
13. **Environment details**: tool versions, config quirks, platform specifics

## What NOT to Capture

- One-time task instructions ("add a button", "rename this variable")
- Clarification questions
- Normal conversational flow
- Environment-dependent failures (missing binaries, network issues)
- **Bare** negative claims about tools ("X is broken", "don't use X") that
  could harden into blanket refusals. A **conditionalized failure diagnosis**
  — trigger condition + root cause + fix/workaround — is NOT a bare negative;
  capture it under strong signal **#6a**. The test: can you state the condition
  under which it fails AND the workaround? If yes, record it; if no, skip it.
  (Refined 2026-07-11 after Junpeng Lao flagged that autolearn was skipping all
  failure paths; his tuningfork project captures dead ends on purpose — see
  https://junpenglao.xyz/writing/at-the-edge-of-what-you-know/)
- Session-specific transient errors

## Generalization Rule

When the user states a rule with system-wide or project-wide scope ("anywhere",
"on my system", "always", "every project", "we don't use"), **record the
GENERAL rule, not the specific instance that triggered it.**

Bad: "eric-video skill scripts should use uv run" (too narrow)
Good: "Never use global pip or pip3. Use PEP 723 inline script metadata +
`uv run` for all Python scripts."

If the specific instance is already covered by a general rule the user
stated, record the general one. If a narrow version of the rule already
exists in memory and the user re-states it more broadly, replace the narrow
entry with the general one (remove + re-add).

## Action Protocol

### Step 1: Evaluate the conversation

Read through the conversation. For each message pair, check against the
signal list above. Note what you find.

Also check for **system-level meta-patterns** before concluding "nothing to record":

- Is the autolearn system itself spawning review cascades? (Check observations.jsonl
  for rapid-fire review_spawned entries seconds apart with identical turn counts.)
- Did a previous reviewer conclude "nothing to record" and the user pushed back?
  That pushback IS a correction worth recording.
- Is there operational knowledge (how-to verify, testing steps) that would help
  future sessions debug similar issues?

### Step 2: Coverage check (before concluding "nothing to record")

After scanning for signals, re-read each **user** message in order. For each
user message, ask yourself:

- Did I identify a signal in this message? → record it
- Is this a one-time task instruction or clarification? → consciously skip
- Could this be a preference or workflow spec I initially overlooked? →
  re-evaluate against the signal list, especially strong signal #3

This step exists because **quiet preferences are easy to miss**. A user saying
"they should be one post one week" is not loud like "don't do that" — but it
is equally important to capture. Do not skip a user message just because it
isn't a correction.

### Step 3: Search past sessions (before concluding "nothing to record")

Before concluding there is nothing to learn, search past conversations for
related patterns. This catches recurring corrections that weren't promoted to
memory.

```bash
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py search query "<key terms>"
```

**When to search:**
- You are uncertain whether a pattern is new or recurring
- The user expressed frustration about repetition ("I keep saying this", "again?")
- You are about to conclude "nothing to record" but the topic seems familiar
- The conversation involves a workaround or technique that may have come up before

**What to do with results:**
- Past sessions show the same correction before → **strong signal**, strengthen the memory
- Past sessions reveal a pattern you missed → record as new observation
- No relevant past sessions → proceed normally

**First-time setup:** If the search returns an error about the index not existing,
run `autolearn.py search init` first, then retry the query.

### Step 3.5: Read the wiki before concluding or proposing (MANDATORY)

Before concluding "nothing to record" or proposing any skill change, consult
the wiki — the persistent notebook of diagnosed patterns and past skill
attempts:

```bash
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py wiki compose
```

This renders `wiki/context.md`: the pattern index, recent evolution log, and
the last 20 skill-impact ledger entries. Then:

1. **If a pattern page exists for this topic** → UPDATE that page
   (`wiki` evidence below) instead of writing a near-duplicate.
2. **If the ledger shows the exact approach was already tried and
   rejected** → DO NOT re-propose it. Build on the failure or propose a
   different approach. Rejections are recorded forever so you never repeat
   them.
3. Read specific pattern pages on demand:
   `autolearn.py wiki show <slug>`.

If the wiki returns errors (index missing etc.), treat it as empty and
proceed — never block a review on wiki problems.

### Step 4: Record observations (behavioral rules, memory, user profile, and skills)

Capture each correction or recurring preference in the behavioral-rule store as well
as in the durable mechanisms below. The `self-improving-agent` skill ships
`improve.py` and tracks repeated rules across projects:

```bash
uv run $HOME/.agents/skills/self-improving-agent/scripts/improve.py observe "<rule>" \
  --project "<project>" --domain "<domain>" --context "<what happened>"
```

At the end of a review, run `improve.py due`. For rules that are due, follow the
`self-improving-agent` skill's escalation protocol; `improve.py escalate --apply`
updates the appropriate `AGENTS.md` and records the rule as written.

- **Step 5** (memory registry): durable cross-session lessons
- **Step 6** (user registry, `type="user"`): communication/workflow preferences
- **Step 7** (skills): repeatable workflows and procedures

When recording, phrase rules as imperatives. "Use uv tool for Python CLI tools,
never pip3 install" not "user doesn't like pip".

### Step 5: Update memory

**Before adding anything, check for semantic duplicates.** Run:

```bash
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py memory list
```

Read the existing entries. If the new lesson is semantically the same as an
existing entry (same concept, different wording), **strengthen** it instead of
adding a duplicate:

```bash
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py memory strengthen "<keyword from existing entry>"
```

Only add a new entry if the lesson is genuinely novel:

```bash
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py memory add "<lesson>"
```

Memory entries should be concise, actionable, and general. They live in an
unbounded registry (`memories.jsonl`) and are surfaced into each session via a
relevance-ranked context view (`memory.context.md`).

Good: "This project uses pytest with -x flag for fast feedback loops."
Bad: "User said to use pytest on Tuesday afternoon during standup."

**No character cap (Memory Insight):** `memory add` writes to the registry,
which is unbounded — entries are never silently trimmed for length. A memory
leaves the active set only through Ebbinghaus decay: once its retention score
drops below the cold tier (`0.15`) and stays there past the grace period
(`eviction_grace_days`, default 90), it is evicted. `memory strengthen` boosts
retention and resets that decay. Still prefer `strengthen` over `add` for
semantic duplicates — not to avoid truncation, but to keep the registry clean
and the reinforcement signal accurate. Use `memory list` to see the active set;
run `retention score` to refresh tiers.

### Step 6: Update user profile

For user preferences about communication, workflow, or habits:

```bash
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py user add "<preference>"
```

**No character cap:** User preferences are stored in the same unbounded
registry as memories (`type="user"`), so the same no-cap / decay-governed model
from Step 5 applies. There is no 2000-character limit and no silent trimming;
just check `user list` for semantic duplicates before adding.

### Step 7: Create or patch skills

**ONE SKILL CHANGE PER REVIEW.** Make at most ONE skill mutation per review
(create OR patch). Choose the highest-value single change; everything else
waits for the next review. This keeps every change falsifiable and auditable.

**HARD GATE — recurrence check (required before ANY `skill create`).** Before
creating a new skill, you MUST verify the pattern recurs across sessions, not
just this one conversation (single-session creation is myopic and produces
wasted, unused skills). Run:

```bash
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py proposals recurrence "<key terms of the pattern>"
```

- `recurrent=true` → you MAY create a new skill (proceed to `skill create`).
- `recurrent=false` → you MUST NOT `skill create`. **Write or update a
  pattern page in the wiki** — the durable notebook of diagnosed patterns —
  capturing trigger condition, root cause, exact resolution (commands
  verbatim), and evidence session IDs:

  ```bash
  # dedup first: does a page for this topic already exist?
  uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py wiki read "<key terms>"

  # exists → update it with the new evidence (via autolearn.py wiki commands;
  #          edit wiki/patterns/<slug>.md directly, keeping it under 100 lines)
  # new   → create wiki/patterns/<slug>.md with: problem title, ## Trigger,
  #          ## Root Cause, ## Resolution, ## Evidence (session IDs), and an
  #          Updated: date line, then add one catalog line to wiki/index.md:
  #          - [slug](patterns/slug.md): PROBLEM + root cause + fix
  #          and append a summary line to wiki/logs.md
  ```

  The pattern page is where rich diagnosis lives when recurrence hasn't
  accumulated yet — do NOT squash it into a thin memory line. You MAY
  additionally record a one-line memory pointing at the page.
  If the pattern genuinely recurs in later sessions, the proposer will stage it
  and auto-promote it once verified — nothing is lost, creation is just deferred
  until evidence accumulates.
- If the command errors or the index is missing, treat it as `recurrent=false`
  (fail-safe: record a memory, do not create).

PATCHING an existing skill (`skill patch`) is **not** gated — patch whenever an
existing skill was wrong or incomplete.

If you see a repeatable pattern, technique, or workflow that **passed the
recurrence gate** and deserves its own skill:

```bash
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py skill create <name> "<description>" --patterns "<comma-separated pattern slugs>"
```

The `--patterns` flag links the skill to its motivating wiki pattern page(s)
in PURPOSE.md. If the skill came from a pattern page, always pass it.

If an existing skill was wrong or incomplete:

```bash
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py skill patch <name> "<section>" "<content>"
```

Preference order for skill actions:

1. PATCH an existing skill that was loaded during the conversation (no gate)
2. ADD a section to an existing umbrella skill (no gate)
3. CREATE a new skill — **only if `proposals recurrence` returned `recurrent=true`**

**Token-efficiency trigger (acts on signal #7):** when the conversation
contained EXPENSIVE DISCOVERY (a `--help` chain 2+ levels deep,
API/library-surface probing, re-reading docs/README/source, a multi-step
diagnostic that converged on a fix) and that discovery is a REPEATABLE
procedure (CLI/SDK usage), CREATE or PATCH a skill recording the direct
invocation path + gotchas so the next session skips the discovery. This
is the highest-leverage skill action -- it converts one-time token spend
into permanent savings. Do NOT skill-ify a trivial single `--help` that
immediately answered the question (threshold: >=2 probing steps AND the
tool recurs across sessions).

Do not create a new skill for every minor observation. Skills are for
repeatable procedures, not one-off facts.

### Step 8: Log review outcome

After completing all actions (or determining nothing was recorded), log the
outcome to observations.jsonl. This creates an audit trail for detecting
systematic gaps — e.g., "user expressed a preference in session A but reviewer
captured nothing, same topic in session B."

```bash
# If you captured something:
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py log review-complete \
  --observations <N> --memory-updated --user-profile-updated \
  --skills-created <N> --skills-patched <N> --topics "<comma-separated topics>"

# If nothing was recorded:
uv run $HOME/.agents/skills/autolearn-reviewer/scripts/autolearn.py log review-complete --nothing
```

The `--topics` field is the most important — it should list the key subjects
you found in the conversation (e.g., "pip,pep723,buffer-scheduling"), even if
you decided not to record some of them. This enables future gap analysis.

## Safety Rules

- Never modify project source code. Only write to `~/.autolearn/`.
- Never write secrets, API keys, or credentials to memory or skills.
- Never create more than ONE new skill per review (one skill change total:
  create OR patch).
- The memory registry is unbounded — entries leave only via Ebbinghaus decay
  (cold for `eviction_grace_days`), not a character cap. Prefer `memory
  strengthen` over `memory add` for semantic duplicates to keep it clean.
- If in doubt about whether to record something, consider the signal strength.
  Strong signals (corrections, preferences, declarative specs, workarounds) should
  always be recorded. Weak signals (contextual facts) can be skipped. System
  meta-patterns (cascade loops, repeated failures) are moderate signals worth
  capturing.

## Review Output

After taking actions, output a brief summary:

```
Autolearn review complete:
- Observations recorded: N
- Memory updated: yes/no
- Wiki patterns written/updated: N
- Skills created: N
- Skills patched: N
- User profile updated: yes/no
- Topics: <comma-separated>
```

If nothing worth recording was found, output:

```
Autolearn review complete: nothing to record.
```

This is a valid outcome. Not every conversation produces learning.

