@qingflow-tech/qingflow-app-user-mcp 1.0.4 → 1.0.6

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 (27) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/pyproject.toml +2 -1
  4. package/skills/qingflow-app-user/SKILL.md +2 -1
  5. package/skills/qingflow-app-user/references/data-gotchas.md +8 -4
  6. package/skills/qingflow-app-user/references/public-surface-sync.md +6 -4
  7. package/skills/qingflow-app-user/references/record-patterns.md +14 -4
  8. package/skills/qingflow-record-analysis/SKILL.md +103 -166
  9. package/skills/qingflow-record-analysis/agents/openai.yaml +2 -2
  10. package/skills/qingflow-record-analysis/references/analysis-gotchas.md +56 -110
  11. package/skills/qingflow-record-analysis/references/analysis-patterns.md +106 -119
  12. package/skills/qingflow-record-analysis/references/business-context.md +74 -0
  13. package/skills/qingflow-record-analysis/references/confidence-reporting.md +49 -72
  14. package/skills/qingflow-record-analysis/references/data-access-playbook.md +106 -0
  15. package/skills/qingflow-record-analysis/references/pandas-recipes.md +172 -0
  16. package/skills/qingflow-record-analysis/references/report-format.md +76 -0
  17. package/skills/qingflow-record-insert/SKILL.md +28 -7
  18. package/skills/qingflow-record-update/SKILL.md +1 -1
  19. package/src/qingflow_mcp/backend_client.py +55 -1
  20. package/src/qingflow_mcp/cli/commands/record.py +63 -6
  21. package/src/qingflow_mcp/cli/formatters.py +101 -1
  22. package/src/qingflow_mcp/public_surface.py +2 -1
  23. package/src/qingflow_mcp/response_trim.py +235 -10
  24. package/src/qingflow_mcp/server.py +19 -12
  25. package/src/qingflow_mcp/server_app_user.py +30 -13
  26. package/src/qingflow_mcp/tools/record_tools.py +13425 -8817
  27. package/skills/qingflow-record-analysis/references/dsl-templates.md +0 -93
@@ -1,145 +1,91 @@
1
1
  # Analysis Gotchas
2
2
 
3
- ## Do not skip schema
3
+ ## Do Not Skip Schema
4
4
 
5
- If the task is analysis-style and you jump straight to `record_list` or `record_analyze`, you are already off the stable path.
5
+ Correct path:
6
6
 
7
- Correct recovery:
7
+ 1. `app_get`
8
+ 2. `record_browse_schema_get`
9
+ 3. `record_access`
10
+ 4. Python
8
11
 
9
- 1. `record_browse_schema_get`
10
- 2. inspect the schema and choose fields
11
- 3. build one or more small DSLs
12
- 4. run `record_analyze`
12
+ `record_browse_schema_get` returns readable fields for the selected view. Missing fields are permission or view-scope boundaries, not invitations to guess hidden ids.
13
13
 
14
- The schema here is applicant-node visible-only. If a field is absent, treat it as not available to the current user rather than switching to guessed ids or builder-side memory.
14
+ ## Do Not Use Export For Analysis
15
15
 
16
- ## Normalize relative time phrases before building the DSL.
16
+ Export tools are for user-requested files. Analysis uses `record_access` because it returns structured completeness and compact field metadata.
17
17
 
18
- Examples:
18
+ ## Do Not Treat `record_list` As Full Data
19
19
 
20
- - `最近一个完整自然月` -> convert to an explicit full-month date range
21
- - `上个月` -> convert to a concrete month range
22
- - `最近30天` -> convert to exact start/end dates
20
+ `record_list` is sample/browse only. It can be capped and should not justify:
23
21
 
24
- Do not pass vague time phrases or impossible dates into MCP.
22
+ - average
23
+ - share
24
+ - ranking
25
+ - trend
26
+ - regional distribution
27
+ - "all data" insights
25
28
 
26
- ## Do not treat 200-row list output as full data
29
+ ## Do Not Control Paging
27
30
 
28
- `record_list` can hit:
31
+ `record_access` owns paging internally.
29
32
 
