capsule-memory README

The project's README from github.com/unicity-aos/capsule-memory. As one markdown file: README.md.

astrid-capsule-memory

License: MIT OR Apache-2.0 MSRV: 1.94

Cross-session memory for Astrid OS agents.

In the OS model, this capsule is the persistent swap file. It carries context across session boundaries so the agent remembers what happened last time.

How it works

Hooks into prompt_builder.v1.hook.before_build. On each prompt assembly cycle:

  1. Reads .astrid/memory.md from the workspace via the VFS
  2. Wraps the content in a # Memory section
  3. Publishes an appendSystemContext hook response on the per-request response topic

If the file is missing or empty, the capsule is a no-op.

Size cap

Agent-written content can grow without limit (unlike human-authored AGENTS.md), so a 32KB hard cap prevents unbounded context window consumption. Content beyond the limit is truncated at a UTF-8 character boundary with a [Memory truncated] marker.

Read-only

This capsule handles the read/inject side only. The agent writes to .astrid/memory.md using existing filesystem tools (write_file, replace_in_file) from astrid-capsule-fs. No new tools needed.

Development

cargo build --target wasm32-unknown-unknown --release

License

Dual-licensed under MIT and Apache 2.0.

Copyright (c) 2025-2026 Joshua J. Bouw and Unicity Labs.

capsule-memory (unicity-aos/capsule-memory)

Searching Database…

这是什么?这是 Astrid OS / Unicity AOS 智能体的一个插件(capsule),用于实现跨会话记忆:它从工作区读取一个本地记忆文件,并将内容注入系统提示词,让智能体记住之前会话中发生的事情。
这是独立应用,还是某个更大系统的插件?它是一个小型 Rust 钩子模块(插件),接入 Astrid OS 的提示词构建流水线。它只能作为更大的 Unicity AOS 智能体框架的一部分使用,无法单独运行。
我该如何让它运行起来?无需单独安装。每次组装提示词时,它都会通过 VFS 自动读取工作区中的 '.astrid/memory.md',将其包裹在 '# Memory' 段落中,并发布一个 appendSystemContext 钩子响应。
它需要其他 Astrid OS 插件才能工作吗?需要。这个插件只负责读取记忆;写入 '.astrid/memory.md' 则通过独立的 astrid-capsule-fs 插件提供的文件系统工具(writefile、replaceinfile)完成。
它能注入的记忆量有限制吗?有限制。内容上限为 32KB,以保护上下文窗口。超出部分会在 UTF-8 字符边界处被截断,并附上截断提示。
这个插件面向哪些人?面向在 Astrid OS / Unicity AOS 上构建或扩展智能体的开发者,希望其智能体在会话之间保留上下文。
什么是 Astrid OS / Unicity AOS?它是一个智能体操作系统框架。本项目只是其中若干模块化插件之一,这些插件为 AI 智能体提供类似操作系统的基础能力(如文件系统、记忆等)。本插件则充当上下文的持久化交换文件。
如果 memory.md 还不存在会怎样?插件会直接变为空操作,在该文件存在且有内容之前,不会向提示词注入任何内容。
为什么不直接使用人工编写的 AGENTS.md 式记忆文件?因为智能体写入的内容可能无限增长,而人工编写的 AGENTS.md 不会这样。因此本插件设定了 32KB 的硬性上限,以保持上下文窗口可控。
Size
0.1 MB
Stars
8.4K
Age
7mo
Commits · 90 Days