Agent skill

Folded Memory Implementation

by simbajigege in simbajigege/book2skills

Developer implementation guide for building hierarchical (folded) memory into an Agent.

Custom licenceAuto-check passed

Install Folded Memory Implementation

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

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

GitHub CLI
$ gh skill install simbajigege/book2skills folded-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/folded-memory-implementation .claude/skills/folded-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
folded-memory-implementation
GitHub stars
184
Token cost
~3.4k tokens
SKILL.md length
553 words
Files
3
Skills in repo
37
Repo updated
First seen
Licence
Custom licence

At a glance

Developer implementation guide for building hierarchical (folded) memory into an Agent.

  • Works in 9 steps: Understand the setup → Three-layer architecture → Data structures → …
  • Compact-memory-implementation is not retaining enough
  • SKILL.md covers The core idea, Step 1 — Understand the setup, Step 2 — Three-layer… and Step 3 — Data structures, plus 8 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Folded Memory Implementation is an agent skill from simbajigege/book2skills. Developer implementation guide for building hierarchical (folded) memory into an Agent. Three-layer architecture where recent turns stay detailed, older content compresses into episodes, and the oldest distills into durable semantic facts. Use when compact-memory-implementation is not retaining enough, or when agents need to recall decisions from many sessions ago.

Its SKILL.md is about 3.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `README.md`).

The repository describes itself as: Create best skills based on best books.

When your agent uses it

  • Compact-memory-implementation is not retaining enough
  • Agents need to recall decisions from many sessions ago

Example prompts

  • “/folded-memory-implementation”

Requirements

  • Python 3

Workflow steps

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

  1. Understand the setup
  2. Three-layer architecture
  3. Data structures
  4. Fork agent: L1 → L2 (episode compactor)
  5. Fork agent: L2 → L3 (semantic extractor)
  6. When to trigger each layer
  7. Recall: build system prompt from layers
  8. Full agent loop
  9. Persistence

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

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    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

Folded Memory Implementation loads about 3.4k tokens when it runs. Until then it costs about 99 tokens; SKILL.md has 553 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~99
When it runs · the whole SKILL.md, loaded when a task matches
~3.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); files beside SKILL.md 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 553 words (~3,431 tokens).

“A developer guide for hierarchical memory: instead of replacing history with a single flat summary, maintain three memory layers at different levels of detail. Old content is compressed more aggressively — not discarded. Each layer is independently stored and selectively…”

— opening of SKILL.md by simbajigege, Custom licence
name
folded-memory-implementation

Read the full SKILL.md on GitHub

Files

SKILL.md and 2 other files in skills/folded-memory-implementation of simbajigege/book2skills.

  • SKILL.md
  • LICENSE.txt
  • README.md

Open the folder on GitHubat commit e5ba66c

Compare with similar skills

Folded Memory Implementation 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.

Folded Memory Implementation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Folded Memory Implementation this skillsimbajigege/book2skills184—~3.4kAutomated safety check: PassCustom licence
MCP Developmentcoollabsio/coolify63k1 repos~949Automated safety check: PassMIT
Game Developmentsickn33/agentic-awesome-skills47k1 repos~1.3kAutomated safety check: PassMIT
Twenty App Entity Developmenttwentyhq/twenty58k—~1.8kAutomated safety check: PassCustom licence
Developmentccusage/ccusage19k—~433Automated safety check: PassCustom licence
Frontend DevelopmentOpenHands/OpenHands90k—~324Automated safety check: PassMIT

Similar skills

  • MCP Development

    coollabsio/coolify

    A skill your agent uses for Laravel MCP development. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 1 repo~949 tokens
    Frontend & DesignAuto-check passed
  • Game Development

    sickn33/agentic-awesome-skills

    Game development orchestrator. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 1 repo~1.3k tokens
    Game DevelopmentAuto-check passed
  • Guides changes to an existing Twenty app: adding or editing objects, layouts, logic functions and front components, with a plan stated before multi-entity edits.

    58k GitHub stars~1.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Development

    ccusage/ccusage

    Guides ccusage monorepo development. An agent skill from ccusage/ccusage.

    19k GitHub stars~433 tokensUpdated today
    DevelopmentAuto-check passed
  • Frontend Development

    OpenHands/OpenHands

    This skill should be used when the user asks to "add UI copy", "add a translation", "optimize the frontend bundle", "change onboarding", "change conversation UI", "add a query key", "change MSW…

    90k GitHub stars~324 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Fortify Development

    coollabsio/coolify

    ACTIVATE when the user works on authentication in Laravel. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 4 repos~1.9k tokens
    Backend & APIsAuto-check passed

More from simbajigege/book2skills

All 37 skills in this repo
  • MEMORY.md Restructuring

    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.

    184 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • 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

Questions about Folded Memory Implementation

What does Folded Memory Implementation do?

Developer implementation guide for building hierarchical (folded) memory into an Agent. Folded Memory Implementation is an agent skill from simbajigege/book2skills. Developer implementation guide for building hierarchical (folded) memory into an Agent.

When should I use Folded Memory Implementation?

Folded Memory Implementation fits situations like: compact-memory-implementation is not retaining enough; agents need to recall decisions from many sessions ago.

How do I install Folded Memory Implementation in Claude Code?

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

How do I install Folded Memory Implementation in Codex?

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

Can I use Folded Memory Implementation 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 folded-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/folded-memory-implementation, .gemini/skills/folded-memory-implementation, .github/skills/folded-memory-implementation and .opencode/skills/folded-memory-implementation in your project.

What does Folded Memory Implementation need to run?

SKILL.md names no scripts, command-line tools or credentials: Folded Memory Implementation is instructions for the agent only. Our summary lists: Python 3.

Does Folded Memory Implementation 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 Folded Memory Implementation 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. Review the folder before installing.

What licence does Folded Memory Implementation use?

Folded Memory Implementation 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 Folded Memory Implementation use?

About 3.4k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Folded Memory Implementation?

Skills that share tags, products or a category with Folded Memory Implementation: MCP Development (coollabsio/coolify, 63k stars), Game Development (sickn33/agentic-awesome-skills, 47k stars), Twenty App Entity Development (twentyhq/twenty, 58k stars) and Development (ccusage/ccusage, 19k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Folded Memory Implementation?

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.