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

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/haidrrrry/loop-engineering-skills/loop-memory
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.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.svg" alt="Measured on agentmods" 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. 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.00107 $0.00729
Opus 5 $0.00053 $0.00365
Sonnet 5 $0.00021 $0.00146
Haiku 4.5 $0.00011 $0.00073

Measured 3d ago against content hash 055a2d753c30, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 3d 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. 3d 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 (2 stars, last pushed 2mo ago), licensed MIT. It adds 107 tokens to every session and 729 once invoked, about $0.0005 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

add-backend

Guide for adding a backend (Rust or Python) to the agent-sec-core security middleware. Use when creating new backends, integrating Rust or Python code into the security middleware, or extending with new backend actions.

alibaba/anolisa · 46 tokens

skill-ledger

Skill 安全状态查看、风险暴露审查、用户决策、快速扫描认证与可选深度扫描。支持用户主动查看或扫描单个/全部 Skill;当用户要求 agent 安装 Skill 且安装成功后,必须自动对最终本地目录执行快速扫描认证。.

alibaba/anolisa · 67 tokens

pr-body

分析当前分支的全部变更,自动生成或更新 PR 标题和正文。聚焦内容质量:解释 why、归纳 what、标注测试方式,遵循 anolisa 项目 PR 模板规范。适用于新建 PR 前生成描述,或已有 PR 需要更新描述。.

alibaba/anolisa · 68 tokens

regex-mastery

Use this skill when writing regular expressions, debugging pattern matching,optimizing regex performance, or implementing text validation. Triggers on regex, regular expressions, pattern matching, lookahead, lookbehind, named groups, capture groups, backreferences, and any task requiring text pattern matching.

alibaba/anolisa · 60 tokens

install-openclaw

Install and configure OpenClaw non-interactively with Alibaba Cloud Model Studio. Use when the user asks to install OpenClaw, configure Aliyun Bailian/Model Studio/DashScope credentials, choose pay-as-you-go, Coding Plan, or Token Plan billing, set Base URL/model config, optionally configure DingTalk, start the local…

alibaba/anolisa · 85 tokens

agentsight-bugfix

AgentSight fix issues 流程。了解问题 → 复现验证 → 根因分析 → 编码修复 → 验证修复,五阶段标准化调试迭代循环。确保 AI agent 遵循最小改动、逐轮验证的修复规范。.

alibaba/anolisa · 67 tokens