teamai-cli 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +17 -8
- package/README.zh-CN.md +18 -9
- package/agents/teamai-recall.md +54 -1
- package/dist/index.js +2299 -1137
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,12 +6,16 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
6
6
|
|
|
7
7
|
### 💥 破坏性变更
|
|
8
8
|
|
|
9
|
+
- **`teamai init` 默认 scope 改为 project**(#250):未传 `--scope` 时安装到 `<cwd>/.teamai/` 与 `<cwd>/.claude/...`,不再默认装到 `~/`。恢复旧行为:`teamai init <repo> --scope user`
|
|
10
|
+
- 远端 `teamai.yaml.scope` 不再锁定本机安装位置(`validateScopeMatch` 已移除);本地 scope 仅由 CLI 决定
|
|
11
|
+
- 新建默认 `teamai.yaml` 不再写入 `scope:` 字段
|
|
9
12
|
- **移除 `auto-recall` PostToolUse hook**:不再在 `Bash`/`Grep`/`WebSearch`/`WebFetch` 工具调用后被动、隐式地自动搜索团队知识库——这条链路噪音大、命中率低,且与更早前上线的 `teamai-recall` subagent(任务开始前主动检索,支持 codebase 图谱 drill-down、输出结构化摘要)功能重叠。已安装环境的 hooks 配置会在下次 `teamai pull` / `hooks inject` 时自动清理,无需手动迁移
|
|
10
13
|
- `contribute-check` 的知识空白检测(Phase 2)改为由 `teamai recall`(手动 + `teamai-recall` subagent 均会触发)记录召回质量,缓存格式不变,功能保留
|
|
11
14
|
- `TEAMAI_RECALL_DISABLED=1` 现在控制 `teamai recall` 的质量记录而非 auto-recall hook
|
|
12
15
|
|
|
13
16
|
### ✨ 新功能
|
|
14
17
|
|
|
18
|
+
- **`teamai init <repo>` 位置参数**(#250):推荐写法;`--repo` 永久保留为等价别名(无 deprecation 警告)
|
|
15
19
|
- **跨 agent skills 视图**:`teamai list` 新增 `--source <repo|local|all>` 和 `--agent <id>` 参数(默认 `--source all`)。`local` / `all` 模式会扫描所有已安装 AI agent 的 skills 目录,每个 skill 标注来源 `[team]` / `[builtin]` / `[source:<name>]` / `[local-only]`。`--verbose` 时展开每个 agent 的 skill 列表与描述摘要。未安装的 agent 不出现在输出里
|
|
16
20
|
- **Known agents 注册表**:内置 28 个 AI agent 路径(Claude Code / Cursor / Codex / Gemini CLI / Aider / Augment / Hermes / Copilot / KiloCode / Kiro / OpenCode / Qoder / Trae / Windsurf / WorkBuddy 等),自动检测哪些已安装。`teamai.yaml` 中显式配置的 `toolPaths` 优先生效
|
|
17
21
|
- **`teamai skill` 子命令组**:
|
package/README.md
CHANGED
|
@@ -30,19 +30,24 @@ npm install -g teamai-cli
|
|
|
30
30
|
|
|
31
31
|
### Team admin / solo user
|
|
32
32
|
|
|
33
|
-
Create a shared-experience repo on your git host (GitHub, TGit, or CNB), **grant write access to team members**, then have them run `teamai init
|
|
33
|
+
Create a shared-experience repo on your git host (GitHub, TGit, or CNB), **grant write access to team members**, then have them run `teamai init https://github.com/yourorg/yourrepo`.
|
|
34
34
|
|
|
35
35
|
> Solo use needs no separate repo setup: `teamai init` checks the target repo and creates it automatically if it doesn't exist.
|
|
36
36
|
|
|
37
37
|
### Team members
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
#
|
|
41
|
-
|
|
40
|
+
# Project-scope init (default, resources installed under the project directory)
|
|
41
|
+
cd /path/to/my-project
|
|
42
|
+
teamai init https://github.com/yourorg/yourrepo
|
|
43
|
+
|
|
44
|
+
# User-scope init (resources installed under ~/)
|
|
45
|
+
teamai init https://github.com/yourorg/yourrepo --scope user
|
|
42
46
|
|
|
43
|
-
#
|
|
47
|
+
# Optional layered setup: keep a project repo active while inheriting safe
|
|
48
|
+
# resources and searchable knowledge from an initialized user-scope repo
|
|
44
49
|
cd /path/to/my-project
|
|
45
|
-
teamai init
|
|
50
|
+
teamai init https://github.com/yourorg/project-repo --inherit-user-scope
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
Once initialized, every AI session automatically pulls the latest skills / rules and other Harness updates published by admins — no manual sync needed.
|
|
@@ -122,10 +127,14 @@ Beyond distributing the Harness, TeamAI organizes accumulated team experience an
|
|
|
122
127
|
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:
|
|
123
128
|
|
|
124
129
|
```
|
|
125
|
-
|
|
130
|
+
[teamai] This session may contain a problem worth documenting: you interrupted the AI twice, the AI retried failing tools 8 times.
|
|
131
|
+
|
|
132
|
+
Task: Fix duplicate project-level Hook injection
|
|
133
|
+
|
|
134
|
+
Consider running /teamai-share-learnings to summarize what you learned and share it with your team.
|
|
126
135
|
```
|
|
127
136
|
|
|
128
|
-
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.
|
|
137
|
+
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.
|
|
129
138
|
|
|
130
139
|
### Team Knowledge Recall
|
|
131
140
|
|
|
@@ -153,7 +162,7 @@ Author: member-b | Score: 12.0 | Tags: deploy, config
|
|
|
153
162
|
- **Shared search index** (`search-index.json`): four categories — learnings (session experience), docs (team docs), rules (coding rules), and skills (each `SKILL.md`) — sourced from the corresponding team-repo directories, (re)built on `teamai pull` / `teamai contribute`.
|
|
154
163
|
- **Codebase knowledge graph** (`teamwiki/`): produced by `teamai import`, queried live at search time.
|
|
155
164
|
|
|
156
|
-
Ranking uses BM25 + graph-boost,
|
|
165
|
+
Ranking uses BM25 + graph-boost. When the current working directory contains a project-scope config, Recall searches that project; if the project enables `--inherit-user-scope`, it then searches user knowledge, tags each result with its origin, and lets an identical project entry override the user entry. Without a project config in the current directory, Recall searches the user scope. Active-scope hits are implicitly upvoted; inherited user hits remain read-only while the project is active.
|
|
157
166
|
|
|
158
167
|
### Codebase Knowledge Graph
|
|
159
168
|
|
package/README.zh-CN.md
CHANGED
|
@@ -30,19 +30,24 @@ npm install -g teamai-cli
|
|
|
30
30
|
|
|
31
31
|
### 团队管理员 / 个人使用者
|
|
32
32
|
|
|
33
|
-
在 Git 托管平台(GitHub、TGit 或 CNB)创建共享经验仓库,**授予团队成员写权限**,然后让他们运行 `teamai init
|
|
33
|
+
在 Git 托管平台(GitHub、TGit 或 CNB)创建共享经验仓库,**授予团队成员写权限**,然后让他们运行 `teamai init https://github.com/yourorg/yourrepo`。
|
|
34
34
|
|
|
35
35
|
> 个人使用无需单独建仓:`teamai init` 会检查目标仓库,不存在时自动创建。
|
|
36
36
|
|
|
37
37
|
### 团队成员
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
#
|
|
41
|
-
|
|
40
|
+
# 项目级初始化(默认,资源安装到项目目录下)
|
|
41
|
+
cd /path/to/my-project
|
|
42
|
+
teamai init https://github.com/yourorg/yourrepo
|
|
43
|
+
|
|
44
|
+
# 用户级初始化(资源安装到 ~/ 下)
|
|
45
|
+
teamai init https://github.com/yourorg/yourrepo --scope user
|
|
42
46
|
|
|
43
|
-
#
|
|
47
|
+
# 可选的分层模式:项目仓库保持为当前 scope,同时继承已初始化的
|
|
48
|
+
# user scope 中的安全资源和可检索知识
|
|
44
49
|
cd /path/to/my-project
|
|
45
|
-
teamai init
|
|
50
|
+
teamai init https://github.com/yourorg/project-repo --inherit-user-scope
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
初始化完成后,每次开启 AI 会话时都会自动拉取管理员发布的 skills / rules 等 Harness 更新,无需手动同步。
|
|
@@ -119,13 +124,17 @@ teamai source remove other-team
|
|
|
119
124
|
|
|
120
125
|
### 自动经验沉淀
|
|
121
126
|
|
|
122
|
-
Session 结束时,Stop hook 按**摩擦信号**对 session 评分——这些信号表明本次 session 踩到了值得记录的东西:你打断或纠正了 AI、拒绝了某次工具调用,或 AI 反复重试出错的工具。又长又顺(工具调用很多但没有摩擦)的 session 不会触发;真正较劲过的 session 才会。达标后 AI
|
|
127
|
+
Session 结束时,Stop hook 按**摩擦信号**对 session 评分——这些信号表明本次 session 踩到了值得记录的东西:你打断或纠正了 AI、拒绝了某次工具调用,或 AI 反复重试出错的工具。又长又顺(工具调用很多但没有摩擦)的 session 不会触发;真正较劲过的 session 才会。达标后 AI 会显示如下英文提示:
|
|
123
128
|
|
|
124
129
|
```
|
|
125
|
-
|
|
130
|
+
[teamai] This session may contain a problem worth documenting: you interrupted the AI twice, the AI retried failing tools 8 times.
|
|
131
|
+
|
|
132
|
+
Task: Fix duplicate project-level Hook injection
|
|
133
|
+
|
|
134
|
+
Consider running /teamai-share-learnings to summarize what you learned and share it with your team.
|
|
126
135
|
```
|
|
127
136
|
|
|
128
|
-
|
|
137
|
+
提示会列出实际触发它的非零摩擦信号;如果能取得首个任务摘要,还会在脱敏、单行化后附上任务上下文。`/teamai-share-learnings` skill 自动总结 session 经验并推送到团队仓库。每个 session 最多提示一次。
|
|
129
138
|
|
|
130
139
|
### 团队知识检索
|
|
131
140
|
|
|
@@ -153,7 +162,7 @@ Author: member-b | Score: 12.0 | Tags: deploy, config
|
|
|
153
162
|
- **共享检索索引**(`search-index.json`):learnings(session 经验)、docs(团队文档)、rules(编码规则)、skills(各 `SKILL.md`)四类,源自团队仓库对应目录,在 `teamai pull` / `teamai contribute` 时构建重建。
|
|
154
163
|
- **代码知识图谱**(`teamwiki/`):由 `teamai import` 生成,检索时实时查询。
|
|
155
164
|
|
|
156
|
-
排序采用 BM25 +
|
|
165
|
+
排序采用 BM25 + 图谱增强。当前工作目录包含 project scope 配置时,Recall 先检索该项目;如果项目启用了 `--inherit-user-scope`,再检索 user 知识并标注结果来源,相同条目由 project 版本覆盖 user 版本。当前目录没有 project 配置时,Recall 检索 user scope。当前 scope 的命中会隐式投票,项目运行期间继承的 user 命中保持只读。
|
|
157
166
|
|
|
158
167
|
### 代码知识图谱
|
|
159
168
|
|
package/agents/teamai-recall.md
CHANGED
|
@@ -32,10 +32,40 @@ teamai recall --check "<3-6 keywords from the task>"
|
|
|
32
32
|
meaningful coverage for this task. Emit exactly one line
|
|
33
33
|
`No relevant team knowledge found for: <query>` and **stop** — do not
|
|
34
34
|
proceed to Step 1–5, do not read any files, do not run a full recall.
|
|
35
|
-
- If the output starts with `RELEVANT`:
|
|
35
|
+
- If the output starts with `RELEVANT`: check complexity (see below),
|
|
36
|
+
then continue to Step 1 or take the LOW shortcut.
|
|
36
37
|
- If the command fails or `teamai` is not on PATH: skip the precheck and
|
|
37
38
|
continue to Step 1 (do not block on precheck failure).
|
|
38
39
|
|
|
40
|
+
#### Complexity quick-judge (after RELEVANT)
|
|
41
|
+
|
|
42
|
+
> **Format dependency**: The LOW shortcut parses `title=` and `sources=` from `--check` stdout. If `emitCheckVerdict` output format changes, update this section.
|
|
43
|
+
|
|
44
|
+
Scan the original task description for complexity signals:
|
|
45
|
+
|
|
46
|
+
**LOW signals** (all must hold):
|
|
47
|
+
- Task targets a single file or a single field/parameter change
|
|
48
|
+
- Keywords present: 改名/rename/修改名称/修改字段/add parameter/加参数/
|
|
49
|
+
改配置/change config/update constant/修改常量/加个字段/加一个参数
|
|
50
|
+
- No multi-module interaction, no new flow/controller/class creation
|
|
51
|
+
|
|
52
|
+
**If LOW and `--check` output includes `title=` and `sources=`**: use them
|
|
53
|
+
directly to construct a short response (≤500 chars):
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Relevant knowledge: <title from --check output>
|
|
57
|
+
Suggested files: <sources from --check output>
|
|
58
|
+
<!-- teamai:recalled-doc-ids: [] -->
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Stop here** — skip Steps 1–5 entirely.
|
|
62
|
+
|
|
63
|
+
**If LOW but `--check` output lacks `sources=`**: run
|
|
64
|
+
`teamai recall <keywords> --depth context`, take only the top-1 result's
|
|
65
|
+
title + Sources, return the same short format above, and skip Steps 1–5.
|
|
66
|
+
|
|
67
|
+
**If not LOW**: continue to Step 1 as normal.
|
|
68
|
+
|
|
39
69
|
### Step 1 — Classify question type and choose retrieval depth
|
|
40
70
|
|
|
41
71
|
Determine if the query matches a G-document category:
|
|
@@ -57,6 +87,19 @@ corresponding file and extract relevant sections. Skip BM25 search.
|
|
|
57
87
|
> - `--depth lookup`: searches ALL evidence pages including raw symbol lists (for precise file:line lookups)
|
|
58
88
|
> - `--depth route`: returns the router table only (use when you need to discover what projects exist)
|
|
59
89
|
|
|
90
|
+
**Task complexity heuristic — choose depth by task type:**
|
|
91
|
+
|
|
92
|
+
| Signal in query | Task type | Depth | Rationale |
|
|
93
|
+
|-----------------|-----------|-------|-----------|
|
|
94
|
+
| feature/新功能/新增功能/大功能/redesign/重构整个/multi-file | Feature (large) | `--depth lookup` | Need full file coverage to avoid missing files |
|
|
95
|
+
| 添加/修改/如何改/实现/implement/refactor | Edit (medium) | `--depth lookup` | Need symbol-level anchors |
|
|
96
|
+
| bugfix/修复/fix/patch/typo/单文件/one-file | Bugfix (small) | `--depth context` | Fast pass; skip graph-index drill-down |
|
|
97
|
+
|
|
98
|
+
For **bugfix/small** tasks: use `--depth context` only, skip the
|
|
99
|
+
graph-index.json deep read in the edit/change section below, and keep
|
|
100
|
+
output ≤ 1500 characters. The main conversation already knows which
|
|
101
|
+
file to fix.
|
|
102
|
+
|
|
60
103
|
**Edit/change queries** (keywords: 新增/添加/修改/如何改/重构/实现; how to add/change/modify/implement): use `--depth lookup` in Step 3 so facts/relation pages are visible. After BM25 recall, also read these directly (bypassing BM25 ranking uncertainty):
|
|
61
104
|
1. `teamwiki/evidence/code/<project>/.indices/graph-index.json` (priority; fall back to `teamwiki/.indices/graph-index.json` if absent) — when surfacing edges, pick 1–3 entry files most relevant to the task and read only their forward direct-dep edges (`from` == entry file); skip reverse expansion (each edge: `{from, to, relation}` — from/to are file paths, relation is type e.g. DEPENDS_ON)
|
|
62
105
|
2. `Sources:` file anchors listed in any matching facts pages (component.md / interface.md)
|
|
@@ -149,6 +192,16 @@ Suggested reading order: <contract/types first> → <impl> → ...
|
|
|
149
192
|
|
|
150
193
|
> Edges capped at 10; see graph-index.json for full graph. Keep this section ≤ 300 characters. Omit this section for non-edit queries.
|
|
151
194
|
|
|
195
|
+
### Candidate change files
|
|
196
|
+
|
|
197
|
+
If the `teamai recall` output contains a
|
|
198
|
+
`--- Candidate change files ---` section, reproduce it here verbatim.
|
|
199
|
+
These are source files and their forward dependencies from the code
|
|
200
|
+
graph — the main conversation should check whether its planned
|
|
201
|
+
changes cover all of them.
|
|
202
|
+
|
|
203
|
+
If no candidate files section was returned, omit this heading entirely.
|
|
204
|
+
|
|
152
205
|
### Gaps (if relevant)
|
|
153
206
|
|
|
154
207
|
⚠️ <gap description> — do not guess answers for this area.
|