30
- - `row_cap=200`
31
- - `row_cap_hit=true`
32
- - `sample_only=true`
33
+ Do not invent:
33
34
 
34
- When this happens, it is sample-only evidence.
35
+ - `page`
36
+ - `page_size`
37
+ - `limit`
38
+ - `requested_pages`
39
+ - `scan_max_pages`
40
+ - `max_rows`
41
+ - `timeout`
35
42
 
36
- It is not acceptable to use that result alone for:
43
+ ## Do Not Print Raw CSV
37
44
 
38
- - 平均值
39
- - 占比
40
- - 排名
41
- - 趋势
42
- - 地域分布
43
- - “基于全部数据”的 business insight
45
+ Read CSV files with pandas. Summarize computed results, not raw rows.
44
46
 
45
- ## Do not mix full analyze totals with sample rows
47
+ ## Do Not Rename Source Files
46
48
 
47
- If `record_analyze` gives full-population coverage, but list rows are capped, do not merge them into one final statement.
49
+ CSV columns are directly readable and field-id anchored: `record_id`, `<字段标题>__field_<id>`. Use those columns directly in pandas.
48
50
 
49
- Split them into:
51
+ ## Do Not Trust Sparse Dimensions
50
52
 
51
- - `全量可信结论`
52
- - `样本观察`
53
+ Before final grouping, run a field-quality profile. If the selected field is mostly blank, say so and downgrade the claim.
53
54
 
54
- ## Do not present truncated grouped rows as a full grouped list
55
+ Rules of thumb:
55
56
 
56
- If `completeness.rows_truncated=true` or `completeness.statement_scope=returned_groups_only`:
57
+ - Overall blank rate above 40%: not a primary conclusion dimension.
58
+ - Any compared period blank rate above 80%: do not use that field for period comparison.
59
+ - A sparse field can support only `已填写样本观察`.
57
60
 
58
- - do not say `各部门`
59
- - do not say `所有分组`
60
- - do not say `完整名单`
61
+ If the user asks for a semantic field such as `板块`, test nearby candidates like product, platform, module, stage, source, owner, or department before concluding.
61
62
 
62
- Correct recovery:
63
+ ## Do Not Hide Incomplete Access
63
64
 
64
- - do not describe the answer as complete grouped coverage
65
- - keep the wording inside the returned group scope
65
+ If `needs_scope`, no CSV exists. Ask for a time/business scope.
66
66
 
67
- ## Do not guess fields under ambiguity
67
+ If `partial`, use only subset wording and avoid full-population claims.
68
68
 
69
- If the field is uncertain:
69
+ If field meaning is ambiguous, ask the user to confirm from a short list.
70
70
 
71
- - do not bounce across tools
72
- - do not guess ids
73
- - do not switch from one read tool to another by trial and error
74
- - do not keep retrying different guessed field names in a loop
71
+ ## Do Not Guess Metrics
75
72
 
76
- Correct recovery:
73
+ Before fetching data, decide whether the request needs count, sum, average, distinct count, ratio, ranking, trend, or comparison.
77
74
 
78
- 1. `record_browse_schema_get`
79
- 2. if several plausible candidates remain, ask the user to confirm from a short list
80
- 3. build the DSL only after the field is clear
75
+ ## Do Not Call A Ratio Without Denominator
81
76
 
82
- If the intended field is absent from the schema altogether, stop and explain that it is not visible in the current applicant-node permission scope.
77
+ For penetration, conversion, or share:
83
78
 
