@thinkingai/ae-cli 1.0.18 → 1.0.20

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 (36) hide show
  1. package/dist/{auth-2UTBG5U3.js → auth-A4NV2VHD.js} +15 -6
  2. package/dist/{auth-ECD46NBA.js → auth-T3ILGJKW.js} +2 -2
  3. package/dist/{chunk-7QBNU44L.js → chunk-5CCFSPAF.js} +8 -30
  4. package/dist/{chunk-4KQ7H7DY.js → chunk-OVMQFFC2.js} +1 -1
  5. package/dist/{chunk-MR57UIKC.js → chunk-TMMUBSKW.js} +10 -0
  6. package/dist/{chunk-LAAS6ITR.js → chunk-TOXRLDUP.js} +2 -2
  7. package/dist/{client-O56G2SNJ.js → client-FPA76DGY.js} +3 -3
  8. package/dist/{config-BU5FHGGE.js → config-QZIEYXQZ.js} +2 -2
  9. package/dist/index.js +18 -13
  10. package/dist/{raw-A3VN2B6I.js → raw-MZIKHQH4.js} +3 -3
  11. package/dist/{te-analysis-UGKESPBE.js → te-analysis-CFQBXUCO.js} +93 -7
  12. package/dist/{te-audience-THZNVHYB.js → te-audience-WPBBWADL.js} +3 -3
  13. package/dist/{te-common-QZOUME3S.js → te-common-GL3KBZPD.js} +3 -3
  14. package/dist/{te-community-AZVW3NFX.js → te-community-3XEJNSQL.js} +3 -3
  15. package/dist/{te-dataops-OE5PX2K6.js → te-dataops-H4WSMCG5.js} +3 -3
  16. package/dist/{te-engage-RYGEQTYK.js → te-engage-2VFM37ZM.js} +3 -3
  17. package/dist/te-kb-U6SQUJVC.js +41 -0
  18. package/dist/{te-meta-MGO5BCMG.js → te-meta-BO45GW32.js} +7 -7
  19. package/package.json +2 -1
  20. package/skills/ae-analysis/SKILL.md +69 -37
  21. package/skills/ae-analysis/references/build_event_analysis_qp.md +132 -0
  22. package/skills/ae-analysis/references/build_funnel_analysis_qp.md +143 -0
  23. package/skills/ae-analysis/references/build_prop_analysis_qp.md +122 -0
  24. package/skills/ae-analysis/references/build_retention_analysis_qp.md +141 -0
  25. package/skills/ae-analysis/references/get_analysis_query_schema.md +22 -11
  26. package/skills/ae-analysis/references/get_metric.md +7 -1
  27. package/skills/ae-analysis/references/get_report_definition.md +4 -0
  28. package/skills/ae-analysis/references/list_dashboards.md +2 -0
  29. package/skills/ae-analysis/references/list_events.md +4 -1
  30. package/skills/ae-analysis/references/list_metrics.md +5 -0
  31. package/skills/ae-analysis/references/list_properties.md +6 -1
  32. package/skills/ae-analysis/references/list_reports.md +2 -0
  33. package/skills/ae-analysis/references/query_adhoc.md +71 -31
  34. package/skills/ae-community/SKILL.md +14 -101
  35. package/skills/ae-dataops/SKILL.md +13 -58
  36. package/skills/ae-engage/SKILL.md +15 -98
