learning-loop

A structured method for an AI agent to research a topic, record what it learns, check its reasoning, and carry useful knowledge into later sessions. TDD is not explained in the supplied information.

In plain words
What is it for?
Use it for self-directed research, exploration, knowledge capture, session startup, and session closure when no inner agent delegation is needed.
Why use it?
It addresses the problem of losing context between separate agent sessions and of claiming work was done without actually carrying out the required checks.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/richfrem/agent-plugins-skills/learning-loop
Any agent
npx skills add richfrem/agent-plugins-skills --skill learning-loop
Clone the repo
git clone --depth 1 https://github.com/richfrem/agent-plugins-skills

Made for: Claude Code, Codex.

Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,621 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00078 $0.01621
Opus 5 $0.00039 $0.00811
Sonnet 5 $0.00016 $0.00324
Haiku 4.5 $0.00008 $0.00162

Measured 2d ago against content hash b2743f85f734, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

learning-loop 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 2d 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.

plugins/agent-loops/skills/learning-loop/SKILL.md · 153 lines

How it starts

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

Dependencies

This skill requires Python 3.8+ and standard library only. No external packages needed.

To install this skill's dependencies:

pip-compile ./requirements.in
pip install -r ./requirements.txt

See ./requirements.txt for the dependency lockfile (currently empty — standard library only).


Learning Loop

The Learning Loop is a structured cognitive continuity protocol ensuring that knowledge survives across isolated agent sessions. It is designed to be universally applicable to any agent framework.

CRITICAL: Anti-Simulation Rules

YOU MUST ACTUALLY PERFORM THE STEPS LISTED BELOW. Describing what you "would do", summarizing expected output, or marking a step complete without actually doing the work is a PROTOCOL VIOLATION.

Closure is NOT optional. If the user says "end session" or you are wrapping up, you MUST run the full closure sequence. Skipping any step means the next agent starts blind.


The Iron Chain

Prerequisite: You must establish a valid session context upon Wakeup before modifying any code.

Orientation → Synthesis → Strategic Gate → Red Team Audit → [Execution] → Loop Complete (Return to Orchestrator)

Phase I: Orientation (The Scout)

Goal: Establish Identity & Context. Trigger: First action upon environment initialization.

  1. Identity Check: Read any local orientation documents or primers provided by the user's environment.
  2. Context Loading: Retrieve the historical session state (the "Context Snapshot" or equivalent state file) to understand what the previous agent accomplished.
  3. Report Readiness: Output: "Orientation complete. Context loaded. Ready."

STOP: Do NOT proceed to work until you have completed Phase I.


Phase II: Intelligence Synthesis

  1. Mode Selection: Decide if you are doing standard documentation (recording ADRs) or exploratory research.
  2. Synthesis: Perform your research. Aggregate findings into clear, modular markdown files in the project's designated learning/ or memory/ directory.

Read the full file on GitHub · 153 lines

Files

What ships with it

9 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 153 lines · 78 tokens per session scan A b2743f85f734

Subscribe to this mod's changes

learning-loop is a skill published in the GitHub repository richfrem/agent-plugins-skills (6 stars, last pushed 4d ago), licensed MIT. It adds 78 tokens to every session and 1,621 once invoked, about $0.0004 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

kapso-whatsapp

How to interact with Kapso WhatsApp from the swarm — read inbound webhook payloads (text AND media), fetch message history, send free-form messages within the 24h session window (and template messages outside it), mark-as-read, show the typing indicator, send reactions, download media, verify webhook signatures, and…

desplega-ai/agent-swarm · 156 tokens

composio

Use Composio from Agent Swarm through the agent-swarm x composio CLI route, the swarmx MCP tool, or a registered ctx.api.composio script connection. Trigger when a task needs connected third-party app tools such as Gmail, Google Calendar, Google Docs, Google Drive, GitHub, Slack, Notion, or HubSpot through Tool Router…

desplega-ai/agent-swarm · 128 tokens

attio-interaction

Generic Attio CRM REST API v2 recipes for querying records, upserting companies/people/deals, writing notes/tasks/comments, managing lists, and handling webhooks.

desplega-ai/agent-swarm · 39 tokens

scheduled-task-resilience

Guardrails for polling, scheduled jobs, and long-running external operations. Use whenever a task waits on CI, builds, deploys, browser jobs, or another asynchronous API so work survives heartbeat checks without duplicate delivery.

desplega-ai/agent-swarm · 48 tokens

swarm-scripts

Bulk, repeat, fan-out, or data-heavy work: write and run swarm scripts (inline script-run, named script-upsert, durable launch-script-run). Covers the script-vs-tool rubric, the authoring contract (args first, ctx second), the seed catalog, connections and secrets, dbquery, and exposing a script as an API.

desplega-ai/agent-swarm · 82 tokens

user-management

How to manage the user registry — creating users for new Slack/GitHub/GitLab/Linear identities, managing aliases, resolving users across platforms. Use when a new human interacts with the swarm or when user identity needs updating.

desplega-ai/agent-swarm · 49 tokens