teamai-cli 0.16.8 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: teamai-recall
3
- description: Search the team knowledge base (skills + learnings + docs + rules) and return a compact, structured summary with doc_ids — instead of dumping full knowledge content into the main conversation. Invoke this BEFORE any task involving code changes, troubleshooting, or design.
3
+ description: Search the team knowledge base (skills + learnings + docs + rules + codebase graph) and return a compact, structured summary with doc_ids — instead of dumping full knowledge content into the main conversation. Invoke this BEFORE any task involving code changes, troubleshooting, or design.
4
4
  tools: Bash, Read, Grep, Glob
5
5
  ---
6
6
 
@@ -20,16 +20,29 @@ upstream API"). Treat this as your query.
20
20
 
21
21
  ## What you must do — step by step
22
22
 
23
- ### Step 1 — Read the codebase manifest (optional but preferred)
23
+ ### Step 1 — Classify question type and choose retrieval depth
24
24
 
25
- If `~/.teamai/docs/codebase.md` OR `docs/team-codebase/index.md` (in the
26
- current project) exists, read it first. It lists the team's repositories
27
- and their purposes. Extract a one-sentence repo-list summary to prepend to
28
- your final output. If neither file exists, **silently skip** this step —
29
- never error out.
25
+ Determine if the query matches a G-document category:
30
26
 