@@ -0,0 +1,141 @@
1
+ # analysis +build_retention_analysis_qp (build retention analysis qp)
2
+
3
+ > **Prerequisite:** Follow the Global AE CLI Rules in [`../SKILL.md`](../SKILL.md).
4
+
5
+ Domain: **Model Analysis**
6
+
7
+ ## Use Cases
8
+ - Build a validated retention-analysis QP from structured intent.
9
+ - Use in the mandatory builder flow before `+query_adhoc --model_type retention`.
10
+ - This command builds QP only and does not execute the analysis query.
11
+ - This is one of exactly four QP builders: `event`, `retention`, `funnel`, `prop_analysis`.
12
+ - Use this builder for retention ad hoc requests; do not manually build retention QP through `+get_analysis_query_schema`.
13
+
14
+ ## JSON Rules
15
+ - CLI flags use snake_case, but JSON object keys use camelCase DTO names.
16
+ - Correct nested keys: `initialEvent`, `returnEvent`, `unitNum`, `rtnRateOrNum`, `relationEventPropertyName`, `initialFilters`, `returnFilters`, `initialFilterRelation`, `returnFilterRelation`.
17
+ - Initial/return event filters are event-property-only and use `eventPropertyName`; they do not use the generic `field` object.
18
+ - Retention global filters and groups use the generic `field` object.
19
+ - Do not run syntax examples with placeholder JSON. Fill `time_range` and `retention` with valid nested fields before calling this command.
20
+ - `--dry-run` still requires the same required flags as a real builder call. Never run this command as dry-run without `--project_id`, `--time_range`, and `--retention`.
21
+ - Do not call `get_analysis_query_schema`, `list_events`, `list_properties`, `list_metrics`, or `get_metric` before this builder for normal ad-hoc analysis. The builder resolves events and properties internally.
22
+ - Builder commands do not accept `zone_offset`; pass `--zone_offset` to `+query_adhoc` after the builder succeeds.
23
+ - If the request misses time range, initial event, return event, or retention interval, stop and ask the user to clarify.
24
+
25
+ ## Command Syntax
26
+ ```bash
27
+ ae-cli analysis +build_retention_analysis_qp --project_id <project_id> --time_range '<valid_time_range_json>' --retention '<valid_retention_json>'
28
+ ae-cli analysis +build_retention_analysis_qp --project_id <project_id> --time_range '<valid_time_range_json>' --retention '<valid_retention_json>' --relation and --time_particle_size day
29
+ ae-cli analysis +build_retention_analysis_qp --project_id <project_id> --time_range '<valid_time_range_json>' --retention '<valid_retention_json>' --dry-run
30
+ ```
31
+
32
+ ## Parameters
33
+ | Parameter | Required | Description |
34
+ |---|---|---|
35
+ | `--project_id` / `-p` | Yes | Project ID |
36
+ | `--time_range` | Yes | Retention analysis time range JSON |
37
+ | `--retention` | Yes | Retention intent JSON |
38
+ | `--relation` | No | Top-level retention filter relation. Supported values: and, or. Default: and |
39
+ | `--time_particle_size` | No | Time granularity. Supported values: day, week, month |
40
+
41
+ ## JSON Shape
42
+ `--time_range` object:
43
+ ```json
44
+ {"mode":"start_to_yesterday","startTime":"2021-05-18"}
45
+ ```
46
+
47
+ Time range fields:
48
+ | Field | Required | Description |
49
+ |---|---|---|
50
+ | `mode` | Yes | `recent`, `previous`, `custom`, `start_to_today`, `start_to_yesterday` |
51
+ | `unit` | For `recent`/`previous` | `day`, `week`, `month`, `quarter`, `year` |
52
+ | `value` | For `recent`/`previous` | Unit count. `{"mode":"previous","unit":"day","value":1}` means yesterday. |
53
+ | `startTime` | For `custom`/`start_to_*` | `yyyy-MM-dd` or `yyyy-MM-dd HH:mm:ss` |
54
+ | `endTime` | For `custom` only | `yyyy-MM-dd` or `yyyy-MM-dd HH:mm:ss` |
55
+
56
+ `--retention` object:
57
+ ```json
58
+ {
59
+ "initialEvent":"注册",
60
+ "returnEvent":"商品购买",
61
+ "unitNum":7,
62
+ "statType":"retention",
63
+ "rtnRateOrNum":"R0",
64
+ "relationEventPropertyName":"账户ID",
65
+ "initialFilters":[{"eventPropertyName":"账户ID","operator":"exists"}],
66
+ "returnFilters":[{"eventPropertyName":"账户ID","operator":"exists"}],
67
+ "filters":[{"field":{"name":"城市","type":"event_property"},"operator":"exists"}],
68
+ "groups":[{"field":{"name":"渠道","type":"user_property"}}]
69
+ }
70
+ ```
71
+
72
+ Retention fields:
73
+ | Field | Required | Description |
74
+ |---|---|---|
75
+ | `initialEvent` | Yes | Initial event display name, technical name, or remark |
76
+ | `returnEvent` | Yes | Return event display name, technical name, or remark |
77
+ | `unitNum` | Yes | Retention interval count, such as `1` for day-1 or `7` for day-7 |
78
+ | `statType` | No | `retention` for retained users or `lost` for lost users |
79
+ | `rtnRateOrNum` | No | `R0`, `rate`, or `retention` for rate; `R1`, `number`, or `count` for user count. Default: `R0`. |
80
+ | `relationEventPropertyName` | No | Event property shared by initial event, return event, and simultaneous metrics |
81
+ | `simultaneousMetrics` | No | Extra retention display metrics |
82
+ | `groups` | No | Generic group-by dimensions |
83
+ | `filters` | No | Generic retention filters |
84
+ | `initialFilters` | No | Event-property-only filters for initial event |
85
+ | `initialFilterRelation` | No | Relation for `initialFilters`: `and` or `or` |
86
+ | `returnFilters` | No | Event-property-only filters for return event |
87
+ | `returnFilterRelation` | No | Relation for `returnFilters`: `and` or `or` |
88
+
89
+ Initial/return event filter object:
90
+ ```json
91
+ {"eventPropertyName":"账户ID","operator":"exists"}
92
+ ```
93
+
94
+ Generic filter object for `retention.filters`:
95
+ ```json
96
+ {"field":{"name":"城市","type":"event_property"},"operator":"exists"}
97
+ ```
98
+
99
+ Group object:
100
+ ```json
101
+ {"field":{"name":"渠道","type":"user_property"}}
102
+ ```
103
+
104
+ Metric object for `simultaneousMetrics`:
105
+ ```json
106
+ {"event":"商品购买","aggregation":"user_count"}
107
+ ```
108
+
109
+ Supported aggregations:
110
+ `total_count`, `user_count`, `per_user_count`, `sum`, `avg`, `avg_per_user`, `max`, `min`, `distinct_count`, `true_count`, `false_count`, `not_empty_count`, `empty_count`, `median`, `percentile`, `variance`, `stddev`.
111
+
112
+ Filter operator rules:
113
+ | Operator | Values |
114
+ |---|---|
115
+ | `exists`, `not_exists`, `is_true`, `is_false` | Omit `values` |
116
+ | `between` | Exactly two values |
117
+ | `eq`, `neq`, `lt`, `lte`, `gt`, `gte`, `contains`, `not_contains`, `regex`, `not_regex` | Non-empty `values` array |
118
+ | `in_cluster`, `not_in_cluster` | Cluster operator; values are not required by builder validation |
119
+
120
+ ## Examples
121
+ Minimal day-7 retention:
122
+ ```bash
123
+ ae-cli analysis +build_retention_analysis_qp --project_id 3137 --time_range '{"mode":"previous","unit":"day","value":7}' --retention '{"initialEvent":"注册","returnEvent":"商品购买","unitNum":7}'
124
+ ```
125
+
126
+ Retention with relation property and event-level filters:
127
+ ```bash
128
+ ae-cli analysis +build_retention_analysis_qp --project_id 3137 --time_range '{"mode":"start_to_yesterday","startTime":"2021-05-18"}' --retention '{"initialEvent":"special_data","returnEvent":"商品购买","unitNum":7,"relationEventPropertyName":"账户ID","initialFilters":[{"eventPropertyName":"账户ID","operator":"exists"}],"returnFilters":[{"eventPropertyName":"账户ID","operator":"exists"},{"eventPropertyName":"城市","operator":"exists"}],"returnFilterRelation":"or","filters":[{"field":{"name":"账户ID","type":"event_property"},"operator":"exists"},{"field":{"name":"城市","type":"event_property"},"operator":"exists"}],"groups":[{"field":{"name":"账户ID","type":"event_property"}}]}' --relation or --time_particle_size day
129
+ ```
130
+
131
+ ## Decision Rules
132
+ - After successful build, call `+query_adhoc --model_type retention --qp '<response.qp>'`.
133
+ - If build returns non-generated status, stop and ask user to clarify; do not call `+query_adhoc`.
134
+ - Wrap JSON parameters in single quotes to avoid shell escaping issues.
135
+ - Do not pre-query metrics or metadata. Pass user-provided event/property names to the builder and let it resolve them.
136
+ - Do not put global filter relation inside `retention`; pass it as top-level CLI flag `--relation`.
137
+ - For overall/totals retention, omit `--time_particle_size`; only set it when user asks for day/week/month breakdown.
138
+ - If the user gave a time zone, keep it for `+query_adhoc --zone_offset`; do not put it in the builder JSON.
139
+
140
+ ## Recommended Chaining
141
+ - `+build_retention_analysis_qp` -> if `status=generated` -> `+query_adhoc --model_type retention --qp '<response.qp>'`
@@ -4,13 +4,22 @@
4
4
 
