@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,312 @@
1
+ # Scenario: Admin — set up a new team repo from scratch
2
+
3
+ Goal: the user becomes the first admin of a brand-new TeamAI team. At the end they
4
+ have a working team repo URL to share with members.
5
+
6
+ Run the commands yourself. Only stop to ask when a step says "ASK".
7
+
8
+ ## Step 1 — Install and verify
9
+
10
+ ```bash
11
+ npm install -g teamai-cli
12
+ teamai --version
13
+ ```
14
+
15
+ If `teamai --version` fails, Node.js ≥ 20 is missing. Tell the user to install
16
+ Node 20+ (from https://nodejs.org), then retry. Do not continue until the version
17
+ prints.
18
+
19
+ ## Step 2 — Pick a Git platform (only when the user gave NO repo URL)
20
+
21
+ If the user already gave a full repo URL, skip to Step 4. Otherwise, TeamAI needs a
22
+ place to store the team's skills/rules. The user does not need to know Git. Work
23
+ through these sub-steps **in order**:
24
+
25
+ ### 2a — Ask which platform they know
26
+
27
+ **Tencent-internal first:** before asking, probe whether TGit is reachable
28
+ on this machine — see `{SKILL_DIR}/references/provider-tgit.md` ("Probe
29
+ reachability") for the one-line `x-env: tgit` check. If it says `tgit: OK`, **list Tencent TGit first** and
30
+ prefer it. Then ask: *"Have you heard of / do you have an account on any of these —
31
+ Tencent TGit, GitHub, GitLab, or CNB (cnb.cool)?"*
32
+
33
+ - **Tencent TGit** — https://git.woa.com (Tencent-internal only; shown
34
+ first when the probe above says `tgit: OK`)
35
+ - **GitHub** — https://github.com
36
+ - **GitLab** — https://gitlab.com (or a self-hosted company GitLab)
37
+ - **CNB** — https://cnb.cool
38
+
39
+ If they name one, use that platform and go to sub-step 2c.
40
+
41
+ ### 2b — If they've heard of NONE, auto-probe reachability
42
+
43
+ Test which sites this network can actually reach (probe each, ~3s timeout each).
44
+ The TGit probe checks the `x-env: tgit` header, not just reachability (see
45
+ `{SKILL_DIR}/references/provider-tgit.md`); the others just check reachability:
46
+
47
+ ```bash
48
+ curl -sS -m 3 -D - -o /dev/null https://git.woa.com 2>/dev/null | grep -qi '^x-env:[[:space:]]*tgit' && echo "tgit: OK" || echo "tgit: unreachable"
49
+ curl -sSf -m 3 -o /dev/null https://github.com && echo "github: OK" || echo "github: unreachable"
50
+ curl -sSf -m 3 -o /dev/null https://gitlab.com && echo "gitlab: OK" || echo "gitlab: unreachable"
51
+ curl -sSf -m 3 -o /dev/null https://cnb.cool && echo "cnb: OK" || echo "cnb: unreachable"
52
+ ```
53
+
54
+ - **TGit reachable (`tgit: OK`)** → prefer Tencent TGit; it is the
55
+ Tencent-internal default.
56
+ - **Exactly one reachable** → use that one.
57
+ - **Several reachable** → list them (TGit first when present) and let the user pick.
58
+ - **None reachable** → stop. Tell the user to ask their own admin for a ready-made
59
+ repo URL, then switch to `{SKILL_DIR}/references/join-member.md`.
60
+
61
+ Choose by **account + reachability only — never by region**.
62
+
63
+ ### 2c — Give the sign-up / create link and let them create the project
64
+
65
+ Once the platform is decided, hand the user the direct link to sign in and create
66
+ the repository, then continue to the next step:
67
+
68
+ | Platform | Sign in / sign up | Create a new repo (do this) |
69
+ |----------|------------------------------|------------------------------------|
70
+ | Tencent TGit | https://git.woa.com | https://git.woa.com/projects/new |
71
+ | GitHub | https://github.com/login | https://github.com/new |
72
+ | GitLab | https://gitlab.com/users/sign_in | https://gitlab.com/projects/new |
73
+ | CNB | https://cnb.cool | https://cnb.cool/new/repos (org first: https://cnb.cool/new/groups) |
74
+
75
+ > **Tencent TGit:** don't send the user to the browser to create the repo —
76
+ > prefer letting `teamai init` create it via the API in Step 5. See
77
+ > `{SKILL_DIR}/references/provider-tgit.md` ("When you `teamai init` on TGit").
78
+
79
+ Tell the user to sign in, create an **empty** repo (suggested name
80
+ `<team-name>-teamai`), and give you the resulting repo URL. Explain in one
81
+ sentence: *"The repo on the website is where the team's skills and rules live; your
82
+ computer only holds a synced copy — you never put business code in it."*
83
+
84
+ > You may instead let `teamai init` create the repo from the CLI in Step 5 (it
85
+ > offers to create a missing repo on GitHub/GitLab). Creating it in the browser
86
+ > first is the simplest path for a user who does not know Git, and is required on
87
+ > CNB (see the CNB caveat in Step 5).
88
+
89
+ ## Step 3 — Log in from the CLI
90
+
91
+ Signing in on the website (Step 2c) is not enough — `teamai init` also needs the
92
+ platform's CLI credentials. Have the user complete the matching CLI login:
93
+
94
+ ### Tencent TGit
95
+
96
+ See `{SKILL_DIR}/references/provider-tgit.md` ("Log in") — you install `gf` and
97
+ run `gf auth login` yourself; the user only approves in the browser / iOA. No `GITLAB_URL` needed.
98
+ Then return here for Step 4.
99
+
100
+ ### CNB — install the CLI, authorize, then read the repo (in this order)
101
+
102
+ Once the user has created their repo on cnb.cool and given you the URL, do these
103
+ three steps **in order**:
104
+
105
+ 1. **Install the CNB CLI** (needed to talk to cnb.cool):
106
+ ```bash
107
+ npm install -g @cnbcool/cnb-cli
108
+ ```
109
+ (`teamai init` also installs it automatically if it is missing, but running it
110
+ here first makes the next step predictable.)
111
+ 2. **Ask the user to authorize.** Start the login and have them approve it in the
112
+ browser (OAuth2 device flow):
113
+ ```bash
114
+ cnb login
115
+ ```
116
+ Wait for them to confirm they finished authorizing before continuing.
117
+ 3. **Then read their repo** — proceed to Step 4/5 (`teamai init <their CNB URL>`),
118
+ which can now clone and read the repo with the authorized CLI.
119
+
120
+ (Headless/CI alternative: set `CNB_TOKEN` instead of `cnb login`.)
121
+
122
+ ### GitHub — YOU run the login; user only clicks approve
123
+
124
+ **Don't hand the user a `gh` command to run** — you run the login, they only approve
125
+ it in the browser. Log them in before `teamai init`:
126
+
127
+ ```bash
128
+ gh auth login --web --git-protocol https
129
+ ```
130
+
131
+ The flow prints a one-time code and a `https://github.com/login/device` URL.
132
+ **Relay both to the user and ask them to open that URL and approve** — that approval
133
+ is the *only* thing they do; the command finishes on its own once they do. Confirm
134
+ with `gh auth status` before continuing.
135
+
136
+ (Headless/CI only: skip the interactive login and pre-set `GITHUB_TOKEN` — a token
137
+ with `repo` scope — instead.)
138
+
139
+ ### GitLab (gitlab.com)
140
+
141
+ Set a Personal Access Token with `api` scope. Prefer a **short-lived** token and
142
+ pull it from a secret manager or a no-echo prompt rather than typing the literal
143
+ value (a pasted `export` lands in shell history and process listings):
144
+ ```bash
145
+ read -rs GITLAB_TOKEN && export GITLAB_TOKEN # paste when prompted; not echoed
146
+ ```
147
+ Self-hosted GitLab: also set the instance URL first —
148
+ `export GITLAB_URL=https://git.example.com`. Run `unset GITLAB_TOKEN` when
149
+ `teamai init` is done.
150
+
151
+ For GitHub/GitLab, `teamai init` installs any helper CLI it needs automatically.
152
+
153
+ ## Step 4 — Decide the scope (ASK)
154
+
155
+ One choice — this workspace or the whole machine?
156
+
157
+ - Default (workspace): resources land in the current workspace's `.claude/` etc.
158
+ `cd` into the workspace first.
159
+ - Whole machine: add `--scope user` so every project gets the team resources.
160
+ - A folder holding several repos (a workspace): set up each repo, then run the
161
+ same `init` in the folder. It also receives what each repo inside selects.
162
+
163
+ (The repo name was already chosen when the user created the repo in Step 2c —
164
+ suggested form `<team-name>-teamai`.)
165
+
166
+ ## Step 5 — Initialize (you run it)
167
+
168
+ Use the **full URL**, never `owner/repo`:
169
+
170
+ Ask whether the user wants to activate any logical projects this team repo
171
+ declares. If `init` lists **Available projects**, show the names/IDs and ask
172
+ which belong to this setup; enter the corresponding comma-separated numbers.
173
+ Press Enter for none only when the user explicitly chooses no project. If the
174
+ IDs are already known, pass `--project id1,id2` to skip the picker. For a
175
+ non-interactive run, ask first and pass `--project`: without it, init keeps
176
+ `projects: []` and prints a `teamai projects set <id>` follow-up instead of
177
+ waiting for a choice.
178
+
179
+ ```bash
180
+ # workspace scope (default) — run from inside the project directory
181
+ teamai init https://<platform>/<org>/<repo-name>
182
+
183
+ # or whole machine
184
+ teamai init https://<platform>/<org>/<repo-name> --scope user
185
+ ```
186
+
187
+ If the repo does not exist yet, `init` offers to create it — accept the prompt.
188
+
189
+ - **Tencent TGit:** `gf` and login are already done, so init creates the
190
+ repo via the API when it's missing — see
191
+ `{SKILL_DIR}/references/provider-tgit.md` ("When you `teamai init` on TGit").
192
+ - **CNB caveat:** a `cnb login` token **cannot create** an org or repo — that is
193
+ exactly why the CNB flow has the user create the repo on the website first
194
+ (Step 2c). If the org/repo is still missing here, `init` prints web links
195
+ (`https://cnb.cool/new/groups`, `https://cnb.cool/new/repos`) — have the user
196
+ create them in the browser, then re-run `teamai init`. By this step the CNB CLI
197
+ should already be installed and authorized (Step 3). (A `CNB_TOKEN` with
198
+ `group-manage:rw` + `group-resource:rw` lets the CLI create them directly.)
199
+ - **GitHub caveat:** if a push later fails, check the repo's default branch is
200
+ `main` (not `master`).
201
+ - If `init` detects an unknown GitLab host, it stops and asks you to set
202
+ `GITLAB_URL` + `GITLAB_TOKEN`, then retry.
203
+
204
+ If the repo has roles enabled, `init` asks for one or more comma-separated role
205
+ numbers when running interactively. The first number is the primary role and the
206
+ remaining numbers become additional roles; pass `--role <id>` for a
207
+ non-interactive run when only a primary role is needed. Without a terminal (or
208
+ with `CI` / `TEAMAI_NONINTERACTIVE` set) `init` never waits: a provider that
209
+ would need a browser login fails at once and names the credential to prepare —
210
+ a token for GitHub / CNB / GitLab / GitCode, and for TGit a prior `gf auth
211
+ login` run in an interactive shell (see Step 3).
212
+
213
+ **Which AI tools to set up — all of them by default (global rule 9).** Do not add
214
+ `--agent` to restrict the install unless the user explicitly said to (e.g. "only
215
+ Claude Code"). Omitting `--agent` gives an interactive picker — select **every AI
216
+ tool already installed** on the machine. Then **report back which agents were set
217
+ up**, in the user's language: name the tools that will now auto-start TeamAI, and
218
+ any detected tool that was skipped and why (e.g. CodeBuddy/WorkBuddy by design),
219
+ and any installed hooks that still need trust (e.g. Codex with automatic trust
220
+ disabled or unavailable). See the troubleshooting reference, `"$(teamai skill path core)/references/troubleshooting.md"`.
221
+
222
+ ## Step 6 — Verify with doctor
223
+
224
+ ```bash
225
+ teamai doctor
226
+ teamai hooks list # per-tool: which AI tools actually got the hooks
227
+ ```
228
+
229
+ Resolve everything `doctor` flags before continuing.
230
+
231
+ **Don't trust the "Hooks injected into all AI tool settings" message on its own** —
232
+ it prints even for tools where nothing was written. `teamai doctor` / `teamai hooks
233
+ list` show the real per-tool status. Only the tool you set up (e.g. `claude`) is
234
+ expected to show hooks installed; others are skipped by design or not yet supported,
235
+ which is normal. Full table in the troubleshooting reference
236
+ (`"$(teamai skill path core)/references/troubleshooting.md"`), section "Which tools actually get hooks".
237
+
238
+ ## Step 7 — Grant members branch access (required before they can join)
239
+
240
+ TeamAI uses the Git host's access control. After the repo exists, each member
241
+ needs permission to clone it and to push branches. Leave the default branch
242
+ protected. They open pull requests against it.
243
+
244
+ `teamai push` pushes a feature branch and opens a pull request. Reports and
245
+ learnings use the branches `teamai-reports` and `teamai-learnings`.
246
+
247
+ Do this before handing off the invite line below. Without branch access,
248
+ `teamai init` or `teamai push` fails with a permission error.
249
+
250
+ ## Step 8 — Hand off to members
251
+
252
+ Everything you show here goes **in the user's language** (global rule 1). Only the
253
+ `/teamai …` line, URLs, and commands stay verbatim.
254
+
255
+ **First, reassure them about privacy** (say this in their language): *"TeamAI does
256
+ not send any of your session data to third parties. The only place anything is
257
+ reported is the team repo you just set up — usage counts and knowledge go there,
258
+ and raw conversation content is never uploaded."* (Team reporting is opt-in and
259
+ carries counts + tool names only, on a separate branch of that same repo.)
260
+
261
+ 1. Give the user their **repo web URL** to share.
262
+ 2. Give them a ready-to-forward invite line **written in their language**, with the
263
+ URL filled in. The `/teamai` prefix stays as-is; translate the rest:
264
+ `/teamai Help me join my team's TeamAI, repo URL is <URL>`
265
+ Tell them to send the URL + this line to each member.
266
+ 3. Remind them (in their language): a member's `teamai init` does not copy team
267
+ resources. They arrive on the next session start, or when the member runs
268
+ `teamai pull`. In workspace scope, init creates a tool directory only for a tool
269
+ named with `--agent` or picked in init's tool picker; otherwise that directory
270
+ appears when the member first opens that tool in the project. Resources the
271
+ team adds later arrive at the next session start.
272
+
273
+ ## Step 9 — What's next (guide them, don't just list commands)
274
+
275
+ Wrap up **in the user's own language** (global rule 1).
276
+
277
+ The user may not be comfortable with the command line, so **don't just hand them a
278
+ list of `teamai …` commands.** Instead, point them back to *this skill* for
279
+ day-to-day work — they can keep letting the AI run things for them:
280
+
281
+ - To manage the team later, they run (in their language):
282
+ `/teamai I already have TeamAI set up, help me manage it` — this loads
283
+ the daily-management flow (`{SKILL_DIR}/references/manage-admin.md`): publishing skills, inviting
284
+ members, roles / packages / env.
285
+ - To share a reusable skill with the team, they run (in their language):
286
+ `/teamai Share this <skill-name> skill with my team` — see
287
+ `"$(teamai skill path core)/references/contribute-member.md"`.
288
+ - Sharing a **session's learnings** needs no command from them: TeamAI prompts on
289
+ its own at the end of a session worth sharing, and the `share` workflow
290
+ (`teamai skill get share`) takes over. (Only once recall is on — off by default;
291
+ turn it on team-wide with `sharing.recall.enabled: true` in `teamai.yaml`, then
292
+ `teamai push`. Never on a read-only HTTP source, or while a member's teamai
293
+ config cannot be loaded. A team that works in English also sets `language: en`
294
+ in that file so the recall rule and the TodoWrite and merged-MR hints are
295
+ English only; omit it, or set `zh`, to keep the historical bilingual text.)
296
+
297
+ Mention the underlying commands (`teamai push`, `teamai roles`, …) only as a note
298
+ for users who *do* want them — the primary path is re-invoking `/teamai`.
299
+
300
+ ## Step 10 — Tell them how to leave (via the skill, not raw commands)
301
+
302
+ Finish by telling the user, **in their language**, that they can remove TeamAI any
303
+ time — and that they don't need the command line to do it. They just re-invoke the
304
+ skill and you'll handle it:
305
+
306
+ `/teamai Uninstall TeamAI` (in their language; the `/teamai` prefix stays as-is)
307
+
308
+ One line, in their language: *"That removes the hooks and synced resources from
309
+ your machine; your team repo on the website is untouched — you can rejoin any time
310
+ with `/teamai` and the repo URL."*
311
+
312
+ (If they ask right now, load `{SKILL_DIR}/references/uninstall.md` and run it for them.)
@@ -0,0 +1,180 @@
1
+ # Scenario: Uninstall — remove TeamAI from this machine
2
+
3
+ The user wants to remove TeamAI. **You run the command for them** — they should not
4
+ have to type `teamai uninstall` themselves. Everything you say goes in the user's
5
+ language (global rule 1); only the commands stay verbatim.
6
+
7
+ ## Step 1 — Confirm scope first (ASK — this is destructive)
8
+
9
+ Uninstalling removes hooks and synced resources from the machine and cannot be
10
+ undone with a single button, so confirm before running anything. Ask ONE question:
11
+
12
+ *"Do you want to remove TeamAI from **just this AI tool**, or from the **whole
13
+ machine** (all tools)?"*
14
+
15
+ - **Just this tool** → `--agent <tool>` (use the tool this conversation runs in,
16
+ e.g. `claude`). Shared resources are removed only if it is the last tool using
17
+ them. An instructions file several tools read (CodeBuddy and WorkBuddy share
18
+ `.codebuddy/rules/teamai-context.md`) is cleaned block by block: a teamai
19
+ block stays while a remaining tool on that file still writes it, so
20
+ `--agent workbuddy` keeps that file while CodeBuddy is installed. The team
21
+ rules in a project's `.codebuddy/rules` are shared the same way. A file an
22
+ earlier release wrote the blocks to, such as the project `AGENTS.md`, loses
23
+ its teamai blocks, since no tool reads them there now. A file teamai created
24
+ goes with its last block; one the user had before stays, even if empty.
25
+ - **Whole machine** → no `--agent` flag. Run outside a project, it removes the
26
+ user scope but keeps the data of each project still set up, and names them
27
+ (`Kept the data of N project(s) still set up on this machine: ...`). Each of
28
+ those needs `teamai uninstall` run in it; after the last one, one more
29
+ `teamai uninstall` outside any project removes what is left in `~/.teamai`.
30
+
31
+ Reassure them (in their language): *"This only removes things from your computer.
32
+ Your team's repo on the website is untouched — you can rejoin any time with
33
+ `/teamai` and the repo URL."*
34
+
35
+ ## Step 2 — Run it (you run it)
36
+
37
+ A targeted project exclusion needs the same confirmation even when there are no local files to remove. `--dry-run` and declining confirmation leave the project config unchanged.
38
+
39
+ Whole machine:
40
+
41
+ ```bash
42
+ teamai uninstall
43
+ ```
44
+
45
+ Just the current tool (example for Claude Code):
46
+
47
+ ```bash
48
+ teamai uninstall --agent claude
49
+ ```
50
+
51
+ `teamai uninstall` asks for a confirmation of its own. Let the user answer that
52
+ prompt. Only add `--force` (skips the prompt) if the user has already clearly told
53
+ you to go ahead without further confirmation:
54
+
55
+ ```bash
56
+ teamai uninstall --force
57
+ ```
58
+
59
+ ## Step 3 — Report the result in the user's language
60
+
61
+ Tell them what was removed and remind them, in one line, how to come back:
62
+ *"Done — TeamAI has been removed from this machine. To rejoin later, run `/teamai`
63
+ and give it your team repo URL."*
64
+
65
+ ## Notes
66
+
67
+ - If no valid configuration is found and TeamAI reports "home directory only," uninstall removes `~/.teamai` but keeps each project still set up (or registered in `~/.teamai/env-scopes`) and the shared files it reads, as a user-scope uninstall does.
68
+ - Project uninstall keeps the shared Claude/Codex team hooks in the main checkout
69
+ while another checkout uses them. A targeted uninstall releases only the selected
70
+ tool. Checkouts that exclude a tool do not retain its shared hook. Bare-repository
71
+ worktrees remove their own hook files independently. When the main checkout has
72
+ no install, the shared manifest and its empty `.teamai` directory are removed
73
+ after the last team hook is removed.
74
+ - A migrated data partition is one installation shared by its checkouts. Full
75
+ uninstall removes every checkout's shared hooks and registrations, then the
76
+ partition. Targeted uninstall (`--agent`) removes only that tool's hooks and
77
+ registration the current checkout uses, and keeps the other tools; when it is
78
+ the last tool it removes the partition, so every checkout's hooks go too.
79
+ Inherited submodule clones keep separate checkout ownership within that partition;
80
+ full uninstall removes their recorded hooks too, preserving versioned parent hooks.
81
+ - For OpenCode, uninstall also removes the rules globs teamai added to
82
+ `instructions` in `opencode.json`, including the relative `rules/*.md` an
83
+ earlier release wrote in user scope. In a project it removes
84
+ `.opencode/rules/**/*.md` from `.opencode/opencode.json` and the
85
+ `.opencode/rules/*.md` an earlier release wrote to the root `opencode.json`,
86
+ and deletes `.opencode/opencode.json` when nothing else is left in it.
87
+ The user's own entries stay.
88
+ - Uninstall removes the team-rules block from the file a tool with no rules
89
+ format reads in user scope (`~/.codex/AGENTS.md`, `~/.zcode/AGENTS.md`,
90
+ `$DSH_HOME/AGENTS.md`, the OpenClaw workspace `AGENTS.md`,
91
+ `~/.pi/agent/AGENTS.md`, `~/.joycode/rules.txt`, `~/.config/muse/AGENTS.md`), and the file when teamai
92
+ created it for the block alone.
93
+ - Uninstall cleans legacy Codex rule copies at the recorded `toolRoots`
94
+ location, including publishers' bare local filenames, and the copies earlier
95
+ releases left in a project's `.workbuddy/rules` and `.pi/rules`, in
96
+ `.openclaw/rules`, `~/.pi/agent/rules` and `~/.joycode/rules`. It keeps
97
+ edited copies and names them.
98
+ For a rule the team has
99
+ removed, it deletes the copy only if its hash matches the recorded delivery.
100
+ Without that record, it keeps the copy and names it in a warning. Save any
101
+ changes you need, then delete the copy manually.
102
+ - A skill directory, rule or agent at a team resource's name goes only when it
103
+ is teamai's (on the delivery record, or a team version by the history). The
104
+ user's own file or skill of that name stays, and uninstall names it in a
105
+ warning.
106
+ - A copy git tracks is never deleted: uninstall names it and lists it in its
107
+ summary under `Kept (tracked)`. If the repository no longer needs it, have
108
+ the user run `git rm -r <path>` and commit.
109
+ - If the output kept the data of projects still set up, list them and say that
110
+ TeamAI stays in those projects until `teamai uninstall` is run in each.
111
+ - If an OpenCode config entry cannot be removed, repair its config or permissions
112
+ and retry the same uninstall command. Uninstall reports failure and keeps
113
+ its ownership record and shared data directory, even for the last tool.
114
+ - Project uninstall keeps the global Pi and Oh My Pi extensions, Hermes
115
+ plugin and config, OpenCode's user plugin, and the Codex family's
116
+ user-level hooks, which the user
117
+ scope, the HTTP agent or another project may use, and names them. If none
118
+ does, run `teamai hooks remove` in the project first: it removes them.
119
+ Targeted project Codex uninstall keeps project config and records its
120
+ exclusion, even without local resources. Legacy project hook copies go.
121
+ User-scope uninstall removes these global channels.
122
+ The retained adapters respect project exclusions, including cached HTTP
123
+ prompt injection and HTTP sync. An excluded tool does not download its
124
+ resources again on the next session start.
125
+ - An enabled, installed Pi, Oh My Pi, Hermes or project Codex also keeps the
126
+ project's shared state in use without a local tool directory. Uninstalling
127
+ another tool preserves that state and the remaining tool's instructions.
128
+ - Do **not** delete the team repo on the Git platform — uninstall never touches it,
129
+ and neither should you.
130
+ - If the user only wants to stop auto-sync for one tool but keep TeamAI otherwise,
131
+ that is the `--agent <tool>` form, not a full uninstall.
132
+ - In a project, uninstall also removes teamai's git hook: the
133
+ `hook.teamai-post-checkout`, `hook.teamai-post-merge` and `hook.teamai-post-rewrite` entries in the repo's git
134
+ config and the `# >>> teamai git hook` block in `.git/hooks/post-checkout`,
135
+ `post-merge` and `post-rewrite`. Other hooks stay; a script left with only its shebang is deleted.
136
+ - In a project, uninstall also takes teamai's blocks out of `.git/info/exclude`
137
+ once it has deleted the files they hid: the `delivered` block, the
138
+ `delivered/<id>` block it keeps in another repository (a tool folder that is
139
+ a nested clone or submodule, a tool home kept in git), the HTTP local
140
+ agent's lines for this project (it keeps serving the other workspaces; a
141
+ user-scope uninstall removes its `local-agent` block in every exclude file it
142
+ recorded), and every other `# [teamai:…]` block in those files. A file the user creates later at one of
143
+ those paths is visible to git. Their own lines stay, and so does another
144
+ project's block in a shared repository. A read-only exclude file is left as
145
+ it is, and the warning lists the lines to delete by hand; the uninstall is
146
+ then incomplete (exit 1) and keeps its records, so rerunning it once the
147
+ file is writable removes the block. Copies in other
148
+ worktrees stay on disk and become visible there. `--agent <tool>` drops only
149
+ that tool's lines (`.agents/skills` too for Codex) from every worktree,
150
+ keeping a path another tool in use reads. `--dry-run` lists the blocks under
151
+ `Git exclude blocks (teamai's):`. An incomplete uninstall keeps the line of
152
+ every file still on disk until the retry. With no configuration found (a
153
+ machine set up only with `init --http`, uninstall run outside its projects),
154
+ uninstall removes `~/.teamai/` and the HTTP source, and first teamai's lines
155
+ from every exclude file its records name, but the line of a file it leaves on
156
+ disk (named), and the local agent's MCP servers in Claude's and CodeBuddy's
157
+ local scopes that are still as it wrote them (a changed copy stays, named).
158
+ If such a file does not parse, `~/.teamai/` and the records stay and it exits
159
+ 1, naming the file: fix it and rerun. `teamai source remove-http` leaves
160
+ those servers but keeps their records, for this uninstall to remove. In a workspace with no project config, run uninstall there: it also reads that workspace's `.teamai/managed-local-mcp.json`, with or without user config. A failed removal keeps those records and exits 1; repair the named file and retry in the same workspace. It does not scan other unconfigured workspaces. The local agent's skills and rules go only as far as they are
161
+ still what it installed: a file the user added inside a skill, an edited
162
+ copy, and a tracked file stay, named. If another pull or push holds the
163
+ project's sync lock, uninstall changes nothing and exits 1: run it again.
164
+ - A `credentials` line stays, with a warning, while the models file it names
165
+ still holds an API key in any checkout of that repository. MCP lines
166
+ (the `# [teamai:mcp-exclude:start]` block) go only for MCP configs it proves
167
+ hold no resolved `${VAR}` value, judged in every checkout of the repository
168
+ (the main checkout of a `--separate-git-dir` repo or a submodule too), after
169
+ removing teamai's servers from each. A line names the path a write lands in: for a config
170
+ under a symlinked directory, the link's target (`/config/mcp.json` for
171
+ `.cursor/` linking to `config/`); for a config that is itself a symlink, its
172
+ target, in that target's repository. For one it cannot prove clean (including one written
173
+ under a `toolPaths` mapping since changed, at the built-in location of a tool
174
+ the team dropped or moved that no other tool maps, or in a nested repository's
175
+ linked worktree, that still holds servers, and one written for a tool since moved
176
+ (or at its built-in location) that another tool maps, holding a server that tool
177
+ did not write) it keeps the line
178
+ and warns, naming the file and why: have the user remove teamai's servers from
179
+ that file, then delete the line (with the last one, the block's markers). Do not
180
+ delete a kept line while its file still holds a token.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: share
3
+ description: >-
4
+ Turn a session into a team learning: summarize what was solved, discovered or worked around,
5
+ and publish it to the team knowledge base with `teamai contribute`. Loaded on demand by the
6
+ teamai discovery stub, and by the friction reminder that ends a session worth sharing.
7
+ ---
8
+
9
+ # Contribute — share what a session taught you with the team
10
+
11
+ Summarize what this AI coding session taught you and push it to the team knowledge base.
12
+
13
+ **Write the document in Simplified Chinese**, as earlier releases required. Commands, flags,
14
+ URLs, paths and code identifiers stay as they are.
15
+
16
+ ## When to Use
17
+
18
+ - When teamai suggests this session has valuable content worth sharing
19
+ - When you've solved a tricky problem and want to document the solution
20
+ - When you've discovered a useful workflow or pattern
21
+ - After a long session with diverse tool usage
22
+
23
+ ## How It Works
24
+
25
+ 1. **Summarize**: review the tools used, the problems solved and the patterns found in this session
26
+ 2. **Write the document**: a Markdown document (language as above) covering:
27
+ - What the task or problem was
28
+ - The key decisions and why they were made
29
+ - The solution, workaround or pattern discovered
30
+ - Which tools or skills proved especially useful
31
+ - Pitfalls and things to watch out for
32
+ 3. **Save it**: write the document to a temporary file
33
+ 4. **Push it to the team**: run `teamai contribute --file <path> --title "<title>"`
34
+
35
+ ## Document Template
36
+
37
+ Copy the template, the frontmatter field table and the tag taxonomy from
38
+ `{SKILL_DIR}/references/doc-template.md`. The frontmatter is required: it is what
39
+ makes the document searchable.
40
+
41
+ ## Example
42
+
43
+ ```bash
44
+ # After writing the summary to /tmp/session-summary.md
45
+ teamai contribute --file /tmp/session-summary.md --title "Debugging K8s pod startup timeouts"
46
+ ```
47
+
48
+ ## Important
49
+
50
+ - Run this as a **sub-agent** (Agent tool) to avoid polluting the main session's context
51
+ - The document is pushed to the team repo's `teamai-learnings` branch, under `learnings/`, with no pull request
52
+ - Team members will see it on their next `teamai pull`
53
+ - Keep summaries concise and actionable — this is a knowledge base, not a diary
54
+
55
+ ## Publishing a reusable skill instead
56
+
57
+ A member asking to publish a skill ("share this xxx skill with my team") is a
58
+ different flow, and it does not need recall: it lives in the `core` skill, at
59
+ `"$(teamai skill path core)/references/contribute-member.md"`. This file
60
+ is for turning a *session* into a learning.
61
+
62
+ ## References
63
+
64
+ In the files below, `{SKILL_DIR}` is the directory `teamai skill path share` prints; a reference file you open on its own writes that directory as `SKILL_DIR` in braces.
65
+
66
+ | File | When to load it |
67
+ |---|---|
68
+ | `{SKILL_DIR}/references/doc-template.md` | Writing the learning document: template, frontmatter fields, tag taxonomy. |
69
+
70
+ `teamai skill get share --full` prints this skill with its reference appended.
@@ -0,0 +1,44 @@
1
+ # Learning document template
2
+
3
+ **Required: the document must start with YAML frontmatter.** It feeds the search index
4
+ and is how other members discover the learning.
5
+
6
+ ```markdown
7
+ ---
8
+ title: "<short title naming the core problem or finding>"
9
+ author: <username>
10
+ date: <YYYY-MM-DD>
11
+ tags: [tag1, tag2, tag3]
12
+ ---
13
+
14
+ ## Context
15
+ What were you doing? What problem did you hit?
16
+
17
+ ## Solution
18
+ How did you solve it? What were the key steps?
19
+
20
+ ## Lessons
21
+ - Lesson 1
22
+ - Lesson 2
23
+
24
+ ## Related Skills
25
+ - skill-name-1
26
+ - skill-name-2
27
+ ```
28
+
29
+ ### Frontmatter fields
30
+
31
+ | Field | Required | Meaning | Example |
32
+ |------|------|------|------|
33
+ | title | yes | Short title (under 60 characters) | "Diagnosing K8s Pod OOM kills" |
34
+ | author | yes | Contributor's username | jeffyxu |
35
+ | date | yes | Date as YYYY-MM-DD | 2026-03-28 |
36
+ | tags | yes | 2-5 key tags | [k8s, oom, troubleshooting] |
37
+
38
+ ### Choosing tags
39
+
40
+ Pick 2-5 from these categories:
41
+ - **Stack**: python, typescript, go, k8s, docker, sglang, cuda
42
+ - **Problem type**: troubleshooting, performance, deployment, config, api
43
+ - **Pattern**: workflow, pattern, tool-usage, best-practice
44
+ - **Scenario**: debugging, testing, monitoring, security