teamai-cli 0.17.2 → 0.17.4
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/README.md +85 -471
- package/README.zh-CN.md +88 -474
- package/agents/teamai-recall.md +1 -0
- package/dist/index.js +21989 -20566
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,555 +11,169 @@
|
|
|
11
11
|
[](https://www.npmjs.com/package/teamai-cli)
|
|
12
12
|
[](LICENSE)
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Git-native management of skills, rules, and docs across 20+ AI tools — for you or your whole team.
|
|
14
|
+
[](https://discord.gg/gervEZm58g)
|
|
15
|
+
[](https://discord.gg/DeHHxPnfZF)
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
Make every AI coding agent work by the same harness.
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
Git-native management of skills, rules, and docs across Claude Code / Codex / CodeBuddy / WorkBuddy and more.
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
For you or your whole team.
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
## Quick Start
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
### Install
|
|
27
26
|
|
|
28
27
|
```bash
|
|
29
28
|
npm install -g teamai-cli
|
|
30
29
|
```
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
<summary>Tencent internal users: install <code>@tencent/teamai-cli</code> via tnpm</summary>
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm install -g @tencent/teamai-cli --registry=http://r.tnpm.oa.com
|
|
37
|
-
```
|
|
31
|
+
### Team admin / solo user
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
</details>
|
|
33
|
+
Create a shared-experience repo on your git host (GitHub or TGit), **grant write access to team members**, then have them run `teamai init --repo https://github.com/yourorg/yourrepo`.
|
|
41
34
|
|
|
42
|
-
|
|
35
|
+
> Solo use needs no separate repo setup: `teamai init` checks the target repo and creates it automatically if it doesn't exist.
|
|
43
36
|
|
|
44
37
|
### Team members
|
|
45
38
|
|
|
46
39
|
```bash
|
|
47
40
|
# User-scope init (default, resources installed under ~/)
|
|
48
|
-
teamai init --repo
|
|
41
|
+
teamai init --repo https://github.com/yourorg/yourrepo
|
|
49
42
|
|
|
50
43
|
# Project-scope init (resources installed under the project directory)
|
|
51
44
|
cd /path/to/my-project
|
|
52
|
-
teamai init --repo
|
|
53
|
-
|
|
54
|
-
# Non-interactive mode (for CI/CD or AI-agent automation)
|
|
55
|
-
teamai init --repo yourteam/yourproject --scope user --role hai_dev --force
|
|
45
|
+
teamai init --repo https://github.com/yourorg/yourrepo --scope project
|
|
56
46
|
```
|
|
57
47
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
First create the shared-experience repo on your git host (GitHub by default; TGit also supported) and grant write access to every team member.
|
|
48
|
+
Once initialized, every AI session automatically pulls the latest skills / rules and other Harness updates published by admins — no manual sync needed.
|
|
61
49
|
|
|
62
|
-
|
|
63
|
-
- **TGit (Tencent Gongfeng):** create on [git.woa.com](https://git.woa.com/) and grant master permissions in bulk via user groups.
|
|
50
|
+
> **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.
|
|
64
51
|
|
|
65
|
-
|
|
52
|
+
## Harness Management & Distribution
|
|
66
53
|
|
|
67
|
-
|
|
68
|
-
- `https://git.woa.com/yourteam/yourrepo` → TGit
|
|
54
|
+
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' Harness.
|
|
69
55
|
|
|
70
|
-
###
|
|
56
|
+
### How It Works
|
|
71
57
|
|
|
72
|
-
Some users or agents only need to *consume* a team's skills/rules — no git clone, no push. Onboard them over plain HTTP with just an API key:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
teamai init --http https://your-team-host/api --token <api-key>
|
|
76
58
|
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
- If the team-repo endpoint (`/repo`) is not live yet, init falls back to **reporting-only mode** — hooks and status reporting are wired immediately, and skills/rules begin syncing automatically once the endpoint is available.
|
|
81
|
-
|
|
82
|
-
#### Agent status reporting
|
|
83
|
-
|
|
84
|
-
Once initialized, supported agents (CodeBuddy / WorkBuddy) report their installed-skill state on session start and pull down server-managed skill install / update / uninstall commands, driven by the existing hook dispatch (`session-start` → report + sync, `prompt-submit` → sync). Failed deliveries are buffered to an offline queue and retried next time.
|
|
85
|
-
|
|
86
|
-
> **Privacy.** The install path and machine id are only hashed *locally* to derive a stable `local_agent_id` — neither is ever uploaded.
|
|
87
|
-
|
|
88
|
-
<details>
|
|
89
|
-
<summary><b>HTTP contract</b> (for backend implementers) — what the <code>--http</code> endpoint must serve</summary>
|
|
90
|
-
|
|
91
|
-
The value you pass to `--http <baseUrl>` is the base; every endpoint is relative to it and authenticated with `Authorization: Bearer <api-key>`.
|
|
92
|
-
|
|
93
|
-
| Endpoint | Method | Purpose | Path |
|
|
94
|
-
|----------|--------|---------|------|
|
|
95
|
-
| `{baseUrl}/repo` | GET | Team-repo snapshot (skills + rules/docs) | **fixed** |
|
|
96
|
-
| `{baseUrl}/api/local-agent/report` | POST | Session start: upsert agent + installed skills | default, configurable |
|
|
97
|
-
| `{baseUrl}/api/local-agent/sync` | POST | Report status + return pending skill commands | default, configurable |
|
|
98
|
-
| `{baseUrl}/api/local-agent/commands/ack` | POST | Ack one command (`{ id, status, error }`) | default, configurable |
|
|
99
|
-
|
|
100
|
-
`GET /repo` returns JSON (a 404 or non-JSON 200 ⇒ the client enters reporting-only mode):
|
|
101
|
-
|
|
102
|
-
```json
|
|
103
|
-
{
|
|
104
|
-
"version": "<opaque cache key, e.g. a commit hash>",
|
|
105
|
-
"files": [{ "path": "rules/foo.md", "content": "..." }],
|
|
106
|
-
"commands":[{ "type": "install_skill", "skill_slug": "x", "skill_version": "1.0.0", "download_url": "https://signed-url/..." }]
|
|
107
|
-
}
|
|
59
|
+
teamai push → create branch + MR → reviewer approves + merges
|
|
60
|
+
↓
|
|
61
|
+
SessionStart hook → teamai pull → synced to local AI tools
|
|
108
62
|
```
|
|
109
63
|
|
|
110
|
-
|
|
111
|
-
- A skill `download_url` is fetched **directly** — it carries its own signed auth in the query string, so no `Bearer` header is sent. It must resolve to a `.zip` whose root is either `<slug>/SKILL.md …` or a flat `SKILL.md …`.
|
|
112
|
-
|
|
113
|
-
**Fixed vs configurable.** The `/repo` path is fixed; the three reporter paths are defaults you can override. The JSON shapes above are the contract. Knobs (env vars):
|
|
64
|
+
Members push changes via `teamai push`, which opens a Merge Request for review. 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.
|
|
114
65
|
|
|
115
|
-
|
|
116
|
-
|----------|--------|
|
|
117
|
-
| `TEAMAI_API_TOKEN` | API key (alternative to `--token`) |
|
|
118
|
-
| `TEAMAI_REPORT_ENDPOINT` | Reporter base URL (defaults to the `--http` URL) |
|
|
119
|
-
| `TEAMAI_REPORT_PATHS` | JSON `{ "report", "sync", "ack" }` to override the three reporter paths |
|
|
120
|
-
| `TEAMAI_REPORT_AGENTS` | Comma-separated agents that report (default `workbuddy,codebuddy`) |
|
|
121
|
-
| `TEAMAI_SKILL_DOWNLOAD_HOSTS` | Comma-separated host allowlist for skill `download_url` (empty = allow all) |
|
|
66
|
+
### Team Hooks
|
|
122
67
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
## Commands
|
|
126
|
-
|
|
127
|
-
| Command | Description |
|
|
128
|
-
|---------|-------------|
|
|
129
|
-
| `teamai init` | Initialize (OAuth login, link repo, register member, inject hooks) |
|
|
130
|
-
| `teamai push` | Push local resources to a branch and open a Merge Request |
|
|
131
|
-
| `teamai pull` | Pull team resources and inject into local AI tools |
|
|
132
|
-
| `teamai status` | Show local vs team repo diff |
|
|
133
|
-
| `teamai recall <query>` | Search the team knowledge base (BM25 + graph-boost) |
|
|
134
|
-
| `teamai recall enable/disable/status` | Toggle or check recall state (controls auto-recall hooks + subagent deployment) |
|
|
135
|
-
| `teamai import --dir <path>` | Extract code knowledge graph from a local directory |
|
|
136
|
-
| `teamai import --from-repo <url>` | Import a repo's code knowledge graph (`teamwiki/`) |
|
|
137
|
-
| `teamai import --from-org <org>` | Batch import all repos under an organization |
|
|
138
|
-
| `teamai import --from-repo-list <yaml>` | Batch import repos from a whitelist |
|
|
139
|
-
| `teamai import --from-mr <url>` | Extract learning from a merged MR/PR |
|
|
140
|
-
| `teamai import --from-iwiki <id>` | Import iWiki documents as learnings |
|
|
141
|
-
| `teamai codebase --lint` | Knowledge graph health check |
|
|
142
|
-
| `teamai contribute` | Share session experience to team repo |
|
|
143
|
-
| `teamai members` | List team members |
|
|
144
|
-
| `teamai roles` | Manage team roles and namespaces |
|
|
145
|
-
| `teamai remove <type> <name>` | Remove a resource and open MR |
|
|
146
|
-
| `teamai digest` | Generate weekly team usage digest |
|
|
147
|
-
| `teamai doctor` | Diagnose configuration issues |
|
|
148
|
-
| `teamai uninstall` | Remove all teamai resources and hooks |
|
|
149
|
-
|
|
150
|
-
Global options: `--dry-run`, `--verbose`
|
|
151
|
-
|
|
152
|
-
Import options: `--incremental`, `--skip-enrich` (skip AI calls, only extract + graph)
|
|
153
|
-
|
|
154
|
-
<details>
|
|
155
|
-
<summary>More commands (management, CI, analytics)</summary>
|
|
156
|
-
|
|
157
|
-
| Command | Description |
|
|
158
|
-
|---------|-------------|
|
|
159
|
-
| `teamai list [type]` | List resources (skills\|rules\|docs\|env\|wiki) |
|
|
160
|
-
| `teamai skill [show <name>]` | Inspect skill metadata and contributors |
|
|
161
|
-
| `teamai source` | Manage cross-team skill subscriptions |
|
|
162
|
-
| `teamai tags` | Manage tag-based resource filtering |
|
|
163
|
-
| `teamai env` | Manage team environment variables |
|
|
164
|
-
| `teamai hooks` | Manage AI-tool hooks |
|
|
165
|
-
| `teamai cache --gc` | Garbage-collect clone cache |
|
|
166
|
-
| `teamai ci extract-mr --url <url>` | CI: extract knowledge from MR, post comments, write after merge |
|
|
167
|
-
|
|
168
|
-
</details>
|
|
169
|
-
|
|
170
|
-
## How It Works
|
|
171
|
-
|
|
172
|
-
```
|
|
173
|
-
Member A Member B
|
|
174
|
-
create skill / write rules same
|
|
175
|
-
│ │
|
|
176
|
-
▼ ▼
|
|
177
|
-
teamai push teamai push
|
|
178
|
-
│ │
|
|
179
|
-
▼ ▼
|
|
180
|
-
create branch + MR create branch + MR
|
|
181
|
-
│ │
|
|
182
|
-
└──────► team git repo ◄─────────────┘
|
|
183
|
-
│ ▲
|
|
184
|
-
│ │ reviewer approves + merges MR
|
|
185
|
-
▼
|
|
186
|
-
SessionStart hook → teamai pull
|
|
187
|
-
auto-synced to every member's local
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
- `teamai push` creates a dedicated branch (`teamai/push/<user>/<timestamp>`), pushes it, then opens a Merge Request and assigns reviewers automatically.
|
|
191
|
-
- `teamai init` lets you configure default reviewers (stored in the `reviewers` field of `teamai.yaml`).
|
|
192
|
-
- `teamai init` injects hooks tailored to each tool's format (`SessionStart`, `Stop`, `PostToolUse`, `UserPromptSubmit`, etc.). During sessions the hooks run `teamai pull`, `teamai update`, tracking, dashboard updates, and so on (supports Claude Code, Codex, Claude Code Internal, Codex Internal, Cursor, CodeBuddy IDE, OpenClaw, WorkBuddy).
|
|
193
|
-
- Skills sync to `~/.claude/skills/`, `~/.codex/skills/`, `~/.codex-internal/skills/`, `~/.claude-internal/skills/`, `~/.cursor/skills/`, `~/.codebuddy/skills/`.
|
|
194
|
-
- Rules sync to each tool's rules directory and are merged into `CLAUDE.md` via marker comments (supported for claude, claude-internal, codebuddy).
|
|
195
|
-
- Knowledge syncs to `~/.teamai/docs/`.
|
|
196
|
-
- Learnings sync to `~/.teamai/learnings/` and back the recall index (shared team-wide, not partitioned by role).
|
|
197
|
-
- Culture syncs the team culture file (`culture.md`): its frontmatter and body are compiled and injected into every AI tool's `CLAUDE.md`.
|
|
198
|
-
|
|
199
|
-
## Role-scoped Skills
|
|
200
|
-
|
|
201
|
-
When the team resource repo enables role-scoped directories, skills are organized under role namespaces. During `teamai init`, the CLI asks you to pick a `primaryRole` and optional `additionalRoles` and writes them to your local `config.yaml`.
|
|
202
|
-
|
|
203
|
-
Remote repo layout convention:
|
|
204
|
-
|
|
205
|
-
```text
|
|
206
|
-
manifest/roles.yaml # role definitions
|
|
207
|
-
skills/<namespace>/<skill>/ # skills organized by namespace
|
|
208
|
-
rules/ # global, not role-scoped
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
- `teamai pull` reads `manifest/roles.yaml` and only syncs skills under `primaryRole + additionalRoles` namespaces (unioned with tag-filter results).
|
|
212
|
-
- Skills install flat from `skills/<namespace>/<skill-name>/` into `<tool>/skills/<skill-name>/` — the namespace layout is invisible to users.
|
|
213
|
-
- If two activated namespaces contain a skill with the same name, `pull` fails outright to prevent silent overrides.
|
|
214
|
-
- Skills outside both activated namespaces and tag-filter results are cleaned up automatically.
|
|
215
|
-
- `rules/`, `docs/`, `learnings/` keep their original behavior and are not role-scoped (learnings are shared team-wide).
|
|
216
|
-
|
|
217
|
-
Example config:
|
|
68
|
+
Declare custom hooks in `hooks/hooks.yaml` and `teamai pull` delivers them to every AI tool:
|
|
218
69
|
|
|
219
70
|
```yaml
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
71
|
+
hooks:
|
|
72
|
+
- id: block-secret
|
|
73
|
+
description: Scan for secrets before commit
|
|
74
|
+
event: PreToolUse
|
|
75
|
+
matcher: Bash
|
|
76
|
+
command: 'bash -lc "~/.teamai/team-scripts/scan-secret.sh" || true'
|
|
77
|
+
tools: [claude, cursor]
|
|
224
78
|
```
|
|
225
79
|
|
|
226
|
-
This syncs every skill from `skills/common/`, `skills/hai/`, and `skills/pm/`.
|
|
227
|
-
|
|
228
|
-
## Role-scoped Pushing
|
|
229
|
-
|
|
230
|
-
In a role-scoped repo, when you push a new skill the CLI auto-detects available namespaces and prompts:
|
|
231
|
-
|
|
232
80
|
```bash
|
|
233
|
-
#
|
|
234
|
-
teamai
|
|
235
|
-
#
|
|
236
|
-
# Which namespace should new skills be pushed to?
|
|
237
|
-
# 1. common
|
|
238
|
-
# 2. hai
|
|
239
|
-
# 3. pm
|
|
240
|
-
# Choose namespace [1-3] (default: 1 = common):
|
|
241
|
-
|
|
242
|
-
# Explicit target namespace
|
|
243
|
-
teamai push --role pm
|
|
81
|
+
teamai hooks list # list effective hooks
|
|
82
|
+
teamai hooks inject # force-reconcile into all tools
|
|
83
|
+
teamai hooks remove # remove all teamai-managed hooks
|
|
244
84
|
```
|
|
245
85
|
|
|
246
|
-
-
|
|
247
|
-
- Without a `primaryRole`, namespaces are discovered by scanning the team repo's directory structure.
|
|
248
|
-
- When only one namespace exists, it's selected automatically — no prompt.
|
|
249
|
-
- `--role <id>` temporarily overrides the target namespace.
|
|
250
|
-
- Modifying an existing skill keeps its original namespace — no reselection needed.
|
|
251
|
-
|
|
252
|
-
On push, the CLI checks `SKILL.md`'s YAML frontmatter (`name`/`description`) and auto-fills anything missing, so you don't have to maintain it by hand.
|
|
253
|
-
|
|
254
|
-
## Team Culture
|
|
255
|
-
|
|
256
|
-
Create `culture.md` at the root of the team repo. Use YAML frontmatter for company/team info and the body for cultural guidelines:
|
|
257
|
-
|
|
258
|
-
```markdown
|
|
259
|
-
---
|
|
260
|
-
company:
|
|
261
|
-
name: Acme Corp
|
|
262
|
-
mission: Build great things
|
|
263
|
-
values:
|
|
264
|
-
- Innovation
|
|
265
|
-
- Integrity
|
|
266
|
-
team:
|
|
267
|
-
name: Platform
|
|
268
|
-
mission: Enable developers
|
|
269
|
-
goals:
|
|
270
|
-
- Ship v2.0
|
|
271
|
-
- Improve test coverage
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
## Coding Guidelines
|
|
275
|
-
|
|
276
|
-
- Every PR needs at least one reviewer approval
|
|
277
|
-
- Direct pushes to master are forbidden
|
|
278
|
-
- Test coverage must stay above 80%
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
`teamai pull` compiles `culture.md` into structured content and injects it into every AI tool's `CLAUDE.md` (between `<!-- [teamai:culture:start] -->` and `<!-- [teamai:culture:end] -->`). AI coding assistants pick up the team culture on every session.
|
|
282
|
-
|
|
283
|
-
## Cross-team Skill Subscription
|
|
86
|
+
### Cross-team Skill Subscription
|
|
284
87
|
|
|
285
|
-
|
|
88
|
+
Subscribe to other teams' public skill repos:
|
|
286
89
|
|
|
287
90
|
```bash
|
|
288
|
-
# Add a subscription source
|
|
289
91
|
teamai source add https://github.com/other-team/teamai-public.git --name other-team
|
|
290
|
-
|
|
291
|
-
# List subscribed sources
|
|
292
92
|
teamai source list
|
|
293
|
-
|
|
294
|
-
# Browse skills from a source
|
|
295
|
-
teamai source browse other-team
|
|
296
|
-
|
|
297
|
-
# Remove a subscription (and clean up its skills)
|
|
93
|
+
teamai source browse other-team # browse available skills
|
|
298
94
|
teamai source remove other-team
|
|
299
95
|
```
|
|
300
96
|
|
|
301
|
-
Subscribed skills sync
|
|
302
|
-
|
|
303
|
-
## Scope
|
|
304
|
-
|
|
305
|
-
TeamAI supports two scopes that can coexist:
|
|
306
|
-
|
|
307
|
-
| Dimension | User Scope (default) | Project Scope |
|
|
308
|
-
|-----------|---------------------|---------------|
|
|
309
|
-
| **Install location** | under `~/` (e.g. `~/.claude/skills/`) | under the project (e.g. `<project>/.claude/skills/`) |
|
|
310
|
-
| **Config file** | `~/.teamai/config.yaml` | `<project>/.teamai/config.yaml` |
|
|
311
|
-
| **Use case** | general team norms, cross-project skills | project-specific skills and rules |
|
|
312
|
-
| **Init** | `teamai init --repo <group>/<repo>` | `cd <project> && teamai init --repo <group>/<repo> --scope project` |
|
|
97
|
+
Subscribed skills sync automatically on `teamai pull`.
|
|
313
98
|
|
|
314
|
-
|
|
315
|
-
- `teamai pull` pulls user and project scopes sequentially; they don't conflict.
|
|
316
|
-
- `teamai contribute --scope user/project` lets you pick which repo to push to.
|
|
317
|
-
- `teamai recall` merges knowledge bases from both scopes into a single ranking and tags each result with its origin `[user]` / `[project]`.
|
|
318
|
-
- The `scope` field in the remote `teamai.yaml` locks the repo's type; member init must match.
|
|
99
|
+
## Knowledge Base
|
|
319
100
|
|
|
320
|
-
|
|
101
|
+
Beyond distributing the Harness, TeamAI organizes accumulated team experience and code structure into a searchable knowledge base that the AI recalls automatically when needed.
|
|
321
102
|
|
|
322
|
-
|
|
103
|
+
### Automatic Experience Sharing
|
|
323
104
|
|
|
324
|
-
|
|
325
|
-
AI coding session (ongoing...)
|
|
326
|
-
│
|
|
327
|
-
▼ PostToolUse hook continuously tracks tool calls and skill usage
|
|
328
|
-
│
|
|
329
|
-
▼ session ends (Stop hook fires)
|
|
330
|
-
│
|
|
331
|
-
├─ Smart scoring: tool-call count + tool diversity + skill usage + error retries + session duration
|
|
332
|
-
│ (extracted from dashboard events.jsonl, one-shot, out of 100)
|
|
333
|
-
│
|
|
334
|
-
├─ Score < 35 → stay silent (too few or too uniform calls, not worth summarizing)
|
|
335
|
-
│
|
|
336
|
-
▼ Score ≥ 35
|
|
337
|
-
│
|
|
338
|
-
AI: "This session was productive — consider running /teamai-share-learnings to share."
|
|
339
|
-
│
|
|
340
|
-
▼ user accepts
|
|
341
|
-
│
|
|
342
|
-
/teamai-share-learnings (AI sub-agent)
|
|
343
|
-
├─ AI summarizes the session's lessons
|
|
344
|
-
├─ Generates a Markdown document
|
|
345
|
-
└─ teamai contribute --file <path> → pushes directly to the team repo's learnings/
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
- `/teamai-share-learnings` is a built-in CLI skill, deployed locally by `teamai pull/init`.
|
|
349
|
-
- Each session is prompted at most once (de-duplicated); you can always ignore it.
|
|
350
|
-
- The document lands directly in `learnings/` and is visible to teammates on their next `pull`.
|
|
351
|
-
|
|
352
|
-
## Team Knowledge Recall
|
|
353
|
-
|
|
354
|
-
`teamai recall` implements the "read" side of the knowledge flywheel — the AI can search across accumulated team experience docs:
|
|
105
|
+
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:
|
|
355
106
|
|
|
356
107
|
```
|
|
357
|
-
|
|
108
|
+
建议运行 /teamai-share-learnings 总结本次 session 的经验并分享给团队。
|
|
358
109
|
```
|
|
359
110
|
|
|
360
|
-
|
|
361
|
-
$ teamai recall "fuse port"
|
|
362
|
-
[1/2] MR review caught a FUSE port-conflict bug ★1 [user]
|
|
363
|
-
Author: jeffyxu | Score: 18.5 | Tags: troubleshooting, fuse, k8s
|
|
364
|
-
|
|
365
|
-
[2/2] FUSE deployment configuration best practices [project]
|
|
366
|
-
Author: alice | Score: 12.0 | Tags: fuse, deploy
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
- **Dual-scope merged search:** automatically merges user and project scope knowledge bases, each result tagged with its origin.
|
|
370
|
-
- Hybrid CJK + English search (Intl.Segmenter + CJK bigrams).
|
|
371
|
-
- Searches implicitly upvote matched docs; good docs naturally float up over time.
|
|
372
|
-
- Votes are written to each scope's own repo, so attribution stays correct.
|
|
373
|
-
|
|
374
|
-
`teamai recall` results carry a `[<type>]` tag so callers can quickly tell which knowledge bucket a hit came from. The shared search index covers four categories:
|
|
111
|
+
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.
|
|
375
112
|
|
|
376
|
-
|
|
377
|
-
|------|--------|-------|
|
|
378
|
-
| `[learnings]` | `~/.teamai/learnings/*.md` | session experience documents |
|
|
379
|
-
| `[docs]` | team repo `docs/**/*.md` | shared project knowledge |
|
|
380
|
-
| `[rules]` | team repo `rules/**/*.md` | coding rules and conventions |
|
|
381
|
-
| `[skills]` | team repo `skills/<name>/SKILL.md` | reusable AI skills |
|
|
113
|
+
### Team Knowledge Recall
|
|
382
114
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
### Recall Enable / Disable
|
|
386
|
-
|
|
387
|
-
Recall is controlled at two levels — team admin sets the default, individual users can override:
|
|
388
|
-
|
|
389
|
-
| Layer | File | Field | Effect |
|
|
390
|
-
|-------|------|-------|--------|
|
|
391
|
-
| Team default | `teamai.yaml` | `sharing.recall.enabled` | `true` / `false` (default: `false`) |
|
|
392
|
-
| User override | `~/.teamai/config.yaml` | `recallEnabled` | `true` / `false` — wins over team default |
|
|
393
|
-
| Env var | shell | `TEAMAI_RECALL_DISABLED=1` | Force-disable all recall hooks (quick kill-switch) |
|
|
115
|
+
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:
|
|
394
116
|
|
|
395
117
|
```bash
|
|
396
|
-
teamai recall enable #
|
|
397
|
-
teamai recall disable #
|
|
118
|
+
teamai recall enable # on: deploy the teamai-recall subagent + inject guidance rules
|
|
119
|
+
teamai recall disable # off: remove the subagent and rules
|
|
398
120
|
teamai recall status # show effective state (team default + user override)
|
|
399
121
|
```
|
|
400
122
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
### Codebase Knowledge Graph (teamwiki/)
|
|
404
|
-
|
|
405
|
-
`teamai codebase --extract` (or `teamai import --from-repo`) parses your source repos and writes a structured knowledge graph under `teamwiki/`:
|
|
406
|
-
|
|
407
|
-
```
|
|
408
|
-
teamwiki/
|
|
409
|
-
├── router.md # Navigation hub — lists every imported repo
|
|
410
|
-
├── index.md # Global index (auto-generated, with timestamp)
|
|
411
|
-
├── hot.md # Active working memory (reserved for Phase 4)
|
|
412
|
-
├── source-manifest.json # Per-file hash manifest for incremental extraction
|
|
413
|
-
├── .indices/
|
|
414
|
-
│ └── graph-index.json # Knowledge graph: nodes + edges (JSON)
|
|
415
|
-
├── evidence/
|
|
416
|
-
│ └── code/
|
|
417
|
-
│ └── <project>/ # One directory per imported repo
|
|
418
|
-
│ ├── index.md # Project summary (fact count + page list)
|
|
419
|
-
│ ├── component.md # Functions / classes / components
|
|
420
|
-
│ ├── interface.md # Interface and type definitions
|
|
421
|
-
│ ├── config.md # Config keys (env vars, TOML keys, etc.)
|
|
422
|
-
│ ├── error.md # Error-handling patterns
|
|
423
|
-
│ └── relation-<dir>.md # Import relationships grouped by top-level dir
|
|
424
|
-
└── gaps/
|
|
425
|
-
└── detected.md # Detected knowledge gaps (IMPL_MISSING, LOW_CONNECTIVITY, …)
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
**graph-index.json** stores the extracted graph. A real example: 11 HAI team repos → **2 218 nodes, 852 edges**.
|
|
429
|
-
|
|
430
|
-
| Field | Description |
|
|
431
|
-
|-------|-------------|
|
|
432
|
-
| `nodes[].kind` | `component` (function/class) or `config` (config key) |
|
|
433
|
-
| `edges[].relation` | `imports` — cross-file and cross-repo dependency |
|
|
434
|
-
|
|
435
|
-
Cross-repo edges are detected automatically by PascalCase label matching.
|
|
436
|
-
|
|
437
|
-
`teamai recall` uses this graph for **BM25 + graph-boost** retrieval: keyword hits are re-ranked by graph proximity, so you get structurally relevant results, not just textual matches.
|
|
438
|
-
|
|
439
|
-
### TodoWrite reminder hook
|
|
440
|
-
|
|
441
|
-
`teamai pull` registers a PostToolUse hook on the `TodoWrite` tool. The first time a session writes a TODO list, the hook injects a one-time reminder asking the agent to invoke `teamai-recall` if it has not already done so. Per-session deduplication uses `~/.teamai/sessions/<sid>-todowrite-hint.json` (24 h TTL).
|
|
442
|
-
|
|
443
|
-
To disable the reminder globally, set:
|
|
123
|
+
**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. Under the hood it shells out to the `teamai recall` command, which you can also run manually:
|
|
444
124
|
|
|
445
125
|
```bash
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
The same env var also disables `teamai recall`'s quality tracking (used by contribute-check's knowledge-gap detection).
|
|
450
|
-
|
|
451
|
-
### `agents` resource type
|
|
452
|
-
|
|
453
|
-
The team repo can ship custom subagent definitions under a flat `agents/` directory (one `*.md` file per agent). They follow the same push / pull / remove semantics as `rules`:
|
|
126
|
+
$ teamai recall "port conflict"
|
|
127
|
+
[1/2] MR review caught a port-conflict bug ★1 [user]
|
|
128
|
+
Author: member-a | Score: 18.5 | Tags: troubleshooting, networking
|
|
454
129
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
agents/
|
|
458
|
-
code-reviewer.md # team-authored subagent
|
|
459
|
-
.removed # tombstone (auto-managed by `teamai remove agents <name>`)
|
|
130
|
+
[2/2] Deployment configuration best practices [project]
|
|
131
|
+
Author: member-b | Score: 12.0 | Tags: deploy, config
|
|
460
132
|
```
|
|
461
133
|
|
|
462
|
-
|
|
134
|
+
**Coverage spans two parts:**
|
|
463
135
|
|
|
464
|
-
|
|
136
|
+
- **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`.
|
|
137
|
+
- **Codebase knowledge graph** (`teamwiki/`): produced by `teamai import`, queried live at search time.
|
|
465
138
|
|
|
466
|
-
|
|
139
|
+
Ranking uses BM25 + graph-boost, merges dual-scope (user + project) results tagged with origin, and implicitly upvotes matched docs so good content floats up over time.
|
|
467
140
|
|
|
468
|
-
|
|
469
|
-
hooks:
|
|
470
|
-
- id: block-secret # unique, ^[a-z0-9-]+$ — used for the marker + manifest
|
|
471
|
-
description: 提交前扫描密钥 # written into the hook description
|
|
472
|
-
event: PreToolUse # Claude PascalCase event name (the cross-tool lingua franca)
|
|
473
|
-
matcher: Bash # optional tool matcher
|
|
474
|
-
command: 'bash -lc "~/.teamai/team-scripts/scan-secret.sh" || true'
|
|
475
|
-
timeout: 15 # optional, seconds
|
|
476
|
-
tools: [claude, cursor] # optional; default = all hook-capable tools
|
|
477
|
-
|
|
478
|
-
# Optional: tune the CLI's own built-in hooks (whitelisted fields only)
|
|
479
|
-
builtin:
|
|
480
|
-
disabled: [Hook dispatch post-tool-use TodoWrite] # drop a built-in hook
|
|
481
|
-
overrides:
|
|
482
|
-
Hook dispatch stop: { timeout: 20 } # only `timeout` may be overridden
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
- `teamai pull` reconciles built-in (A) + team (B) hooks into each tool on every session start (it bypasses the "already synced" fast-path, so new/changed hooks self-heal automatically).
|
|
486
|
-
- Team hooks are isolated from built-in hooks by a `[teamai:hook:<id>]` marker and tracked in `~/.teamai/managed-hooks.json`, so removing one from `hooks.yaml` cleanly removes it from every tool on the next pull — built-in hooks are never disturbed.
|
|
487
|
-
- Disk format is unchanged and byte-identical for built-in hooks, so upgrading the CLI is a zero-diff, zero-regression operation for already-installed machines.
|
|
141
|
+
### Codebase Knowledge Graph
|
|
488
142
|
|
|
489
|
-
|
|
143
|
+
`teamai import` parses source repos into a structured graph under `teamwiki/`, enabling structurally-aware retrieval:
|
|
490
144
|
|
|
491
145
|
```bash
|
|
492
|
-
teamai
|
|
493
|
-
teamai
|
|
494
|
-
teamai
|
|
146
|
+
teamai import --from-repo https://github.com/org/repo
|
|
147
|
+
teamai import --from-org myorg # batch import all repos
|
|
148
|
+
teamai codebase --lint # health check
|
|
495
149
|
```
|
|
496
150
|
|
|
497
|
-
|
|
498
|
-
> - Commands are printed for transparency when applied (unless `--silent`).
|
|
499
|
-
> - `sharing.hooks.autoApply: false` (in `teamai.yaml`) holds team hooks during `pull` and only hints — the user must run `teamai hooks inject` to consent.
|
|
500
|
-
> - `sharing.hooks.requireTeamScripts: true` rejects any team hook whose command is not under `~/.teamai/team-scripts/`.
|
|
501
|
-
> - Set `TEAMAI_HOOKS_DISABLED=1` to veto all team hooks locally (built-in hooks still apply).
|
|
502
|
-
|
|
503
|
-
## Update
|
|
504
|
-
|
|
505
|
-
```bash
|
|
506
|
-
teamai update # auto-detect and upgrade to latest
|
|
507
|
-
npm update -g teamai-cli # or trigger an npm upgrade manually
|
|
508
|
-
```
|
|
151
|
+
The graph stores components, interfaces, configs, and cross-repo import edges. `teamai recall` uses it for graph-boosted re-ranking.
|
|
509
152
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
- `teamai-cli` → public npm (`https://registry.npmjs.org`)
|
|
513
|
-
- `@tencent/teamai-cli` → internal tnpm (`http://r.tnpm.oa.com`)
|
|
514
|
-
|
|
515
|
-
To override the registry manually, set `TEAMAI_NPM_REGISTRY=<url>`.
|
|
516
|
-
|
|
517
|
-
### Auto-update Control
|
|
518
|
-
|
|
519
|
-
Auto-update runs on the Stop hook at the end of a session. It can be controlled at two layers:
|
|
520
|
-
|
|
521
|
-
| Layer | File | Field | Allowed values |
|
|
522
|
-
|-------|------|-------|----------------|
|
|
523
|
-
| Team default | `teamai.yaml` | `autoUpdate` | `true` (default) / `false` |
|
|
524
|
-
| User override | `~/.teamai/config.yaml` | `updatePolicy` | `auto` / `prompt` / `skip` |
|
|
525
|
-
|
|
526
|
-
The user-level `updatePolicy` always wins over the team-level `autoUpdate`.
|
|
527
|
-
|
|
528
|
-
## CI Integration
|
|
529
|
-
|
|
530
|
-
TeamAI can integrate into your CI pipeline to automatically extract knowledge from every MR/PR:
|
|
531
|
-
|
|
532
|
-
```
|
|
533
|
-
MR opened/updated → CI extracts learning + codebase suggestions → posts as comments
|
|
534
|
-
→ Reviewer rejects unwanted suggestions (GitHub 👎 / TGit ☝️)
|
|
535
|
-
→ MR merged → CI writes approved items to team knowledge repo
|
|
536
|
-
```
|
|
537
|
-
|
|
538
|
-
### Quick Start
|
|
539
|
-
|
|
540
|
-
```bash
|
|
541
|
-
# Comment mode: post suggestions to MR (run on PR open/update)
|
|
542
|
-
teamai ci extract-mr --url "$MR_URL" --mode comment --individual-comments
|
|
543
|
-
|
|
544
|
-
# Write mode: write approved items to knowledge repo (run after merge)
|
|
545
|
-
teamai ci extract-mr --url "$MR_URL" --mode write --team-repo ./team-repo --individual-comments
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
### CI Templates
|
|
549
|
-
|
|
550
|
-
Ready-to-use templates in `examples/ci/`:
|
|
551
|
-
|
|
552
|
-
| File | Platform |
|
|
553
|
-
|------|----------|
|
|
554
|
-
| `github-actions-mr-extract.yml` | GitHub Actions |
|
|
555
|
-
| `coding-ci-mr-extract.yaml` | Coding CI (TGit + ZhiYan QCI) |
|
|
153
|
+
## Commands
|
|
556
154
|
|
|
557
|
-
|
|
155
|
+
| Command | Description |
|
|
156
|
+
|---------|-------------|
|
|
157
|
+
| `teamai init` | Initialize: OAuth login, link repo, register member, inject hooks |
|
|
158
|
+
| `teamai pull` | Pull team resources and inject into local AI tools |
|
|
159
|
+
| `teamai push` | Push local resources to a branch and open a Merge Request |
|
|
160
|
+
| `teamai status` | Show local vs team repo diff |
|
|
161
|
+
| `teamai contribute` | Share session experience to team repo |
|
|
162
|
+
| `teamai recall <query>` | Search the team knowledge base (BM25 + graph-boost) |
|
|
163
|
+
| `teamai recall enable/disable/status` | Toggle or check recall state |
|
|
164
|
+
| `teamai import` | Import knowledge (`--dir`, `--from-repo`, `--from-org`, `--from-repo-list`, `--from-mr`, `--from-iwiki`) |
|
|
165
|
+
| `teamai codebase --lint` | Knowledge graph health check |
|
|
166
|
+
| `teamai ci extract-mr --url <url>` | CI: extract knowledge from MR, post comments, write after merge |
|
|
167
|
+
| `teamai members` | List team members |
|
|
168
|
+
| `teamai roles` | Manage team roles and namespaces |
|
|
169
|
+
| `teamai skill exclude add/remove/list` | Manage skills excluded from local sync ([usage guide](docs/usage-guide.md#excluding-skills-you-dont-need)) |
|
|
170
|
+
| `teamai source` | Manage cross-team skill subscriptions |
|
|
171
|
+
| `teamai remove <type> <name>` | Remove a resource and open MR |
|
|
172
|
+
| `teamai digest` | Generate weekly team usage digest |
|
|
173
|
+
| `teamai doctor` | Diagnose configuration issues |
|
|
174
|
+
| `teamai uninstall` | Remove all teamai resources and hooks |
|
|
558
175
|
|
|
559
|
-
|
|
560
|
-
|----------|--------------|---------|
|
|
561
|
-
| GitHub | Add 👎 reaction to the suggestion comment | Write all |
|
|
562
|
-
| TGit | Add ☝️ emoji to the suggestion note | Write all |
|
|
176
|
+
Global options: `--dry-run`, `--verbose`
|
|
563
177
|
|
|
564
178
|
## License
|
|
565
179
|
|