Session learn extractor

From CarlosCaPe/octorato · View interactive version

Session learn extractor is an AI agent skill from the GitHub repository CarlosCaPe/octorato. Extracts the reusable pattern from the session and writes it as a DRAFT skill in skills/learned/. Triggers after 'ya quedo', 'fixed', 'shipped', 'merged' on something that took several investigation steps, or via /learn.

How to use this skill

Skill file

Session Learn Extractor — Pattern Capture After the Fact

Why this exists

Without it: every hard-won lesson dies in the session transcript. The next time it surfaces, the operator solves it again from scratch. Memories help (we have them) but they capture facts; skills capture reusable PROCEDURES.

With it: the moment a non-trivial problem closes, you draft a candidate skill. The operator skims, promotes the good ones, drops the noise. Brain compounds.

ECC ships this as /learn + /skill-create + an instinct system w/ confidence scoring. We adopt the simpler /learn half — the instinct layer is duplicative with our existing memories.

When to fire

Auto-trigger when ALL of these hold in the current session:

  1. The operator just expressed closure ("ya quedó", "done", "fixed", "shipped", "merged", "live", "✓").
  2. The session involved at least one of:
  1. There is NO existing brain skill that already covers the same procedure (quick connectome check: python3 ~/.claude/scripts/query_connectome.py query "<problem keywords>" — if MATCH ≥ 0.5, SKIP).

Manual trigger via /learn slash command — operator-initiated whenever they feel a pattern is worth keeping.

Don't fire when

How it works (workflow)

1. Extract the kernel

Re-read the last N (≈10-30) tool calls of the session. Identify:

2. Draft the skill

Write to ~/.claude/skills/learned/<kebab-slug>/SKILL.md with frontmatter + body:

---
name: <kebab-slug>
description: <when to use it; 1-2 sentences ending with the trigger condition>
metadata:
  type: lesson-learned
  status: draft
  captured: <YYYY-MM-DD>
  origin: session-learn-extractor (auto) | session-learn-extractor (manual /learn)
---

# <Title>

## Symptom
<what you'd observe in a future session>

## Root cause
<the actual underlying issue>

## Fix
<the specific commands/changes>

## How to recognize next time
<the diagnostic signal: an error string, a log pattern, a tool output shape>

## See also
- [[related-skill-or-memory]] (if any)

3. Hand off, don't auto-promote

DO NOT auto-move drafts from learned/ to top-level skills/. Operator reviews + promotes via:

mv ~/.claude/skills/learned/<slug> ~/.claude/skills/<slug>
# then edit metadata.status: draft → active, drop the 'captured' field
# ai-push

This keeps the brain's skills/ surface curated; learned/ is the staging area.

Output format (verbal report after writing the draft)

Single compact summary:

📝 Captured: <slug> — drafted at ~/.claude/skills/learned/<slug>/SKILL.md
   Why: <1-line — what made this non-trivial>
   Promote: mv ~/.claude/skills/learned/<slug> ~/.claude/skills/<slug>

Operator sees this once per closure event; never spam.

Anti-patterns (don't do these)

See also

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.