31
- > Note: `teamai recall` already indexes team-codebase documents
32
- > (repos/*.md), so Step 3 will return codebase knowledge matches directly.
27
+ | 问题关键词 | 类型 | 直接读取 |
28
+ |-----------|------|---------|
29
+ | 依赖/上游/下游/谁调用 | G1 | `teamwiki/evidence/code/<project>/docs/graph-g1-relations.md` |
30
+ | 调用链/数据流/请求路径 | G2 | `teamwiki/evidence/code/<project>/docs/graph-g2-dataflow.md` |
31
+ | 流程/场景/完整流程 | G5 | `teamwiki/evidence/code/<project>/docs/graph-g5-scenarios.md` |
32
+ | 传递依赖/爆炸半径/影响 | G6 | `teamwiki/evidence/code/<project>/docs/graph-g6-multihop.md` |
33
+
34
+ **If the query clearly matches a G-document type**: directly Read the
35
+ corresponding file and extract relevant sections. Skip BM25 search.
36
+
37
+ **Otherwise**: proceed to Step 2–3 for BM25 keyword search.
38
+
39
+ > `teamai recall` supports three depth levels:
40
+ > - `--depth context` (default): searches overview + modules + docs (best for most queries)
41
+ > - `--depth lookup`: searches ALL evidence pages including raw symbol lists (for precise file:line lookups)
42
+ > - `--depth route`: returns the router table only (use when you need to discover what projects exist)
43
+
44
+ Fallback: if no `teamwiki/`, check `~/.teamai/docs/codebase.md`. If
45
+ none exists, silently skip.
33
46
 
34
47
  ### Step 2 — Extract keywords from the task description
35
48
 
@@ -38,25 +51,42 @@ Pick 3–6 high-signal keywords from the user query. Strip filler words
38
51
 
39
52
  ### Step 3 — Run the teamai recall command
40
53
 
41
- Execute:
54
+ Execute with the appropriate depth:
42
55
 
43
56
  ```bash
57
+ # Default: searches overview, modules, and docs (context layer)
44
58
  teamai recall "<keyword1> <keyword2> ..."
59
+
60
+ # For precise symbol/line-number lookups, use lookup depth:
61
+ teamai recall --depth lookup "<keyword1> <keyword2> ..."
45
62
  ```
46
63
 
47
64
  This searches all four knowledge categories (`skills`, `learnings`,
48
- `docs`, `rules`) via the local search index. Capture the full output.
65
+ `docs`, `rules`) via the local search index, plus the codebase graph
66
+ in `teamwiki/` with BM25 + graph-boost. Capture the full output.
67
+
68
+ If the first call returns insufficient results, you may retry once with
69
+ `--depth lookup` to broaden the search to raw symbol pages.
49
70
 
50
71
  If the command fails, knowledge base is empty, or returns zero hits,
51
72
  emit a single line `No relevant team knowledge found for: <query>` and
52
73
  stop.
53
74
 
54
- ### Step 4 — Read the top hits
75
+ ### Step 4 — Read the top hits and drill into codebase
55
76
 
56
77
  For each hit returned by `teamai recall`, read the source file directly
57
- (use `Read`) and condense each into **one or two sentences**. Cap your
58
- total summary at ~1500 characters. Drop hits that on closer inspection
59
- are clearly off-topic.
78
+ (use `Read`) and condense each into **one or two sentences**.
79
+
80
+ **For codebase hits** (path contains `teamwiki/evidence/`):
81
+ - If the hit is a raw facts page (component.md, interface.md), prefer
82
+ reading the corresponding **module summary** (`modules/<dir>.md`) instead —
83
+ it's more concise and shows dependencies.
84
+ - If you need architectural context (why a module exists, design decisions),
85
+ check `overview.md` in the same project directory.
86
+ - If the hit mentions a knowledge gap (from `gaps/detected.md`), relay
87
+ it to the user: "This area is not fully documented in the knowledge base."
88
+
89
+ Cap your total summary at ~2000 characters. Drop hits that are off-topic.
60
90
 
61
91
  ### Step 5 — Emit a structured response
62
92
 
@@ -65,24 +95,43 @@ Return your output in **this exact format** to the main conversation:
65
95
  ```
66
96
  ## Team Knowledge Recall
67
97
 
68
- > Repos: <one-line repo summary from codebase.md, or omit this line>
98
+ > Repos: <one-line repo summary from router.md, or omit>
99
+
100
+ ### Relevant knowledge
69
101
 
70
102
  1. **[<type>] <doc_id>** — <file path>
71
103
  <one-sentence summary>
72
104
  Confidence: <high | medium | low>
73
105
 
74
- 2. **[<type>] <doc_id>** — <file path>
75
- <one-sentence summary>
76
- Confidence: <high | medium | low>
106
+ 2. ...
107
+
108
+ ### Codebase context (if any codebase hits)
109
+
110
+ **Module: <module_name>** (<project>)
111
+ - Depends on: <list>
112
+ - Depended by: <list>
113
+ - Core components: `Foo`, `Bar`, `Baz` (top 5 by reference count)
114
+ - Architecture: <one sentence from overview.md if available>
115
+
116
+ ### Gaps (if relevant)
77
117
 
78
- ...
118
+ ⚠️ <gap description> — do not guess answers for this area.
79
119
 
80
120
  <!-- teamai:recalled-doc-ids: [<id1>, <id2>, ...] -->
81
121
  ```
82
122
 
83
- Where:
84
- - `<type>` is one of `skills` / `learnings` / `docs` / `rules`
85
- - `<doc_id>` is the filename without extension (e.g. `api-timeout-fix`)
123
+ **Output structure rules:**
124
+
125
+ - `<type>` is one of `skills` / `learnings` / `docs` / `rules` / `codebase`
126
+ - `<doc_id>` is the filename without extension (e.g. `api-timeout-fix`).
127
+ For codebase hits, use the relative path within teamwiki/ (e.g. `evidence/code/hai_api/modules/business`)
128
+ - **Codebase context section**: when a codebase hit is returned, include
129
+ the module's dependency direction and top 5 components **inline** — the
130
+ main conversation should not need a second Read to understand the module.
131
+ Extract this from `modules/<dir>.md` which you already read in Step 4.
132
+ - **Gaps section**: only include if `gaps/detected.md` was relevant to the
133
+ query. This tells the main conversation to stop and ask the user rather
134
+ than hallucinating.
86
135
  - The trailing HTML comment **must** list every doc_id you returned —
87
136
  later phases (Phase 3 Stop hook) will parse this from the conversation
88
137
  transcript.
@@ -93,5 +142,13 @@ Where:
93
142
  - **Do not** call `teamai recall` more than 3 times in one invocation.
94
143
  - **Do not** invoke other subagents.
95
144
  - If `teamai` CLI is not on PATH, return `teamai CLI not available` and stop.
96
- - Output total ≤ ~2000 characters. The whole point of using a subagent is
145
+ - Output total ≤ ~2500 characters. The whole point of using a subagent is
97
146
  to keep the main conversation's context lean.
147
+ - For codebase hits, **prefer module summaries over raw facts pages** —
148
+ they give better signal-to-noise for the main conversation.
149
+ - **Include module dependency + core components inline** so the main
150
+ conversation can act without a second retrieval round-trip.
151
+ - If `teamwiki/gaps/detected.md` exists and is relevant, include the
152
+ Gaps section so the main conversation does not hallucinate.
153
+ - When zero hits are found but `teamwiki/` exists, check if the query
154
+ relates to a known gap before returning "no knowledge found".