Agent skill

MEMORY.md Restructuring

by simbajigege in simbajigege/book2skills

Reorganizes an overgrown MEMORY.md into a short pointer index plus separate topic files, and fixes or deletes outdated memories instead of archiving them.

Custom licenceAuto-check passedAgent Workflows

Install MEMORY.md Restructuring

skills CLI
$ npx skills add simbajigege/book2skills --skill agent-memory-implementation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install simbajigege/book2skills agent-memory-implementation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/simbajigege/book2skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/agent-memory-implementation .claude/skills/agent-memory-implementation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
agent-memory-implementation
GitHub stars
184
Token cost
~2.4k tokens
SKILL.md length
1,001 words
Files
5 (incl. scripts, references)
Skills in repo
37
Repo updated
First seen
Licence
Custom licence

At a glance

Reorganizes an overgrown MEMORY.md into a short pointer index plus separate topic files, and fixes or deletes outdated memories instead of archiving them.

  • Works in 5 steps: Audit what exists → Classify each entry → Restructure → …
  • MEMORY.md has grown past 200 lines
  • SKILL.md covers The 2-Layer Architecture, How Claude Code Writes…, Memory Type Definitions and Restructuring Process, plus 1 more section
  • Runs Python scripts from its folder

What it does

The skill reshapes an agent's memory directory into two layers modeled on how Claude Code's autoDream service works. Layer one is MEMORY.md, a pointer-only index that is loaded every time and kept to about 200 lines, each entry being a one-line link with a short hook. Layer two is a set of topic files with YAML frontmatter holding name, description and type, which are read only when relevant.

There is no archive layer: stale, superseded or contradicted memories are deleted or corrected in place, so the folder always shows the current truth. The skill also explains how Claude Code's background extraction agent writes memories after each query loop, so your restructuring does not fight it. An audit script (scripts/memory_audit.py) and a reference of memory type definitions ship alongside it.

When your agent uses it

  • MEMORY.md has grown past 200 lines
  • Index entries contain full paragraphs instead of one-line pointers
  • Index entries and topic content are mixed in the same file
  • Memory notes contradict each other or describe things that are no longer true

Example prompts

  • “Reorganize my memory files so MEMORY.md is only an index of pointers.”
  • “Clean up MEMORY.md, half of it is outdated project notes.”
  • “Move the long paragraphs in MEMORY.md into topic files and leave one-line links behind.”

Requirements

  • An existing MEMORY.md and memory directory to restructure
  • Python to run scripts/memory_audit.py

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Audit what exists
  2. Classify each entry
  3. Restructure
  4. Verify
  5. Report

What it can do on your machine

Read from SKILL.md and the folder at commit e5ba66c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

MEMORY.md Restructuring loads about 2.4k tokens when it runs, and up to ~4.4k if it reads all its reference files. Until then it costs about 156 tokens; SKILL.md has 1,001 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~156
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

Its licence (Custom licence) doesn't allow us to republish the file, so here is its outline and opening line. It has 1,001 words (~2,356 tokens).

“Restructures memory files into the 2-layer architecture that Claude Code's autoDream service uses internally — designed to keep the always-loaded index small while making deeper knowledge accessible on demand.”

— opening of SKILL.md by simbajigege, Custom licence
name
agent-memory-implementation
license
Skill implementation guide for personal/educational use.

Read the full SKILL.md on GitHub

Files

SKILL.md and 4 other files (scripts, references) in skills/agent-memory-implementation of simbajigege/book2skills.

  • SKILL.md
  • LICENSE.txt
  • README.md
  • references/memory-type-definitions.md
  • scripts/memory_audit.py

Open the folder on GitHubat commit e5ba66c

Compare with similar skills

MEMORY.md Restructuring next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

MEMORY.md Restructuring compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
MEMORY.md Restructuring this skillsimbajigege/book2skills184—~2.4kAutomated safety check: PassCustom licence
Memori Long-Term MemoryMemoriLabs/Memori17k—~2kAutomated safety check: NotesCustom licence
Memori Long-Term MemoryMemoriLabs/Memori17k—~2kAutomated safety check: PassApache-2.0
MemPalace Recall for Planningopen-gsd/gsd-core10k1 repos~1.5kAutomated safety check: NotesMIT
Planning with FilesOthmanAdi/planning-with-files27k—~2.9kAutomated safety check: PassMIT
User Thoughts Memorysickn33/agentic-awesome-skills47k1 repos~2.5kAutomated safety check: PassMIT

Similar skills

  • Memori Long-Term Memory

    MemoriLabs/Memori

    Connects Claude Code to Memori Cloud for long-term memory, recalling stored context before substantive replies and saving new context afterward.

    17k GitHub stars~2k tokensUpdated 4 days ago
    Agent WorkflowsAuto-check: notes
  • Memori Long-Term Memory

    MemoriLabs/Memori

    Adds structured long-term memory to OpenClaw agents, built automatically from sessions, with tools the agent calls to recall facts, summaries and decisions.

    17k GitHub stars~2k tokensUpdated 4 days ago
    Agent WorkflowsAuto-check passed
  • Recalls earlier decisions, patterns and surprises from MemPalace memory before planning, behind a config gate that never blocks the planning step.

    10k GitHub starsUsed in 1 repo~1.5k tokens
    Agent WorkflowsAuto-check: notes
  • Planning with Files

    OthmanAdi/planning-with-files

    Keeps a task plan, findings and progress log in markdown files on disk so long agent tasks survive context resets, with Gemini hooks and helper scripts.

    27k GitHub stars~2.9k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • User Thoughts Memory

    sickn33/agentic-awesome-skills

    Saves a user's project decisions, rules and preferences into a project-local mdbase so later sessions and other agents can recover the intent.

    47k GitHub starsUsed in 1 repo~2.5k tokens
    Agent WorkflowsAuto-check passed
  • Lemmalog

    JordyZomer/lemmalog

    Externalize working memory and logical state into the lemmalog Datalog engine (MCP).

    329 GitHub stars~2.8k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check passed

