360 Secure SkillHub
360 安全技能中心

Memory Tree Pipeline

该 Skill 为 AI Agent 提供源、主题、全局三层结构化记忆,支持写入与召回记忆、自动封存为主题摘要、主题提取、全文索引、完整性校验与统计,并强调令牌预算和幂等封存;实现以本地 Python 脚本和文件系统为主。

larios613-hub
larios613-hub
热度 25.05
最近更新 2026-05-23 12:57:02
分类:知识依赖:代码执行 / 读写文件应用场景:笔记整理 / 摘要总结 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add memory-tree-pipeline
Metadata
name
memory-tree-pipeline
version
1.0.0
description
Three-scope structured memory for AI agents. Automatically organize, summarize, and index agent memory with sealing workers and topic extraction.
license
MIT
tags
["memory","agent-memory","structured-memory","topic-extraction","summarization","context-management"]
source
el-rudo-larios/memory-tree
trigger
agent memory structured memory topic extraction summarization pipeline
metadata
{"openclaw":{"emoji":"🌳"}}

Memory Tree — Three-Scope Structured Memory

A structured memory system with three scopes (source, topic, global) that automatically organizes, summarizes, and indexes agent memory. Never lose context again.

Architecture

Source (raw) → Topic (summarized) → Global (cross-topic knowledge)
   134 files         13 files              6 files

Quick Start

from memory_tools import MemoryTools

tools = MemoryTools(workspace="/path/to/workspace")

# Store a memory
tools.store("User prefers dark mode for all UI", topic_hint="preferences")

# Recall memories
results = tools.recall("dark mode", scope="global")

# Seal source → topic summaries
tools.seal()

# Check status
status = tools.status()
# → {"source_files": 134, "topic_files": 13, "global_files": 6}

Features

  • Three-scope hierarchy: Source → Topic → Global
  • Automatic sealing: Raw memories compressed into topic summaries
  • Topic extraction: Automatic categorization by content
  • Index management: Full-text search across all scopes
  • Budget enforcement: Topic files < 2000 tokens, Global < 5000 tokens
  • Idempotent sealing: Safe to run multiple times

Testing

python -m pytest test_memory_tree.py -v
# 15 tests passing

License

MIT