Skip to content
Skills Library
AI & agents · Writing

adev:learn

/adev:learn

Capture a lesson learned as a heuristic in the project's memory store. Use when the user says 'remember this', 'save this lesson', 'learn that...', 'file a heuristic', 'we learned that...', or shares a rule/pattern that should persist across sessions. In Codex, invoke with $adev:learn

Repository
adev-plugin ↗
Licence
MIT
Last repository change
24.10.2026

Assessment and security

90/ 100Class: good
Format15 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Capture a lesson learned as a heuristic in the project's memory store. Use when the user says 'remember this', 'save this lesson', 'learn that...', 'file a heuristic', 'we learned that...', or shares a rule/pattern that should persist across sessions. In Codex, invoke with $adev:learn

Triggers from the description

s memory store. Use when the user sayssave this lessonlearn that...file a heuristicwe learned that...
Original author description

Capture a lesson learned as a heuristic in the project's memory store. Use when the user says 'remember this', 'save this lesson', 'learn that...', 'file a heuristic', 'we learned that...', or shares a rule/pattern that should persist across sessions. In Codex, invoke with $adev:learn

How it works

  1. Arguments
  2. Prerequisites
  3. Step 1: Parse Input
  4. Step 2: Determine Scope
  5. Step 3: Distill the Heuristic
  6. Step 4: Present for Confirmation
  7. Step 5: Write the Heuristic
  8. Step 6: Confirm
  9. List Mode (--list)
  10. Promote/Demote/Archive Modes
Original SKILL.md headings · 227 lines, 1,365 words
SKILL.md preview
---
name: adev:learn
description: "Capture a lesson learned as a heuristic in the project's memory store. Use when the user says 'remember this', 'save this lesson', 'learn that...', 'file a heuristic', 'we learned that...', or shares a rule/pattern that should persist across sessions. In Codex, invoke with $adev:learn"
---

# Capture a Heuristic

Explicit user-driven capture of lessons the automated lifecycle missed. Takes a free-text lesson and distills it into a structured heuristic entry in `.context-index/memory/heuristics/`.

**Announce at start:** "I'm using the /adev:learn skill to capture this lesson as a heuristic."

## Arguments

- *(positional)*: Free-text lesson or rule. Examples:
  - `/adev:learn "always run tests before committing hook changes"`
  - `/adev:learn "the repomap parser chokes on re-exports — use named exports"`
- `--module <module>`: Target module scope (e.g., `hooks`, `cli`). If omitted, infer from context or ask.
- `--anti-pattern <text>`: Explicit counter-rule ("don't do this"). If omitted, attempt to derive one.
- `--list`: List all heuristics, optionally filtered by `--module`.
- `--promote <id>`: Promote a heuristic's confidence one level up.
- `--demote <id>`: Demote a heuristic's confidence one level down.
- `--archive <id> --reason <text>`: Archive a heuristic with a reason.

## Prerequisites

1. `.context-index/` must exist. If not, stop and suggest `/adev:init`.
2. The adev plugin's `lib/heuristics.mjs` must be accessible (it provides the storage API). Derive the plugin root from this skill file's base directory by stripping the `skills/<name>/` suffix. Use `<ADEV_ROOT>/lib/heuristics.mjs` for imports.

## Step 1: Parse Input

If the user provided a positional argument, use it as the raw lesson text.

If no argument was provided, ask:

```
What lesson should I capture? Describe:
- What to do (or what not to do)
- Why (what went wrong or what worked)
```

Wait for the user's response.

**Load Skill Extensions:** Load any skill extension instructions before proceeding:

```bash
adev skill-ext load --skill learn
```

If the output is not `__NONE__`, incorporate it as additional standing instructions that apply to this skill's entire execution. Frame it as: *"The following skill extension instructions apply to this invocation (source: installed domain extensions and/or project-level overrides)."* If the output is `__NONE__`, continue normally.

## Step 2: Determine Scope

The scope maps to a module slug from `manifest.yaml`. Heuristics scoped to a module are injected into agent context when working on that module.

**If `--module` was provided**, validate it exists as a module in the manifest or use `_global`. Proceed.

