Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/usage-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ Recall counts every doc it returns (`recalled_count`). A returned doc is **adopt
| Copilot CLI | Yes | No: the subagent has a session of its own, and no hook links it to its parent |
| Cursor | Yes | No: as for Copilot CLI |
| OpenCode | Yes | Yes: the `task` call links the subagent's session to its parent |
| OMP | Yes, settled only by the claim of its `bash` call | No: the subagent's session is not linked to its parent |
| OMP | Yes, settled only by the claim of its `bash` call | Yes: the subagent's session file sits under its parent's, whose session header links the two sessions (verified against OMP 18.4.8) |
| Pi | Yes | None: TeamAI deploys no subagent to Pi |
| ZCode | Yes | No: ZCode runs no hooks inside a subagent |
| OpenClaw, Hermes, Kiro, JoyCode | No: no PostToolUse hook | No |
Expand All @@ -1371,7 +1371,7 @@ Recall counts every doc it returns (`recalled_count`). A returned doc is **adopt
**Known limits.**

- **Cursor, Copilot CLI and ZCode subagents.** A recall run in a subagent never credits the main agent's reads: Cursor and Copilot CLI give the subagent its own session with no link to the parent, and ZCode runs no hooks in it. A recall the main agent runs itself does vote.
- **OMP.** The subagent's session is not linked to its parent, so the subagent path gives no adoption. OMP sets no session variable in its shell, so a run settles only through the claim of the `bash` call that ran it: when OMP moves a large output into an artifact, the `run=` line and the vote are lost, and an OMP started from a Claude Code shell records its run under the Claude session until that claim corrects it.
- **OMP.** The subagent path needs the main session's file on disk: when it has none (`--no-session`), the subagent is not linked to its parent and gives no adoption. OMP sets no session variable in its shell, so a run settles only through the claim of the `bash` call that ran it: when OMP moves a large output into an artifact, the `run=` line and the vote are lost, and an OMP started from a Claude Code shell records its run under the Claude session until that claim corrects it.
- **Searches not counted.** OMP's `grep` (a markdown tree) and Cursor's `Grep` add no evidence; opening the doc still counts. ZCode prints `Grep` lines relative to its working directory, so a ZCode search run from a directory inside the team repo is not counted.
- **No PostToolUse hook.** OpenClaw, Hermes, Kiro and JoyCode record their recalls but no reads, so these recalls never vote.
- **Older CLIs.** A member on an older TeamAI still votes from the session transcript, and that path keys a skill, a doc in a subdirectory or a wiki page by its file's basename (`SKILL`, `setup`) rather than the id recall prints (`retry`, `common/setup`), so those votes miss the doc. Top-level learnings and docs are unaffected, and upgrading ends it.
Expand Down Expand Up @@ -2158,7 +2158,7 @@ These paths are verified against the ZCode desktop app: profiles created in its

### Oh My Pi

