agentleFS
rongarederongarede/claude-skills-orchestration/skills/agent-memory/SKILL.md

agent-memory

Skill1 starsChanged 8 months agoMITView on GitHub

联想记忆系统:为 Claude Code subagent 提供基于 BM25 + 三维评分的记忆检索、存储、反馈学习能力

38 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use observability, data-analysis and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 4 projects that use this

  • shanggqmSkill

    data-analysis

    数据分析技能,提供结构化的数据查询、统计分析和报告生成工作流。当用户需要查询数据库、进行数据统计分析、生成分析报告时使用。按规范输出原始数据、计算结果、Markdown报告和HTML可视化报告。

    Also in 3 projects that use this

  • Microsoft AzureSkill

    skill-authoring

    Write Agent Skills that comply with the agentskills.io specification. WHEN: "create a skill", "new skill", "write a skill", "skill template", "skill structure", "review skill", "skill PR", "skill compliance", "SKILL.md format", "skill frontmatter", "skill best practices". DO NOT USE FOR: general documentation. INVOKES: vally CLI.

    Also in 3 projects that use this

  • VercelSkill

    technical-writing

    Write, edit, review, or audit user-facing documentation for the eve repository. Use for changes under docs/, documentation tied to eve APIs or CLI behavior, docs work based on Slack or support feedback, and requests to make eve docs clearer, more natural, or less AI-patterned while verifying claims against current source, tests, CLI help, public releases, and repository conventions.

    Also in 3 projects that use this

  • JetBrainsSkill

    webapp-testing

    Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

    Also in 4 projects that use this

  • AnthropicSkill

    pdf

    Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

    Also in 5 projects that use this

The file

Files
SKILL.md

Agent Memory System

为 Claude Code subagent 提供联想记忆能力。

核心能力

能力模块说明
存储memory_store.pyMarkdown 文件存储,YAML frontmatter 元数据
检索retriever.pyBM25 + 扩散激活 + 三维评分(相关性/重要性/新近性)
关联associator.py共现分析 + 语义相似度
提取extractor.py从任务描述自动提取结构化记忆
注入inject.py向 agent prompt 注入相关记忆上下文
演化evolver.pyLLM 驱动的记忆邻居演化
去重consolidator.pyJaccard 相似度合并(阈值 0.85)
衰减decay_engine.pyEbbinghaus 遗忘曲线 R=e^(-t/S)
学习feedback_loop.py自动推断 + 渐进式升级(降权→告警→阻断,health 过滤)
触发trigger_tracker.py触发效率追踪:record/efficiency/adjust/stats/reset
导出obsidian_export.pyObsidian 笔记/MOC/Mermaid 图
注册registry.pyAgent 角色注册表

存储格式

每条记忆为一个 .md 文件,YAML frontmatter 包含元数据:

---
id: task_example
name: 任务描述
description: 一句话摘要
type: task
owner: tetsu
scope: private
importance: 8
access_count: 3
positive_feedback: 5
negative_feedback: 1
keywords: [TDD, Python]
tags: [implementation]
timestamp: 2026-03-14T22:00:00
---

记忆正文内容...

CLI 用法

# 基础路径
SCRIPT=~/.claude/skills/agent-memory/scripts/cli.py

# 快速添加记忆
python3 $SCRIPT --agent tetsu --store ~/.claude/memory/agents/Worker/tetsu \
  quick-add --name "任务名" --description "描述" --type task --context "执行上下文" "正文内容"

# 检索记忆
python3 $SCRIPT --agent tetsu --store ~/.claude/memory/agents/Worker/tetsu \
  retrieve --query "搜索关键词" --top-k 5

# 快速添加(明确字段)
python3 $SCRIPT --store ~/.claude/memory/agents/Worker/tetsu \
  add --subject "任务主题" --description "详细描述" --keywords "kw1,kw2" --importance 7

