moradin-learn-from-sessions

moradin-learn-from-sessions is a skill for Claude Code from CloseTheLoops/moradin. It costs 36 tokens per session (919 once invoked), scanned A, original, MIT.

A one-time tool for reviewing past Claude Code sessions to find repeated user preferences, corrections, and lessons. It presents possible memories for review instead of saving them automatically.

In plain words
What is it for?
Scanning session history, extracting likely preferences, and preparing them as candidates that an operator can approve or reject.
Why use it?
It reduces the need to restate working preferences that have appeared across many earlier sessions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument; mentions Claude Code.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python scripts/extract_preferences.py --since 180 --min-count 5 --min-sessions 3.

Part of the moradin plugin — 14 skills shipped together

Good fit Scanning session history, extracting likely preferences, and preparing them as candidates that an operator can approve or reject.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/CloseTheLoops/moradin
agentmods
npx agentmods add skills/closetheloops/moradin/learn-from-sessions

Made for: Claude Code.

Or install moradin, the plugin that ships this one along with the rest of its 14 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for moradin-learn-from-sessions

README.md
[![agentmods](https://agentmods.dev/badge/skills/closetheloops/moradin/learn-from-sessions/github.svg)](https://agentmods.dev/skills/closetheloops/moradin/learn-from-sessions)
Your own site
<a href="https://agentmods.dev/skills/closetheloops/moradin/learn-from-sessions"><img src="https://agentmods.dev/badge/skills/closetheloops/moradin/learn-from-sessions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for moradin-learn-from-sessions

Your own site · 80×15
<a href="https://agentmods.dev/skills/closetheloops/moradin/learn-from-sessions"><img src="https://agentmods.dev/badge/skills/closetheloops/moradin/learn-from-sessions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 919 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00036 $0.00919
Opus 5 $0.00018 $0.00460
Sonnet 5 $0.00007 $0.00184
Haiku 4.5 $0.00004 $0.00092

Measured 8d ago against content hash 6524140f863b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

moradin-learn-from-sessions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/learn-from-sessions/SKILL.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

moradin:learn-from-sessions

Mine your accumulated Claude Code session history for implicit preferences. Surfaces candidates for review; operator decides what becomes memory.

When to invoke

/moradin:learn-from-sessions [--since 180d] [--project <name>]

Best run ONCE at first-time setup, then again periodically (monthly or quarterly) to catch new patterns. For per-session incremental capture, use /moradin:ship after each session.

What you do

  1. Set up. Confirm ANTHROPIC_API_KEY is in env. If not, ask operator to set it or use --local-only mode.

  2. Discover sessions. Run scripts/session_scanner.py --since 180 --count-only to show operator how many sessions/turns will be scanned.

  3. Estimate cost. Roughly $0.001 per turn for pre-filter + $0.01 per extracted candidate. For ~10k turns: typically $8-15.

  4. Confirm with operator before running the expensive extraction.

  5. Run extraction.

    python scripts/extract_preferences.py --since 180 --min-count 5 --min-sessions 3
    

    This:

    • Scans matching JSONL files
    • Pre-filters with regex (corrections / preferences / lessons signal patterns)
    • Classifies filtered turns with Haiku (cheap)
    • Extracts structured candidates with Sonnet (strong)
    • Clusters similar candidates
    • Applies stability thresholds (count ≥ 5, sessions ≥ 3, confidence ≥ 0.6)
    • Writes review file to scratch/proposed_<date>.md
  6. Surface results to operator. Read the proposed file, summarize:

    • Total candidates that passed stability
    • Top 5 by occurrence count
    • Distribution: how many principle / preference / lesson candidates
  7. Walk operator through review (optional). For each candidate ask:

    • ACCEPT → write to memory/preferences/<title>.md (or principles/ or lessons/ based on category)
    • EDIT → rewrite statement, then accept
    • REJECT → skip
  8. After approval session. Run python scripts/refresh_indexes.py to update _INDEX.md files. Delete the review file.

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 80 lines · 36 tokens per session scan A 6524140f863b

Subscribe to this mod's changes

moradin-learn-from-sessions is a skill published in the GitHub repository CloseTheLoops/moradin (2 stars, last pushed 1mo ago), licensed MIT. It adds 36 tokens to every session and 919 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

context-manager

Use when a long-running agent task needs context budgeting, checkpointing, compaction, retrieval, or capability-based model routing.

Mark393295827/third-brain-v7-skills · 28 tokens

knowledge-ops

Use when an Obsidian knowledge system needs classification, deduplication, retrieval, synchronization, debt queues, or governed Agent/Wiki promotion.

Mark393295827/third-brain-v7-skills · 33 tokens

session-learn

Use when a completed work session should yield durable concepts, corrections, decisions, reusable patterns, and a traceable next action.

Mark393295827/third-brain-v7-skills · 29 tokens

log-session

Append a structured entry to the project's session log (docs/LOGS.md): what was done this session, files touched, decisions taken, and the next step — so the next session (or another person) can pick up the thread without re-reading git history. Run it before /clear, before closing Claude Code, or at any natural…

gtrabanco/agentic-workflow · 183 tokens

context-engineering

Workflow for context packets, context audits, compaction, handoffs, session memory, and deciding what AI-agent context to load, retrieve, trim, summarize, refresh, or omit. Use for context rot, context flooding, stale or missing context, task switching, and long-running agent sessions. Do not use when prompt wording…

n-n-code/n-n-code-skills · 89 tokens

wiki-lint

Health-check a wiki vault. Finds orphan pages (no inbound links), dead wikilinks (point to non-existent pages), missing frontmatter fields, stale claims, empty sections, and pages absent from catalog.md. Produces a structured report with severity tiers and proposes concrete fixes — but does not auto-apply them unless…

tboome33/obsidian-mcp-router · 119 tokens