84
- Examples of the right recovery question:
85
-
86
- - “我找到两个可能的字段:`线索来源`、`来源渠道`。你要按哪个字段统计?”
87
- - “目前最像‘来源’的字段有这三个:`来源`、`来源渠道`、`获客来源`。请确认你要按哪个字段分析。”
88
-
89
- ## Do not try to control paging manually
90
-
91
- `record_analyze` hides paging and scan budget on purpose.
92
-
93
- - Do not invent `page_size`
94
- - Do not invent `requested_pages`
95
- - Do not invent `scan_max_pages`
96
- - Do not invent `auto_expand_pages`
97
-
98
- When the result is incomplete:
99
-
100
- 1. narrow the scope with views or filters
101
- 2. reduce the analysis problem into smaller DSLs
102
- 3. keep the answer at `初步观察` or `部分结果` if completeness is still not enough
103
-
104
- ## Do not guess metric semantics from loose business wording
105
-
106
- Before building the DSL, first decide whether the question needs:
107
-
108
- - `count`
109
- - `sum`
110
- - `avg`
111
- - `distinct_count`
112
- - a ratio with numerator + denominator
113
- - a sorted ranking result
114
-
115
- Do not jump straight from words like `数量`, `人数`, `单量`, or `金额` to one assumed metric.
116
-
117
- ## Do not hide partial completion
118
-
119
- If the user asked for several outputs and only part of them is stable:
120
-
121
- - say which parts are complete
122
- - say which parts are still unresolved
123
- - do not present the answer as fully finished
124
-
125
- ## Do not send unsupported formula or div-style metrics into `record_analyze`.
126
-
127
- Examples to avoid:
128
-
129
- - `{"op":"div", ...}`
130
- - metric items with `formula`, `expr`, `numerator`, or `denominator`
131
-
132
- Correct recovery:
133
-
134
- 1. query the source metrics with separate DSLs
135
- 2. confirm both sides are complete and compatible
136
- 3. compute the derived ratio outside MCP in the reasoning layer
79
+ 1. define numerator
80
+ 2. define denominator
81
+ 3. query compatible source data
82
+ 4. compute in Python
83
+ 5. report numerator and denominator
137
84
 
138
- ## Do not call something a ratio without the denominator
85
+ ## Normalize Relative Dates
139
86
 
140
- If the user asks for penetration / conversion / 占比:
87
+ Convert relative phrases into exact ranges before `record_access`.
141
88
 
142
- 1. define numerator
143
- 2. define denominator
144
- 3. query both sides explicitly
145
- 4. only then compute and report the ratio
89
+ - `今年5月` -> exact May 1 to May 31 in the current year
90
+ - `去年同期` -> same date range in previous year
91
+ - `最近30天` -> exact rolling start/end dates
@@ -1,125 +1,112 @@
1
1
  # Analysis Patterns
2
2
 