**If no scope**, infer from the lesson text:
1. Check if the lesson mentions a module name, skill name, or file path that maps to a manifest module.
2. If a clear match is found, propose it:
   ```
   This seems related to the **hooks** module. Use that scope? (yes / different / global)
   ```
3. If no match, ask:
   ```
   Which module does this apply to?
   1. hooks
   2. cli
   3. implementation
   ...
   N. Global (applies to all modules)
   ```

## Step 3: Distill the Heuristic

Transform the raw lesson into the structured heuristic format. This is the critical step — the goal is to **generalize** the lesson so it's useful in future contexts, not to record a specific incident.

**Generate these fields:**

| Field | How to derive |
|-------|---------------|
| `title` | Short imperative summary (max 120 chars). e.g., "Verify hook JSON contract after edits" |
| `pattern` | The "do this" rule (max 500 chars). Write as a concrete instruction an agent can follow. |
| `anti-pattern` | The "don't do this" counter-rule (max 500 chars). Derive from the lesson's failure case, or from `--anti-pattern` if provided. |
| `id` | Safe-slug derived from the title: lowercase, kebab-case, max 64 chars. e.g., `verify-hook-json-after-edits` |
| `confidence` | Start at `medium` for first-time lessons. If the lesson is a guess not yet confirmed by a concrete failure, or the user signals low certainty, use `low` instead. If the user says "this has happened multiple times" or "we keep hitting this", use `high`. |

**Redaction check:** Ensure the pattern and anti-pattern do NOT contain:
- Credentials, tokens, API keys
- PII (names, emails, IPs)
- Literal file contents that should be linked instead

If any are detected, redact and link to evidence instead.

## Step 4: Present for Confirmation

Show the user the proposed heuristic before writing:

```
Proposed heuristic:

  Scope:        hooks
  ID:           verify-hook-json-after-edits
  Title:        Verify hook JSON contract after edits
  Pattern:      After editing any hook script or hooks.json, run the hook
                test suite to confirm the stdin/stdout JSON contract is intact.
  Anti-pattern: Assume a hook edit is correct based on a manual dry-run alone.
  Confidence:   medium

Save this? (yes / edit / cancel)
```

- **yes**: Proceed to write.
- **edit**: Ask which field to change, apply the edit, re-present.
- **cancel**: Abort without writing.

**Terse form:** Renders the scope, id, title, and confidence lines, the pattern and anti-pattern text in full, and the "Save this? (yes / edit / cancel)" prompt — no heuristic is written yet, so no artifact path exists to substitute for them.

## Step 5: Write the Heuristic

Construct the heuristic entry object:

```javascript
{
  id: "<generated-id>",
  scope: "<scope>",
  title: "<title>",
  pattern: "<pattern>",
  antiPattern: "<anti-pattern>",
  confidence: "medium",
  evidence: [{
    path: "<current-session-file-or-conversation-ref>",
    date: "<today YYYY-MM-DD>",
    source: "learn"
  }],
  contradictedBy: [],
  created: "<today YYYY-MM-DD>",
  updated: "<today YYYY-MM-DD>"
}
```

Write the entry to `.context-index/memory/heuristics/<scope>.md` using the YAML frontmatter format documented in `_format.md`. If the scope file doesn't exist yet, create it with a heading.

**File format:**

```markdown
# Heuristics: <scope>

---
id: <id>
scope: <scope>
title: <title>
pattern: <pattern>
anti-pattern: <anti-pattern>
confidence: medium
evidence:
  - path: <evidence-path>
    date: <today>
    source: learn
contradicted-by: []
created: <today>
updated: <today>
---
```

If the file already exists with other entries, append the new frontmatter block after the last existing block.

**Duplicate check:** Before writing, read existing heuristics for the scope. If an entry with a similar title or pattern exists (fuzzy match), offer to update it instead:

```
Similar heuristic already exists:

  ID:    existing-hook-validation
  Title: Run hook tests after changes

  Options:
  1. Update existing (add evidence, merge patterns)
  2. Create new anyway (different enough)
  3. Cancel
```

## Step 6: Confirm

```
Saved heuristic: <id> (scope: <scope>, confidence: medium)

This lesson will be surfaced when agents work on the <scope> module
via /adev:implement, /adev:plan, and /adev:debug.

To strengthen it: /adev:learn --promote <id>
To remove it:     /adev:learn --archive <id> --reason "no longer relevant"
```

