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.
git clone --depth 1 https://github.com/CloseTheLoops/moradinnpx agentmods add skills/closetheloops/moradin/learn-from-sessionsWrote 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.
[](https://agentmods.dev/skills/closetheloops/moradin/learn-from-sessions)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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
-
Set up. Confirm
ANTHROPIC_API_KEYis in env. If not, ask operator to set it or use--local-onlymode. -
Discover sessions. Run
scripts/session_scanner.py --since 180 --count-onlyto show operator how many sessions/turns will be scanned. -
Estimate cost. Roughly $0.001 per turn for pre-filter + $0.01 per extracted candidate. For ~10k turns: typically $8-15.
-
Confirm with operator before running the expensive extraction.
-
Run extraction.
python scripts/extract_preferences.py --since 180 --min-count 5 --min-sessions 3This:
- 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
-
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
-
Walk operator through review (optional). For each candidate ask:
- ACCEPT → write to
memory/preferences/<title>.md(orprinciples/orlessons/based on category) - EDIT → rewrite statement, then accept
- REJECT → skip
- ACCEPT → write to
-
After approval session. Run
python scripts/refresh_indexes.pyto update_INDEX.mdfiles. Delete the review file.
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.
- 8d ago First seen · 80 lines · 36 tokens per session scan A 6524140f863b
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.
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.
knowledge-ops
Use when an Obsidian knowledge system needs classification, deduplication, retrieval, synchronization, debt queues, or governed Agent/Wiki promotion.
session-learn
Use when a completed work session should yield durable concepts, corrections, decisions, reusable patterns, and a traceable next action.
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…
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…
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…