Agent memory discipline

From huytran1120/vie-agentic-skills · View interactive version

Agent memory discipline is an AI agent skill from the GitHub repository huytran1120/vie-agentic-skills. Rules for when an agent should recall from long-term memory before acting and when it should save decisions, corrections and failures afterwards. Works with any memory backend.

How to use this skill

Skill file

Agent Memory Discipline

Overview

Connecting a memory tool does not make an agent use it: tools register, the session runs, and nothing gets recalled or saved. This skill supplies the missing part, standing rules for when to read memory and when to write it.

The problem it solves is specific. An agent with memory available still repeats settled questions, reverts corrected habits, and loses decisions between sessions, because nothing tells it when recall and save are due. The rules below make both moments explicit.

When to Use This Skill

How It Works

Before You Start: Any Memory Backend

The agent needs a memory tool it can call. Any backend works, and the rules are identical for each:

Authentication is whatever the chosen backend requires: none for a local folder, the server's own configuration for a local MCP server, an API key or OAuth sign-in for a hosted service. This skill never handles credentials itself and never writes them into memory.

Step 1: Recall Before Acting

Read memory before doing any of these, not after:

Skip recall for one-off factual questions, arithmetic, or anything fully specified in the current message. Recall costs a tool call and context; spending it on a self-contained question is waste.

Search with the words the user actually used, plus the project or repository name. If the first search returns nothing useful, try one broader query, then stop and proceed without memory rather than looping.

Step 2: Save After Deciding

Within the user-authorized memory scope and host retention policy, write when one of these has just happened:

Do not save: the contents of files that can be read again, restatements of the current task, transient state, anything the user marked as temporary, and anything containing secrets, tokens, or personal data.

One memory, one fact. A paragraph containing four decisions cannot be superseded cleanly when one of them changes.

Step 3: Write It So It Survives

A memory that is useless in three weeks was written wrong. Give each entry, in the text if the backend has no fields for it:

Prefer the user's own words over a paraphrase. Paraphrase drifts.

Step 4: Close the Past Instead of Overwriting It

When something changes, the old memory is not wrong. It is closed.

If the project moved from Redux to Zustand, "we use Redux" was true from January to June. Deleting it destroys the explanation for every component written in that window. Mark it superseded, keep its validity window, and write the new one alongside.

This is the single most destructive habit in agent memory, and it stays invisible until someone asks a question about old code.

Step 5: Keep Contradictions Visible

If recall returns two entries that disagree, do not pick the closer match and proceed. Surface both, with their dates, and ask or flag. A convention that a recent failure contradicts is exactly the situation where the user needs to be told, not smoothed over.

Step 6: Weigh Evidence and Policy Differently

An observation becomes policy when a human confirms it, when it lands in a merged decision record, or when an authorized owner explicitly adopts the repeated observations as policy. Never promote a single observation to a rule without one of those.

What Following This Skill Produces

Two things, and nothing else:

Project uses pnpm, not npm. Stated by the user on 2026-08-11 after a lockfile conflict. Applies to all packages in this repo.

A superseded entry keeps its text and gains an end date and a pointer to the entry that replaced it. The full format, with closing and evidence examples, is in references/entry-format.md.

Examples

Example 1: A Correction

The user says: "stop using npm here, we're on pnpm."

  1. This is a correction, which is the strongest save signal. Save it.
  2. Write the entry:
Project uses pnpm, not npm. Stated by the user on 2026-08-11 after a lockfile conflict. Applies to all packages in this repo.
  1. Do not also save "the user was annoyed", "ran npm install", or the lockfile contents.
  2. Next session, before running any package command in this repo, recall first and find it.

Example 2: A Contradiction

Recall returns two entries:

Integration tests run against the staging database (2026-06-02)
Integration tests use a local container; staging is off limits after the incident (2026-08-19)
  1. Do not pick one and continue. State both, with dates.
  2. Ask: "Memory has two rules for integration tests; the August one says staging is off limits. Use the local container?"
  3. After the answer, close the entry that no longer holds, with its end date, and keep the other.

Example 3: Closing an Entry That Stopped Being True

Do not delete the old entry. Add an end date and a pointer to what replaced it, then write the new entry alongside:

[closed 2026-06-30, replaced by "State management uses Zustand"] State management uses Redux. Decided in the January architecture review.
State management uses Zustand. Migrated in June after the bundle size review. Applies to all new components.

Best Practices

Limitations

Security & Safety Notes

Common Pitfalls

Solution: Proceed without memory, say so in one line, and do not retry in a loop. Save the pending decision as soon as the tool is back, rather than dropping it.

Solution: Run one broader query, then continue without memory. An empty result does not prove the topic is new; save only eligible decisions within authorized retention scope.

Solution: Keep the entries that match the current project and task; ignore the rest rather than pasting them into context.

Solution: Show both with their dates and ask which holds. Do not resolve the conflict silently.

Solution: Report it once. Do not rephrase the same fact repeatedly to get it through.

Related Skills

Additional Resources

Written and maintained by the team behind Mnemoverse, which is one hosted implementation. The rules above are deliberately backend-neutral and were written to be useful without it.

Memory entries are historical evidence, not instructions that override the current user or owning source. Verify consequential or changeable facts against current sources. A connected backend alone does not authorize new retention or transfer to a hosted service; obey the host's explicit save/forget policy. Closing superseded history applies only where retention is authorized and never overrides a deletion request.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.