AI编码
github.com ·
@Tencent
腾讯 teamai-cli v0.22.0 发布:新增 GitCode 支持与多项修复
该版本主要修复了环境路径解析、内置代理渲染、Cursor 规则写入等问题,并新增了 GitCode 平台支持、WASM tree-sitter AST 代码知识图谱跟踪、团队提交共同作者归属等功能,同时优化了钩子注入和 PR 更新逻辑。
AI推荐理由 腾讯teamai-cli v0.22.0发布,包含多项修复和功能增强,如新增GitCode支持、WASM tree-sitter AST跟踪、团队提交共同作者归属等。信息来自官方GitHub Release,具体且可验证,但属于常规版本更新,对多数用户兴趣有限。
70
正文
官方发布说明 (https://github.com/Tencent/teamai-cli/releases/tag/v0.22.0)
## 变更内容
* 修复(doctor):通过 getTeamaiHome 解析项目作用域的 env.sh 路径,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/348 中完成
* 修复/内置代理按工具渲染,由 @damenjs 在 https://github.com/Tencent/teamai-cli/pull/345 中完成
* 修复(rules):将 Cursor 规则写入为带派生 frontmatter 的 .mdc 文件,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/349 中完成
* 测试(e2e):修复因 #349 破坏的过时 Cursor 规则 .md 断言,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/355 中完成
* 修复(push):更新已打开的 PR 而不是创建重复 PR,由 @rzexin 在 https://github.com/Tencent/teamai-cli/pull/350 中完成
* 修复(hooks):通过 workspace_roots 解析 Cursor SessionStart 项目,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/353 中完成
* 功能(hooks):注入后提醒用户信任 Codex hooks,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/356 中完成
* 修复(skills):在初始化时部署 team-wiki-codebase,与 recall 解耦,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/358 中完成
* 修复(import):在 --dir 模式下运行 reconcile 和 deep enrich,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/362 中完成
* 功能(wiki-engine):为代码知识图谱添加 WASM tree-sitter AST 跟踪,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/304 中完成
* 功能(dashboard):从 CodeBuddy 记录中提取 toolReject/toolError 摩擦,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/336 中完成
* 修复(local-agent):将容器代理 hooks/skills 写入引擎可读路径,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/357 中完成
* 修复(push):在 --skill 下保留其他资源的打开 PR 记录,并审查后续,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/359 中完成
* 功能(coauthor):跨 AI 工具的团队控制的提交共同作者归属,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/365 中完成
* 修复(hooks):阻止 hook 分发阻塞在 tty 提示上,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/366 中完成
* 修复(hooks):统一 hook 注入范围,使项目范围初始化安装 SessionStart hook,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/370 中完成
* 修复(git):在 pull 时协调分叉的团队仓库克隆,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/367 中完成
* 功能(gitcode):添加 GitCode (gitcode.com) 提供商支持 (#361),由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/376 中完成
* 修复(hooks):在共享 HOME 中隔离项目 hooks,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/377 中完成
* 杂务(发布):0.22.0-beta.1,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/379 中完成
* ci:将 npm 发布迁移到可信发布,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/381 中完成
* 杂务(发布):0.22.0-beta.2,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/382 中完成
* 修复(frontmatter):处理 SKILL.md 解析中的 CRLF 和 BOM,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/378 中完成
* 修复(frontmatter):保留格式错误的技能元数据,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/383 中完成
* 修复(votes):避免覆盖待处理的贡献提示,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/384 中完成
* 修复(votes):使点赞收集可靠以促进学习,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/371 中完成
* 杂务(发布):0.22.0-beta.3,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/385 中完成
* 功能(viz):添加知识库健康报告命令,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/368 中完成
* 杂务(发布):0.22.0-beta.4,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/388 中完成
* 修复(viz):左对齐 Top Recalled 标签,使标题不被裁剪,由 @m0Nst3r873 在 https://github.com/Tencent/teamai-cli/pull/389 中完成
* 功能(data-layout):P0 — 原子锁 + projectAnchor/workspaceRoot 拆分 (#374),由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/387 中完成
* 杂务(发布):0.22.0-beta.5,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/390 中完成
* 修复(local-agent):停止在每个 git worktree 中重新提示 ClawPro 绑定,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/392 中完成
* 杂务(发布):0.22.0,由 @jeff-r2026 在 https://github.com/Tencent/teamai-cli/pull/396 中完成
## 新贡献者
* @damenjs 在 https://github.com/Tencent/teamai-cli/pull/345 中做出了首次贡献
* @rzexin 在 https://github.com/Tencent/teamai-cli/pull/350 中做出了首次贡献
**完整变更日志**:https://github.com/Tencent/teamai-cli/compare/v0.21.0...v0.22.0
仓库 README(当前仓库文档,非发布变更)
# TeamAI — 让每个团队都成为 AI 原生
> [English](README.md) | [简体中文](README.zh-CN.md)
[](https://github.com/Tencent/teamai-cli/actions/workflows/ci.yml)
[](https://www.npmjs.com/package/teamai-cli)
[](https://www.npmjs.com/package/teamai-cli)
[](LICENSE)
TeamAI 管理你团队的技能、规则、MCP 和知识,覆盖 Claude Code、Codex、CodeBuddy、WorkBuddy、OpenCode、Cursor、Qoder 和其他 AI 代理。
## 快速开始
### 安装
```bash
npm install -g teamai-cli
```
### 团队管理员 / 个人用户
在你的 Git 托管平台(GitHub、GitLab、GitCode、CNB、TGit 或私有 Git 服务)上创建一个共享体验仓库,**授予团队成员写权限**,然后运行 `teamai init https://github.com/yourorg/yourrepo`。
> **还没有团队仓库?** 从预加载了生产就绪技能、规则和审查代理的模板开始。浏览 [teamai-hub](https://github.com/teamai-hub) 组织,点击 **Use this template**,然后对你的新仓库运行 `teamai init`。
### 团队成员
```bash
# 根据你希望资源安装的位置选择一种
# 项目范围初始化(默认,资源安装在项目目录下)
cd /path/to/my-project
teamai init https://github.com/yourorg/yourrepo
# 或者,用户范围初始化(资源安装在 ~/ 下)
teamai init https://github.com/yourorg/yourrepo --scope user
```
初始化后,每个 AI 会话自动拉取管理员发布的最新技能/规则和其他 Harness 更新——无需手动同步。
> **完整使用指南:** [docs/usage-guide.md](docs/usage-guide.md) ([中文版](docs/usage-guide.zh-CN.md)) — 涵盖从团队创建到日常使用的所有内容。
## 产品架构
**团队执行 × 团队上下文 × 团队改进**:
| 层 | 职责 | 当前 CLI 中的实现 |
|-------|-----|-------------------|
| **团队执行** | 让每个代理按团队方式工作 | `init` / `pull` / `push`、技能、规则、代理、hooks、MCP、环境 |
| **团队上下文** | 让每个代理理解团队 | recall、学习、代码库图谱、teamwiki... |
| **团队改进** | 让每次执行改进团队 | 基于摩擦的共享学习、会话、摘要、仪表板... |
## 概述
代理
团队执行
团队上下文
团队改进
技能规则文档环境代理hooks MCP
学习代码库团队维基
使用会话仪表板
Claude Code✓✓✓✓✓✓✓✓✓✓✓✓✓
Codex✓✓✓✓✓✓✓✓✓✓✓✓✓
Cursor✓✓✓✓✓✓✓✓✓✓✓✓✓
Qoder✓✓✓✓✓✓✓✓✓✓✓✓✓
CodeBuddy✓✓✓✓✓✓✓✓✓✓✓✓✓
OpenCode✓✓✓✓✓✓✓✓✓✓———
WorkBuddy✓✓✓✓—✓✓✓✓✓✓✓✓
OpenClaw✓✓✓✓———✓✓✓———
Hermes✓—✓✓———✓✓✓———
DeepSeek Harness✓—✓————✓✓✓———
**Git 提供商** — GitHub · GitLab · GitCode · CNB · TGit · 私有 Git 服务。
### 分发控制
管理员配置一次并传递给每个成员的团队级设置,在 `teamai pull` 时生效:
| 能力 | 命令 | 作用 |
|------------|---------|--------------|
| **角色** | `teamai roles` | 定义角色 → 命名空间映射,使每个成员只同步其角色的技能。 |
| **标签** | `teamai tags` | 标记技能/规则,使成员只订阅他们需要的标签。 |
| **来源** | `teamai source` | 订阅额外的技能仓库——其他团队的公共仓库,或你自己组织内的共享/公共仓库;订阅的技能在 pull 时自动同步。 |
## 团队执行
> 一个团队。一个 Harness。每个代理。
TeamAI 将技能、规则、文档和 hooks 保存在一个共享的 Git 仓库中,并通过“push → 审查并合并 → pull”流程分发到每个成员的本地 AI 工具——支持订阅其他团队或共享仓库的 Harness。
### 工作原理
```
teamai push → 创建分支 + MR → 审查者批准 + 合并
↓
SessionStart hook → teamai pull → 同步到本地 AI 工具
```
成员通过 `teamai push` 推送更改,这会打开一个合并请求以供审查。对仍在未合并 PR 中等待的资源重新运行 `teamai push` 会就地更新该 PR,而不是创建重复的 PR。合并后,`teamai pull`(通过 SessionStart hook 在会话开始时自动触发)将最新资源同步到本地。技能同步到 `~/.claude/skills/`、`~/.codex/skills/`、`~/.cursor/skills/`、`~/.codebuddy/skills/` 等。在**项目范围**安装中,SessionStart 首先创建该工具的项目根目录(例如 `/.claude`)(如果缺失),然后拉取到其中——裸 `teamai pull` 仍然不会创建代理目录。
### 团队 Hooks
在 `hooks/hooks.yaml` 中声明自定义 hooks,`teamai pull` 会将它们交付给每个 AI 工具:
```yaml
hooks:
- id: block-secret
description: 在提交前扫描秘密
event: PreToolUse
matcher: Bash
command: 'bash -lc "~/.teamai/team-scripts/scan-secret.sh" || true'
tools: [claude, cursor]
```
```bash
teamai hooks list # 列出有效的 hooks
teamai hooks inject # 重新协调到每个已安装的工具
teamai hooks remove # 移除所有 teamai 管理的 hooks
```
### 团队 MCP 服务器
在 `mcp/mcp.yaml` 中声明一次;`teamai pull` 写入每个工具的原生配置。使用 `${VAR}` 表示秘密。
```yaml
servers:
- name: gpu-analysis
transport: http # stdio | http | sse
url: https://example.com/api/mcp
headers:
Authorization: Bearer ${GPU_ANALYSIS_TOKEN}
```
```bash
teamai mcp list | inject | remove
```
### 技能订阅来源
订阅额外的技能仓库——其他团队的公共仓库,或你自己组织内的共享/公共仓库:
```bash
teamai source add https://github.com/other-team/teamai-public.git --name other-team
teamai source list
teamai source browse other-team # 浏览可用技能
teamai source remove other-team
```
添加/移除更改立即在本地生效,订阅的技能在下次 `teamai pull` 时同步。当你想与队友共享 `teamai.yaml` 更改时,运行 `teamai push`。
### 团队包
共享和恢复团队的 npm 包和 Claude Code 插件:
```bash
teamai install typescript
teamai install typescript@5.9.2 --npm
teamai install code-review@claude-plugins-official
teamai push # 共享声明
teamai install # 安装团队声明的所有内容
```
有关完整工作流程和配置,请参阅 [使用指南](docs/usage-guide.md#team-packages)。
## 团队上下文
> 每个代理都理解团队的工作方式。
除了分发 Harness,TeamAI 还将积累的团队经验和代码结构组织成可搜索的知识库,AI 在需要时自动回忆。
### 自动经验分享
会话结束时,Stop hook 根据**摩擦**对其进行评分——表明会话遇到了值得记住的事件的信号:你中断或纠正了 AI、拒绝了工具调用,或 AI 不得不重试失败的工具。一个长但常规的会话(大量工具调用,无摩擦)不会触发;一个你真正与问题斗争的会话会触发。如果分数足够高,AI 会建议:
选择一个,取决于你希望资源安装在哪里
# 项目范围初始化(默认,资源安装在项目目录下)
cd /path/to/my-project
teamai init https://github.com/yourorg/yourrepo
# 或者,用户范围初始化(资源安装在 ~/ 下)
teamai init https://github.com/yourorg/yourrepo --scope user
```
初始化后,每个 AI 会话自动拉取管理员发布的最新技能/规则和其他 Harness 更新——无需手动同步。
> **完整使用指南:** [docs/usage-guide.md](docs/usage-guide.md) ([中文版](docs/usage-guide.zh-CN.md)) — 涵盖从团队创建到日常使用的所有内容。
## 产品架构
**团队执行 × 团队上下文 × 团队改进**:
| 层 | 职责 | 当前 CLI 中的实现 |
|-------|-----|-------------------|
| **团队执行** | 让每个代理按团队方式工作 | `init` / `pull` / `push`、技能、规则、代理、hooks、MCP、环境 |
| **团队上下文** | 让每个代理理解团队 | recall、学习、代码库图谱、teamwiki... |
| **团队改进** | 让每次执行改进团队 | 基于摩擦的共享学习、会话、摘要、仪表板... |
## 概述
代理
团队执行
团队上下文
团队改进
技能规则文档环境代理hooks MCP
学习代码库团队维基
使用会话仪表板
Claude Code✓✓✓✓✓✓✓✓✓✓✓✓✓
Codex✓✓✓✓✓✓✓✓✓✓✓✓✓
Cursor✓✓✓✓✓✓✓✓✓✓✓✓✓
Qoder✓✓✓✓✓✓✓✓✓✓✓✓✓
CodeBuddy✓✓✓✓✓✓✓✓✓✓✓✓✓
OpenCode✓✓✓✓✓✓✓✓✓✓———
WorkBuddy✓✓✓✓—✓✓✓✓✓✓✓✓
OpenClaw✓✓✓✓———✓✓✓———
Hermes✓—✓✓———✓✓✓———
DeepSeek Harness✓—✓————✓✓✓———
**Git 提供商** — GitHub · GitLab · GitCode · CNB · TGit · 私有 Git 服务。
### 分发控制
管理员配置一次并传递给每个成员的团队级设置,在 `teamai pull` 时生效:
| 能力 | 命令 | 作用 |
|------------|---------|--------------|
| **角色** | `teamai roles` | 定义角色 → 命名空间映射,使每个成员只同步其角色的技能。 |
| **标签** | `teamai tags` | 标记技能/规则,使成员只订阅他们需要的标签。 |
| **来源** | `teamai source` | 订阅额外的技能仓库——其他团队的公共仓库,或你自己组织内的共享/公共仓库;订阅的技能在 pull 时自动同步。 |
## 团队执行
> 一个团队。一个 Harness。每个代理。
TeamAI 将技能、规则、文档和 hooks 保存在一个共享的 Git 仓库中,并通过“push → 审查并合并 → pull”流程分发到每个成员的本地 AI 工具——支持订阅其他团队或共享仓库的 Harness。
### 工作原理
```
teamai push → 创建分支 + MR → 审查者批准 + 合并
↓
SessionStart hook → teamai pull → 同步到本地 AI 工具
```
成员通过 `teamai push` 推送更改,这会打开一个合并请求以供审查。对仍在未合并 PR 中等待的资源重新运行 `teamai push` 会就地更新该 PR,而不是创建重复的 PR。合并后,`teamai pull`(通过 SessionStart hook 在会话开始时自动触发)将最新资源同步到本地。技能同步到 `~/.claude/skills/`、`~/.codex/skills/`、`~/.cursor/skills/`、`~/.codebuddy/skills/` 等。在**项目范围**安装中,SessionStart 首先创建该工具的项目根目录(例如 `/.claude`)(如果缺失),然后拉取到其中——裸 `teamai pull` 仍然不会创建代理目录。
### 团队 Hooks
在 `hooks/hooks.yaml` 中声明自定义 hooks,`teamai pull` 会将它们交付给每个 AI 工具:
```yaml
hooks:
- id: block-secret
description: 在提交前扫描秘密
event: PreToolUse
matcher: Bash
command: 'bash -lc "~/.teamai/team-scripts/scan-secret.sh" || true'
tools: [claude, cursor]
```
```bash
teamai hooks list # 列出有效的 hooks
teamai hooks inject # 重新协调到每个已安装的工具
teamai hooks remove # 移除所有 teamai 管理的 hooks
```
### 团队 MCP 服务器
在 `mcp/mcp.yaml` 中声明一次;`teamai pull` 写入每个工具的原生配置。使用 `${VAR}` 表示秘密。
```yaml
servers:
- name: gpu-analysis
transport: http # stdio | http | sse
url: https://example.com/api/mcp
headers:
Authorization: Bearer ${GPU_ANALYSIS_TOKEN}
```
```bash
teamai mcp list | inject | remove
```
### 技能订阅来源
订阅额外的技能仓库——其他团队的公共仓库,或你自己组织内的共享/公共仓库:
```bash
teamai source add https://github.com/other-team/teamai-public.git --name other-team
teamai source list
teamai source browse other-team # 浏览可用技能
teamai source remove other-team
```
添加/移除更改立即在本地生效,订阅的技能在下次 `teamai pull` 时同步。当你想与队友共享 `teamai.yaml` 更改时,运行 `teamai push`。
### 团队包
共享和恢复团队的 npm 包和 Claude Code 插件:
```bash
teamai install typescript
teamai install typescript@5.9.2 --npm
teamai install code-review@claude-plugins-official
teamai push # 共享声明
teamai install # 安装团队声明的所有内容
```
有关完整工作流程和配置,请参阅 [使用指南](docs/usage-guide.md#team-packages)。
## 团队上下文
> 每个代理都理解团队的工作方式。
除了分发 Harness,TeamAI 还将积累的团队经验和代码结构组织成可搜索的知识库,AI 在需要时自动回忆。
### 自动经验分享
会话结束时,Stop hook 根据**摩擦**对其进行评分——表明会话遇到了值得记住的事件的信号:你中断或纠正了 AI、拒绝了工具调用,或 AI 不得不重试失败的工具。一个长但常规的会话(大量工具调用,无摩擦)不会触发;一个你真正与问题斗争的会话会触发。如果分数足够高,AI 会建议:
高到足以触发,AI 会建议:
```
[teamai] 此会话可能包含值得记录的问题:你中断了 AI 两次,AI 重试失败工具 8 次。
任务:修复重复的项目级 Hook 注入
考虑运行 /teamai-share-learnings 来总结你学到的内容并与团队分享。
```
提示会指出触发它的非零摩擦信号,并在可用时包含第一个任务的脱敏单行摘要。`/teamai-share-learnings` 技能会总结会话并将学习文档直接推送到团队仓库。每个会话最多提示一次。
### 团队知识回忆
让 AI 在任务前自动搜索积累的团队知识。此功能**默认关闭**,必须显式启用——团队可以在 `teamai.yaml` 中设置 `sharing.recall.enabled: true` 作为默认值,成员可以在本地覆盖:
```bash
teamai recall enable # 开启:部署 teamai-recall 子代理并注入指导规则
teamai recall disable # 关闭:移除子代理和规则
teamai recall status # 显示有效状态(团队默认 + 用户覆盖)
```
**搜索通过子代理运行**:启用后,`teamai pull` 将内置的 `teamai-recall` 子代理部署到每个 AI 工具的 `agents/` 目录。AI 在任务前调用它——子代理提取关键词、运行搜索、读取匹配的源文件,并返回团队知识的结构化摘要。子代理首先运行相关性预检查(`teamai recall --check`),当任务与团队知识无关时完全跳过检索。在底层,它调用 `teamai recall` 命令,你也可以手动运行:
```bash
$ teamai recall "端口冲突"
[1/2] MR 审查捕获了端口冲突错误 ★1 [用户]
作者:member-a | 分数:18.5 | 标签:故障排除、网络
[2/2] 部署配置最佳实践 [项目]
作者:member-b | 分数:12.0 | 标签:部署、配置
匹配:冲突 | 缺失:端口
```
### 代码库知识图谱
`teamai import` 将源代码仓库解析为 `teamwiki/` 下的结构化图谱,实现结构感知检索:
```bash
teamai import --from-repo https://github.com/org/repo
teamai import --from-org myorg # 批量导入所有仓库
teamai codebase --lint # 健康检查
```
图谱存储组件、接口、配置和跨仓库导入边。`teamai recall` 使用它进行图谱增强的重新排序。
当回忆命中来自代码库页面时,结果包含一个 `Sources:` 行,列出相关的源文件路径——为代理提供代码更改的直接起点,而不是重新探索仓库。
边来自同时运行的两个轨道,重叠时 AST 结果优先:
- **AST 轨道**(TypeScript/JavaScript、Python、Go):WASM [tree-sitter](https://tree-sitter.github.io/) 解析器将 `import`/`require`、调用点和 TS `implements` 子句解析为精确的文件到文件 `DEPENDS_ON` / `REFERENCES` / `IMPLEMENTS` 边(标记为 `code-ast`,带置信度权重)。
- **启发式轨道**(所有语言,包括 Java/Rust):基于正则表达式的提取(标记为 `code-heuristic`),也覆盖 AST 轨道不支持的语言。
WASM 解析器是纯 JavaScript 依赖——不需要原生工具链。如果由于任何原因加载失败,提取回退到启发式轨道并记录 `AST_UNAVAILABLE` 差距。设置 `TEAMAI_SKIP_AST=1` 强制仅使用启发式提取。
## 团队改进
> 每次执行都让整个团队更聪明。
深入了解团队实际如何使用其 AI 工具,以及将会话摩擦转化为共享技能、规则和知识的起点:
| 能力 | 命令 | 显示内容 |
|------------|---------|---------------|
| **使用情况** | `teamai digest` | 每周团队摘要——令牌使用量、对话量和干预率。 |
| **会话** | `teamai session save` | 隐私清理的每会话摘要(工具序列、提示轮次、干预),为摘要的会话亮点提供数据。 |
| **仪表板** | `teamai dashboard` | 显示团队成员实时编码会话状态、干预次数和令牌使用量的 Web 仪表板。 |
| **知识库健康** | `teamai dashboard` → KB Health | 内置仪表板页面,报告知识库使用情况和健康度——按类型覆盖、最常回忆条目、静默条目、回忆趋势、作者贡献和维护控制台。 |
## 命令
| 命令 | 描述 |
|---------|-------------|
| `teamai init` | 初始化:OAuth 登录、链接仓库、注册成员、注入 hooks |
| `teamai pull` | 拉取团队资源并注入到本地 AI 工具 |
| `teamai push` | 将本地资源推送到分支并打开合并请求 |
| `teamai install [target]` | 安装声明的 npm 包和 Claude 插件;带目标时,也更新 `teamai.yaml` |
| `teamai status` | 显示本地与团队仓库差异 |
| `teamai contribute` | 将会话经验分享到团队仓库 |
| `teamai recall ` | 搜索团队知识库(BM25 + 图谱增强) |
| `teamai recall enable/disable/status` | 切换或检查回忆状态 |
| `teamai recall promote [learningId]` | 将高置信度学习提升为正式知识(技能/规则/文档) |
| `teamai recall maintenance` | 维护知识库健康:修剪低置信度学习、写回置信度分数、标记过时条目 |
| `teamai import` | 导入知识(`--dir`、`--from-repo`、`--from-org`、`--from-repo-list`、`--from-mr`、`--from-iwiki`) |
| `teamai codebase --lint` | 知识图谱健康检查 |
| `teamai ci extract-mr --url ` | CI:从 MR 提取知识、发布评论、合并后写入 |
| `teamai members` | 列出团队成员 |
| `teamai roles` | 管理团队角色和命名空间 |
| `teamai tags` | 管理基于标签的技能/规则过滤 |
| `teamai skill exclude add/remove/list` | 管理从本地同步中排除的技能([使用指南](docs/usage-guide.md#exclud
ing-skills-you-dont-need)) |
| `teamai source` | 管理技能订阅来源(其他团队或你组织的共享仓库) |
| `teamai remove ` | 移除资源并打开 MR |
| `teamai session save` | 将隐私清理的会话摘要记录到月度日志(`--push` 为 `digest` 提供数据) |
| `teamai digest` | 生成每周团队使用摘要 |
| `teamai doctor` | 诊断配置问题 |
| `teamai uninstall` | 移除所有 teamai 资源和 hooks |
## 许可证
[MIT](LICENSE)
## 贡献
欢迎提交 PR!请先阅读 [CONTRIBUTING.md](.github/CONTRIBUTING.md)。
查看原文(中文正文为 AI 翻译)
Official release notes (https://github.com/Tencent/teamai-cli/releases/tag/v0.22.0)
## What's Changed
* fix(doctor): resolve env.sh path via getTeamaiHome for project scope by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/348
* Fix/builtin agents render per tool by @damenjs in https://github.com/Tencent/teamai-cli/pull/345
* fix(rules): write Cursor rules as .mdc with derived frontmatter by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/349
* test(e2e): fix stale Cursor rule .md assertion broken by #349 by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/355
* fix(push): update the open PR instead of opening duplicates by @rzexin in https://github.com/Tencent/teamai-cli/pull/350
* fix(hooks): resolve Cursor SessionStart project via workspace_roots by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/353
* feat(hooks): remind users to trust Codex hooks after inject by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/356
* fix(skills): deploy team-wiki-codebase on init, decouple from recall by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/358
* fix(import): run reconcile and deep enrich in --dir mode by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/362
* feat(wiki-engine): add WASM tree-sitter AST track for code knowledge graph by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/304
* feat(dashboard): extract toolReject/toolError friction from CodeBuddy transcripts by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/336
* fix(local-agent): write container agent hooks/skills to engine-read paths by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/357
* fix(push): preserve other resources' open-PR records under --skill, plus review follow-ups by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/359
* feat(coauthor): team-controlled commit co-author attribution across AI tools by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/365
* fix(hooks): stop hook-dispatch from blocking on tty prompt by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/366
* fix(hooks): unify hook-injection scope so project-scope init installs the SessionStart hook by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/370
* fix(git): reconcile diverged team-repo clone on pull by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/367
* feat(gitcode): add GitCode (gitcode.com) provider support (#361) by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/376
* fix(hooks): isolate project hooks across shared HOME by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/377
* chore(release): 0.22.0-beta.1 by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/379
* ci: migrate npm publishing to trusted publishing by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/381
* chore(release): 0.22.0-beta.2 by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/382
* fix(frontmatter): handle CRLF and BOM in SKILL.md parsing by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/378
* fix(frontmatter): preserve malformed skill metadata by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/383
* fix(votes): avoid clobbering pending contribute hints by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/384
* fix(votes): make upvote collection reliable for learning promotion by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/371
* chore(release): 0.22.0-beta.3 by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/385
* feat(viz): add knowledge base health report command by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/368
* chore(release): 0.22.0-beta.4 by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/388
* fix(viz): left-align Top Recalled labels so titles aren't clipped by @m0Nst3r873 in https://github.com/Tencent/teamai-cli/pull/389
* feat(data-layout): P0 — atomic lock + projectAnchor/workspaceRoot split (#374) by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/387
* chore(release): 0.22.0-beta.5 by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/390
* fix(local-agent): stop re-prompting ClawPro binding in every git worktree by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/392
* chore(release): 0.22.0 by @jeff-r2026 in https://github.com/Tencent/teamai-cli/pull/396
## New Contributors
* @damenjs made their first contribution in https://github.com/Tencent/teamai-cli/pull/345
* @rzexin made their first contribution in https://github.com/Tencent/teamai-cli/pull/350
**Full Changelog**: https://github.com/Tencent/teamai-cli/compare/v0.21.0...v0.22.0
Repository README (current repository documentation, not release changes)
# TeamAI — Make Every Team AI Native
> [English](README.md) | [简体中文](README.zh-CN.md)
[](https://github.com/Tencent/teamai-cli/actions/workflows/ci.yml)
[](https://www.npmjs.com/package/teamai-cli)
[](https://www.npmjs.com/package/teamai-cli)
[](LICENSE)
TeamAI manages your team's skills, rules, MCP, and knowledge across Claude Code, Codex, CodeBuddy, WorkBuddy, OpenCode, Cursor, Qoder, and other AI agents.
## Quick Start
### Install
```bash
npm install -g teamai-cli
```
### Team admin / solo user
Create a shared-experience repo on your git host (GitHub, GitLab, GitCode, CNB, TGit, or a private Git service), **grant write access to team members**, then run `teamai init https://github.com/yourorg/yourrepo`.
> **No team repo yet?** Start from a template pre-loaded with production-ready skills, rules, and review agents. Browse the [teamai-hub](https://github.com/teamai-hub) org, click **Use this template**, then `teamai init` against your new repo.
### Team members
```bash
# Choose one, depending on where you want resources installed
# Project-scope init (default, resources installed under the project directory)
cd /path/to/my-project
teamai init https://github.com/yourorg/yourrepo
# Or, user-scope init (resources installed under ~/)
teamai init https://github.com/yourorg/yourrepo --scope user
```
Once initialized, every AI session automatically pulls the latest skills / rules and other Harness updates published by admins — no manual sync needed.
> **Full usage guide:** [docs/usage-guide.md](docs/usage-guide.md) ([中文版](docs/usage-guide.zh-CN.md)) — covers everything from team creation to day-to-day use.
## Product architecture
**Team Execution × Team Context × Team Improvement**:
| Layer | Job | In this CLI today |
|-------|-----|-------------------|
| **Team Execution** | Make every agent work the team's way | `init` / `pull` / `push`, skills, rules, agents, hooks, MCP, env |
| **Team Context** | Make every agent understand the team | recall, learnings, codebase graph, teamwiki... |
| **Team Improvement** | Make every execution improve the team | friction-based share-learnings, sessions, digest, dashboard... |
## Overview
Agent
Team Execution
Team Context
Team Improvement
skillsrulesdocsenvagentshooksmcp
learningscodebaseteamwiki
usagesessionsdashboard
Claude Code✓✓✓✓✓✓✓✓✓✓✓✓✓
Codex✓✓✓✓✓✓✓✓✓✓✓✓✓
Cursor✓✓✓✓✓✓✓✓✓✓✓✓✓
Qoder✓✓✓✓✓✓✓✓✓✓✓✓✓
CodeBuddy✓✓✓✓✓✓✓✓✓✓✓✓✓
OpenCode✓✓✓✓✓✓✓✓✓✓———
WorkBuddy✓✓✓✓—✓✓✓✓✓✓✓✓
OpenClaw✓✓✓✓———✓✓✓———
Hermes✓—✓✓———✓✓✓———
DeepSeek Harness✓—✓————✓✓✓———
**Git providers** — GitHub · GitLab · GitCode · CNB · TGit · private Git service.
### Distribution Controls
Team-wide settings an admin configures once and delivers to every member on `teamai pull`:
| Capability | Command | What it does |
|------------|---------|--------------|
| **Roles** | `teamai roles` | Define role → namespace mappings so each member syncs only the skills for their role. |
| **Tags** | `teamai tags` | Tag skills / rules so members subscribe to just the tags they need. |
| **Sources** | `teamai source` | Subscribe to additional skill repos — other teams' public repos, or shared/public repos within your own org; subscribed skills sync automatically on pull. |
## Team Execution
> One Team. One Harness. Every Agent.
TeamAI keeps skills, rules, docs, and hooks in a shared git repo and distributes them to every member's local AI tools through a "push → review & merge → pull" flow — with support for subscribing to other teams' or shared repos' Harness.
### How It Works
```
teamai push → create branch + MR → reviewer approves + merges
↓
SessionStart hook → teamai pull → synced to local AI tools
```
Members push changes via `teamai push`, which opens a Merge Request for review. Re-running `teamai push` on a resource that is still waiting in an unmerged PR updates that PR in place instead of opening a duplicate. Once merged, `teamai pull` (triggered automatically on session start via the SessionStart hook) syncs the latest resources locally. Skills sync to `~/.claude/skills/`, `~/.codex/skills/`, `~/.cursor/skills/`, `~/.codebuddy/skills/`, etc. In a **project-scope** install, SessionStart first creates that tool's project root (e.g. `/.claude`) if it is missing, then pulls into it — a bare `teamai pull` still will not invent agent directories.
### Team Hooks
Declare custom hooks in `hooks/hooks.yaml` and `teamai pull` delivers them to every AI tool:
```yaml
hooks:
- id: block-secret
description: Scan for secrets before commit
event: PreToolUse
matcher: Bash
command: 'bash -lc "~/.teamai/team-scripts/scan-secret.sh" || true'
tools: [claude, cursor]
```
```bash
teamai hooks list # list effective hooks
teamai hooks inject # re-reconcile into every installed tool
teamai hooks remove # remove all teamai-managed hooks
```
### Team MCP Servers
Declare once in `mcp/mcp.yaml`; `teamai pull` writes each tool's native config. Use `${VAR}` for secrets.
```yaml
servers:
- name: gpu-analysis
transport: http # stdio | http | sse
url: https://example.com/api/mcp
headers:
Authorization: Bearer ${GPU_ANALYSIS_TOKEN}
```
```bash
teamai mcp list | inject | remove
```
### Skill Subscription Sources
Subscribe to additional skill repos — other teams' public repos, or shared/public repos within your own org:
```bash
teamai source add https://github.com/other-team/teamai-public.git --name other-team
teamai source list
teamai source browse other-team # browse available skills
teamai source remove other-team
```
The add/remove change takes effect locally right away, and subscribed skills sync on the next
`teamai pull`. Run `teamai push` when you want to share the `teamai.yaml` change with teammates.
### Team Packages
Share and restore the team's npm packages and Claude Code plugins:
```bash
teamai install typescript
teamai install typescript@5.9.2 --npm
teamai install code-review@claude-plugins-official
teamai push # Share the declarations
teamai install # Install everything declared by the team
```
See the [Usage Guide](docs/usage-guide.md#team-packages) for the complete workflow and configuration.
## Team Context
> Every agent understands how the team works.
Beyond distributing the Harness, TeamAI organizes accumulated team experience and code structure into a searchable knowledge base that the AI recalls automatically when needed.
### Automatic Experience Sharing
When a session ends, the Stop hook scores it by **friction** — signals that the session hit something worth remembering: you interrupted or corrected the AI, denied a tool call, or the AI had to retry failing tools. A long-but-routine session (lots of tool calls, no friction) does not trigger; a session where you actually fought a problem does. If the score is high enough, the AI suggests:
```
[teamai] This session may contain a problem worth documenting: you interrupted the AI twice, the AI retried failing tools 8 times.
Task: Fix duplicate project-level Hook injection
Consider running /teamai-share-learnings to summarize what you learned and share it with your team.
```
The hint names the non-zero friction signals that triggered it and, when available, includes a redacted, single-line summary of the first task. The `/teamai-share-learnings` skill summarizes the session and pushes a learning document directly to the team repo. Each session is prompted at most once.
### Team Knowledge Recall
Let the AI automatically search accumulated team knowledge before a task. This feature is **off by default** and must be enabled explicitly — teams can set `sharing.recall.enabled: true` in `teamai.yaml` as the default, and members can override locally:
```bash
teamai recall enable # on: deploy the teamai-recall subagent + inject guidance rules
teamai recall disable # off: remove the subagent and rules
teamai recall status # show effective state (team default + user override)
```
**Search runs via a subagent**: once enabled, `teamai pull` deploys the built-in `teamai-recall` subagent into each AI tool's `agents/` directory. The AI invokes it before a task — the subagent extracts keywords, runs the search, reads the matched source files, and returns a structured summary of team knowledge. The subagent first runs a relevance precheck (`teamai recall --check`) and skips retrieval entirely when the task is unrelated to team knowledge. Under the hood it shells out to the `teamai recall` command, which you can also run manually:
```bash
$ teamai recall "port conflict"
[1/2] MR review caught a port-conflict bug ★1 [user]
Author: member-a | Score: 18.5 | Tags: troubleshooting, networking
[2/2] Deployment configuration best practices [project]
Author: member-b | Score: 12.0 | Tags: deploy, config
Matched: conflict | Missing: port
```
### Codebase Knowledge Graph
`teamai import` parses source repos into a structured graph under `teamwiki/`, enabling structurally-aware retrieval:
```bash
teamai import --from-repo https://github.com/org/repo
teamai import --from-org myorg # batch import all repos
teamai codebase --lint # health check
```
The graph stores components, interfaces, configs, and cross-repo import edges. `teamai recall` uses it for graph-boosted re-ranking.
When a recall hit comes from a codebase page, the result includes a `Sources:` line listing the relevant source file paths — giving agents a direct starting point for code changes instead of re-exploring the repo.
Edges come from two tracks that run together, with AST results taking precedence on overlap:
- **AST track** (TypeScript/JavaScript, Python, Go): a WASM [tree-sitter](https://tree-sitter.github.io/) parser resolves `import`/`require`, call sites, and TS `implements` clauses to precise file-to-file `DEPENDS_ON` / `REFERENCES` / `IMPLEMENTS` edges (tagged `code-ast`, with confidence weights).
- **Heuristic track** (all languages, including Java/Rust): regex-based extraction (tagged `code-heuristic`), which also covers languages the AST track does not.
The WASM parser is a pure-JavaScript dependency — no native toolchain is required. If it fails to load for any reason, extraction falls back to the heuristic track and records an `AST_UNAVAILABLE` gap. Set `TEAMAI_SKIP_AST=1` to force heuristic-only extraction.
## Team Improvement
> Every execution makes the entire team smarter.
Insight into how the team actually uses its AI tools, and a starting point for turning session friction into shared skills, rules, and knowledge:
| Capability | Command | What it shows |
|------------|---------|---------------|
| **Usage** | `teamai digest` | Weekly team digest — token usage, conversation volume, and intervention rate. |
| **Sessions** | `teamai session save` | Privacy-scrubbed per-session summaries (tool sequence, prompt turns, interventions) that feed the digest's Session Highlights. |
| **Dashboard** | `teamai dashboard` | Web dashboard showing team members' live coding-session status, intervention count, and token usage. |
| **KB Health** | `teamai dashboard` → KB Health | Built-in dashboard page reporting knowledge-base usage & health — coverage by type, top recalled entries, silent entries, recall trend, author contributions, and a maintenance console. |
## Commands
| Command | Description |
|---------|-------------|
| `teamai init` | Initialize: OAuth login, link repo, register member, inject hooks |
| `teamai pull` | Pull team resources and inject into local AI tools |
| `teamai push` | Push local resources to a branch and open a Merge Request |
| `teamai install [target]` | Install declared npm packages and Claude plugins; with a target, also update `teamai.yaml` |
| `teamai status` | Show local vs team repo diff |
| `teamai contribute` | Share session experience to team repo |
| `teamai recall ` | Search the team knowledge base (BM25 + graph-boost) |
| `teamai recall enable/disable/status` | Toggle or check recall state |
| `teamai recall promote [learningId]` | Promote a high-confidence learning to formal knowledge (skills/rules/docs) |
| `teamai recall maintenance` | Maintain knowledge base health: prune low-confidence learnings, writeback confidence scores, flag stale entries |
| `teamai import` | Import knowledge (`--dir`, `--from-repo`, `--from-org`, `--from-repo-list`, `--from-mr`, `--from-iwiki`) |
| `teamai codebase --lint` | Knowledge graph health check |
| `teamai ci extract-mr --url ` | CI: extract knowledge from MR, post comments, write after merge |
| `teamai members` | List team members |
| `teamai roles` | Manage team roles and namespaces |
| `teamai tags` | Manage tag-based skill/rule filtering |
| `teamai skill exclude add/remove/list` | Manage skills excluded from local sync ([usage guide](docs/usage-guide.md#excluding-skills-you-dont-need)) |
| `teamai source` | Manage skill subscription sources (other teams or your org's shared repos) |
| `teamai remove ` | Remove a resource and open MR |
| `teamai session save` | Record a privacy-scrubbed session summary to a monthly log (`--push` feeds `digest`) |
| `teamai digest` | Generate weekly team usage digest |
| `teamai doctor` | Diagnose configuration issues |
| `teamai uninstall` | Remove all teamai resources and hooks |
## License
[MIT](LICENSE)
## Contributing
PRs are welcome! Please read [CONTRIBUTING.md](.github/CONTRIBUTING.md) first.