Agent Rule Memory and Correction Log

Make a long-running agent keep the rules you teach it: capture corrections instantly, reload past compaction, and test each rule.

AI Systemsagent-memorycontext-compaction
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“My agent keeps forgetting my rules after a week.”
Beforegeneric AI agent
That's a common issue with long-running agents. Every time the context window gets compressed to stay within limits, important context gets lost, including the instructions and rules you've carefully set up. I could suggest a few approaches to help with this, like more frequent context resets or writing rules in a more explicit format. There are different strategies depending on how your agent is deployed and how often it runs. What's your typical usage pattern?
Afterwith Agent Rule Memory and Correction Log
DURABLE MEMORY SYSTEM INSTALLED

TWO-PART SOLUTION

Part 1: PERSISTENT MEMORY FILE (memory.md)
Location: /agent/memory.md
Stored in project repo (survives context compression)

Memory Categories:
• VOICE: "Write like a product manager. No jargon. Short paragraphs."
• WORKFLOW: "Always ask before executing destructive commands."
• CONTACTS: "Follow up with customer_A@example.com every Monday."
• DECISIONS: "Never recommend service_X. We deprecated it 2024-Q2."

Updates automatically when you teach rules via corrections.md

Part 2: CORRECTION LOG (corrections.md)
Purpose: Every rule change gets timestamped and appended
Example entry:
"2026-01-15: Added rule – Never use em-dashes in customer emails (feedback from Jane)"

Agent retrieval: On every new conversation, agent loads top-20 rules from memory.md

IMPLEMENTATION CONFIG
Extraction hook: Fires when session tokens > 80,000
Action: Agent summarizes recent decisions → append to corrections.md
Retrieval prompt: Loads memory.md + top-5 recent corrections at session start
Redaction: Scrubs names/emails before compression (your choice)

TRACKING + AUDIT
Weekly rule-drift report: Shows which rules agent followed vs ignored
Missing rule detection: Catches contradictions between memory.md and recent corrections

DELIVERABLE
✓ memory.md template (ready to customize)
✓ corrections.md template with sample entries
✓ Pre-compression extraction prompt (paste into agent config)
✓ Retrieval prompt for agent's session start
✓ Audit checklist (monthly review)

EXPECTED OUTCOME
Agent stops forgetting rules after context compression
Instead of day-7 memory loss, rules persist indefinitely
You add rules incrementally via corrections.log
Weekly drift reports show exactly what's working/failing

About this skill

Your agent stops forgetting the rules you taught it after its context gets summarized. Corrections are captured the moment you give them and reloaded where compaction cannot reach.

What it does

  • Diagnoses where a rule is being lost: chat-only storage, load timing, burial, conflicts, or vague wording
  • Installs a short rules file with ids and scopes plus an append-only correction log
  • Loads rules through the always-sent instruction slot for Claude Code, the Agent SDK, or a raw API loop
  • Guards against memory poisoning and adds a regression test per high-impact rule

What you get

A memory setup: diagnosis, file locations, capture and load mechanics, seeded rules, regression tests, and a consolidation cadence.

Best for

Anyone running a persistent assistant or autonomous agent that keeps repeating mistakes it was already corrected on.

SKILL.md preview

SKILL.md
---
name: agent-durable-memory-loop

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More ai & agents skills

View all AI & Agents skills →