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 agentmods add agents/labilezhu/everlingo/memory-writer-agent-specgit clone --depth 1 https://github.com/labilezhu/everlingoWrote 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/agents/labilezhu/everlingo/memory-writer-agent-spec)<a href="https://agentmods.dev/agents/labilezhu/everlingo/memory-writer-agent-spec"><img src="https://agentmods.dev/badge/agents/labilezhu/everlingo/memory-writer-agent-spec.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.00000 | $0.05887 |
| Opus 5 | $0.00000 | $0.02943 |
| Sonnet 5 | $0.00000 | $0.01177 |
| Haiku 4.5 | $0.00000 | $0.00589 |
Grade A, and why
memory-writer-agent-spec 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 323 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Memory Writer Agent
负责写入 memory vault 。
Memory Writer Agent 负责验证、合并 Chat Agent 构造的 entries,并写入 memory vault 。
除"创建/合并笔记"主流程外,Writer 还接收 Chat Agent 同步触发的"删除 / 编辑"请求,走代码路径,不调 LLM(见下文「笔记删除与编辑」节)。
Memory Writer Agent 用一个队列接收请求,然后异步处理。Memory Writer Agent 是全局单例和独立单线程或协程。由于使用独立单线程或协程,所以没有并发写文件问题。队列内容不需要持久化,可接受因程序非法结束的丢失。
即,用独立 daemon Thread + queue.Queue 。
单例归属:放 src/everlingo/gateway/gateway.py 模块级实例。
实现形态(2026-07 迁移):所有 vault 文件操作改走 Vault MCP Server(indexer 进程内嵌的 FastMCP Streamable HTTP server);MCP URL 从 $workspace/indexer.mcp.url 发现。indexer 离线时,entry 被丢弃并 logger.error 告警,不重试、不阻塞队列。
Memory Writer 并发模型图(双入口):
vars: {
d2-config: {
layout-engine: elk
theme-id: 4
dark-theme-id: 200
}
}
direction: down
p_batch: "生产者① MainAgent.invoke() 末尾\nbatch list[MemoryEntry]\n(异步,不阻塞回复)"
p_action: "生产者② Chat Agent memory_writer_action\ndelete/edit 请求(同步等待结果)"
q: "queue.Queue\nitem① list[MemoryEntry]\nitem② _ActionRequest(entry, future)" { shape: cylinder }
thread: "daemon thread _run_loop\n全局单例·串行消费·无锁" {
pb: "_process_batch"
pa: "_process_action\ndelete/edit 纯代码(no LLM)"
}
kb: "_write_kb_item_async(per-entry)" {
agent: "create_agent(self._llm, tools)\nsystem_prompt:mem_entry_spec /\nenvelope_spec / vault_spec(MCP 加载)"
llm: "LLM 合并或新建 kb markdown" { shape: cloud }
}
evt: "_append_event_async(纯代码)\nstat → write(preamble) / append(section)"
mcp: "Vault MCP Server(Indexer 进程)\nper-entry mcp_vault_connection(lang)\n沙箱锁定 lang vault_dir"
vault: "vault 文件系统 memory/languages/<lang>/vault/" {
items: "items/\nkb item:LLM 合并/新建 markdown" { shape: page }
events_f: "events/YYYY/MM/DD.md\n## Event 段落追加(纯代码)" { shape: page }
}
notice: "notice_sink.notify → Session SystemNotice\n(写入确认告知,Chat Agent 决定是否转述)"
imgstore: "ImageStore\ncopy_session_image_to_vault 路径" { shape: cylinder }
off_b: "离线降级(创建流程):\nentry 丢弃 + logger.error 告警\n不重试、不阻塞队列" { shape: text; style.opacity: 0.75 }
off_a: "离线降级(action 流程):\nIndexerOfflineError 经 future.set_exception 回传\nChat Agent 抛出并转告用户(不丢弃)" { shape: text; style.opacity: 0.75 }
p_batch -> q: "入队"
p_action -> q: "execute_action_async\nasyncio.wrap_future(future)"
q -> thread: "串行 get() 按 item 类型分发"
thread.pb -> kb
thread.pb -> evt
kb -> mcp: "fs 工具 read / write / find / grep"
evt -> mcp: "stat / write / append"
thread.pa -> mcp: "read / delete / write\nfrontmatter 保护字段强制保留原值"
mcp -> vault.items: "normalize_frontmatter_text 归一化后落盘"
mcp -> vault.events_f
kb -> notice: "解析最终 AIMessage 确认 JSON\nupdated_files / update_summary"
kb -> imgstore: "嵌聊天图片时先复制\n拿 markdown_relative_path"
imgstore -> vault: "图片写入 {md}.assets/"
mcp -> off_b: "MCP 连不上"
mcp -> off_a: "MCP 连不上"
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.
- 5d ago First seen · 323 lines · 0 tokens per session scan A 2eb32b15e1f7
memory-writer-agent-spec is an agent published in the GitHub repository labilezhu/everlingo (12 stars, last pushed 11d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 5,887 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
context
You are the Context agent. Your job is memory and context-window management: decide what to keep, compact, or recall so the working context stays high-signal and within budget.
ia-learnings-researcher
Searches docs/solutions/ for relevant past solutions by frontmatter metadata. Use before implementing features or fixing problems to surface institutional knowledge and prevent repeated mistakes.
memory
Agent "memory" from bestdeejay-design/awesome-ai-handbook, covering agent memory: short-term, long-term, vector, 1. why agents need memory, 2. types of memory, 3. short-term memory (working) and the problem: context overflow.
documcp-memory
Work with DocuMCP's Knowledge Graph memory system.
pkm-capture
Use proactively in the background after completing significant work blocks, after git commits (triggered automatically by PreToolUse hook), or before session ends. Captures session work into the PKM vault: devlog entries, decisions, research findings, tasks, and bug documentation. Conservative — most exchanges produce…
backlink-manager
Maintain wiki backlinks — update reverse index, related fields, and detect unlinked mentions after page creation/update.