More from simbajigege/book2skills

All 37 skills in this repo
  • Compact Memory Implementation

    simbajigege/book2skills

    A developer guide to adding compact memory to an agent: when to trigger compaction, how to fork a compactor sub-agent, what the summary holds, and how to restore it.

    184 GitHub stars~2.5k tokensUpdated 1 mo ago
    Auto-check passed
  • Semantic Line-Art SVG Diagrams

    simbajigege/book2skills

    Turns text, screenshots, or existing diagrams into minimal, accessible line-art SVGs for teaching material, with an optional Mermaid relationship spec.

    184 GitHub stars~2.5k tokensUpdated 1 mo ago
    Auto-check passed
  • Fail-Closed Agent Tool Builder

    simbajigege/book2skills

    Helps define agent tools with a fail-closed pattern: one class holding name, schema, security flags and a validate, permission and call execution chain.

    184 GitHub stars~2k tokensUpdated 1 mo ago
    Auto-check passed
  • LLM Query Loop Implementation

    simbajigege/book2skills

    Implements a production-style agent loop in your own AI product, with tool calling, tool results fed back, exit conditions and budget guards.

    184 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Analyzing Financial Reports

    simbajigege/book2skills

    Analyzes Chinese public company financial statements (balance sheet, income statement, cash flow) to assess asset quality, profit authenticity, cash flow health, solvency, and overall investment…

    184 GitHub starsUsed in 1 repo~930 tokens
    Auto-check passed
  • Tool Permission System Design

    simbajigege/book2skills

    Guides designing a layered permission pipeline for agent tools that decides which calls are allowed, need confirmation or are denied, with scopes and hooks.

    184 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about MEMORY.md Restructuring

What does MEMORY.md Restructuring do?

Reorganizes an overgrown MEMORY.md into a short pointer index plus separate topic files, and fixes or deletes outdated memories instead of archiving them. The skill reshapes an agent's memory directory into two layers modeled on how Claude Code's autoDream service works.md, a pointer-only index that is loaded every time and kept to about 200 lines, each entry being a one-line link with a short hook.

When should I use MEMORY.md Restructuring?

MEMORY.md Restructuring fits situations like: MEMORY.md has grown past 200 lines; index entries contain full paragraphs instead of one-line pointers; index entries and topic content are mixed in the same file; memory notes contradict each other or describe things that are no longer true.

How do I install MEMORY.md Restructuring in Claude Code?

Run `npx skills add simbajigege/book2skills --skill agent-memory-implementation -a claude-code`. Or copy the skill folder (skills/agent-memory-implementation in simbajigege/book2skills) into .claude/skills/agent-memory-implementation in your project. Claude Code loads it when a task matches its description.

How do I install MEMORY.md Restructuring in Codex?

Run `npx skills add simbajigege/book2skills --skill agent-memory-implementation -a codex`. Or copy the skill folder (skills/agent-memory-implementation in simbajigege/book2skills) into .agents/skills/agent-memory-implementation in your project. Codex loads it when a task matches its description.

Can I use MEMORY.md Restructuring in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add simbajigege/book2skills --skill agent-memory-implementation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/agent-memory-implementation, .gemini/skills/agent-memory-implementation, .github/skills/agent-memory-implementation and .opencode/skills/agent-memory-implementation in your project.

What does MEMORY.md Restructuring need to run?

Going by SKILL.md and its folder, MEMORY.md Restructuring needs Python for the scripts in its folder. Our summary lists: An existing MEMORY.md and memory directory to restructure; Python to run scripts/memory_audit.py.

Does MEMORY.md Restructuring access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is MEMORY.md Restructuring safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does MEMORY.md Restructuring use?

MEMORY.md Restructuring has a licence file (from the LICENSE file in the skill folder) that doesn't match a standard licence. Read it on GitHub before reusing the skill.

How many tokens does MEMORY.md Restructuring use?

About 2.4k tokens (SKILL.md is roughly 9.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2k tokens, read only when the agent opens those files.

What are the alternatives to MEMORY.md Restructuring?

Skills that share tags, products or a category with MEMORY.md Restructuring: Memori Long-Term Memory (MemoriLabs/Memori, 17k stars), Memori Long-Term Memory (MemoriLabs/Memori, 17k stars), MemPalace Recall for Planning (open-gsd/gsd-core, 10k stars) and Planning with Files (OthmanAdi/planning-with-files, 27k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains MEMORY.md Restructuring?

simbajigege (a GitHub user) maintains it in simbajigege/book2skills, which has 184 GitHub stars. The repository holds 37 skills in this directory. The repository was last updated on August 26, 2026.

Source: simbajigege/book2skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.