Oh My Pi (OMP) is available as a built-in target. TeamAI deploys skills, rules, and subagents to OMP's native directories — `.omp/skills/`, `.omp/rules/`, and `.omp/agents/` at project scope, and `~/.omp/agent/skills/`, `~/.omp/agent/rules/`, and `~/.omp/agent/agents/` at user scope (user-scope resources live under the agent directory `~/.omp/agent/`, a different prefix from the project one, so TeamAI switches prefixes with the scope). Instructions (`claudemd`) deploy to the matching `AGENTS.md`, and MCP servers merge into `~/.omp/agent/mcp.json` / `<project>/.omp/mcp.json` (Claude `mcpServers` shape — see the MCP section above). Skills are one-level `<name>/SKILL.md` bundles and TeamAI fills in a `description` on sync, which OMP's native skill provider requires to discover a skill. These paths follow OMP's documented discovery layout (verified against OMP 18.2.5). Hooks ride OMP's extension runner: `teamai pull` writes a single generated extension to `~/.omp/agent/extensions/teamai-hooks.ts` (never a project copy — OMP auto-loads both roots and would double-dispatch every event), which forwards OMP's `session_start` / `session_stop` / `before_agent_start` / `tool_result` events to the same `teamai hook-dispatch` entry point every other agent uses, gated on the session `cwd`. Every event carries the OMP session id (`ctx.sessionManager.getSessionId()`; a subagent has its own), and `tool_result` also the tool's text output and a status from `isError`, so upvote **adoption** runs for OMP's main agent: OMP sets no session variable in its shell, so a recall joins the session of the `bash` call that ran it, and a `read` with a line selector (`x.md:50-200`, `x.md:raw`) counts as a read of the file. From OMP 18.3.2 a subagent's events also carry its `ctx.agent` id and name, so the `teamai-recall` subagent's own reads never count. A doc the main agent opens after a subagent's recall is not upvoted yet: the subagent's session is not linked to its parent. The `session_stop` handler returns nothing, so a dispatch can never force a session continuation, and there is no matcher-scoped post-tool-use pass because OMP's tool ids are lowercase (`bash`, `read`, …) and it has no `Skill` / `TodoWrite` tool. `teamai uninstall` removes the extension. OMP profiles (`OMP_PROFILE` / `PI_CODING_AGENT_DIR` / `PI_CONFIG_DIR`), which relocate the agent directory, are not supported; the default `~/.omp/agent/` layout is used.
Oh My Pi (OMP) is available as a built-in target. TeamAI deploys skills, rules, and subagents to OMP's native directories — `.omp/skills/`, `.omp/rules/`, and `.omp/agents/` at project scope, and `~/.omp/agent/skills/`, `~/.omp/agent/rules/`, and `~/.omp/agent/agents/` at user scope (user-scope resources live under the agent directory `~/.omp/agent/`, a different prefix from the project one, so TeamAI switches prefixes with the scope). Instructions (`claudemd`) deploy to the matching `AGENTS.md`, and MCP servers merge into `~/.omp/agent/mcp.json` / `<project>/.omp/mcp.json` (Claude `mcpServers` shape — see the MCP section above). Skills are one-level `<name>/SKILL.md` bundles and TeamAI fills in a `description` on sync, which OMP's native skill provider requires to discover a skill. These paths follow OMP's documented discovery layout (verified against OMP 18.2.5). Hooks ride OMP's extension runner: `teamai pull` writes a single generated extension to `~/.omp/agent/extensions/teamai-hooks.ts` (never a project copy — OMP auto-loads both roots and would double-dispatch every event), which forwards OMP's `session_start` / `session_stop` / `before_agent_start` / `tool_result` events to the same `teamai hook-dispatch` entry point every other agent uses, gated on the session `cwd`. Every event carries the OMP session id (`ctx.sessionManager.getSessionId()`; a subagent has its own), and `tool_result` also the tool's text output and a status from `isError`, so upvote **adoption** runs for OMP's main agent: OMP sets no session variable in its shell, so a recall joins the session of the `bash` call that ran it, and a `read` with a line selector (`x.md:50-200`, `x.md:raw`) counts as a read of the file. From OMP 18.3.2 a subagent's events also carry its `ctx.agent` id and name, so the `teamai-recall` subagent's own reads never count. A subagent's session file sits under its parent's, whose header names the parent session, so the extension links the two on the subagent's tool calls, and a doc the main agent opens after a subagent's recall is upvoted (verified against OMP 18.4.8). The `session_stop` handler returns nothing, so a dispatch can never force a session continuation, and there is no matcher-scoped post-tool-use pass because OMP's tool ids are lowercase (`bash`, `read`, …) and it has no `Skill` / `TodoWrite` tool. `teamai uninstall` removes the extension. OMP profiles (`OMP_PROFILE` / `PI_CODING_AGENT_DIR` / `PI_CONFIG_DIR`), which relocate the agent directory, are not supported; the default `~/.omp/agent/` layout is used.