3
- ## When to use this skill
4
-
5
- Use this skill when the user asks for:
6
-
7
- - 分布
8
- - 占比
9
- - 平均值
10
- - 排名 / top-N
11
- - 趋势
12
- - 洞察
13
- - 最终统计结论
14
- - 全量范围内的 business summary
15
-
16
- ## Canonical analysis sequence
17
-
18
- 1. `record_browse_schema_get`
19
- 2. decide whether the question needs `count`, `sum`, `avg`, `distinct_count`, `ratio`, or `ranking`
20
- 3. build one or more field_id-based DSLs
21
- 4. `record_analyze`
22
- 5. `record_list` only for sample inspection
23
-
24
- Result reading order:
25
-
26
- 1. `result.rows`
27
- 2. `result.totals.metric_totals`
28
- 3. `ranking`
29
- 4. `ratios`
30
- 5. `completeness`
31
- 6. `presentation`
32
-
33
- Treat `record_browse_schema_get` as the browse-schema source of truth. Missing fields are permission boundaries, not invitations to guess hidden ids.
34
-
35
- ## Distribution / ratio pattern
36
-
37
- 1. Run `record_browse_schema_get`
38
- 2. Inspect candidate fields and aliases
39
- 3. If several plausible candidates remain, stop and ask the user to confirm the field from a short list
40
- 4. Build a DSL with:
41
- - one dimension
42
- - `count`
43
- - sort by the count alias
44
- 5. Run `record_analyze`
45
- 6. Report:
46
- - `result.totals.metric_totals`
47
- - `safe_for_final_conclusion`
48
- - `completeness.statement_scope`
49
- - `completeness.warnings`
50
- 7. If grouped rows are truncated, describe the answer as `主要分组` or `已返回分组中`, not `各部门` or `全部`
51
-
52
- ## penetration / conversion / share-of-total pattern
53
-
54
- 1. Run `record_browse_schema_get`
55
- 2. Write down the business definition in plain language:
56
- - numerator
57
- - denominator
58
- - grouping dimension, if any
59
- 3. Build separate DSLs when numerator and denominator are not the same filtered population
60
- 4. Query the numerator first
61
- 5. Query the denominator second
62
- 6. Only compute the ratio outside MCP after both source results are complete and use compatible scopes
63
- 7. If the denominator is missing, do not call the output `渗透率`, `转化率`, `占比`, or `%`
64
-
65
- ## Average / ranking pattern
66
-
67
- 1. Run `record_browse_schema_get`
68
- 2. Choose one dimension field and one numeric metric field
69
- 3. Build a DSL with:
70
- - `dimensions=[...]`
71
- - `metrics=[count,sum]` or `metrics=[count,avg,min,max]`
72
- 4. Run `record_analyze`
73
- 5. If the answer uses ranking language, make the ranking come from structured sorted results
74
- 6. Prefer the structured `ranking` block when it exists instead of inferring order from loose text
75
- 7. Use list mode only to inspect examples after the aggregate result is understood
76
-
77
- ## Trend pattern
78
-
79
- 1. Run `record_browse_schema_get`
80
- 2. Choose a date/time field from `suggested_time_fields`
81
- 3. Build a DSL with `bucket=day|week|month|quarter|year`
82
- 4. Run `record_analyze`
83
- 5. Treat the result as final only if `safe_for_final_conclusion=true`
84
- 6. If the user asked for a relative time phrase such as `最近一个完整自然月`, translate it into an explicit legal date range before building the DSL
85
-
86
- ## Sample inspection pattern
87
-
88
- Only use `record_list` after schema/analyze when you need:
89
-
90
- - example rows
91
- - spot checks
92
- - representative samples
93
- - manual inspection of records behind an aggregate bucket
94
-
95
- Never use list mode alone to justify final averages, shares, rankings, or regional distribution claims.
96
-
97
- ## Statement-to-query discipline
98
-
99
- - If you want to say `单量低` or `volume low`, query `count`
100
- - If you want to say `金额高`, query `sum`
101
- - If you want to say `客单价高`, query `avg` or trusted `sum + count`
102
- - If you want to say `增长` or `下降`, query a time bucket
103
- - If you want to say `渗透率` or `占比`, query both numerator and denominator
104
- - If you want to say `各部门` / `全部渠道` / `完整名单`, make sure `completeness.statement_scope=full_population` and `completeness.rows_truncated=false`
105
- - If you want to say `Top N` or `排名`, make sure the result is explicitly sorted and the conclusion follows that returned order
106
- - If the task is complex, default to `先结构、后解读`
107
-
108
- ## Ambiguous field recovery
109
-
110
- If the user asks for something like “来源分布” or “类型占比” and the exact field is unclear:
111
-
112
- 1. run `record_browse_schema_get`
113
- 2. inspect titles, aliases, and suggested fields
114
- 3. if one candidate is clearly dominant, proceed
115
- 4. if multiple candidates are still plausible, ask the user to confirm which field they want
3
+ ## Canonical Sequence
4
+
5
+ 1. `app_get`
6
+ 2. `record_browse_schema_get`
7
+ 3. decide metric intent
8
+ 4. choose `record_access.columns / where / order_by`
9
+ 5. `record_access`
10
+ 6. Python over every returned CSV shard
11
+ 7. optional `record_list` or `record_get` only for sample/detail verification
12
+
13
+ Metric intent must be one of:
14
+
15
+ - `count`
16
+ - `sum`
17
+ - `avg`
18
+ - `distinct_count`
19
+ - ratio with numerator and denominator
20
+ - sorted ranking
21
+ - time trend
22
+ - period comparison
23
+
24
+ ## Distribution
25
+
26
+ 1. Fetch grouping field and filter fields.
27
+ 2. Run the field-quality profile for the grouping field.
28
+ 3. If the field passes quality gates, group by the readable field-id anchored column such as `项目状态__field_343283094`.
29
+ 4. Count rows and calculate share from the sum of counts.
30
+ 5. Report top groups plus total row count.
31
+
32
+ If the grouping field is ambiguous, ask the user to choose from a short candidate list.
33
+
34
+ ## Dimension Selection
35
+
36
+ When the user asks for a semantic bucket such as `板块`, `模块`, `业务线`, or `来源`, inspect candidate fields and choose the most reliable one:
37
+
38
+ 1. Match schema titles to the user's wording.
39
+ 2. Fetch candidate fields together if they are cheap.
40
+ 3. Profile `blank_rate`, period coverage, and distinct count.
41
+ 4. Prefer the candidate with clear semantics and usable coverage.
42
+ 5. If the literal field is sparse, downgrade it to `已填写样本观察` and use the nearest reliable fallback for the main conclusion.
43
+
44
+ Example: if `缺陷所属模块` is mostly empty but `缺陷所属平台` and `所属产品` are complete, use platform/product for the main conclusion and state that module-level analysis is limited.
45
+
46
+ Quality gates:
47
+
48
+ - Overall `blank_rate > 0.4`: not a primary conclusion dimension.
49
+ - Any compared period `blank_rate > 0.8`: not valid for period comparison.
50
+ - High-cardinality description/id fields are not dimensions unless the user explicitly asks for record-level ranking.
51
+
52
+ ## Ratio / Conversion / Penetration
53
+
54
+ 1. Define numerator and denominator in plain language.
55
+ 2. Fetch both populations with compatible scope.
56
+ 3. Compute ratio in Python.
57
+ 4. Report `numerator / denominator = percentage`.
116
58
 
