agentleFS
haidrrrryhaidrrrry/loop-engineering-skills/skills/loop-memory/SKILL.md

loop-memory

Skill4 starsChanged 5 months agoMITView on GitHub

Give the agent episodic memory so it improves every cycle instead of repeating mistakes. Use this skill whenever working in a project that has a .loop/LESSONS.md file, whenever a task is being retried after a failure, whenever the user says "remember this", "don't make that mistake again", "learn from this", or "why do you keep doing that", and at the start and end of every task run inside a loop. Also use it to compress or maintain the lessons file when it grows long.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. jonhill90/skills★ 9same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the 3 most recent entries.

    line 21
  2. Distinctive:

    When an attempt failed, the reflection must answer: what did I *believe* that was wrong?

    line 44
  3. Distinctive:

    Read all entries oldest-first.

    line 50
  4. Distinctive:

    Delete the oldest 20 entries after graduation.

    line 53
  5. Distinctive:

    Never delete Standing rules without the user's approval.

    line 54

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.

Failure modes to avoid

  • Memory theater: writing entries but never reading them. The read step is the value; the write step alone is a diary.
  • Overfitting to one incident: a one-off environment hiccup is not a lesson. If it can't recur, don't record it.
  • Unbounded growth: a 200-entry file no one reads is dead memory. Compress.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.