### DeepSeek Harness

Expand Down
6 changes: 3 additions & 3 deletions docs/usage-guide.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ recall 会为返回的每篇文档计数(`recalled_count`)。运行 recall
| Copilot CLI | 支持 | 不支持:subagent 有自己的会话,且没有 hook 将其关联到父会话 |
| Cursor | 支持 | 不支持:同 Copilot CLI |
| OpenCode | 支持 | 支持:`task` 调用将 subagent 的会话关联到父会话 |
| OMP | 支持,仅通过其 `bash` 调用的认领确定归属 | 不支持:subagent 的会话未关联到父会话 |
| OMP | 支持,仅通过其 `bash` 调用的认领确定归属 | 支持:subagent 的会话文件位于父会话文件之下,父会话文件的会话头把两个会话关联起来(对照 OMP 18.4.8 验证) |
| Pi | 支持 | 不适用:TeamAI 不向 Pi 部署 subagent |
| ZCode | 支持 | 不支持:ZCode 在 subagent 内不运行 hook |
| OpenClaw、Hermes、Kiro、JoyCode | 不支持:没有 PostToolUse hook | 不支持 |
Expand All @@ -1251,7 +1251,7 @@ recall 会为返回的每篇文档计数(`recalled_count`)。运行 recall
**已知限制。**