117
- Do not keep retrying different guessed field names in a loop.
59
+ If denominator is missing or scope differs, do not call the result a rate.
118
60
 
119
- ## Partial completion discipline
61
+ ## Average / Sum
120
62
 
121
- If the user asked for several conclusions and only some of them are fully supported:
63
+ 1. Fetch grouping field and numeric metric field.
64
+ 2. Convert the metric column with `pd.to_numeric(errors="coerce")`.
65
+ 3. Report count, sum, and average together when useful.
66
+ 4. State how blanks/non-numeric values were handled if material.
67
+
68
+ ## Ranking
69
+
70
+ 1. Build the metric in Python.
71
+ 2. Sort explicitly.
72
+ 3. Report Top N with metric values.
73
+ 4. Do not infer ranking from unsorted sample rows.
74
+
75
+ ## Trend
76
+
77
+ 1. Choose a date/time field from `suggested_time_fields`.
78
+ 2. Convert relative phrases into exact date ranges.
79
+ 3. Fetch the date field and metrics.
80
+ 4. Bucket in pandas by day/week/month/quarter/year.
81
+ 5. Report both absolute values and changes.
82
+
83
+ ## Same-Period Comparison
84
+
85
+ For `今年5月 vs 去年5月`:
86
+
87
+ 1. Use the same date field for both periods.
88
+ 2. Fetch the full combined date range or two separate compatible ranges.
89
+ 3. Apply identical business filters.
90
+ 4. Compute absolute delta and percentage delta.
91
+ 5. State both periods explicitly.
92
+
93
+ ## Sample Inspection
94
+
95
+ Use `record_list` only after the aggregate result is complete, and only for:
96
+
97
+ - representative examples
98
+ - checking surprising categories
99
+ - manually inspecting records behind a bucket
100
+
101
+ Never use `record_list` alone for final averages, shares, rankings, trends, or distributions.
102
+
103
+ ## Ambiguous Field Recovery
104
+
105
+ If the exact field is unclear:
106
+
107
+ 1. inspect `record_browse_schema_get.fields`
108
+ 2. use titles and suggested fields
109
+ 3. if one candidate is clearly dominant, proceed
110
+ 4. otherwise ask the user to confirm
122
111
 
