# Self-Learning Agent: Sessions to Tested Skills & Memory

> Your agent learns from its own sessions. Repeated work becomes skills tested on a session the draft never saw, your corrections reach every memory note, and stale skills are retired. Local, zero dependencies, runs on your Claude Code subscription (no API key).

Self-Learning Agent: Sessions to Tested Skills & Memory is a paid AI agent skill on Agensi by Leandro Maia, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $45 (one-time purchase)
- Creator: [Leandro Maia](https://www.agensi.io/creators/leandro-maia)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Version: 1.0
- Last updated: 2026-11-25
- Security: scan passed (2026-11-25); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/self-learning-agent-sessions-to-tested-skills-memory
- Tags: ai-agents, claude-code, automation, productivity, llm-ops, agent-memory, self-improving

## About this skill

Turn the work your agent keeps repeating into skills that are proven on real sessions, and keep its memory true, automatically.

### The problem
Agents forget. You explain the same deploy trap every few weeks. A skill you wrote last month still names a path that changed. Memory notes pile up as duplicates that contradict each other. Most skill tools only help you write a skill you already know you need. They never tell you which skills should exist, prove that a skill works, or keep it correct afterwards.

### What it does
- **Finds what deserves a skill.** It reads your finished Claude Code (and Codex) sessions and notes repeated tasks, traps that led to the right path, and your corrections about how to do things.
- **Sets a real bar.** A skill is created only after 3+ sessions across 2+ different weeks, and only when no existing skill already covers it.
- **Tests on held-out work.** The draft is written from older sessions, then tested on real ones, including the newest session, which it never saw. It ships only if it solves every case.
- **Maintains what it built.** Skills that fail in use get minimal fixes, overlapping skills are merged, and skills unused for 60 days are archived.
- **Keeps memory true.** Correct a fact once and every memory note and skill that still says the old thing is fixed, with the old value kept as dated history. Duplicate notes are merged weekly, and contradictions come to you instead of being guessed.
- **Is safe by design.** It never deletes anything (backups plus `_archive/`). Secrets are redacted and new text is scanned for prompt injection before anything is written. The model gets no tools, edits only touch files under review, and `--dry` writes nothing.

### Why this beats prompting it yourself
Asking an agent to "make skills from my history" gives you a snapshot: whatever stood out in one pass, with no proof it works and nobody looking after it next month. This is a loop. It waits for evidence across weeks, tests every draft against sessions it did not learn from, and keeps working after install: it tracks uses and failures, fixes and merges skills, and retires what goes stale. You end up with fewer skills, and each one has solved real past cases.

### Use cases
- Build a personal skill library from the work you actually repeat, not from what you remember.
- Stop re-explaining corrections: one correction updates every note and skill.
- Keep a team's shared skills folder from rotting as tools, paths and versions change.
- Run it on a schedule (cron, Task Scheduler or a SessionEnd hook) and read a weekly report: created, improved, merged, retired, plus "Needs you".

### How to use
1. `node scripts/learn.js all --dry`: see what it would do, with nothing written.
2. `node scripts/learn.js all`: real run. Or just ask your agent to "learn from our sessions".
3. `node scripts/learn.js status`: candidates being watched, skill usage, last runs.

### Known limitations
- It needs history. Expect the first skills after 2 to 3 weeks of regular use; the bar is deliberate.
- Model calls use your Claude Code subscription. A first run over a large backlog is read in chunks (`--limit`).
- The secret and injection scan is a regex safety net, not a guarantee. Read the weekly report.
- It learns only from history saved on local disk.

Built and run in production at Veriddan AI Studio since October 2026.

## Requires

- Node.js 18+
- Claude Code CLI (logged in)

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Self-Learning Agent: Sessions to Tested Skills & Memory skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What do I get?

The full skill folder: SKILL.md plus five zero-dependency Node.js scripts (observe, curate, memory audit, weekly cleanup, CLI). Install it in ~/.claude/skills and ask your agent to "learn from our sessions", or run learn.js on a schedule.

### Does it need an API key or cost per use?

No. Every model call goes through the claude CLI on your existing Claude Code subscription. Nothing else is paid and nothing runs on a server.

### How is this different from tools that mine my history once?

A one-off miner gives you a snapshot. This is a loop with a bar: a skill needs 3+ sessions in 2+ different weeks, is tested on real sessions including one the draft never saw, and is maintained afterwards (fixed when it fails, merged, retired when unused). It also keeps your memory notes true.

### Will it change or delete my files?

It never deletes. Every change keeps the previous version in backups, retired or merged items move to _archive, edits only touch files under review, and --dry previews a full run writing nothing.

### Is my data safe?

Everything runs locally. Secrets are redacted before anything is stored, new text is scanned for prompt injection and destructive commands, and nothing leaves your machine except the model calls your Claude Code already makes.

### Which agents and systems does it support?

It learns from Claude Code and Codex CLI session files and writes standard SKILL.md skills. Works on Windows, macOS and Linux with Node.js 18+.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
