Hierarchical Memory (Neural Branching)
This skill provides a structured method for managing long-term memory in a multi-layered, branched format to prevent context bloat and ensure high-fidelity recall.
🛡️ Security & Transparency
This skill includes a Python script
scripts/add_branch.py. This script is used solely to:
- 1. Create directories in your
memory/ folder. - Create boilerplate markdown files for new memory branches.
- Append links to these new files in your existing memory maps.
It does not perform any network activity, access sensitive system files, or execute external code.
Memory Architecture
The memory system is organized into three primary layers:
- 1. Layer 1: Root Memory (
MEMORY.md)
- The central nervous system.
- Contains high-level context about the partnership, core missions, and global goals.
- Acts as a map to all other memory layers.
- 2. Layer 2: Domain Memories (
memory/domains/*.md)
- Specialized knowledge silos.
- Examples:
coding.md,
trading.md,
social.md,
research.md.
- Contains domain-specific philosophies, tech stacks, and project indices.
- 3. Layer 3: Project Memories (
memory/projects/*.md)
- Deep-dive details for specific initiatives.
- Examples:
hesapgaraj.md,
clawguard.md,
baa.md.
- Contains project status, to-dos, technical specs, and history.
How to Use This Skill
1. Recalling Information
- - Always start by searching
MEMORY.md. - Follow the "Map" links to the relevant Domain or Project file.
- Use
read to load only the specific branch needed for the current task.
2. Adding New Information
- - New Fact about the Partnership: Update
MEMORY.md. - New Domain: Create a new file in
memory/domains/ and link it from MEMORY.md. - New Project: Create a new file in
memory/projects/ and link it from its primary Domain file.
3. Cross-Referencing
- - If a project belongs to multiple domains (e.g., a trading bot that requires coding), link the Project file from both Domain files.
Automation Tools
Use the provided scripts to maintain the hierarchy:
- -
scripts/add_branch.py: Automatically create a new domain or project file with the correct template and linking.
Best Practices
- - Atomic Writes: Keep project files focused only on that project.
- Backlinks: Every branch should have a "Back to Root" or "Back to Domain" link.
- Pruning: During heartbeats, review branches and remove obsolete information.
- Why This Matters: Every branch and major entry must include a "Significance" line (Why is this important?) to prevent "Zombie Memory" (useless data accumulation).
- Recent Delta: Maintain a
recent_delta.md in each domain/project folder containing changes from the last 3-7 days for rapid context synchronization.
层级记忆(神经分支)
本技能提供了一种结构化的方法,以多层分支格式管理长期记忆,防止上下文膨胀并确保高保真度回忆。
🛡️ 安全与透明性
本技能包含一个Python脚本 scripts/add_branch.py。该脚本仅用于:
- 1. 在您的 memory/ 文件夹中创建目录。
- 为新的记忆分支创建模板Markdown文件。
- 在现有记忆地图中附加指向这些新文件的链接。
它不执行任何网络活动、访问敏感系统文件或运行外部代码。
记忆架构
记忆系统分为三个主要层级:
- 1. 第一层:根记忆(MEMORY.md)
- 中枢神经系统。
- 包含关于合作关系、核心使命和全局目标的高层上下文。
- 作为所有其他记忆层的地图。
- 2. 第二层:领域记忆(memory/domains/*.md)
- 专门知识库。
- 示例:coding.md、trading.md、social.md、research.md。
- 包含特定领域的理念、技术栈和项目索引。
- 3. 第三层:项目记忆(memory/projects/*.md)
- 特定计划的深度细节。
- 示例:hesapgaraj.md、clawguard.md、baa.md。
- 包含项目状态、待办事项、技术规格和历史记录。
如何使用本技能
1. 回忆信息
- - 始终从搜索 MEMORY.md 开始。
- 跟随地图链接到相关的领域或项目文件。
- 使用 read 仅加载当前任务所需的特定分支。
2. 添加新信息
- - 关于合作关系的新事实: 更新 MEMORY.md。
- 新领域: 在 memory/domains/ 中创建新文件,并从 MEMORY.md 链接它。
- 新项目: 在 memory/projects/ 中创建新文件,并从其主要领域文件链接它。
3. 交叉引用
- - 如果一个项目属于多个领域(例如,需要编码的交易机器人),则从两个领域文件链接项目文件。
自动化工具
使用提供的脚本维护层级结构:
- - scripts/add_branch.py:自动创建新的领域或项目文件,包含正确的模板和链接。
最佳实践
- - 原子写入: 保持项目文件仅专注于该项目。
- 反向链接: 每个分支应包含返回根或返回领域的链接。
- 修剪: 在心跳期间,审查分支并移除过时信息。
- 为何重要: 每个分支和主要条目必须包含重要性行(这为什么重要?),以防止僵尸记忆(无用数据积累)。
- 近期增量: 在每个领域/项目文件夹中维护一个 recent_delta.md,包含最近3-7天的变更,用于快速上下文同步。