5
5
  Domain: **Model schema queries**
6
6
 
7
+ > **CRITICAL - Builder-supported ad hoc models**
8
+ >
9
+ > Do **not** use this tool for natural-language ad hoc requests whose target model is `event`, `retention`, `funnel`, or `prop_analysis`.
10
+ > For those four models, use the matching QP builder first:
11
+ > `+build_event_analysis_qp`, `+build_retention_analysis_qp`, `+build_funnel_analysis_qp`, or `+build_prop_analysis_qp`, then `+query_adhoc`.
12
+ >
13
+ > If a builder returns `need_clarification`, `invalid_argument`, `unsupported_feature`, or `validation_error`, stop and ask the user or report the structured error. Do not fall back to this schema tool.
14
+
7
15
  > **CRITICAL - Step-by-Step Execution (BLOCKING)**
8
16
  >
17
+ > This blocking sequence applies only to non-builder/manual model paths such as `distribution`, `attribution`, `heat_map`, `interval`, `path`, `rank_list`, or `sql`.
9
18
  > **You MUST execute these steps in order. Do NOT skip any step.**
10
19
  >
11
20
  > | Step | Command | When to proceed |
12
21
  > |------|---------|-----------------|
13
- > | **Step 1 (MANDATORY)** | `--model_type <type>` **without `--segments`** | Always execute first. Review result. |
22
+ > | **Step 1 (MANUAL PATH ONLY)** | `--model_type <type>` **without `--segments`** | Execute first only for non-builder/manual models. Review result. |
14
23
  > | **Step 2 (OPTIONAL)** | Add `--segments 'filter_group'` | Only if Step 1 result lacks filter/groupBy structures AND you need them |
15
24
  > | **Step 3 (OPTIONAL)** | Add `--segments 'examples'` | Only if Step 1+2 insufficient for multi-metric, time comparison, formulas |
16
25
  >
@@ -19,26 +28,27 @@ Domain: **Model schema queries**
19
28
 
20
29
  ## Pre-call Checklist (Execute in Order)
21
30
 
31
+ 0. ✓ **Builder-supported model?** → If `event`/`retention`/`funnel`/`prop_analysis`, stop using this tool and use the matching builder.
22
32
  1. ✓ **Step 1 completed?** → Review core schema
23
33
  2. ✓ **Gap identified?** → Justify need (e.g., "need filter_group structure")
24
34
  3. ✓ **Justified?** → Call again with specific segment
25
35
 
26
- **Rule**: Uncertain → execute Step 1 first.
36
+ **Rule**: For non-builder/manual models, uncertain → execute Step 1 first. For `event`, `retention`, `funnel`, or `prop_analysis`, uncertain → read the matching builder reference first.
27
37
 
28
38
  ## Command (Execute in Order)
29
39
 
30
40
  ```bash
31
- # Step 1: ALWAYS START HERE (no segments)
32
- ae-cli analysis +get_analysis_query_schema --model_type event
41
+ # Step 1: start here only for non-builder/manual models (no segments)
42
+ ae-cli analysis +get_analysis_query_schema --model_type distribution
33
43
 
34
44
  # Step 2: Only after Step 1, if filter/groupBy needed
35
- ae-cli analysis +get_analysis_query_schema --model_type event --segments 'filter_group' --include_core false
45
+ ae-cli analysis +get_analysis_query_schema --model_type distribution --segments 'filter_group' --include_core false
36
46
 
37
47
  # Step 3: Only after Step 1/2, for complex scenarios
38
- ae-cli analysis +get_analysis_query_schema --model_type event --segments 'examples' --include_core false
48
+ ae-cli analysis +get_analysis_query_schema --model_type distribution --segments 'examples' --include_core false
39
49
 
40
50
  # Follow-up request (already have core from earlier step in same session)
41
- ae-cli analysis +get_analysis_query_schema --model_type event --segments 'examples' --include_core false
51
+ ae-cli analysis +get_analysis_query_schema --model_type distribution --segments 'examples' --include_core false
42
52
  ```
43
53
 
44
54
  ## Parameters
@@ -53,9 +63,10 @@ ae-cli analysis +get_analysis_query_schema --model_type event --segments 'exampl
53
63
 
54
64
  | 场景 | 参数 | 执行顺序 |
55
65
  |---|---|---|