# 反馈(手动正向)
python3 $SCRIPT --agent tetsu --store ~/.claude/memory/agents/Worker/tetsu \
  feedback --memory-id "mem_id" --useful

# 反馈(手动负向)
python3 $SCRIPT --agent tetsu --store ~/.claude/memory/agents/Worker/tetsu \
  feedback --memory-id "mem_id" --not-useful

# 反馈(自动推断)
python3 $SCRIPT --agent tetsu --store ~/.claude/memory/agents/Worker/tetsu \
  feedback --memory-id "mem_id" --auto --event task_success

# 记忆去重合并
python3 $SCRIPT --store ~/.claude/memory/agents/Worker/tetsu \
  consolidate --threshold 0.85 --dry-run

# 列出记忆
python3 $SCRIPT --store ~/.claude/memory/agents/Worker/tetsu list --limit 10

# 统计
python3 $SCRIPT --store ~/.claude/memory/agents/Worker/tetsu stats

# 生成索引(增量,默认)
python3 $SCRIPT --store ~/.claude/memory/agents/Worker/tetsu generate-index

# 生成索引(强制全量重建)
python3 $SCRIPT --store ~/.claude/memory/agents/Worker/tetsu generate-index --force

# 修复损坏记忆文件(--fix 自动修复, --delete 删除无法修复项, --yes 跳过确认)
python3 $SCRIPT --store ~/.claude/memory/agents/Worker/tetsu repair --fix --delete --yes

# 一站式健康概览(blocked/warning/healthy 分布 + 衰减统计,--trigger-stats 附加触发效率)
python3 $SCRIPT --agent tetsu --store ~/.claude/memory/agents/Worker/tetsu dashboard --trigger-stats

路径约束

Agent正确路径
tetsu~/.claude/memory/agents/Worker/tetsu
shin~/.claude/memory/agents/Auditor/shin
fumio~/.claude/memory/agents/Weaver/fumio
root~/.claude/memory/agents/root

--store 参数优先于 --agent 推断的路径。

测试

cd ~/.claude/skills/agent-memory
python3 -m pytest  # 491 tests, ~5s

架构演进

Phase内容状态
Phase 1Active Recall + Retrieval Feedback已完成
Phase 2Memory Consolidation + Decay已完成
Phase 3Feedback Learning Loop已完成
Phase Afeedback_loop.py 审计修复(M1-M4)已完成
Phase Bretriever + cli feedback 集成已完成
Phase Ctrigger_tracker.py 智能触发追踪已完成
Phase D端到端测试(5 场景,12 tests)已完成
Phase E全量审计 + 文档同步已完成
Round 2深度集成(decay+feedback 联动、consolidator+health 联动、CLI dashboard)已完成
Round 3自动化集成(feedback hook、trigger-map 注释、CLI 专项测试 +60、evolver+feedback 联动)已完成
Round 4智能自动化(auto-consolidate hook、scheduled decay hook、cross-agent retriever、performance benchmarks)已完成
Round 5健壮性强化(conftest fixtures、incremental index、corrupted recovery、full workflow tests)已完成

也可在 CLI 中添加 health-check 和 trigger 子命令:

# 健康检查(--show-all 显示全部记忆,含 healthy 状态)
python3 $SCRIPT --agent tetsu --store ~/.claude/memory/agents/Worker/tetsu health-check --show-all

# 触发追踪
python3 $SCRIPT --agent tetsu --store ~/.claude/memory/agents/Worker/tetsu trigger stats

# 记忆演化
python3 $SCRIPT --store ~/.claude/memory/agents/Worker/tetsu \
  evolve mem_xxxxx --context "新语境" --tags "tag1,tag2"

# 跨 agent 联合检索(Round 4 新增)
python3 $SCRIPT retrieve --cross-agent --query "搜索关键词" --top-k 5
python3 $SCRIPT retrieve --stores "~/.claude/memory/agents/Worker/tetsu,~/.claude/memory/agents/Auditor/shin" --query "搜索关键词"

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.