**Terse form:** Renders the saved id, scope, and confidence, and the two follow-on invocations (`/adev:learn --promote <id>`, `/adev:learn --archive <id> --reason "…"`). Substitutes the surfacing-context sentence with the repo-relative store path `.context-index/memory/heuristics/<scope>.md`, which now holds the full record.

## List Mode (`--list`)

When `--list` is provided:

1. Read all heuristics using the store API.
2. If `--module` is provided, filter to that scope.
3. Display as a table. **Persona adaptation:** Adapt the display to the active persona's output rules. Verbosity is resolved separately across `templates/verbosity/terse.md`, `templates/verbosity/normal.md`, and `templates/verbosity/deep.md`: when the resolved verbosity is terse and this section carries a `**Terse form:**` block, that block is the section's declared rendering at terse verbosity. See `skills/status/SKILL.md:12` for the full terse-form marker grammar and table-substitution recipe.

```
Heuristics (scope: hooks)

| ID | Title | Confidence | Evidence | Updated |
|----|-------|------------|----------|---------|
| verify-hook-json-after-edits | Verify hook JSON contract after edits | low | 1 | 2026-04-13 |
| always-test-exit-codes | Always test exit codes in hooks | high | 4 | 2026-04-10 |

Total: 2 heuristics (1 high, 0 medium, 1 low)
```

**Terse form:** Renders the heuristics table narrowed to id, title, and confidence, and the totals line. Substitutes the Evidence and Updated columns with a count of heuristics and `/adev:learn --list --module <scope>` for the narrower listing that carries per-entry evidence and update dates.

## Promote/Demote/Archive Modes

**`--promote <id>`**: Read the heuristic, bump confidence one level, write back. Report the change.

**`--demote <id>`**: Read the heuristic, lower confidence one level. If already `low`, offer to archive instead.

**`--archive <id> --reason <text>`**: Move the entry to `archive/<scope>-<id>.md`. Require a reason.

## Key Principles

- **Generalize, don't record.** The lesson should be useful in future contexts, not just describe what happened today.
- **One lesson per heuristic.** If the user describes multiple lessons, file each separately.
- **Medium confidence by default.** A single data point isn't enough for high confidence, but a first-time lesson is more than a guess — start at `medium`, not `low`. The store auto-promotes as evidence accumulates.
- **Always confirm before writing.** Never silently create a heuristic.
- **Source is always `learn`.** This distinguishes user-captured heuristics from auto-extracted ones.
Files in this package (2)
  • SKILL.md 10 KB
  • agents/openai.yaml 1 KB

Versions

The database has no other skills named adev:learn.

Identical content appears in 2 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version e810ec955e6f (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100using-adev
    Gateway skill for the Agentic Development Framework. Injected at session start to establish methodology, available skills, and context routing; also answers on-demand questions during a session. Use when the user asks 'what skills are available', 'how does adev work', 'what is…
  • 90adev:work
    The single front door to adev. Classifies incoming work, reads in-progress project state, routes to the right lifecycle skill, and can drive the whole lifecycle end-to-end so the user never has to pick another command. Use whenever the user is unsure which skill to use, wants to…
  • 100pattern-learn
    Use when the user wants to extract a reusable pattern from recent work and store it for future use. "Save this as a pattern", "remember this approach", "learn from this commit".
  • 100whip-lesson-learn
    Create a real-world whip case-study or lessons-learned markdown file under .whip/lesson-learn/<file-name>.md. Use when the user wants to capture an actual whip run, prompts, decisions, IRC coordination, outcomes, or lessons learned.
  • 100whip-lesson-learn
    Create a real-world whip case-study or lessons-learned markdown file under .whip/lesson-learn/<file-name>.md. Use when the user wants to capture an actual whip run, prompts, decisions, IRC coordination, outcomes, or lessons learned. Prefer the explicitly requested language;…
  • 95learn
    Save a hard-won lesson or surprising fix so future sessions benefit. Boundary: learn records facts/gotchas; distill produces reusable multi-step procedures from conversation history. Use when: "save this to knowledge", "record this", "remember for next time", "/learn", "記下來",…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.