实例 ID 不是凭据
XMEMO_AGENT_INSTANCE_ID 用于标识本地客户端或运行器实例;它不会授权请求。API key 或 OAuth grant 才是访问凭据。服务器会根据实例值生成 agent_instance_id_hash,并将边界权限报告为 attribution_only。
- Credential:X-API-Key 或受支持的 OAuth bearer grant 控制访问权限。
- Instance label:X-Memory-OS-Agent-Instance-ID 让服务器能够比较写入 runner 与后续 caller。
- Agent label:X-Memory-OS-Agent-ID 将逻辑 agent 与某一次安装分别标识。
先规范化,再哈希
运行时会去除 instance id 两端空白、拒绝空值,并在哈希前最多接受 256 个字符。存储的 hash 会规范化为 sha256:<64 hexadecimal characters>;格式错误的预哈希值会被忽略,不会被当作凭据。
from memory_manager.auth.agent_identity import agent_instance_id_hash
instance_hash = agent_instance_id_hash("codex-local-install")
# sha256:<64 hexadecimal characters>每次本地安装保留一个值
在 repository 外保存一个非机密的 instance 值,并将它与访问凭据一起发送。同一安装重启后继续复用它;不同的本地 profile 应选择不同的值。
X-API-Key: <your-assigned-api-key>
X-Memory-OS-Agent-ID: codex
X-Memory-OS-Agent-Instance-ID: <stable-local-instance-id>边界语义是明确的
memory_agent_boundary 会将 caller 的 agent_id 和 instance hash 与数据行中的值比较。两者都匹配时为 self;agent_id 匹配但 hash 不同时为 same_agent_other_instance;缺少可比较身份时报告为 unverified 或 unknown。这些标签用于解释归因,不能替代 token authorization。
{
"relation": "self",
"ownership": "current_agent",
"boundary_authority": "attribution_only",
"current_agent_trust": "client_asserted"
}角色工作流
ChatGPT 用户
让 ChatGPT 持久访问你的 XMemo 偏好、项目事实、决策和 TODO,同时不把 bearer token 粘贴到聊天里。
保存一条合成偏好或项目笔记,开启新聊天,再让 ChatGPT 在继续工作前通过 XMemo 召回它。
Copilot / Codex 开发者
在 IDE 与 CLI agent 之间携带仓库决策、编码规范、bug 修复说明和任务历史。
记录一条代码库决策或 bug 修复,然后让下一个 IDE 或 CLI agent 在编辑前召回相关 XMemo 上下文。
团队 / 企业 pilot owner
用账户控制、来源归因、导出/删除流程和 reviewer-safe 设置证据来评估共享记忆。
让一名 pilot 成员保存一条合成团队记忆,在 XMemo 中确认来源归因,然后审阅删除/导出和支持路径。
来源: Agent 身份