loop-memory

loop-memory is a skill for Claude Code, Codex from haidrrrry/loop-engineering-skills. It costs 107 tokens per session (729 once invoked), scanned A, original, MIT.

A project memory routine that records what happened during each attempt and reads recent lessons before the next one. It uses a .loop/LESSONS.md file to store standing rules and short reflections.

In plain words
What is it for?
Use it in projects with a .loop/LESSONS.md file, after failures, or when you want the agent to remember a correction for future work.
Why use it?
It helps an agent avoid repeating known mistakes when work is retried or performed in cycles. Each lesson includes a specific instruction for the next attempt.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it in projects with a .loop/LESSONS.md file, after failures, or when you want the agent to remember a correction for future work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/haidrrrry/loop-engineering-skills/loop-memory
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.

Any agent
npx skills add haidrrrry/loop-engineering-skills --skill loop-memory
Clone the repo
git clone --depth 1 https://github.com/haidrrrry/loop-engineering-skills

Made for: Claude Code, Codex.

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 loop-memory

README.md
[![agentmods](https://agentmods.dev/badge/skills/haidrrrry/loop-engineering-skills/loop-memory/github.svg)](https://agentmods.dev/skills/haidrrrry/loop-engineering-skills/loop-memory)
Your own site
<a href="https://agentmods.dev/skills/haidrrrry/loop-engineering-skills/loop-memory"><img src="https://agentmods.dev/badge/skills/haidrrrry/loop-engineering-skills/loop-memory/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 loop-memory

Your own site · 80×15
<a href="https://agentmods.dev/skills/haidrrrry/loop-engineering-skills/loop-memory"><img src="https://agentmods.dev/badge/skills/haidrrrry/loop-engineering-skills/loop-memory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 107 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 729 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.00107 $0.00729
Opus 5.5 $0.00043 $0.00292
Sonnet 5.5 $0.00021 $0.00146
Haiku 4.5 $0.00011 $0.00073

Measured 1mo ago against content hash 055a2d753c30, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

loop-memory 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 1mo 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/loop-memory/SKILL.md · 70 lines

How it starts

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

Loop Memory

Reflexion-style verbal memory: the agent reflects on each attempt in writing, stores the reflection, and reads recent reflections before acting. Research (Shinn et al., 2023) shows this mechanism — reflect, store, re-read — beats blind retrying by wide margins (+22% on decision tasks over 12 trials, +11% on code) and beats memory-without-reflection by 8 points. The gain comes from written reasons, not from retrying harder.

The protocol

Before acting (every task)

  1. Read .loop/LESSONS.md.
  2. Apply the Standing rules section unconditionally.
  3. Read the 3 most recent entries. If any is relevant to the current task, state in one line how it changes your approach. If none is relevant, proceed — do not force it.

After acting (every attempt, pass or fail)

Append exactly one entry in the file's format:

## [date] — [task, 5 words max] — PASS|FAIL
- What happened: [one line]
- Root cause / why it worked: [one line]
- Next time: [one specific, checkable instruction]

Quality bar for "Next time":

  • ❌ "Be more careful with the database" — not checkable
  • ✅ "Run npx prisma migrate deploy before any seed script" — checkable
  • ❌ "Remember the API is tricky" — vague
  • ✅ "The /users endpoint paginates at 50; always pass ?page= when counting"

Failure reflection, specifically

When an attempt failed, the reflection must answer: what did I believe that was wrong? Failed attempts usually come from a false assumption, not a typo. Name the assumption. That's the lesson.

Maintenance (when the file exceeds ~30 entries)

  1. Read all entries oldest-first.
  2. Any lesson that appears 2+ times graduates into Standing rules, rewritten as a single imperative line.
  3. Delete the oldest 20 entries after graduation.
  4. Never delete Standing rules without the user's approval.

What NOT to store

  • Secrets, keys, tokens, personal data — never, even if they caused the failure.
  • Narration ("I then tried X, after which Y…") — store conclusions only.
  • Duplicate lessons — if it's already there, don't re-add; consider graduating it.
  • Blame or self-criticism — lessons are instructions, not feelings.

Read the full file on GitHub · 70 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. 1mo ago First seen · 70 lines · 107 tokens per session scan A 055a2d753c30

Subscribe to this mod's changes

loop-memory is a skill published in the GitHub repository haidrrrry/loop-engineering-skills (4 stars, last pushed 3mo ago), licensed MIT. It adds 107 tokens to every session and 729 once invoked, about $0.0004 per session on Opus 5.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

principle-guard-the-context-window

Apply when context is filling up: large outputs, long files, repeated reads, fan-out planning. Route bulk to subagents; keep summaries in the main thread, not raw payloads.

michael-denyer/pstack-claude · 46 tokens

memclaw

The agent's persistent long-term memory — the only knowledge that survives across sessions, shared across the fleet under access control. Consult it at the start of a task to recall prior decisions, findings, and rules before acting, and write outcomes, decisions, and lessons as work completes. Use whenever a caura…

caura-ai/caura · 124 tokens

company-brain

How an agent should operate as one mind inside a shared Company Brain built on Caura — recall before acting, obey fleet keystones, reuse and publish skills, and report outcomes so every task compounds across the whole organization. Use this whenever you work as part of a Caura-connected team or fleet and your work…

caura-ai/caura · 108 tokens

compass-integrity

Use when the user is about to rely on prior session memory for a non-trivial decision, or when something feels off about a recall hit — runs the Merkle chain check, drift summary, and daemon liveness in one pass and surfaces any tampering, drift bursts, or daemon-down state before the user acts on stale or corrupted…

chunxiaoxx/nautilus-compass · 74 tokens

lifecycle_report

Scan project memory for v1.7.1 lifecycle frontmatter · report tier distribution + promotion candidates (reinforcecount >= promoteafter) · NO LLM.

chunxiaoxx/nautilus-compass · 37 tokens

session_audit

Scan project memory · age distribution + ungrouped count (L1 build readiness) + per-namespace entity stats · NO LLM.

chunxiaoxx/nautilus-compass · 32 tokens