@team-ai/teamai-cli 0.0.0-stage → 0.22.2

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +1416 -0
  2. package/LICENSE +13 -0
  3. package/README.ja.md +177 -0
  4. package/README.ko.md +177 -0
  5. package/README.md +176 -2
  6. package/README.th.md +177 -0
  7. package/README.zh-CN.md +183 -0
  8. package/agents/teamai-recall.md +406 -0
  9. package/dist/cli.js +136359 -0
  10. package/dist/index.js +9 -0
  11. package/package.json +100 -4
  12. package/skill-data/core/SKILL.md +250 -0
  13. package/skill-data/core/references/commands.md +471 -0
  14. package/skill-data/core/references/contribute-member.md +161 -0
  15. package/skill-data/core/references/troubleshooting.md +419 -0
  16. package/skill-data/setup/SKILL.md +80 -0
  17. package/skill-data/setup/references/join-member.md +189 -0
  18. package/skill-data/setup/references/manage-admin.md +354 -0
  19. package/skill-data/setup/references/provider-tgit.md +101 -0
  20. package/skill-data/setup/references/setup-admin.md +312 -0
  21. package/skill-data/setup/references/uninstall.md +180 -0
  22. package/skill-data/share/SKILL.md +70 -0
  23. package/skill-data/share/references/doc-template.md +44 -0
  24. package/skill-data/wiki/SKILL.md +317 -0
  25. package/skill-data/wiki/references/agents/graph-rag-agent.md +344 -0
  26. package/skill-data/wiki/references/agents/kb-doc-generator.md +325 -0
  27. package/skill-data/wiki/references/methodology/phase0-collection.md +54 -0
  28. package/skill-data/wiki/references/methodology/phase1-reverse-engineering.md +89 -0
  29. package/skill-data/wiki/references/methodology/phase2-document-types.md +341 -0
  30. package/skill-data/wiki/references/methodology/phase3-ai-enhancement.md +164 -0
  31. package/skill-data/wiki/references/methodology/phase4-quality.md +232 -0
  32. package/skill-data/wiki/references/overview.md +125 -0
  33. package/skill-data/wiki/references/phases/k1-reverse-engineering.md +118 -0
  34. package/skill-data/wiki/references/phases/k2-documents.md +68 -0
  35. package/skill-data/wiki/references/phases/k3-ai-native.md +121 -0
  36. package/skill-data/wiki/references/phases/k4-quality.md +190 -0
  37. package/skill-data/wiki/references/phases/phase0-init.md +113 -0
  38. package/skill-data/wiki/references/templates/project-overview.md +149 -0
  39. package/skill-data/wiki/scripts/scan_repo.py +224 -0
  40. package/skill-data/wiki/scripts/validate_kb.py +256 -0
  41. package/skills/teamai/SKILL.md +46 -0
