agentleFS
camrontaylorcamrontaylor/AI-OS-Template/.claude/skills/meta-memory-write/SKILL.md

meta-memory-write

Skill0 starsChanged 45 days agoMITView on GitHub

Saves durable facts to context/MEMORY.md, the curated working scratchpad read at session start. Triggers on "remember this", "remember that", "note that", "save this to memory", "update memory", "log this", "forget about", "remove from memory". Three actions: add (append under the correct section after dedup check), replace (substring match + swap), remove (confirm with user first). Enforces a 2,500 character cap with consolidation when over. Does NOT trigger for daily session logging (handled by Returning Mode auto-tracking), learnings updates (handled by meta-wrap-up), or one-off in-conversation reminders.

  • Reads credentials

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 11 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the file doesn't exist, create it with the standard scaffold before writing.

    line 32
  2. Distinctive:

    If ambiguous, ask before proceeding.

    line 46
  3. Very specific:

    Read context/MEMORY.md in full.

    line 52
  4. Distinctive:

    If the fact doesn't fit any of the three, ask the user where it belongs rather than creating a new section.

    line 77
  5. Distinctive:

    If adding the new fact would push the file over 2,500 characters:

    line 98
  6. Distinctive:

    Remove threads that are clearly resolved (look for "done", "shipped", "closed" markers)

    line 102
  7. Very specific:

    If still over after consolidation, tell the user: "MEMORY.md is full.

    line 105
  8. Very specific:

    Never store secret values — only reference names (e.g., FIRECRAWL_API_KEY in .env, not the key itself).

    line 117
  9. Distinctive:

    After the write succeeds, reply with exactly:

    line 123
  10. Very specific:

    If the action was remove, reply: Removed — will be active from next session.

    line 129
  11. Very specific:

    If the dedup check caused a skip, reply: Already saved — no change needed.

    line 131
  12. Very specific:

    Never exceed 2,500 characters in context/MEMORY.md.

    line 139
  13. Distinctive:

    Always check for duplicates before adding, because the file is capped and repeats waste the budget.

    line 140
  14. Distinctive:

    Prefer replace over add when updating an existing fact.

    line 141
  15. Distinctive:

    Never quote secret values in MEMORY.md, because this file is committed and read into context every session.

    line 142
  16. Distinctive:

    Always confirm with the user before remove — show the exact line being deleted.

    line 143
  17. Distinctive:

    Do not create new sections beyond Active Threads / Environment Notes / Pending Decisions.

    line 145

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Memory Write

Saves durable facts to context/MEMORY.md — the curated working scratchpad that gets read at session start as a frozen snapshot.

Outcome

  • A durable fact is added to, updated in, or removed from context/MEMORY.md
  • Character cap (2,500) is enforced — consolidation happens before the cap is breached
  • Confirmation message shown: Saved — will be active from next session.
  • context/MEMORY.md exists with the three-section scaffold if it was missing

Context Needs

FileLoad levelHow it shapes this skill
context/MEMORY.mdFullThe file being written to — must be read before every action to dedup and check the cap

If the file doesn't exist, create it with the standard scaffold before writing.


Step 1: Determine Action

Parse the user's request into one of three actions:

User phrasingAction
"remember this", "note that", "save this", "log this", "add to memory"add
"update memory about X", "change the X entry", "X is now Y"replace
"forget about X", "remove X from memory", "delete the X entry"remove

If ambiguous, ask before proceeding.


Step 2: Read MEMORY.md

Read context/MEMORY.md in full. If it doesn't exist, create it with this scaffold:

<!-- Cap: 2,500 chars. Curated working scratchpad. Maintained by meta-memory-write skill. Mid-session writes take effect on the next session (frozen snapshot pattern). -->
# Working Memory

## Active Threads

## Environment Notes

## Pending Decisions

Step 3: Pick Target Section

Decide which section the fact belongs in:

SectionUse for
## Active ThreadsCurrent work, open questions, things to revisit
## Environment NotesURLs (staging, prod), tool versions, project structure, config file locations
## Pending DecisionsDecisions waiting on input, options still under consideration

If the fact doesn't fit any of the three, ask the user where it belongs rather than creating a new section. Sections are intentionally limited to keep the scratchpad focused.


Step 4: Dedup Check

Scan the file for substring matches against the new fact:

  • Exact match exists → skip the write, tell the user the fact is already saved
  • Similar entry exists → prefer replace over add, even if the user said "remember this"
  • No match → proceed to cap check

Step 5: Cap Check

Compute current byte count of context/MEMORY.md.

  • Bash: wc -c < context/MEMORY.md
  • PowerShell: (Get-Item context/MEMORY.md).Length

If adding the new fact would push the file over 2,500 characters:

  1. Consolidate existing entries:
    • Merge similar lines under the same section
    • Remove threads that are clearly resolved (look for "done", "shipped", "closed" markers)
    • Tighten verbose entries into single-line facts
  2. Re-check the count
  3. If still over after consolidation, tell the user: "MEMORY.md is full. Which entry should I drop to make room for {new fact}?"

Step 6: Write the Change

Apply the action using the Edit tool with precise old_string/new_string:

  • add → insert under the target section heading. Use a bullet (- ) prefix. Keep to one line per fact.
  • replace → swap the matched substring with the new value.
  • remove → first show the user the exact line and ask "Remove this?" Only delete after explicit confirmation.

Never store secret values — only reference names (e.g., FIRECRAWL_API_KEY in .env, not the key itself).


Step 7: Confirm

After the write succeeds, reply with exactly:

Saved — will be active from next session.

If the action was remove, reply: Removed — will be active from next session.

If the dedup check caused a skip, reply: Already saved — no change needed.


Rules

Updated automatically when the user flags issues. Read before every run.

  • Never exceed 2,500 characters in context/MEMORY.md. Consolidate first; if that fails, ask the user what to drop.
  • Always check for duplicates before adding, because the file is capped and repeats waste the budget. Substring match across the whole file.
  • Prefer replace over add when updating an existing fact.
  • Never quote secret values in MEMORY.md, because this file is committed and read into context every session; reference env var names only.
  • Always confirm with the user before remove — show the exact line being deleted.
  • Mid-session writes persist to disk but only take effect on the next session. Tell the user this in the confirmation message so they understand why.
  • Do not create new sections beyond Active Threads / Environment Notes / Pending Decisions. If a fact doesn't fit, ask the user where it belongs.

Self-Update

If the user flags an issue with how memory is written — wrong section, missed dedup, bad consolidation — update the ## Rules section in this SKILL.md immediately with the correction and today's date. Don't just log it to learnings; fix the skill so it doesn't repeat the mistake.


Graceful Degradation

  • MEMORY.md missing → create with the standard scaffold, then write
  • MEMORY.md corrupted or malformed → ask the user before doing anything destructive
  • Ambiguous section target → ask the user; don't guess
  • Bash wc -c not available (rare on Windows) → fall back to PowerShell length check

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.