56
- | 简单 | 不传 `--segments` | **Step 1** - 单事件、单指标、无过滤、无分组 |
57
- | 中等 | `--segments 'filter_group'` | **Step 2** - 有过滤或分组,需先完成 Step 1 |
58
- | 复杂 | `--segments 'examples'` | **Step 3** - 多指标、时间对比、自定义公式,需先完成 Step 1 |
66
+ | Builder 支持模型 | 不适用 | `event`/`retention`/`funnel`/`prop_analysis` 禁止用此工具作为 QP 准备步骤,改用 builder |
67
+ | 简单 | 不传 `--segments` | **Step 1** - 非 builder/manual 模型 |
68
+ | 中等 | `--segments 'filter_group'` | **Step 2** - 非 builder/manual 模型,有过滤或分组,需先完成 Step 1 |
69
+ | 复杂 | `--segments 'examples'` | **Step 3** - 非 builder/manual 模型,需先完成 Step 1 |
59
70
 
60
71
  ## Next Steps on Failure
61
- - Verify model type and segment compatibility (e.g., aggregatetype not for funnel/path/interval/sql)
72
+ - Verify model type and segment compatibility (e.g., aggregatetype not for funnel/path/interval/sql)
@@ -4,9 +4,13 @@
4
4
 
5
5
  Domain: **Metadata Query**
6
6
 
7
+ ## Constraints
8
+
9
+ **Not a builder pre-step:** Do not call `+get_metric` before `+build_event_analysis_qp` for normal ad-hoc analysis. If the user asks to query a saved metric, pass the metric display/name/remark directly as `metrics:[{"event":"<metric name>"}]` to `+build_event_analysis_qp`. The builder resolves saved metrics internally. If it cannot resolve the metric, stop on the builder's structured error and ask for clarification.
10
+
7
11
  ## Use Cases
8
12
  - Get the definition details of a single metric. Returns the metric name, display name, remark, model type, linked events, and parameter definition without executing metric calculation.
9
- - Get the definition details of a single metric.
13
+ - Use this command for metric metadata inspection, metric editing, auditing, or when the user explicitly asks for metric definition details. Do not use it merely to expand a saved metric before a builder-supported ad-hoc query.
10
14
 
11
15
  ## Commands
12
16
  ```bash
@@ -22,6 +26,7 @@ ae-cli analysis_meta +get_metric --dry-run
22
26
 
23
27
  ## Decision Rules
24
28
  - For the first run, pass only the required parameters (`--project_id` and `--metric_id`) to confirm the path works, then add optional parameters.
29
+ - For builder-supported ad-hoc analysis, do not read metric details first. Call the matching builder with the user's metric/event/property wording.
25
30
  - For cross-project troubleshooting, first confirm whether `--project_id` matches the current permissions and target environment.
26
31
 
27
32
  ## Next Steps After Failure
@@ -30,3 +35,4 @@ ae-cli analysis_meta +get_metric --dry-run
30
35
 
31
36
  ## Recommended Chaining
32
37
  - +get_metric -> +update_metric
38
+ - For ad-hoc saved metric query: +build_event_analysis_qp -> +query_adhoc
@@ -4,6 +4,10 @@
4
4
 
5
5
  Domain: **Report Management**
6
6
 
7
+ ## Constraints
8
+
9
+ **Not a builder fallback:** Do not call `+get_report_definition` to repair or replace a failed `+build_event_analysis_qp`, `+build_retention_analysis_qp`, `+build_funnel_analysis_qp`, or `+build_prop_analysis_qp` call. For builder-supported ad-hoc analysis, builder failure means stop and ask for clarification or report the structured error.
10
+
7
11
  ## Use Cases
8
12
  - Get the definition details of a single report. Returns model type, event configuration, display configuration, and other definition data without executing a data query.
9
13
  - Get the definition details of a single report.
@@ -8,6 +8,8 @@ Domain: **Dashboard management**
8
8
 
9
9
  **Fuzzy Search Fallback:** If `--query` returns no results, retry with broader keywords (max 3 attempts), then fall back to full list. See [SKILL.md § C. FUZZY_SEARCH_FALLBACK](../SKILL.md#c-fuzzy_search_fallback).
10
10
 
11
+ **Builder failure is terminal:** For builder-supported ad-hoc analysis, this command may be used only in the initial `QUERY_EXISTING_FIRST` dashboard search. Do not call dashboard/report detail tools as a fallback after a QP builder returns non-generated status.
12
+
11
13
  ## Use Cases
12
14
  - List dashboard metadata accessible to the current user in the project. Supports keyword filtering and returns dashboard IDs, names, descriptions, and related metadata, but not dashboard configuration or report data.
13
15
  - List dashboard metadata accessible to the current user in the project.
@@ -8,9 +8,11 @@ Domain: **Metadata Query**
8
8
 
9
9
  **Fuzzy Search Fallback:** If `--query` returns no results, retry with broader keywords (max 3 attempts), then fall back to full list. See [SKILL.md § C. FUZZY_SEARCH_FALLBACK](../SKILL.md#c-fuzzy_search_fallback).
10
10
 
11
+ **Not a builder pre-step:** Do not call `+list_events` before builder-supported ad-hoc analysis (`event`, `retention`, `funnel`, `prop_analysis`). The matching QP builder resolves event names internally. If the builder returns MCP failure, stop and ask for clarification instead of using this command as a fallback.
12
+
11
13
  ## Use Cases
12
14
  - Read-only query for SYSTEM METADATA already effective in the project. Use for super events in production metadata. Do NOT use for tracking-plan metadata (bury/track program); that belongs to BuryProgramTool.
13
- - Read-only query for SYSTEM METADATA already effective in the project.
15
+ - Read-only query for SYSTEM METADATA already effective in the project. Use when the user explicitly asks to inspect event metadata, not as a required preparation step for QP builder.
14
16
 
15
17
  ## Commands
16
18
  ```bash
@@ -30,6 +32,7 @@ ae-cli analysis_meta +list_events --dry-run
30
32
  | `--offset` / `-o` | No | Optional page offset. Default: 0. |
31
33
  ## Decision Rules
32
34
  - For the first run, pass only the required parameter (`--project_id`) to confirm the path works, then add optional parameters.
35
+ - For builder-supported ad-hoc analysis, pass the user's event wording to the builder instead of pre-querying event metadata.
33
36
  - For cross-project troubleshooting, first confirm whether `--project_id` matches the current permissions and target environment.
