内容
# 代码代理内存市场(Windows)
[agentmemory](https://github.com/rohitg00/agentmemory) 的社区打包,用于 **Codex / ChatGPT 桌面版在 Windows**。
这是一个 **Git 市场** 插件包,而不是 OpenAI 官方的插件目录列表。
## 快速开始
```powershell
# 1. 全局安装 agentmemory(允许本机模块 postinstall 脚本)
npm install -g --allow-scripts=onnxruntime-node,sharp,protobufjs @agentmemory/agentmemory
# 2. 启动后端
agentmemory
# 3. 打开 ChatGPT 桌面版 → 插件 → 添加插件市场
# 来源:https://github.com/GoldenLoaf24h/codex-agentmemory-marketplace
# 安装“AgentMemory(Codex / Windows)”并启动新任务
```
> **完整上游安装文档:**
> [github.com/rohitg00/agentmemory → 安装](https://github.com/rohitg00/agentmemory)
## 先决条件
agentmemory 依赖于需要 postinstall 脚本编译的本机模块(`onnxruntime-node`、`sharp`、`protobufjs`)。**您必须在安装前允许这些脚本。**
### 选项 A:安装时允许(推荐)
```powershell
npm install -g --allow-scripts=onnxruntime-node,sharp,protobufjs @agentmemory/agentmemory
```
### 选项 B:永久 allow-scripts 配置
```powershell
npm config set allow-scripts=onnxruntime-node,sharp,protobufjs,protobufjs --location=user
npm install -g @agentmemory/agentmemory
```
之后,随后的安装/升级将不需要 `--allow-scripts` 标志。
### 验证安装
```powershell
agentmemory
```
首次运行将启动交互式设置(选择代理,配置 LLM 提供程序)。设置完成后,后端将在 `http://localhost:3111` 启动。
## 目标环境
| 项目 | 值 |
|---|---|
| 上游 | [rohitg00/agentmemory](https://github.com/rohitg00/agentmemory) |
| 客户端 | **Codex / ChatGPT 桌面版** |
| 操作系统焦点 | **Windows**(PowerShell / Node.js) |
| 分发 | 公共 GitHub 市场 |
| 官方公共目录 | 否 |
## 您获得的内容
- **MCP 配置** — 插件提供 `.mcp.json`,指向 `@agentmemory/mcp`,无需手动设置
- **生命周期钩子** — SessionStart / UserPromptSubmit / PreToolUse / PostToolUse / PreCompact / Stop
- **自动启动** — SessionStart 钩子在 `:3111` 上启动 `agentmemory` 后端(如果尚未运行)(通过 `cmd.exe` shell,与在 PowerShell 中输入相同)
- **优化技能**:
- `recall`、`remember`、`forget`
- `handoff`、`recap`、`session-history`
- `commit-context`、`commit-history`
- `agentmemory-troubleshooting`
## 要求
- 具有 Codex / Work 模式插件的 ChatGPT 桌面应用程序
- **Windows**(推荐)
- Node.js 18+(在 PATH 中)
- 全局安装的 `agentmemory` CLI(参见 [先决条件](#先决条件))
## 在 ChatGPT 桌面版中添加此市场
1. 打开 **插件** → **添加插件市场**
2. 填写:
| 字段 | 值 |
|---|---|
| 来源 | `https://github.com/GoldenLoaf24h/codex-agentmemory-marketplace` |
| Git 引用 | `main` |
| 稀疏路径 | *(留空)* |
3. 点击 **添加市场**
4. 从市场安装 **AgentMemory(Codex / Windows)**
5. **批准所有钩子** — 转到 **设置 → 钩子**,审查每个钩子,并点击 **允许 / 批准** 每个属于此插件的钩子条目。**钩子不会在您明确批准它们之前运行。**
6. **重启** 应用程序或在安装后启动 **新任务**
市场文件:`.agents/plugins/marketplace.json`
> **重要:** Codex 桌面版需要对插件注册的每个钩子进行明确的用户批准。安装此插件后,请导航到 **设置 → 钩子** 并批准所有钩子(SessionStart、UserPromptSubmit、PreToolUse、PostToolUse、PreCompact、Stop)。在批准之前,插件的自动启动、内存召回和观察捕获将完全静默 — 没有错误,只是没有任何反应。
## 首次运行行为
在 SessionStart 时,插件:
1. 探测 `http://127.0.0.1:3111/agentmemory/livez`
2. 如果后端关闭,则通过 `cmd.exe` 在后台启动 `agentmemory`(与在 PowerShell 中输入 `agentmemory` 相同)
3. 最多等待 ~30 秒准备就绪
4. 注册会话上下文
如果自动启动失败,请手动启动后端,然后重启 Codex:
```powershell
agentmemory
```
保持该终端打开。后端必须在端口 **3111** 上可访问。
## 模式
| 模式 | 何时 | 工具 |
|---|---|---|
| 本地 / InMemoryKV | 后端在 `:3111` 上不可访问 | 减少工具,独立存储 |
| **代理** | 后端在 `:3111` 上运行 | **完整工具集(50+)** |
> 探测 `http://127.0.0.1:3111/agentmemory/livez` 以检查状态。返回数据的工具 **不是** 代理模式活跃的证明。
## 多代理注意
此包为 Codex MCP 服务器设置 `AGENT_ID=codex`。如果您还针对同一 agentmemory 实例运行 Hermes 或其他客户端,请为每个客户端提供不同的 `AGENT_ID` 以避免数据冲突。
## Windows 注意
- 验证为 **Windows + Codex 桌面版**
- 优先使用一键启动:PowerShell 中的 `agentmemory`
- 确保 `node` 在 PATH 中(`node --version` 在 PowerShell 中有效)
- 不要手动分割引擎进程或单独运行 `iii`
- 持久化 allow-scripts 配置:`npm config set allow-scripts=... --location=user`(参见 [先决条件](#先决条件))
## 致谢
- 上游项目:[rohitg00/agentmemory](https://github.com/rohitg00/agentmemory)
- 上游作者:Rohit Ghumare
- 许可证:Apache-2.0(参见 `LICENSE`)
## 隐私
内存存储在 `%USERPROFILE%\.agentmemory\data\`(Windows 上的 `~/.agentmemory/data/`)本地存储。此包不提供托管云服务。
## 免责声明
这是 [rohitg00/agentmemory](https://github.com/rohitg00/agentmemory) 的非官方社区打包,用于 Windows Codex 桌面版本地使用和 Git 市场分发。它不是 OpenAI 审查的公共插件目录提交,也不是官方上游存储库。