123
- 1. state which parts are complete
124
- 2. state which parts are still unresolved
125
- 3. do not present the answer as fully complete
112
+ Do not retry tools with guessed field names.
@@ -0,0 +1,74 @@
1
+ # Business Context
2
+
3
+ Use this when analysis depends on organization, aliases, ownership, stage semantics, or user-provided business definitions.
4
+
5
+ ## When To Check Context
6
+
7
+ Check for business context when the request mentions:
8
+
9
+ - department / team / group / region
10
+ - owner / assignee / sales rep / partner
11
+ - stage / status / funnel / conversion
12
+ - product line / business line
13
+ - same-period comparison
14
+ - "北斗部门", "SMB", "伙伴", or any named internal scope
15
+
16
+ ## Mapping Rules
17
+
18
+ Use explicit mappings in this order:
19
+
20
+ 1. the user's message in the current thread
21
+ 2. attached or local business context files
22
+ 3. schema-visible fields and sample records
23
+ 4. short clarification to the user
24
+
25
+ Do not infer hidden org hierarchy from memory. If the mapping changes the denominator or grouping, state it in the final answer.
26
+
27
+ Example:
28
+
29
+ ```python
30
+ dept_map = {
31
+ "烈焰组": "北斗部门",
32
+ "飓风组": "北斗部门",
33
+ }
34
+ df["部门口径"] = df["field_40"].replace(dept_map)
35
+ ```
36
+
37
+ Final wording:
38
+
39
+ ```text
40
+ 部门口径:将「烈焰组」「飓风组」合并计入「北斗部门」。
41
+ ```
42
+
43
+ ## Ratio Definitions
44
+
45
+ Before computing rates, define:
46
+
47
+ - numerator
48
+ - denominator
49
+ - time range
50
+ - grouping dimension
51
+ - exclusions
52
+
53
+ If any part is ambiguous, ask. Do not rename a count as a rate.
54
+
55
+ ## Time Scope
56
+
57
+ Normalize relative dates to exact dates before calling `record_access`.
58
+
59
+ Examples:
60
+
61
+ - `今年5月` -> `2026-05-01` to `2026-05-31` when current year is 2026
62
+ - `去年同期` -> same month range in the previous year
63
+ - `最近一个完整自然月` -> previous calendar month, not the last 30 days
64
+
65
+ ## Cross-App Reconciliation
66
+
67
+ If the analysis needs multiple apps:
68
+
69
+ 1. run the standard sequence per app
70
+ 2. keep each dataset's scope and completeness separately
71
+ 3. join in Python only on explicit ids or trusted business keys
72
+ 4. disclose join keys and unmatched records
73
+
74
+ If no reliable key exists, report the gap instead of forcing a join.
@@ -1,92 +1,69 @@
1
1
  # Confidence Reporting
2
2
 
3
- ## Required output structure
3
+ ## Full Conclusion Gate
4
4
 
5
- When analysis is intended as a final answer, use this order:
6
-
7
- 1. `全量可信结论`
8
- 2. `样本观察`
9
- 3. `待验证假设`
10
-
11
- ## Full conclusion gate
12
-
13
- Only write `全量可信结论` when:
5
+ Use `全量可信结论` only when:
14
6
 
15
7
  - `record_browse_schema_get` was used
16
- - the analysis path used one or more `record_analyze` calls
17
- - every key analysis result has `safe_for_final_conclusion=true`
18
- - `safe_for_final_conclusion=true is necessary but not sufficient`
19
- - no key result depends on an invalid time phrase, an undefined denominator, or an unsupported derived metric
20
- - the result is not just a capped list sample
21
-
22
- ## Sample observation gate
23
-
24
- Put evidence into `样本观察` when:
25
-
26
- - it came from `record_list`
27
- - the tool reports `row_cap_hit`
28
- - the tool reports `sample_only`
29
- - the result is compact/capped and not complete
30
-
31
- ## Downgrade rule
32
-
33
- If `record_browse_schema_get` was not used for an analysis task, downgrade the overall framing to `初步观察` instead of `洞察` or `结论`.
34
-
35
- ## Anti-mixing rule
36
-
37
- Do not combine:
38
-
39
- - full totals from `record_analyze`
40
- - sample-only details from `record_list`
41
-
42
- into one sentence like “基于全部数据分析...”.
43
-
44
- Instead:
45
-
46
- - full totals and distributions go into `全量可信结论`
47
- - illustrative rows go into `样本观察`
48
-
49
- ## Semantic gate
8
+ - data came from `record_access`
9
+ - all returned CSV shards were read in Python
10
+ - `record_access.complete=true`
11
+ - `record_access.truncated=false`
12
+ - `record_access.safe_for_final_conclusion=true`
13
+ - metric definitions are complete
14
+ - denominator exists for every ratio
15
+ - time fields and date ranges are explicit
16
+ - primary grouping dimensions pass field-quality gates
50
17
 