- **Cursor、Copilot CLI 和 ZCode 的 subagent。** 在 subagent 中运行的 recall 从不为主 agent 的读取计分:Cursor 和 Copilot CLI 给 subagent 分配独立会话且不关联父会话,ZCode 在 subagent 内不运行 hook。主 agent 自己运行的 recall 可以正常投票。
- **OMP。** subagent 的会话未关联到父会话,因此 subagent 路径不产生采纳。OMP 不在 shell 中设置会话变量,因此 run 只能通过运行它的 `bash` 调用的认领确定归属:OMP 把大段输出转存为 artifact 时,`run=` 行和投票都会丢失;从 Claude Code shell 启动的 OMP 会先把 run 记在 Claude 会话下,直到该认领将其纠正。
- **OMP。** subagent 路径要求主会话文件已写入磁盘:主会话没有会话文件时(`--no-session`),subagent 无法关联到父会话,也不产生采纳。OMP 不在 shell 中设置会话变量,因此 run 只能通过运行它的 `bash` 调用的认领确定归属:OMP 把大段输出转存为 artifact 时,`run=` 行和投票都会丢失;从 Claude Code shell 启动的 OMP 会先把 run 记在 Claude 会话下,直到该认领将其纠正。
- **不计入的搜索。** OMP 的 `grep`(markdown 树形输出)和 Cursor 的 `Grep` 不产生证据;打开文档仍然计入。ZCode 打印的 `Grep` 行是相对其工作目录的路径,因此从团队仓库内的目录发起的 ZCode 搜索不计入。
- **没有 PostToolUse hook。** OpenClaw、Hermes、Kiro 和 JoyCode 会记录其 recall,但不记录读取,因此这些 recall 从不投票。
- **旧版 CLI。** 使用旧版 TeamAI 的成员仍从会话 transcript 投票,该路径以文件的 basename(`SKILL`、`setup`)而非 recall 打印的 id(`retry`、`common/setup`)作为 skill、子目录中的文档或 wiki 页面的键,因此这些投票落不到该文档上。顶层的 learnings 和文档不受影响,升级后即可解决。
Expand Down Expand Up @@ -2023,7 +2023,7 @@ ZCode 已作为内置目标支持。Skills 下发到 `.zcode/skills/`(ZCode

### Oh My Pi

Oh My Pi(OMP)已作为内置目标支持。TeamAI 将 Skills、Rules 和 Subagents 下发到 OMP 的原生目录——项目级为 `.omp/skills/`、`.omp/rules/` 和 `.omp/agents/`,用户级为 `~/.omp/agent/skills/`、`~/.omp/agent/rules/` 和 `~/.omp/agent/agents/`(用户级资源位于 agent 目录 `~/.omp/agent/` 下,与项目级前缀不同,TeamAI 会随作用域自动切换)。指令(`claudemd`)下发到对应的 `AGENTS.md`;MCP Server 合并进 `~/.omp/agent/mcp.json` / `<project>/.omp/mcp.json`(Claude `mcpServers` 结构,见上文 MCP 章节)。Skills 采用一层 `<name>/SKILL.md` 目录结构,TeamAI 在同步时补全 `description`——OMP 原生 skill 发现要求该字段。以上路径遵循 OMP 官方文档的发现布局(对照 OMP 18.2.5 验证)。Hooks 走 OMP 的 extension runner:`teamai pull` 会生成唯一的 extension 写入 `~/.omp/agent/extensions/teamai-hooks.ts`(绝不写项目副本——OMP 会同时加载两个根并导致每个事件双派发),它把 OMP 的 `session_start` / `session_stop` / `before_agent_start` / `tool_result` 事件转发给所有 agent 共用的 `teamai hook-dispatch` 入口,并按会话 `cwd` 做项目门控。每个事件都携带 OMP 会话 id(`ctx.sessionManager.getSessionId()`;subagent 有自己的会话),`tool_result` 还带上工具的文本输出和根据 `isError` 得出的状态,因此 upvote **采纳(adoption)**在 OMP 主 agent 上生效:OMP 不在其 shell 中设置会话变量,所以 recall 归入运行它的那次 `bash` 调用所在的会话;带行选择器的 `read`(`x.md:50-200`、`x.md:raw`)计为对该文件的读取。从 OMP 18.3.2 起,subagent 的事件还会携带其 `ctx.agent` 的 id 和名称,因此 `teamai-recall` subagent 自身的读取从不计入。主 agent 在 subagent recall 之后打开的文档暂不会被 upvote:subagent 的会话尚未关联到父会话。`session_stop` 处理器不返回任何值,分发绝不会强制会话继续;由于 OMP 的工具名是小写(`bash`、`read` 等)且没有 `Skill` / `TodoWrite` 工具,post-tool-use 不做 matcher 定向分发。`teamai uninstall` 会移除该 extension。OMP 的 profile(`OMP_PROFILE` / `PI_CODING_AGENT_DIR` / `PI_CONFIG_DIR`,会迁移 agent 目录)暂不支持,使用默认的 `~/.omp/agent/` 布局。
Oh My Pi(OMP)已作为内置目标支持。TeamAI 将 Skills、Rules 和 Subagents 下发到 OMP 的原生目录——项目级为 `.omp/skills/`、`.omp/rules/` 和 `.omp/agents/`,用户级为 `~/.omp/agent/skills/`、`~/.omp/agent/rules/` 和 `~/.omp/agent/agents/`(用户级资源位于 agent 目录 `~/.omp/agent/` 下,与项目级前缀不同,TeamAI 会随作用域自动切换)。指令(`claudemd`)下发到对应的 `AGENTS.md`;MCP Server 合并进 `~/.omp/agent/mcp.json` / `<project>/.omp/mcp.json`(Claude `mcpServers` 结构,见上文 MCP 章节)。Skills 采用一层 `<name>/SKILL.md` 目录结构,TeamAI 在同步时补全 `description`——OMP 原生 skill 发现要求该字段。以上路径遵循 OMP 官方文档的发现布局(对照 OMP 18.2.5 验证)。Hooks 走 OMP 的 extension runner:`teamai pull` 会生成唯一的 extension 写入 `~/.omp/agent/extensions/teamai-hooks.ts`(绝不写项目副本——OMP 会同时加载两个根并导致每个事件双派发),它把 OMP 的 `session_start` / `session_stop` / `before_agent_start` / `tool_result` 事件转发给所有 agent 共用的 `teamai hook-dispatch` 入口,并按会话 `cwd` 做项目门控。每个事件都携带 OMP 会话 id(`ctx.sessionManager.getSessionId()`;subagent 有自己的会话),`tool_result` 还带上工具的文本输出和根据 `isError` 得出的状态,因此 upvote **采纳(adoption)**在 OMP 主 agent 上生效:OMP 不在其 shell 中设置会话变量,所以 recall 归入运行它的那次 `bash` 调用所在的会话;带行选择器的 `read`(`x.md:50-200`、`x.md:raw`)计为对该文件的读取。从 OMP 18.3.2 起,subagent 的事件还会携带其 `ctx.agent` 的 id 和名称,因此 `teamai-recall` subagent 自身的读取从不计入。subagent 的会话文件位于父会话文件之下,父会话文件的头部写明父会话 id,因此 extension 会在 subagent 的工具调用中关联这两个会话,主 agent 在 subagent recall 之后打开的文档会被 upvote(对照 OMP 18.4.8 验证)。`session_stop` 处理器不返回任何值,分发绝不会强制会话继续;由于 OMP 的工具名是小写(`bash`、`read` 等)且没有 `Skill` / `TodoWrite` 工具,post-tool-use 不做 matcher 定向分发。`teamai uninstall` 会移除该 extension。OMP 的 profile(`OMP_PROFILE` / `PI_CODING_AGENT_DIR` / `PI_CONFIG_DIR`,会迁移 agent 目录)暂不支持,使用默认的 `~/.omp/agent/` 布局。

### DeepSeek Harness

Expand Down
8 changes: 5 additions & 3 deletions skill-data/core/references/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,11 @@ judge (`TEAMAI_UPVOTE_JUDGE=1`) credits that. `teamai stats` shows each recent
session's runs, recalled docs and adopted docs. Per agent:

- **Claude Code, Codex (0.134+), CodeBuddy (2.103.1+), WorkBuddy, Qoder,
OpenCode**: both a recall the main agent runs and one the `teamai-recall`
subagent runs are credited when the main agent opens the doc.
- **Cursor, Copilot CLI, ZCode, OMP, Pi**: only a recall the main agent runs
OpenCode, OMP**: both a recall the main agent runs and one the
`teamai-recall` subagent runs are credited when the main agent opens the doc.
On OMP the subagent's recall needs the main session's file on disk, so a
`--no-session` run credits only the main agent's own recalls.
- **Cursor, Copilot CLI, ZCode, Pi**: only a recall the main agent runs
itself. A subagent's recall is not linked to the main session, and Pi has no
TeamAI subagent.
- **OpenClaw, Hermes, Kiro, JoyCode**: no PostToolUse hook, so recalls never
Expand Down
6 changes: 4 additions & 2 deletions src/__tests__/helpers/pi-extensions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import fs from 'node:fs';
import path from 'node:path';
import vm from 'node:vm';
import { EventEmitter } from 'node:events';
import { buildPiExtensionSource } from '../../pi-hooks.js';
Expand All @@ -12,7 +14,7 @@ export interface ExtensionDispatch {
/** The ExtensionContext fields the extensions read: Pi and OMP share `cwd` and `sessionManager`; OMP adds `agent`. */
export interface ExtensionContext {
cwd: string;
sessionManager?: { getSessionId: () => string };
sessionManager?: { getSessionId: () => string; getSessionFile?: () => string | undefined };
agent?: { kind: 'main' | 'sub'; id: string; name: string; depth?: number; parentId?: string };
}

Expand Down Expand Up @@ -65,6 +67,6 @@ export function loadOmpExtension(): LoadedExtension {
})();
return { quiet: () => ({ nothrow: () => run }) };
};
const on = register(buildOmpExtensionSource(), { $, Response });
const on = register(buildOmpExtensionSource(), { $, Response, fs, path, Buffer });
return { on, dispatches };
}
Loading
Loading