SuperAPI AI Directory

yy-enable-memory

Agents & models

View repository

Updated 10-15 20:09

About this skill

yy-enable-memory

Description

Create a layered memory management system in the target project root directory, including:

  • Memory management rules .agents/rules/memory/RULE.md(project-shared, committable)
  • Project-private skill .agents/skills/yy-memory/SKILL.md(project-shared, committable)
  • Memory repository structure .memory/(personal and private, not committed)
  • Capacity trimming script .agents/skills/yy-memory/scripts/src/main.ts
  • In AGENTS.md inject a reference to the memory management rules

Use cases

  • The user mentions "add memory functionality", "enable memory management", "give this project memory capability"
  • The user mentions "create a yy-memory skill", "add long-term memory to the project"

Should not trigger:

  • The user requests to query or read existing memory content
  • The user requests to update or modify existing memory
  • The user is only asking what a memory system is
  • The user requests adding memory for a non-project directory (such as Desktop or Downloads folder)

Instructions

Step 1. Confirm the target project

Decision branch:

  • The user specified a target project path: use the path specified by the user, skip to Step 2
  • The user did not specify a target project path: use the current working directory (cwd) as the target project

Step 2. Detect the target project environment

Check whether the following exist under the target project root directory:

  • AGENTS.md file (must exist; otherwise prompt the user to create it first)
  • .agents/rules/ directory (create it if it does not exist)
  • .agents/skills/ directory (create it if it does not exist)
  • .agents/rules/memory/ directory
  • .agents/skills/yy-memory/ directory

Decision branch:

  • AGENTS.md does not exist: prompt the user "The target project is missing the AGENTS.md file; please create it first", and abort the operation
  • The memory rules or yy-memory skill already exist: ask the user "The target project already has a memory system; overwrite or update?", and continue after the user confirms

Step 3. Detect the target project structure

Read the target project's AGENTS.md, and determine its structural characteristics:

  • Whether it already has a "rules to follow" section
  • Whether it already has memory-related rule references
  • Whether it already has .gitignore file

Step 4. Create memory management rules

Generate the rules file from the templates/rule-template.md template:

  • Target path:.agents/rules/memory/RULE.md
  • If it already exists, read it first and then decide whether to overwrite or append
  • The rules content includes: trigger scenarios, read flow, write flow, memory system architecture, capacity management rules

Step 5. Create the project-private yy-memory skill

Generate the skill file from the templates/yy-memory-skill.md template:

  • Target path:.agents/skills/yy-memory/SKILL.md
  • If it already exists, read it first and then decide whether to overwrite or append
  • The skill content includes: description, use cases, instruction steps (execute memory update after commit)

Step 6. Initialize the memory repository structure

Create the memory repository files in the following order:

  1. Create .memory/ Table of Contents
  2. From templates/memory-md.md generate MEMORY.md
  3. From templates/catalog-md.md generate CATALOG.md
  4. From templates/archive-md.md generate ARCHIVE.md
  5. Create work-log.md work log file
  6. Create .memory/hubs/ directory, from templates/hub-template.md generate 5 topic hubs
  7. Create .memory/leaf/ directory, from templates/leaf-template.md generate an example leaf

Hub topic naming(5):

  • hub-1-project-knowledge.md - Project knowledge
  • hub-2-architecture-decisions.md - Architecture decisions
  • hub-3-user-preferences.md - User preferences
  • hub-4-business-rules.md - Business rules
  • hub-5-tool-usage.md - Tool usage

Step 7. Create the pruning script

Copy the scripts/ directory to the target project:

  • Target path:.agents/skills/yy-memory/scripts/
  • How to run:node .agents/skills/yy-memory/scripts/src/main.ts

Step 8. Add .memory/ to .gitignore

Check the target project's .gitignore file:

  • does not exist: create .gitignore, add the .memory/ entry
  • exists and does not contain .memory/: append the .memory/ entry at the end
  • exists and already contains .memory/: skip this step

Step 9. Inject the AGENTS.md rule reference

Read the snippet in resources/agentes-rule-snippet.md and insert it into the appropriate location in AGENTS.md :

  • If there is already a "Rules to follow" section, add it at the end of that section
  • If there is no such section, add it at the end of the file
  • Keep the existing content unchanged and only append new content

Step 10. Output the results

The following content must be output:

  1. Creation result: operation type (create/update)
  2. Generated directory structure: display it using a tree structure
  3. Memory store path:.memory/(personal and private, already added to .gitignore)
  4. Trigger method: automatically load MEMORY.md when the conversation starts, and update memory after manually executing the yy-memory skill
  5. Usage reminder: suggest how the user can verify that the installation succeeded

Security boundaries

  • The memory system can only be created under a valid project directory (containing AGENTS.md)
  • Do not overwrite the user's existing AGENTS.md content; only append the rule reference
  • Do not modify any other files in the target project
  • When initializing the memory store, only generate template files, not specific memory content related to the user's business
  • .memory/ The directory is automatically added to .gitignoreto ensure personal memories are not committed to the repository

Related resources

  • templates/rule-template.md: memory management rules template
  • templates/yy-memory-skill.md: yy-memory project private skill template
  • templates/memory-md.md: MEMORY.md core routing template
  • templates/catalog-md.md: CATALOG.md complete catalog template
  • templates/archive-md.md: ARCHIVE.md archive template
  • templates/hub-template.md: hub topic hub template
  • templates/leaf-template.md: leaf leaf memory template
  • resources/agentes-rule-snippet.md: AGENTS.md injection snippet
  • scripts/: capacity pruning script project (including TypeScript source code, package.json, tsconfig.json, and other configuration)