34
37
 
35
38
  ## Next Steps After Failure
@@ -8,10 +8,13 @@ Domain: **Metadata Query**
8
8
 
9
9
  **Fuzzy Search Fallback:** If `--query` returns no results, retry with broader keywords (max 3 attempts), then fall back to full list. See [SKILL.md § C. FUZZY_SEARCH_FALLBACK](../SKILL.md#c-fuzzy_search_fallback).
10
10
 
11
+ **Not a builder pre-step:** Do not call `+list_metrics` before `+build_event_analysis_qp`, `+build_retention_analysis_qp`, `+build_funnel_analysis_qp`, or `+build_prop_analysis_qp` for normal ad-hoc analysis. Event builder resolves saved metric names internally when the metric name is passed in `metrics[].event`. If the builder fails, stop and ask for clarification instead of using this command as a fallback.
12
+
11
13
  ## Use Cases
12
14
  - List metric metadata in the project. Supports keyword filtering and returns metric IDs, names, display names, model types, remarks, and related metadata, but not metric calculation results.
13
15
  - Supports pagination with fields/limit/offset for payload governance.
14
16
  - Query performs fuzzy matching on metricName, metricDesc, and metricRemark.
17
+ - Use this command for metric metadata management, metric editing, auditing, or when the user explicitly asks to inspect/search metric metadata. Do not use it merely to prepare a builder-supported ad-hoc query.
15
18
 
16
19
  ## Command
17
20
  ```bash
@@ -34,6 +37,7 @@ ae-cli analysis_meta +list_metrics --dry-run
34
37
  - First run should only pass the required parameter (`--project_id`), and add optional parameters only after the path is confirmed to work.
35
38
  - For pagination, use `--limit` and `--offset` together. Default limit is 20.
36
39
  - Use `--fields` to select specific columns for lighter response payloads.
40
+ - For builder-supported ad-hoc analysis, do not search metrics here first. Pass the user-provided metric name directly to the builder.
37
41
  - For cross-project troubleshooting, first confirm whether `--project_id` matches the current permissions and target environment.
38
42
 
39
43
  ## Next Steps After Failure
@@ -43,3 +47,4 @@ ae-cli analysis_meta +list_metrics --dry-run
43
47
 
44
48
  ## Recommended Chaining
45
49
  - +list_metrics -> +create_metric -> +get_metric
50
+ - For ad-hoc event metric query: +build_event_analysis_qp -> +query_adhoc
@@ -4,9 +4,13 @@
4
4
 
5
5
  Domain: **Metadata Query**
6
6
 
7
+ ## Constraints
8
+
9
+ **Not a builder pre-step:** Do not call `+list_properties` before builder-supported ad-hoc analysis (`event`, `retention`, `funnel`, `prop_analysis`). The matching QP builder resolves property names internally. If the builder returns MCP failure, stop and ask for clarification instead of using this command as a fallback.
10
+
7
11
  ## Use Cases
8
12
  - Read-only query for SYSTEM METADATA properties already effective in the project. Supports event/user scope. Do NOT use for tracking-plan metadata (bury/track program); that belongs to BuryProgramTool.
9
- - Read-only query for SYSTEM METADATA properties already effective in the project.
13
+ - Read-only query for SYSTEM METADATA properties already effective in the project. Use when the user explicitly asks to inspect property metadata, not as a required preparation step for QP builder.
10
14
 
11
15
  ## Commands
12
16
  ```bash
@@ -30,6 +34,7 @@ ae-cli analysis_meta +list_properties --dry-run
30
34
 
31
35
  ## Decision Rules
32
36
  - For the first run, pass only the required parameter (`--project_id`) to confirm the path works, then add optional parameters.
37
+ - For builder-supported ad-hoc analysis, pass the user's property wording to the builder instead of pre-querying property metadata.
33
38
  - For cross-project troubleshooting, first confirm whether `--project_id` matches the current permissions and target environment.
34
39
 
35
40
  ## Next Steps After Failure
@@ -8,6 +8,8 @@ Domain: **Report management**
8
8
 
9
9
  **Fuzzy Search Fallback:** If `--query` returns no results, retry with broader keywords (max 3 attempts), then fall back to full list. See [SKILL.md § C. FUZZY_SEARCH_FALLBACK](../SKILL.md#c-fuzzy_search_fallback).
10
10
 
11
+ **Builder failure is terminal:** For builder-supported ad-hoc analysis, this command may be used only in the initial `QUERY_EXISTING_FIRST` report search. Do not call `+list_reports` or `+get_report_definition` as a fallback after a QP builder returns non-generated status.
12
+
11
13
  ## Use Cases
12
14
  - List report metadata accessible to the current user in the project. Supports keyword filtering and returns report IDs, names, model types, update times, and related metadata, but not report definitions or analysis data.
13
15
  - List report metadata accessible to the current user in the project.
@@ -8,15 +8,33 @@ Domain: **Model analysis**
8
8
 
9
9
  **⚠️ QUERY_EXISTING_FIRST:** Before using ad-hoc query, you MUST first check for existing reports/dashboards with `list_reports` and `list_dashboards`. Only use `query_adhoc` if no matching reports found. See [SKILL.md § D. QUERY_EXISTING_FIRST](../SKILL.md#d-query_existing_first).
10
10
 
11
+ **⚠️ QP_BUILDER_SUPPORTED_MODELS_ONLY:** QP builder supports exactly four ad-hoc model types: `event`, `retention`, `funnel`, and `prop_analysis`.
12
+
13
+ For these four model types, call the matching builder before `query_adhoc`. Do not handcraft QP from `get_analysis_query_schema`, examples, or prior knowledge.
14
+
15
+ For all other model types (`distribution`, `attribution`, `heat_map`, `interval`, `path`, `rank_list`, `sql`), QP builder is not supported. Use the legacy schema/metadata path and construct QP manually according to the model schema.
16
+
17
+ For builder-supported models, schema/metadata tools are not builder pre-steps. After report/dashboard lookup misses, do not call `get_analysis_query_schema`, `list_events`, `list_properties`, `list_metrics`, `get_metric`, or `get_report_definition` before the builder. The builder resolves event/property/metric metadata internally.
18
+
19
+ **Hard stop rule:** If builder status is not `generated`, stop and ask the user to clarify or report the builder error. Do not call `query_adhoc`, `get_analysis_query_schema`, or manually assemble QP for `event`, `retention`, `funnel`, or `prop_analysis`.
20
+
21
+ Builder mapping:
22
+ 1. `event` -> `+build_event_analysis_qp`
23
+ 2. `retention` -> `+build_retention_analysis_qp`
24
+ 3. `funnel` -> `+build_funnel_analysis_qp`
25
+ 4. `prop_analysis` -> `+build_prop_analysis_qp`
26
+
11
27
  **Quick check workflow:**
12
28
  1. `list_reports --query <keyword>` - search matching reports
13
29
  2. `list_dashboards --query <keyword>` - search matching dashboards
14
30
  3. If found → use `query_report_data` or `query_dashboard_report_data`
15
- 4. If not found → only then use `query_adhoc`
31
+ 4. If not found and model is builder-supported (`event`/`retention`/`funnel`/`prop_analysis`) → read matching builder reference, call matching builder, then call `query_adhoc` with `model_type` + built `qp`; do not insert schema or metadata lookup before the builder
32
+ 5. If not found and model is not builder-supported (`distribution`/`attribution`/`heat_map`/`interval`/`path`/`rank_list`/`sql`) → use the legacy schema/metadata path, then call `query_adhoc`
16
33
 
17
34
  ## Use Cases
18
- - Precondition helper: call `+get_analysis_query_schema` to get the structure before using this tool.
19
- - When constructing a real `qp`, you must supplement it with real project metadata; first call `analysis_meta +list_events` and `analysis_meta +list_properties`.
35
+ - Execute a QP produced by the required chain for the target model.
36
+ - Builder-supported models (`event`, `retention`, `funnel`, `prop_analysis`): execute the `qp` returned by builder tools.
37
+ - Non-builder models (`distribution`, `attribution`, `heat_map`, `interval`, `path`, `rank_list`, `sql`): execute handcrafted QP from the legacy schema/metadata path when needed.
20
38
  - Event analysis: metrics such as event trigger counts, user counts, sums, averages, and more.
21
39
  - Retention analysis: metrics such as user churn and retention.
22
40
  - Funnel analysis: metrics such as multi-step conversion.
@@ -28,27 +46,41 @@ Domain: **Model analysis**
28
46
  - Heat map: visual heat map analysis of user interactions.
29
47
  - Rank list: ranking / leaderboard analysis.
30
48
  - SQL: custom SQL analysis.
31
- - Process: fetch events/properties and the schema first, then assemble the query JSON, and finally execute the analysis.
32
-
33
- ## Mandatory prerequisites (MUST)
34
- - Before constructing `--qp`, you must first read and follow these reference documents:
35
- - [`./get_analysis_query_schema.md`](./get_analysis_query_schema.md)
36
- - [`./list_events.md`](./list_events.md)
37
- - [`./list_properties.md`](./list_properties.md)
38
- - Do not generate the final `qp` until the documentation review and prerequisite command calls are complete.
39
-
40
- ## Prerequisite call chain (required for constructing qp)
41
- 1. First determine `--model_type`.
42
- 2. Read `get_analysis_query_schema.md`, then call `ae-cli analysis +get_analysis_query_schema --model_type <model_type>` to get the structure.
43
- 3. Read `list_events.md`, then call `ae-cli analysis_meta +list_events --project_id <project_id>` to get the available events.
44
- 4. Read `list_properties.md`, then call `ae-cli analysis_meta +list_properties --project_id <project_id>` to get the available properties.
45
- 5. Build `qp` from the schema + metadata, then call `+query_adhoc`.
46
-
47
- ## Command
49
+ - Process:
50
+ - Builder-supported models: builder -> `query_adhoc`
51
+ - Non-builder models: metadata/schema lookup -> handcraft `qp` -> `query_adhoc`
52
+
53
+ ## Builder-Supported Model Chain
54
+ Use this chain only for `event`, `retention`, `funnel`, and `prop_analysis`.
55
+
56
+ 1. Read the matching builder reference:
57
+ - `event`: [`build_event_analysis_qp.md`](./build_event_analysis_qp.md)
58
+ - `retention`: [`build_retention_analysis_qp.md`](./build_retention_analysis_qp.md)
59
+ - `funnel`: [`build_funnel_analysis_qp.md`](./build_funnel_analysis_qp.md)
60
+ - `prop_analysis`: [`build_prop_analysis_qp.md`](./build_prop_analysis_qp.md)
61
+ 2. Compose the builder JSON using the documented DTO keys. Nested JSON keys are camelCase, not snake_case.
62
+ 3. Run the builder with all required flags. `--dry-run` is allowed only with complete required builder inputs, not by itself.
63
+ 4. If builder returns `status=generated`, copy `data.qp` from the builder response and pass it as `--qp`.
64
+ 5. If the builder returns `need_clarification`, `invalid_argument`, `unsupported_feature`, or `validation_error`, stop and ask for clarification. Do not use the legacy/manual path as a fallback for these four models.
65
+
66
+ ## Legacy Query Chain
67
+ Use this chain only for `distribution`, `attribution`, `heat_map`, `interval`, `path`, `rank_list`, and `sql`.
68
+
69
+ 1. Read this reference and the required schema/metadata references.
70
+ 2. Call `+get_analysis_query_schema` for the target model when the QP shape is not already verified.
71
+ 3. Discover real events/properties/metrics with analysis metadata commands as needed.
72
+ 4. Construct QP according to the documented schema and verified metadata.
73
+ 5. Call `+query_adhoc`.
74
+
75
+ Timezone rule:
76
+ - Builder commands do not accept `zone_offset`.
77
+ - Apply timezone only on this execution command, for example `--zone_offset -11`.
78
+
79
+ ## Command Syntax
48
80
  ```bash
49
- ae-cli analysis +query_adhoc --project_id <project_id> --model_type event --qp '{}'
50
- ae-cli analysis +query_adhoc --project_id <project_id> --model_type event --qp '{}' --fields '["date","event"]' --limit 10 --offset 0 --zone_offset 8 --request_id demo --use_cache true --is_sort_by_columns true --resolve_recent_day true --timeout_minutes 8
51
- ae-cli analysis +query_adhoc --dry-run
81
+ ae-cli analysis +query_adhoc --project_id <project_id> --model_type <model_type> --qp '<qp_json_from_builder_or_legacy_chain>'
82
+ ae-cli analysis +query_adhoc --project_id <project_id> --model_type <model_type> --qp '<qp_json_from_builder_or_legacy_chain>' --fields '["date","event"]' --limit 10 --offset 0 --zone_offset 8 --request_id demo --use_cache true --is_sort_by_columns true --resolve_recent_day true --timeout_minutes 8
83
+ ae-cli analysis +query_adhoc --project_id <project_id> --model_type <model_type> --qp '<qp_json_from_builder_or_legacy_chain>' --dry-run
52
84
  ```
53
85
 
54
86
  ## Parameters
@@ -56,12 +88,12 @@ ae-cli analysis +query_adhoc --dry-run
56
88
  |---|---|---|
57
89
  | `--project_id` / `-p` | Yes | Project ID used to identify the analysis project |
58
90
  | `--model_type` | Yes | Model type. Supported values: event, retention, funnel, distribution, attribution, heat_map, interval, path, rank_list, prop_analysis, sql. |
59
- | `--qp` | Yes | Query parameter JSON. MUST call `+get_analysis_query_schema` first, and use event/property metadata from `analysis_meta +list_events` / `analysis_meta +list_properties` in the same `project_id`. |
91
+ | `--qp` | Yes | Query parameter JSON. For `event`/`retention`/`funnel`/`prop_analysis`, pass QP returned by the matching builder tool. For non-builder models, construct QP through the legacy schema/metadata path. |
60
92
  | `--request_id` | No | Optional unique request ID used for tracking and deduplication. Generated automatically if omitted. |
61
93
  | `--use_cache` | No | Whether to use result cache. Default: true |
62
94
  | `--zone_offset` | No | Time zone offset in hours. For example, UTC+8 is 8 and UTC-5 is -5 |
63
95
  | `--is_sort_by_columns` | No | Whether to sort query results by columns. Default: false |
64
- | `--resolve_recent_day` | No | Whether to resolve relative time expressions such as "last 7 days". Default: false |
96
+ | `--resolve_recent_day` | No | Whether to resolve relative time expressions such as "last 7 days". If omitted, service auto-resolves when `qp.eventView.recentDay` exists and `startTime`/`endTime` is incomplete; otherwise defaults to false. |
65
97
  | `--fields` | No | Optional fields to return. Must match column names in result. Invalid fields cause INVALID_FIELDS error. |
66
98
  | `--limit` | No | Optional limit. Default: 20, maximum: 50. |
67
99
  | `--offset` | No | Optional offset. Default: 0. |
@@ -69,18 +101,26 @@ ae-cli analysis +query_adhoc --dry-run
69
101
 
70
102
  ## Decision Rules
71
103
  - On the first run, start with only the required parameters (`--project_id`,`--model_type`,`--qp`), and add optional parameters after confirming the path works.
104
+ - Do not call this command with placeholder QP such as `{}`. For builder-supported models, wait for builder `status=generated`; for non-builder models, build QP from verified schema/metadata first.
105
+ - For builder-supported models, do not run metadata/schema lookup to "help" the builder. The builder is the metadata resolver.
72
106
  - For pagination, use `--limit` and `--offset` together. Default limit is 20.
73
107
  - Use `--fields` to select specific columns for lighter response payloads.
74
- - `qp` cannot be written from experience alone: it must satisfy both the schema structure and the project metadata constraints.
75
- - Before calling `list_events` / `list_properties`, you must first study the corresponding reference documents.
76
- - Wrap JSON parameters in single quotes (for example `--qp '{}'`) to avoid shell escaping issues.
108
+ - `event`, `retention`, `funnel`, and `prop_analysis` must not manually craft QP with schema-first flow; call the builder and use the returned `qp`.
109
+ - For non-builder models, `qp` must satisfy both schema structure and project metadata constraints.
110
+ - Wrap JSON parameters in single quotes (for example `--qp '<real_qp_json>'`) to avoid shell escaping issues.
77
111
  - For cross-project troubleshooting, first confirm whether `--project_id` matches the current permissions and target environment.
112
+ - If the user supplied a timezone such as UTC-11, pass `--zone_offset -11` here, not to the builder.
78
113
 
79
114
  ## Next Steps on Failure
80
- - If required parameters are missing, fall back to the smallest runnable command and fill them in first (focus on `--project_id`, `--model_type`, `--qp`).
81
- - If `Invalid JSON` appears, first check the schema required fields, then verify whether the event/property names come from metadata query results for the same `project_id`.
115
+ - If required parameters are missing, resolve `project_id`, `model_type`, and a real `qp` first. Do not run placeholder calls except explicit `--dry-run` validation.
116
+ - If a builder returns non-`generated` status for `event`, `retention`, `funnel`, or `prop_analysis`, stop and ask user to clarify before calling `query_adhoc`.
117
+ - If `Invalid JSON` appears on legacy manual QP paths, first check schema required fields, then verify whether event/property names come from metadata query results for the same `project_id`.
82
118
  - If the query times out or results are abnormal, first narrow the time range / grouping dimensions, then split the subqueries to locate the issue.
83
119
 
84
120
  ## Recommended chaining
85
- - +get_analysis_query_schema -> analysis_meta +list_events -> analysis_meta +list_properties -> +query_adhoc
121
+ - +build_event_analysis_qp -> +query_adhoc
122
+ - +build_retention_analysis_qp -> +query_adhoc
123
+ - +build_funnel_analysis_qp -> +query_adhoc
124
+ - +build_prop_analysis_qp -> +query_adhoc
125
+ - +get_analysis_query_schema -> analysis_meta +list_events -> analysis_meta +list_properties -> +query_adhoc (non-builder models only)
86
126
  - +list_events -> +list_properties -> +query_adhoc -> +drilldown_users -> +drilldown_user_events
@@ -2,10 +2,6 @@
2
2
  name: ae-community
3
3
  version: 2.0.0
4
4
  description: "AE community analysis: post search, comment sentiment, topic trends, risky content, livestream data. Includes AE CLI authentication, global parameters, and safety rules (self-contained)."
5
- metadata:
6
- requires:
7
- bins: ["ae-cli"]
8
- cliHelp: "ae-cli community --help"
9
5
  ---
10
6
 
11
7
  # ae-community
@@ -24,107 +20,24 @@ The AE Community domain provides social data analysis: post/video search, commen
24
20
 
25
21
  ## Global AE CLI Rules
26
22
 
27
- AE CLI (`ae-cli`) is the command-line tool for the ThinkingEngine data analysis platform, used by AI Agents and human users. For community-side requests, prefer `ae-cli` and this skill’s reference docs over model memory.
23
+ AE CLI (`ae-cli`) is the command-line tool for the AE / TE / ThinkingEngine analysis platform. For AE analysis-side requests, prefer `ae-cli` and this skill's reference docs over model memory.
28
24
 
29
- ### Authentication
25
+ Global parameters:
30
26
 
31
- You must authenticate before use. Authentication priority:
27
+ | Parameter | Description |
28
+ |---|---|
29
+ | `--format <json\|table>` | Output format. Default is JSON. |
30
+ | `--jq <expr>` | jq filter expression for JSON output. |
32
31
 
33
- 1. Environment variable `TE_TOKEN` (highest priority, suitable for CI/scripts)
34
- 2. Cached token (`~/.ae-cli/tokens.json`, valid for 20 hours)
35
- 3. macOS automatically extracts it from Chrome (macOS only)
32
+ Output and errors:
33
+ - Successful commands return machine-readable JSON by default.
34
+ - Failed commands return `{ "ok": false, "error": { "type": "...", "message": "...", "hint": "..." } }` and exit non-zero.
36
35
 
37
- **Authentication commands**
38
-
39
- ```bash
40
- # Automatic macOS authentication (extract token from Chrome)
41
- ae-cli auth login
42
-
43
- # Manually set token
44
- ae-cli auth set-token <token>
45
-
46
- # View authentication status
47
- ae-cli auth status
48
-
49
- # Log out
50
- ae-cli auth logout
51
- ```
52
-
53
- **Multi-environment support**
54
-
55
- ```bash
56
- # Specify host
57
- ae-cli auth login --host ta-staging.example.com
58
- ae-cli auth set-token <token> --host ta-staging.example.com
59
-
60
- # Configure default host
61
- ae-cli config set defaultHost ta-staging.example.com
62
- ```
63
-
64
- ### Global parameters
65
-
66
- All commands support the following global parameters:
67
-
68
- | Parameter | Description | Default |
69
- |------|------|--------|
70
- | `--host <host>` | AE instance address | defaultHost from config or ta.thinkingdata.cn |
71
- | `--format <json\|table>` | Output format | json |
72
- | `--jq <expr>` | jq filter expression | - |
73
- | `--dry-run` | Show the request only, do not execute it | false |
74
- | `--yes` | Skip confirmation for write operations | false |
75
-
76
- ### Output format
77
-
78
- **JSON (default)**
79
-
80
- ```json
81
- {
82
- "ok": true,
83
- "data": { ... }
84
- }
85
- ```
86
-
87
- **Table**
88
-
89
- ```bash
90
- ae-cli analysis_meta +list_events --project_id <YOUR_PROJECT_ID> --format table
91
- ```
92
-
93
- **jq filtering**
94
-
95
- ```bash
96
- ae-cli analysis_meta +list_events --project_id <YOUR_PROJECT_ID> --jq '.'
97
- ```
98
-
99
- ### Error handling
100
-
101
- Error output goes to stderr, in the following format:
102
-
103
- ```json
104
- {
105
- "ok": false,
106
- "error": {
107
- "type": "auth | api | validation | config",
108
- "message": "...",
109
- "hint": "..."
110
- }
111
- }
112
- ```
113
-
114
- Exit code: success `0`, error `1`.
115
-
116
- ### Security constraints
117
-
118
- - Commands with `risk: read` execute directly
119
- - Commands with `risk: write` require confirmation unless `--yes` is passed
120
- - Use `--dry-run` to preview the request that will be sent
121
-
122
- ### Command structure
123
-
124
- ```bash
125
- ae-cli <domain> +<command> [flags]
126
- ae-cli api <METHOD> <PATH> [--params] [--data]
127
- ```
36
+ Safety constraints:
37
+ - Read commands can execute directly after required IDs and references are verified.
38
+ - Write commands require explicit user intent and normally keep the confirmation prompt.
39
+ - Never invent command names, flags, JSON payloads, `project_id`, resource IDs, field names, event names, property names, metric definitions, or date formats. Read the matching command reference and discover real project metadata first.
40
+ - **NEVER fabricate or guess resource names** (reports, dashboards, events, properties, metrics, clusters, tags, alerts). Always use list commands to discover real resources first. If a resource is not found after fuzzy search and full list fallback, explicitly tell the user "resource not found" and stop - do not proceed with fabricated names.
128
41
 
129
42
  **Community** commands use the domain `community` (this skill). Other AE domains include: `analysis` (analysis), `analysis_audience` (audience), `analysis_meta` (metadata), `analysis_common` (common), `operation` (operations).
130
43