Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add echoVic/blade-code --skill project-auto-memorygit clone --depth 1 https://github.com/echoVic/blade-codeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/echovic/blade-code/project-auto-memory)<a href="https://agentmods.dev/skills/echovic/blade-code/project-auto-memory"><img src="https://agentmods.dev/badge/skills/echovic/blade-code/project-auto-memory.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00137 | $0.01886 |
| Opus 5 | $0.00068 | $0.00943 |
| Sonnet 5 | $0.00027 | $0.00377 |
| Haiku 4.5 | $0.00014 | $0.00189 |
Grade A, and why
knowledge-session-state-and-context-project-auto-memory scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
80% identical to knowledge-session-state-and-context — 75 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 56 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Module Structure
Auto Memory 位于 Session transcript 之外,以项目路径派生独立存储目录。系统提示只自动加载有界索引,详细 topic 由工具按需读取;成功压缩后还会用无 LLM 的规则从被丢弃消息中追加少量候选知识。
Directory Layout
packages/cli/src/memory/AutoMemoryManager.ts:索引、topic、列举和清理packages/cli/src/memory/MemoryConsolidation.ts:压缩后启发式提取packages/cli/src/memory/types.ts:启用开关与索引行数预算packages/cli/src/tools/builtin/memory/MemoryReadTool.ts:按 topic 读取或列举packages/cli/src/tools/builtin/memory/MemoryWriteTool.ts:手工写入与敏感模式拒绝packages/cli/src/prompts/builder.ts:新模型上下文中的索引注入packages/cli/src/slash-commands/memory.ts:用户侧项目记忆管理
Key Entry Points
AutoMemoryManager.loadIndex():加载有界MEMORY.mdAutoMemoryManager.readTopic()/writeTopic():读取或更新详细主题extractLearnings():从用户、assistant 和 tool 消息提取有限规则命中consolidateAfterCompaction():按日期追加提取结果memoryReadTool/memoryWriteTool:模型侧手工访问入口
Gotchas
MEMORY.md自动注入只取前 200 行并附加剩余行提示;MemoryRead(topic="MEMORY")仍可读取完整索引,因此索引过长不会丢失,但会增加一次显式工具调用 (packages/cli/src/memory/AutoMemoryManager.ts,packages/cli/src/tools/builtin/memory/MemoryReadTool.ts)BLADE_AUTO_MEMORY=0只阻止 Prompt builder 自动注入索引,不会注销 MemoryRead/MemoryWrite,也不会阻止手工访问项目记忆 (packages/cli/src/prompts/builder.ts,packages/cli/src/tools/builtin/index.ts)- topic 中的路径分隔符和特殊字符统一替换为
-;不同原始 topic 可能映射到同一个.md文件,调用方不能把原始名称当成无碰撞身份 (packages/cli/src/memory/AutoMemoryManager.ts) - append 是“读取旧正文再整体 writeFile”,AutoMemoryManager 没有 keyed mutex 或原子替换;MemoryWrite 的非并发标记只约束单个 executor,跨 Session 同 topic 写入仍可能 last-writer-wins (
packages/cli/src/memory/AutoMemoryManager.ts,packages/cli/src/tools/builtin/memory/MemoryWriteTool.ts) - Memory 工具优先用
ExecutionContext.workspaceRoot派生项目,Prompt builder 使用传入的projectPath,自动巩固使用getCwd();worktree 和多 workspace 路径必须显式对齐,不能假设三条入口天然写到同一目录 (packages/cli/src/tools/builtin/memory/MemoryReadTool.ts,packages/cli/src/tools/builtin/memory/MemoryWriteTool.ts,packages/cli/src/prompts/builder.ts,packages/cli/src/memory/MemoryConsolidation.ts) - MemoryWrite 的敏感信息拒绝只覆盖少量
password/token/secret/api key/private key正则,既可能漏掉其他凭据,也允许不带赋值形态的普通 password 语句;通过校验不等于内容可安全持久化 (packages/cli/src/tools/builtin/memory/MemoryWriteTool.ts) - MemoryRead 对 topic 不存在和空列表都返回
success: true,调用方必须检查返回正文,不能把工具成功当作记忆已命中 (packages/cli/src/tools/builtin/memory/MemoryReadTool.ts) listTopics()只把ENOENT解释为空列表,其他文件系统错误会抛出并可由 retry-safe 的 MemoryRead 做瞬态重试;deleteTopic()仍把任意 unlink 异常折叠为 false,两个入口的失败语义不同 (packages/cli/src/memory/AutoMemoryManager.ts,packages/cli/src/tools/builtin/memory/MemoryReadTool.ts)- 自动巩固只识别用户显式 remember/convention/lesson 标记、assistant 的 fix 文本和有限 tool error 模式;tool error 每次最多保留 5 条,它不是对被丢弃上下文的完整语义总结 (
packages/cli/src/memory/MemoryConsolidation.ts) - 压缩成功后 consolidation 以 fire-and-forget 启动并吞掉全部异常;记忆写入失败既不回滚 checkpoint,也不会令 compaction 失败 (
packages/cli/src/context/CompactionService.ts,packages/cli/src/memory/MemoryConsolidation.ts)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 56 lines · 137 tokens per session scan A fb7befe4163a
knowledge-session-state-and-context-project-auto-memory is a skill published in the GitHub repository echoVic/blade-code (178 stars, last pushed yesterday), licensed MIT. It adds 137 tokens to every session and 1,886 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. It is 80% identical to knowledge-session-state-and-context, differing in 75 lines, and is treated as a copy.
Other skills, from other repositories
algorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright…
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external agents through well-designed tools. Use when building MCP servers to integrate external APIs or agents, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
slack-gif-creator
Toolkit for creating animated GIFs optimized for Slack, with validators for size constraints and composable animation primitives. This skill applies when users request animated GIFs or emoji animations for Slack from descriptions like "make me a GIF for Slack of X doing Y".
canvas-design
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.
self-improvement
A process for recording useful lessons from unexpected failures, user corrections, missing abilities, and reusable project patterns.
travel-planner
Creates comprehensive travel itineraries with destination analysis, budget planning, transportation, accommodation, and local insights. Use when planning trips, organizing travel schedules, or seeking destination recommendations.