51
- Even when `safe_for_final_conclusion=true`, do not overstate the answer if:
18
+ ## Initial Observation Gate
52
19
 
53
- - the metric definition is incomplete
54
- - the denominator was not queried
55
- - the conclusion mentions trend but no time bucket was queried
56
- - the conclusion mentions单量/volume but no `count` metric was queried
57
- - the conclusion depends on a derived metric the DSL cannot natively express
58
- - `completeness.statement_scope=returned_groups_only`
59
- - `completeness.rows_truncated=true`
20
+ Use `初步观察` when:
60
21
 
61
- ## Grouped enumeration gate
22
+ - `record_access.status=needs_scope`
23
+ - `record_access.status=partial`
24
+ - `record_access.complete=false`
25
+ - `record_access.truncated=true`
26
+ - `record_access.safe_for_final_conclusion=false`
27
+ - evidence came from `record_list`
28
+ - scope or saved view filter is unverified
62
29
 
63
- If grouped rows were truncated:
30
+ ## Anti-Mixing Rule
64
31
 
65
- - do not call the grouped output `各部门`, `全部渠道`, `完整名单`, or `所有分组`
66
- - use `已返回分组中`, `主要分组`, or `前 N 个分组`
67
- - keep full-population statements only for metrics that still cover the full analyzed population
32
+ Do not combine full CSV-derived totals and sample-only rows in one sentence.
68
33
 
69
- ## Partial completion disclosure
34
+ Correct split:
70
35
 
71
- If the user asked for multiple conclusions but only some are complete:
36
+ - full totals/distributions: `全量可信结论`
37
+ - illustrative examples: `样本观察`
72
38
 
73
- - explicitly disclose which parts are complete
74
- - explicitly disclose which parts are not yet complete
75
- - do not collapse the answer into one all-clear conclusion
39
+ ## Semantic Gate
76
40
 
77
- ## Example skeleton
41
+ Even with `safe_for_final_conclusion=true`, downgrade if:
78
42
 
79
- ### 全量可信结论
43
+ - metric definition is incomplete
44
+ - denominator was not queried
45
+ - conclusion mentions trend but no time field was used
46
+ - conclusion mentions volume but no count was computed
47
+ - grouping depends on unconfirmed business aliases
48
+ - custom view scope is not verified
49
+ - primary grouping field has high missingness or poor period coverage
80
50
 
81
- - `result.totals.metric_totals=...`
82
- - `safe_for_final_conclusion=true`
83
- - 这里写最终业务结论
51
+ ## Partial Disclosure
84
52
 
85
- ### 样本观察
53
+ If only part of the user request is complete:
86
54
 
87
- - 以下来自样本明细浏览,不作为最终统计结论
88
- - 这里写代表性样本现象
55
+ - say which parts are complete
56
+ - say which parts are unresolved
57
+ - do not collapse into one all-clear conclusion
89
58
 
90
- ### 待验证假设
59
+ ## Compact Disclosure Template
91
60
 
92
- - 这里写还需要进一步验证的推测
61
+ ```text
62
+ 可信度:全量可信 / 初步观察
63
+ 数据完整性:complete=..., truncated=..., safe_for_final_conclusion=...
64
+ 字段质量:primary dimension blank_rate=..., period coverage=...
65
+ 取数字段:...
66
+ 时间范围:...
67
+ 业务口径:...
68
+ 限制:...
69
+ ```