@@ -0,0 +1,419 @@
1
+ # Troubleshooting & Agent-specific caveats
2
+
3
+ Load this whenever a step fails, `teamai doctor` flags something, or team
4
+ resources don't show up. It is shared by all four scenarios.
5
+
6
+ ## First move: run doctor
7
+
8
+ ```bash
9
+ teamai doctor
10
+ ```
11
+
12
+ It checks provider config, hooks, paths, and package/plugin status. Fix what it
13
+ reports before anything else.
14
+
15
+ ## "Cannot acquire lock <path>: <reason>"
16
+
17
+ The lock could not be inspected, created or reclaimed, including during a
18
+ dry-run preview. Fix the filesystem error named in
19
+ the message (permissions, a full disk, or a parent path that is a file), then
20
+ retry; waiting for another process does not fix it. Ordinary contention still
21
+ uses the command's busy/skip message. An existing permission-denied or ownerless lock
22
+ is treated as held: remove it only after confirming no teamai process uses it.
23
+
24
+ A lock whose owning process is dead blocks nothing: the next command that takes
25
+ the same lock reclaims it, and a process exiting normally removes the locks it
26
+ still holds. `teamai doctor` reports leftover lock files, and
27
+ `teamai doctor --fix` removes the ones whose owner is provably dead.
28
+
29
+ ## "My skills / rules aren't showing up"
30
+
31
+ This is the #1 onboarding issue. In order:
32
+
33
+ 1. **Did init pick this tool?** `teamai init` does not copy team resources. A
34
+ workspace-scope init creates only the directories of tools named with `--agent`
35
+ or picked in its interactive tool picker. Run without a terminal and without
36
+ `--agent`, it creates none, and a tool's project directory appears when that
37
+ tool opens a session there. The resources arrive on that session start, or
38
+ when you run `teamai pull`. Re-run `teamai init <repo> --agent <tool>` to add
39
+ the tool's directory now, then pull or open the tool to fill it.
40
+ 2. **Sync manually to confirm:**
41
+ ```bash
42
+ teamai pull
43
+ teamai list # do the team skills appear now?
44
+ ```
45
+ 3. **Check the hook is installed** (`teamai doctor` reports this). If missing,
46
+ re-inject and reopen the tool:
47
+ ```bash
48
+ teamai hooks inject
49
+ ```
50
+ 4. **Wrong scope?** Workspace-scope built-in hooks are written to your HOME tool
51
+ settings (e.g. `~/.claude/settings.json`), not the project folder; the team's own
52
+ hooks for Claude Code and Codex go to the main checkout
53
+ (`.claude/settings.local.json`, `.codex/hooks.json`). That is intentional.
54
+ With `sharing.gitExclude` on, Codex's team hooks run from `~/.codex/hooks.json`
55
+ instead (one `hook-dispatch <Event> --tool codex --team-hooks` entry per event)
56
+ while the project's `.codex/hooks.json` is tracked or holds entries of its own,
57
+ and always in single-repo mode.
58
+ Existing Claude/Codex main-checkout hook files count as installed targets
59
+ even when HOME and current worktree tool roots are missing. Injection and
60
+ pull update team hooks and restore HOME built-ins; removal clears managed
61
+ main-checkout hooks without recreating HOME roots.
62
+ If Git-hook installation fails after writing agent hooks, `hooks inject`,
63
+ `init` and self-repo bootstrap still attempt Codex trust. Injection preserves
64
+ the installation error without reporting overall success. Init reports the
65
+ error and retains exit code 1 while completing local setup, including HTTP
66
+ initialization. Bootstrap records the error in the debug log and continues
67
+ local setup.
68
+ In workspace scope, `teamai hooks remove` preserves other projects' gated team
69
+ hooks in HOME, while removing the shared built-in hooks.
70
+ If `source remove-http` reports incomplete hook removal, the HTTP source is
71
+ disabled and the failed hooks stay on record. Fix the settings file it names,
72
+ then repeat `source remove-http` to finish removing them.
73
+ If removal cannot acquire the HTTP source lock, it leaves the source intact.
74
+ Wait for sync or plugin reconciliation to finish, check directory permissions,
75
+ then retry removal.
76
+ If you initialized workspace scope but expected machine-wide resources, re-run
77
+ with `--scope user`.
78
+ 5. **Tool has no hook surface** (e.g. Gemini CLI, JoyCode): there is no auto-sync;
79
+ run `teamai pull` manually each time.
80
+ 6. **Claude Code or Codex reads a different directory** (`CLAUDE_CONFIG_DIR` or
81
+ `CODEX_HOME` is set). `teamai doctor` reports `Claude Code root matches
82
+ CLAUDE_CONFIG_DIR` / `Codex root matches CODEX_HOME` when the directory the
83
+ variable names is not the one this config syncs to. Re-run
84
+ `teamai init` from a shell that has the variable exported; it records the root
85
+ and moves the install. If the check says the value cannot be synced to (outside
86
+ your home, or neither a plain directory in it nor one under `.config/`), fix the
87
+ variable first.
88
+ 6. **A command reports a broken manifest** (`Invalid roles manifest…`,
89
+ `Invalid projects manifest…`, `Invalid manifests…`, or `…manifest … could not
90
+ be read`). `pull` skips that scope on purpose, since syncing without the
91
+ manifest would deliver every namespace it gates; `push` stops before pushing
92
+ anything, even with `--role`; `status` lists the other resource types. The fix
93
+ belongs in the team repo's `manifest/roles.yaml` or `manifest/projects.yaml`,
94
+ which the error names by entry — tell the user to ask a team admin. Do not
95
+ delete the manifest or edit the local clone to get past it.
96
+ `recall` still searches learnings and warns once (`Recall indexed learnings
97
+ only…` or `Recall indexed the shared learnings only…`): what it names is
98
+ missing from results until the manifest is fixed and `teamai pull` rebuilds
99
+ the index, so do not report that the team has none of it. If recall also says
100
+ `Recall skips the older index at <path>…`, the smaller index could not be
101
+ written and that scope was not searched at all: resolve the error it names
102
+ (for example a read-only file or a full disk), then fix the manifest and pull.
103
+ 7. **`pull` says `Nothing was synced: <file>: <reason>`.** The project's teamai
104
+ config exists but cannot be read, so no scope syncs there, not even the user
105
+ scope, and the session-start hook syncs nothing either. Show the user the
106
+ file and the reason; `teamai doctor` checks another config and can pass
107
+ here. Moving it aside and re-running `teamai init` replaces their settings
108
+ for that project: do it only with their consent.
109
+ `recall` refuses the same way with `Nothing was searched: <file>: <reason>`:
110
+ no team knowledge was searched, so do not report that the team has none.
111
+
112
+ ## Path names appear in skill usage statistics
113
+
114
+ Slash-command tracking accepts a complete `/skill-name` token at the start of the prompt, followed by whitespace or the end of the prompt, and only for a skill installed for the tool. Absolute paths such as `/Volumes/External/project` and URL components are not skill invocations. Updating prevents new false counts; already recorded usage remains.
115
+
116
+ ## Submodule checkouts and linked skill directories
117
+
118
+ A submodule's Git directory is an identity, not a delivery directory. Team hooks and Codex project trust use its real main checkout. An initialized submodule in a superproject worktree inherits the original submodule's configuration when it exists; run `teamai pull` there without repeating init. The first pull installs Git hooks in that clone. If the parent's hook initializes submodules, follow the admin guide's initialization-and-pull sequence before starting an AI session. With Git < 2.54 and a shared versioned `core.hooksPath`, one dispatch line in each parent hook covers its submodules.
119
+
120
+ Both team skills and the built-in stub accept root-directory links within the same checkout and repository. Links outside it or into child repositories are rejected. Individual skill links, tracked skills, edited stubs and unrelated files stay. Remove a kept stub to receive the packaged one.
121
+
122
+ Pull removes proven TeamAI hook entries left in a Git directory. Older releases did not record file creation or project trust ownership: empty legacy files and unrecorded Codex grants stay. Remove a grant manually only after checking that it is not the member's choice.
123
+
124
+ ## "Last git hook run failed: ..." / a new worktree lacks team resources
125
+
126
+ In workspace scope, teamai's git hook syncs on `git worktree add` and `git pull`
127
+ through merge or a completed rebase (`post-rewrite`, including `pull.rebase=true`; on Git 2.32
128
+ and older, a fast-forward rebase with autostash syncs on `post-checkout`).
129
+ A conflicting rebase syncs only on completion; `git commit --amend` does not sync. It runs
130
+ silently and always exits 0, so its failures surface only here: `teamai doctor`
131
+ names the last one with its fix, and the next interactive `teamai pull` says it
132
+ once. The causes are a team repo fetch that failed or hit the 5 s git-pull hook
133
+ cap without the background pull finishing it, and another teamai process
134
+ holding the project's sync lock longer than the hook waits, or incomplete resource,
135
+ hook or MCP delivery. Only a complete startup sync clears the recorded failure.
136
+ Run `teamai pull`
137
+ in the checkout (after a stuck pull ends, or once the team repo is reachable);
138
+ `~/.teamai/debug.log` has the details. If doctor reports `Git hook syncs new
139
+ worktrees and git pull` as failing, follow its fix: `teamai pull` installs it.
140
+ Git older than 2.54 has no config hooks: teamai then adds a marked block to
141
+ `.git/hooks/post-checkout`, `post-merge` and `post-rewrite`, unless `core.hooksPath` is set (or a
142
+ hook there is a symlink or not an executable shell script), in which case doctor's fix says to upgrade Git
143
+ or, if the team agrees, to commit its guarded `command -v teamai ... || true`
144
+ line into the manager's post-checkout, post-merge and post-rewrite hooks.
145
+ Doctor also detects hooks disabled by name (Git 2.54+) or event (Git 2.55+)
146
+ in effective global, local or worktree config. Follow its command (`git config --local <key> true`,
147
+ or `git config --worktree --unset <key>` for a worktree setting) to enable the named hook or event, then run `teamai pull` to sync. Pull preserves
148
+ explicit disable settings, so reinstalling alone does not enable a disabled hook.
149
+ Existing hook contents and permissions stay unchanged; read/write errors propagate
150
+ from `init` and `hooks inject`, and Git-started pulls record them. An unreadable
151
+ project config prevents sync and keeps its reason in `~/.teamai/debug.log`.
152
+
153
+ Hosts that skip checkout hooks need `teamai pull` in the new checkout before the AI
154
+ tool starts. For Codex CLI 0.160.0, use `git worktree add`, run `teamai pull` there, then
155
+ launch `codex exec -C <worktree>`. Its native `codex exec --worktree` path creates
156
+ the checkout without `post-checkout`, so SessionStart sync arrives after startup
157
+ discovery.
158
+
159
+ ## "KEY is not set. Run `teamai env set KEY`"
160
+
161
+ `pull`, `teamai mcp list`, `teamai env list`, `teamai doctor` and
162
+ `teamai env exec` (on stderr) print this for a secret the team declares in
163
+ `env/secrets.yaml` that has no value on this machine, naming the MCP servers
164
+ that need it and where to get one. It is a note, not a failure: `doctor` exits
165
+ as it would without it. The value is the user's: ask them to run
166
+ `teamai env set KEY` in their own terminal (it prompts without echo). That
167
+ updates MCP servers for the current scope. Run `teamai pull` afterwards only
168
+ to update `env.sh`, and only when the key is an env variable. A CLI run through
169
+ `teamai env exec` gets the value on its next run. Never ask for the value in
170
+ chat or pipe one to `teamai env set --stdin`. A note that an entry "may hold an
171
+ old" value means an earlier write left it, and it stays until `teamai env set`
172
+ or `teamai pull` finds the value.
173
+
174
+ `KEY reads VAR, which is not set` means the user's value for KEY is a
175
+ reference to VAR (`--from-env`) and VAR is unset in this environment. Ask the
176
+ user whether to set VAR in their shell or replace the reference with the
177
+ command in the line; do not choose for them.
178
+
179
+ ## "Did not write <tool>'s MCP servers to <file>" / `withheld:`
180
+
181
+ `pull` prints this, and `teamai mcp list` (`withheld:`) and `teamai doctor`
182
+ report it, when a project MCP config would get a resolved `${VAR}` value that
183
+ git would commit: the file could not be kept out of git first. It is left as
184
+ it was, and an entry an earlier pull wrote stays. The line names the reason and the
185
+ fix. For `git already tracks <file>`, tell the user: `git rm --cached <file>`
186
+ (the file stays on disk), commit that, and rotate the token if the file was
187
+ ever committed with it; then `teamai pull`. Do not run `git rm` or commit for
188
+ them. For an exclude file that is not writable, one another teamai command
189
+ held, or a git error, relay the fix the line gives.
190
+
191
+ For new HTTP local-agent MCP installs, a failed initial ownership-manifest write leaves the MCP config and Git exclusions unchanged. Retry the install after fixing the manifest write error. A bare Copilot entry beside `mcpServers` is removed only with a matching ownership record proving a completed bare write. Older records without that evidence preserve the bare entry. A bare ownership record cannot claim a same-named member entry under `mcpServers`: updates skip the collision, and removal leaves that keyed entry alone. An unmarked Copilot record needs a matching keyed hash that does not also match the bare entry. Completed writes record `bare: true` or `bare: false`; missing placement remains unproven, including after a failed placement-record write. Existing JSON MCP updates keep the old ownership until the config write completes; a later manifest failure restores the config. `uninstall_mcp` keeps ownership if reading or writing the config fails, and restores the entry if removing its manifest record fails. MCP reconcile also restores all configs written before an ownership-save failure. If restoration fails too, repair the named configs and ownership records before retrying; the error reports both failures, and configs still carrying credentials stay excluded from Git.
192
+
193
+ ## "Workspace child <path> is left out" / "<item> differs between ..."
194
+
195
+ `pull` in a workspace prints these; `teamai doctor` repeats the first.
196
+
197
+ - **Left out**: that repo uses another team repo, is in single-repo mode, or
198
+ its config cannot be read. The line gives the reason. To include it, run
199
+ `teamai init <this workspace's team repo>` in it; otherwise it keeps working
200
+ on its own and nothing needs doing.
201
+ - **Differs between**: two repos inside the workspace receive an item of that
202
+ name with different content, so the workspace holds it: what teamai
203
+ installed for it before stays, in the place the workspace's rules give it. Tell the user to make the two copies equal in the team repo or
204
+ rename one. Each repo still receives its own copy.
205
+
206
+ ## Permission / access denied
207
+
208
+ `init`, `pull`, or `push` failing with a permission error usually means the user
209
+ has not been granted access to the team repo on the Git platform. Have them copy
210
+ the **exact** error text to their admin, who adds them on the platform website.
211
+
212
+ ## GitHub push fails
213
+
214
+ Check the team repo's default branch is `main` (not `master`). A stale `master`
215
+ default is a common cause.
216
+
217
+ ## GitLab host not detected
218
+
219
+ If `init` can't confirm a self-hosted GitLab instance, set both and retry. Use a
220
+ short-lived `api`-scope token via a no-echo prompt (not a literal `export`, which
221
+ lands in shell history), and `unset GITLAB_TOKEN` afterward:
222
+
223
+ ```bash
224
+ export GITLAB_URL=https://git.example.com
225
+ read -rs GITLAB_TOKEN && export GITLAB_TOKEN # paste when prompted; api scope
226
+ teamai init https://git.example.com/yourgroup/yourrepo
227
+ ```
228
+
229
+ A member who only syncs and never needs the CLI to open merge requests can skip
230
+ both: `teamai init <url> --provider git` uses their existing Git authentication.
231
+
232
+ For a GitLab deployed at a sub-path, include that path in `GITLAB_URL`, for
233
+ example `https://git.example.com/gitlab`. MR import keeps it in the API base
234
+ and removes it from the project id. An MR outside that instance path is refused.
235
+
236
+ ## Which tools actually get hooks
237
+
238
+ `teamai hooks inject` prints **"Hooks injected into all AI tool settings"** even
239
+ for tools where it wrote nothing. **Do not take that line as proof.** (When the
240
+ team hooks cannot be resolved it exits 1 with the reason instead: the built-in
241
+ hooks are installed, the team hooks are left as they were.) Verify per-tool
242
+ instead:
243
+
244
+ ```bash
245
+ teamai doctor # flags tools whose hooks are missing
246
+ teamai hooks list # per-tool status + the settings file it checked
247
+ ```
248
+
249
+ What you will typically see, and why (this is expected CLI behaviour, **not** a
250
+ broken machine):
251
+
252
+ | Tool | Hooks status | Why |
253
+ |-----------------------|---------------------------|---------------------------------------------------------------------|
254
+ | Claude Code (`claude`)| Installed | Fully supported — this is the main, working path |
255
+ | Codex | Installed and trusted | Codex runs only trusted hooks; teamai trusts the ones it writes through `codex app-server`, and `teamai doctor` names any Codex will not run |
256
+ | Cursor | Installed | Also runs `~/.claude/settings.json`. That copy exits only when `~/.cursor/hooks.json` or the project `.cursor/hooks.json` contains `--tool cursor` |
257
+ | Copilot CLI | Installed | Built-ins use `$COPILOT_HOME/hooks/teamai.json` (default `~/.copilot/hooks/teamai.json`); self mode keeps them in the project. Claude built-ins exit for a valid, enabled version-1 file, global or project, with a `--tool copilot` command; self mode checks only the project directory. A Claude team hook exits only when a valid, enabled project version-1 file delivers the same command to Copilot for the same event and matcher. `COPILOT_CLI` alone does not skip |
258
+ | CodeBuddy / WorkBuddy | Installed | Claude-format hooks in their own `settings.json` |
259
+
260
+ Practical rule: if you set up with `--agent claude`, expect **only** Claude to show
261
+ hooks installed. A tool you are not using, or one that is not a supported hook
262
+ target, showing "missing" is normal — the Claude path is intact. For a tool where
263
+ hooks did not land but you do use it, run `teamai pull` manually each session, and
264
+ see the caveats below.
265
+
266
+ ## Agent-specific caveats
267
+
268
+ Different AI hosts handle the hooks that TeamAI injects differently. When this
269
+ conversation runs in one of these, proactively walk the user through the extra
270
+ step — do not assume auto-sync just works.
271
+
272
+ ### Codex
273
+
274
+ Codex runs a non-managed hook only once it is **trusted**. `teamai init`, `pull`
275
+ and `teamai hooks inject` trust the hooks they write (and, in a project, the main
276
+ checkout, or the current worktree when Git cannot locate a main checkout) through `codex app-server`.
277
+ Trust written by a session-start pull applies from the next Codex session. `teamai doctor` names any teamai hook Codex will not
278
+ run. Then: run `teamai pull`; if `codex` is not on PATH or `codexTrustEnabled: false`
279
+ is set in `config.yaml`, guide the user to trust the teamai hooks in Codex `/hooks`,
280
+ then reopen a session. A new linked worktree gets the team hooks from its second
281
+ Codex session (the first creates its `.codex/`). Member hooks with the same command
282
+ are preserved and remain untouched by automatic trust. Codex ownership uses the
283
+ recorded event, position and complete entry. A moved entry is recovered only by a
284
+ unique full-definition match. Legacy records recover only a unique event, matcher
285
+ and command match; `timeout` and `additionalContextLimit` were not recorded.
286
+ Pre-#370 project Codex ownership is imported from the main checkout's
287
+ `.teamai/managed-hooks.json` before reconciliation or direct removal.
288
+ An unrecorded entry equal to teamai's entry for exactly one team hook (current or
289
+ any earlier team-repo revision) is adopted, so a lost manifest adds no second copy.
290
+ Other unrecorded copies are preserved; pull and doctor name the ambiguous ones.
291
+ Project hook paths follow `toolPaths`;
292
+ Claude uses `settings.local.json` beside its configured settings file. A custom
293
+ Codex path that Codex does not load is reported as `not loaded` by doctor.
294
+
295
+ ### Cursor
296
+
297
+ Cursor writes hooks to `~/.cursor/hooks.json` and also runs `~/.claude/settings.json`. `hook-dispatch --tool claude` and team hook commands written for `claude` exit only when `CURSOR_VERSION` is set and `~/.cursor/hooks.json` or `$CURSOR_PROJECT_DIR/.cursor/hooks.json` contains `--tool cursor`. A setup with only Claude has no second copy, so those hooks still run inside Cursor. Claude Code does not set `CURSOR_VERSION`. An already installed team hook picks up the guard on the next `teamai pull` or `teamai hooks inject`. If `teamai hooks list` shows Cursor without hooks, run `teamai pull` at the start of the session.
298
+
299
+ ### Copilot CLI
300
+
301
+ Built-in hooks use `$COPILOT_HOME/hooks/teamai.json` (default `~/.copilot/hooks/teamai.json`) for normal project installs. Custom team hooks stay in `.github/hooks/teamai.json`; self mode keeps built-ins there too. The next `init`, `pull`, or `hooks inject` migrates each project’s generated built-ins, preserving unrelated hooks. Self sessions skip the global copy. Otherwise each event runs once among the copies a session loaded (global files under any name, or a legacy project command a running host still holds): the first copy claims the event under `~/.teamai/copilot-hook-claims/` and the others exit. A payload without a `timestamp`, or a claim that cannot be written, runs every loaded copy. A cached copy stops once no enabled JSON file Copilot loads holds its built-in: a global copy checks `$COPILOT_HOME/hooks/`, and a legacy project copy checks that directory and its project’s `.github/hooks/`. Hook dispatch uses the working directory’s project config, including its `builtin.disabled`; `builtin.overrides` timeouts do not apply to the shared file. A custom hooks filename keeps its name in `$COPILOT_HOME/hooks/`. Project uninstall preserves the shared global hooks; `hooks remove` removes the built-ins from every JSON file in `$COPILOT_HOME/hooks/`, including filenames other projects configured.
302
+
303
+ Copilot CLI runs a trusted project's `.claude/settings.json` as well as its own `.github/hooks/teamai.json`. `hook-dispatch --tool claude` exits only when `COPILOT_PROJECT_DIR` is set and a valid version-1 hook file without `disableAllHooks`, in the project or global hook directory, has a command containing `--tool copilot`; self mode checks only the project directory. A team hook command written for `claude` exits only when an active version-1 JSON file in `$COPILOT_PROJECT_DIR/.github/hooks/` holds the same command for the same event and matcher, so a hook the project sends only to Claude, or to Copilot for another event or matcher, keeps running. `COPILOT_CLI` is not a signal: Copilot sets it on every subprocess, including a Claude session started from its shell. Copilot does not run `~/.claude/settings.json`. Re-run `teamai pull` or `teamai hooks inject` so an already installed team hook picks up the guard.
304
+
305
+ ### ChatGPT App
306
+
307
+ Hooks injected by `teamai init` are **untrusted by default** in the sandbox. The
308
+ user must **manually trust the hooks in ChatGPT's settings** before they run.
309
+ Guide them to the settings, have them trust/enable the TeamAI hooks, then reopen a
310
+ session and verify with `teamai pull` + `teamai list`.
311
+
312
+ ### WorkBuddy
313
+
314
+ The sandbox **does not add hooks automatically** after `teamai init`. The user
315
+ must **manually edit the config file to register the hook** so auto-sync works.
316
+ Walk them through opening the tool's config and adding the TeamAI session-start
317
+ hook entry; if unsure of the exact config, run `teamai doctor` and `teamai hooks list`
318
+ to see what should be present, then have them replicate it. Until then, they can
319
+ sync with a manual `teamai pull`.
320
+
321
+ ### Muse Code
322
+
323
+ Hooks go in the `hooks` block of `~/.config/muse/settings.json`, which Muse runs in every workspace; a project's `.muse/hooks.json` runs only once the workspace is trusted. Muse starts each hook with an emptied environment, so a variable set only on the command that launched `muse` (such as `TEAMAI_HOOKS_DISABLED=1 muse`) does not reach the hook. The hook command runs `bash -lc`, so export it in `~/.bash_profile` or `~/.profile` instead.
324
+
325
+ ### Tools without a writable hook surface
326
+
327
+ Gemini CLI, JoyCode, and similar tools have no TeamAI-writable hook surface —
328
+ there is no auto-sync. Tell the user to run `teamai pull` manually at the start of
329
+ each session.
330
+
331
+ ## "A recalled doc got no upvote"
332
+
333
+ A recalled doc is upvoted once per session when the session that ran the recall
334
+ opens it within 24 hours: a file read, a reader command (`cat`, `sed -n`, …), or
335
+ a search whose output shows its lines. Listing the doc does not count, and
336
+ neither does working from the recall subagent's summary alone; only the opt-in
337
+ judge (`TEAMAI_UPVOTE_JUDGE=1`) credits that. `teamai stats` shows each recent
338
+ session's runs, recalled docs and adopted docs. Per agent:
339
+
340
+ - **Claude Code, Codex (0.134+), CodeBuddy (2.103.1+), WorkBuddy, Qoder,
341
+ OpenCode, OMP**: both a recall the main agent runs and one the
342
+ `teamai-recall` subagent runs are credited when the main agent opens the doc.
343
+ On OMP the subagent's recall needs the main session's file on disk, so a
344
+ `--no-session` run credits only the main agent's own recalls.
345
+ - **Cursor, Copilot CLI, ZCode, Pi**: only a recall the main agent runs
346
+ itself. A subagent's recall is not linked to the main session, and Pi has no
347
+ TeamAI subagent.
348
+ - **OpenClaw, Hermes, Kiro, JoyCode, Trae**: no PostToolUse hook, so recalls never
349
+ vote.
350
+
351
+ A read after the session's last Stop is credited at SubagentStop, at Copilot CLI's
352
+ SessionEnd, or at the next `teamai pull`.
353
+
354
+ Pending votes reach the team repo's `teamai-reports` branch on the next Stop or
355
+ `teamai pull`. A push that fails — offline, no write access, a crashed run —
356
+ keeps the deltas pending; the next session re-sends them, and each delta is
357
+ added to the team totals exactly once.
358
+
359
+ Index rebuilds (including `teamai pull`) use confirmed team votes plus pending
360
+ local votes, even when reporting is disabled or a push fails. A busy votes lock
361
+ makes that rebuild use confirmed counts only; it does not wait for the lock.
362
+
363
+ Manual `teamai recall feedback --positive <docId>` adds an upvote without adding
364
+ a recall. Confidence caps the upvote-to-recall ratio at 1: more feedback cannot
365
+ exceed that factor's 30% weight or replace recency. This is an activity score,
366
+ not proof of knowledge correctness or task success.
367
+
368
+ ## OpenCode V2 rejects the hooks plugin
369
+
370
+ If OpenCode reports “Plugin must export a default definition”, upgrade TeamAI,
371
+ run `teamai hooks inject` or `teamai pull`, and restart OpenCode. The generated
372
+ built-in and enterprise plugins support both OpenCode 1.18.23 (`server`) and V2
373
+ (`setup`). V1 shell recall uses `TEAMAI_AGENT_SESSION_ID`; V2 supplies its native
374
+ `OPENCODE_SESSION_ID`.
375
+
376
+ ## Still stuck
377
+
378
+ - Re-run the failing command with `-v` / `--verbose` for detail.
379
+ - `teamai status` shows exactly how local differs from the team repo.
380
+ - Report unexpected behavior at https://github.com/Tencent/teamai-cli/issues
381
+ with the agent name, platform, and the step that failed.
382
+
383
+ ## "Pull left an instruction file unchanged"
384
+
385
+ If pull reports incomplete TeamAI markers, it keeps the entire file unchanged.
386
+ Fix the named block so it has exactly one start marker followed by one end
387
+ marker, then run `teamai pull` again. Other files can still sync successfully.
388
+
389
+ Pull keeps retired instruction blocks until every installed tool that wrote the
390
+ file has a working replacement. Repair the named target, extension or plugin
391
+ and run `teamai pull` again. Excluded tools' current and retired files stay
392
+ unchanged and are excluded from doctor's stale-instruction check.
393
+ When a native project file retains a TeamAI block, the session hook skips that
394
+ block, including cached HTTP prompts, until cleanup succeeds. Other blocks
395
+ still reach the hook. Doctor reports malformed markers in retired files;
396
+ repair them before retrying pull.
397
+ If a block's source cannot be resolved, its old block stays even when other
398
+ blocks sync. Repair the source and pull again to complete its migration.
399
+ HTTP prompt commands verify earlier deliveries against the current prompt
400
+ before cleaning shared instructions. Older destination contents do not count;
401
+ culture and recall stay because HTTP prompt commands do not replace them.
402
+ An HTTP prompt sync that cannot clean retired blocks reports a failed ACK and
403
+ keeps its previous cache and manifest for the server's retry.
404
+ OpenClaw HTTP prompts require an existing resolved user workspace, but not an
405
+ existing `AGENTS.md`: the prompt sync creates that file and preserves personal
406
+ text already in it.
407
+
408
+ OpenCode registration saves ownership before activating a new config entry.
409
+ If the state write fails, repair the state directory's permissions and retry
410
+ `teamai pull`; the entry is not activated without its removal ownership.
411
+ If the config write fails, ownership stays available for retry. Entries the
412
+ member already listed are never claimed.
413
+
414
+ ## GitHub MR/PR import API error
415
+
416
+ When import falls back from `gh` to the REST API, a failed metadata, commits,
417
+ or diff request stops before AI extraction and names the HTTP status and
418
+ response body. Check PR visibility and authentication for 404/403, the rate
419
+ limit for 429, or retry a temporary server failure. The error page is not a diff.
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: setup
3
+ description: >-
4
+ TeamAI day 0 and repo lifecycle: create a team repo as admin, join an existing team as a member,
5
+ manage members, roles, MCP and env, and uninstall. Loaded on demand by the teamai discovery stub.
6
+ ---
7
+
8
+ # teamai — setup and lifecycle
9
+
10
+ You run the commands; the user only makes choices when you ask. **They may not
11
+ know Git** — never explain branches, commits or clones.
12
+
13
+ ## Before anything
14
+
15
+ ```bash
16
+ node --version # must be >= 20
17
+ teamai --version # install once with: npm install -g teamai-cli
18
+ ```
19
+
20
+ Then pick the flow. A user **setting up a new team** becomes its admin and creates
21
+ the repo; a user **joining an existing team** needs a repo URL from their admin. A
22
+ would-be member without a URL is still the **join** flow — `join-member.md` tells
23
+ them how to ask for it. Do not send them to the create-repo flow because the URL
24
+ is missing.
25
+
26
+ | The user wants to… | Load this |
27
+ |-----------------------------------------------------------------------------|---------------------------------------------|
28
+ | Set up TeamAI for a team from scratch (create the repo) | `{SKILL_DIR}/references/setup-admin.md` |
29
+ | Join their team, with or without a repo URL | `{SKILL_DIR}/references/join-member.md` |
30
+ | Publish or update skills, rules, MCP, env; invite members; manage roles | `{SKILL_DIR}/references/manage-admin.md` |
31
+ | Remove TeamAI from this machine | `{SKILL_DIR}/references/uninstall.md` |
32
+ | Publish one skill or contribute a doc | `"$(teamai skill path core)/references/contribute-member.md"` |
33
+ | Anything that breaks along the way | `"$(teamai skill path core)/references/troubleshooting.md"` |
34
+
35
+ Supported Git providers are Tencent TGit, GitHub, GitLab and CNB;
36
+ `{SKILL_DIR}/references/setup-admin.md` carries the detection probe, the sign-in
37
+ and create-repo URLs, and the per-provider caveats, and points at
38
+ `{SKILL_DIR}/references/provider-tgit.md` for everything TGit-specific.
39
+
40
+ ## Rules for these flows
41
+
42
+ 1. **Always use a full URL** for the team repo (e.g.
43
+ `https://github.com/your-org/your-repo`). Never the `owner/repo` short form.
44
+ 2. **Don't limit which AI tools get set up — cover all of them by default.**
45
+ Unless the user names specific tools, do **not** pass `--agent` to restrict the
46
+ install. Let `teamai init` set up every AI tool already installed (omitting
47
+ `--agent` gives an interactive picker; select all detected tools). **After init,
48
+ report which agents were set up** — in the user's language, which tools now
49
+ auto-start TeamAI, which detected tools were skipped and why (e.g. CodeBuddy
50
+ design), and any installed hooks that still need trust (e.g. Codex with
51
+ automatic trust disabled or unavailable). Verify the real per-tool result with
52
+ `teamai doctor` and `teamai hooks list`.
53
+ 3. **`teamai init` does not pull.** It saves the config and installs hooks. It does
54
+ not copy team skills, rules or MCP. In workspace scope it creates a tool directory
55
+ only for a tool named with `--agent`, or picked when a person runs it in a
56
+ terminal. Those resources arrive on that tool's next session start, or when you
57
+ run `teamai pull`. Run from an agent shell (no terminal), a workspace-scope init
58
+ without `--agent` creates no tool directory: the directory appears when the user
59
+ opens that tool in the project, and that session start pulls.
60
+ 4. **Finish with `teamai doctor`.** Every setup or onboarding flow ends by running
61
+ it and resolving what it reports before you call the job done.
62
+
63
+ Every public command and every flag, including the flags `--help` hides, is listed in
64
+ `teamai skill get core --full` under `references/commands.md`. Do not guess a flag:
65
+ there is no member-invite flag, for instance — inviting happens on the Git
66
+ platform's website, as `manage-admin.md` describes.
67
+
68
+ ## References
69
+
70
+ In the files below, `{SKILL_DIR}` is the directory `teamai skill path setup` prints; a reference file you open on its own writes that directory as `SKILL_DIR` in braces.
71
+
72
+ | File | When to load it |
73
+ |---|---|
74
+ | `{SKILL_DIR}/references/setup-admin.md` | Creating a team repo: provider detection, auth, repo creation, first push. |
75
+ | `{SKILL_DIR}/references/join-member.md` | Joining an existing team from a repo URL. |
76
+ | `{SKILL_DIR}/references/manage-admin.md` | Day-to-day admin: publishing resources, roles, projects, MCP, env, members. |
77
+ | `{SKILL_DIR}/references/uninstall.md` | Removing TeamAI from a machine or from one agent. |
78
+ | `{SKILL_DIR}/references/provider-tgit.md` | Tencent TGit: reachability probe, `gf` install and login, repo creation on init. |
79
+
80
+ `teamai skill get setup --full` prints this skill with all five appended.