@thinkingai/ae-cli 1.0.15 → 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 (43) hide show
  1. package/README.md +23 -24
  2. package/README.zh.md +21 -22
  3. package/dist/auth-A4NV2VHD.js +153 -0
  4. package/dist/{auth-4GAHTBVH.js → auth-T3ILGJKW.js} +6 -4
  5. package/dist/{chunk-TJIMDNAU.js → chunk-5CCFSPAF.js} +79 -3
  6. package/dist/{chunk-UK6HO5O5.js → chunk-OVMQFFC2.js} +13 -1
  7. package/dist/{chunk-EBFUVWIZ.js → chunk-TMMUBSKW.js} +52 -0
  8. package/dist/{chunk-OQ4XEG77.js → chunk-TOXRLDUP.js} +2 -2
  9. package/dist/{client-HU63573O.js → client-FPA76DGY.js} +3 -3
  10. package/dist/{config-OLF7RBPM.js → config-QZIEYXQZ.js} +20 -5
  11. package/dist/index.js +18 -13
  12. package/dist/{raw-GDO4IWNW.js → raw-MZIKHQH4.js} +3 -3
  13. package/dist/{te-analysis-ZDJXMWZY.js → te-analysis-CFQBXUCO.js} +93 -7
  14. package/dist/{te-audience-T5B52EEB.js → te-audience-WPBBWADL.js} +3 -3
  15. package/dist/{te-common-BPTXXTHQ.js → te-common-GL3KBZPD.js} +3 -3
  16. package/dist/{te-community-FPB5LH56.js → te-community-3XEJNSQL.js} +3 -3
  17. package/dist/{te-dataops-2NUJVG47.js → te-dataops-H4WSMCG5.js} +3 -3
  18. package/dist/{te-engage-K3EANZ5P.js → te-engage-2VFM37ZM.js} +3 -3
  19. package/dist/te-kb-U6SQUJVC.js +41 -0
  20. package/dist/{te-meta-JJMV75KB.js → te-meta-BO45GW32.js} +10 -8
  21. package/package.json +2 -1
  22. package/skills/ae-analysis/SKILL.md +119 -29
  23. package/skills/ae-analysis/references/build_event_analysis_qp.md +132 -0
  24. package/skills/ae-analysis/references/build_funnel_analysis_qp.md +143 -0
  25. package/skills/ae-analysis/references/build_prop_analysis_qp.md +122 -0
  26. package/skills/ae-analysis/references/build_retention_analysis_qp.md +141 -0
  27. package/skills/ae-analysis/references/generate_track_program.md +8 -8
  28. package/skills/ae-analysis/references/get_analysis_query_schema.md +22 -11
  29. package/skills/ae-analysis/references/get_metric.md +7 -1
  30. package/skills/ae-analysis/references/get_report_definition.md +4 -0
  31. package/skills/ae-analysis/references/list_alerts.md +4 -0
  32. package/skills/ae-analysis/references/list_clusters.md +4 -0
  33. package/skills/ae-analysis/references/list_dashboards.md +6 -0
  34. package/skills/ae-analysis/references/list_events.md +8 -1
  35. package/skills/ae-analysis/references/list_metrics.md +9 -0
  36. package/skills/ae-analysis/references/list_properties.md +6 -1
  37. package/skills/ae-analysis/references/list_reports.md +6 -0
  38. package/skills/ae-analysis/references/list_tags.md +4 -0
  39. package/skills/ae-analysis/references/query_adhoc.md +80 -30
  40. package/skills/ae-community/SKILL.md +14 -101
  41. package/skills/ae-dataops/SKILL.md +13 -58
  42. package/skills/ae-engage/SKILL.md +15 -98
  43. package/dist/auth-U2GHFMFY.js +0 -81
@@ -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>'`
@@ -16,26 +16,26 @@ Domain: **Project Configuration**
16
16
 
17
17
  ## Commands
18
18
  ```bash
19
- ae-cli analysis_meta +generate_track_program --project_id <project_id> --form_data '{}'
19
+ ae-cli analysis_meta +generate_track_program --project_id <project_id> --language <language> --form_data '{}'
20
20
  ae-cli analysis_meta +generate_track_program --dry-run
21
21
  ```
22
22
 
23
23
  ## Parameters
24
- | Parameter | Required | Description |
25
- |-----------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
26
- | `--project_id` / `-p` | Yes | Project ID |
27
- | `--form_data` | Yes | Structured business context JSON object. Optional fields: account_system, revenue_model, core_gameplay, currency_system, main_entries, language, predefinedEvent (array of event names like install, start, close), developmentCarrier (array of platforms like Android, iOS, Unity, Cocos, Douyin Mini Game, WeChat Mini Game). All fields can be customized based on business needs. |
24
+ | Parameter | Required | Description |
25
+ |-----------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
26
+ | `--project_id` / `-p` | Yes | Project ID |
27
+ | `--language` / `-l` | Yes | Language code. Supported values: `zh-CN`, `en-US`, `ja-JP`, `ko-KR` |
28
+ | `--form_data` | Yes | Structured business context JSON object. Optional fields for example: account_system, revenue_model, core_gameplay, currency_system, main_entries, predefinedEvent (array of event names like install, start, close), developmentCarrier (array of platforms like Android, iOS, Unity, Cocos, Douyin Mini Game, WeChat Mini Game). All fields can be customized based on business needs. |
28
29
 
29
30
  ## Decision Rules
30
31
  - **CRITICAL: Always call `+get_track_program` first to check existing tracking plan before generating.**
31
- - First run should only pass the required parameters (`--project_id`, `--form_data`).
32
+ - First run should only pass the required parameters (`--project_id`, `--language`, `--form_data`).
32
33
  - Wrap JSON arguments in single quotes (for example `--form_data '{}'`) to avoid shell escaping issues.
33
34
  - This is an asynchronous operation; check in-site message center for generation results.
34
35
  - For cross-project troubleshooting, first confirm whether `--project_id` matches the current permissions and target environment.
35
36
 
36
37
  ## Next Steps After Failure
37
- - If required parameters are missing, fall back to the smallest runnable command and fill them in (focus on `--project_id` and `--form_data`).
38
- - If `FORM_DATA_REQUIRED_FIELDS_MISSING` occurs, ensure all required fields are provided: account_system, revenue_model, core_gameplay, currency_system, main_entries, language.
38
+ - If required parameters are missing, fall back to the smallest runnable command and fill them in (focus on `--project_id`, `--language`, and `--form_data`).
39
39
  - If `Invalid JSON` occurs, validate with the smallest JSON structure first.
40
40
 
41
41
  ## Agent Response Flow
@@ -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.
@@ -4,6 +4,10 @@
4
4
 
5
5
  Domain: **Metadata Lookup**
6
6
 
7
+ ## Constraints
8
+
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
+
7
11
  ## Use Cases
8
12
  - List all alerts in the project. Supports keyword filtering by alert name. Returns a paginated list containing alerts array and pager result with total count.
9
13
  - List all alerts in the project.
@@ -4,6 +4,10 @@
4
4
 
5
5
  Domain: **Cluster Management**
6
6
 
7
+ ## Constraints
8
+
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
+
7
11
  ## Use Cases
8
12
  - List cluster metadata accessible to the current user in the project.
9
13
  - Supports payload governance parameters: `query`, `fields`, `limit`, `offset`.
@@ -4,6 +4,12 @@
4
4
 
5
5
  Domain: **Dashboard management**
6
6
 
7
+ ## Constraints
8
+
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
+
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
+
7
13
  ## Use Cases
8
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.
9
15
  - List dashboard metadata accessible to the current user in the project.
@@ -4,9 +4,15 @@
4
4
 
5
5
  Domain: **Metadata Query**
6
6
 
7
+ ## Constraints
8
+
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
+
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
+
7
13
  ## Use Cases
8
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.
9
- - 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.
10
16
 
11
17
  ## Commands
12
18
  ```bash
@@ -26,6 +32,7 @@ ae-cli analysis_meta +list_events --dry-run
26
32
  | `--offset` / `-o` | No | Optional page offset. Default: 0. |
27
33
  ## Decision Rules
28
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.
29
36
  - For cross-project troubleshooting, first confirm whether `--project_id` matches the current permissions and target environment.
30
37
 
31
38
  ## Next Steps After Failure
@@ -4,10 +4,17 @@
4
4
 
5
5
  Domain: **Metadata Query**
6
6
 
7
+ ## Constraints
8
+
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
+
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
+
7
13
  ## Use Cases
8
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.
9
15
  - Supports pagination with fields/limit/offset for payload governance.
10
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.
11
18
 
12
19
  ## Command
13
20
  ```bash
@@ -30,6 +37,7 @@ ae-cli analysis_meta +list_metrics --dry-run
30
37
  - First run should only pass the required parameter (`--project_id`), and add optional parameters only after the path is confirmed to work.
31
38
  - For pagination, use `--limit` and `--offset` together. Default limit is 20.
32
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.
33
41
  - For cross-project troubleshooting, first confirm whether `--project_id` matches the current permissions and target environment.
34
42
 
35
43
  ## Next Steps After Failure
@@ -39,3 +47,4 @@ ae-cli analysis_meta +list_metrics --dry-run
39
47
 
40
48
  ## Recommended Chaining
41
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
@@ -4,6 +4,12 @@
4
4
 
5
5
  Domain: **Report management**
6
6
 
7
+ ## Constraints
8
+
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
+
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
+
7
13
  ## Use Cases
8
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.
9
15
  - List report metadata accessible to the current user in the project.
@@ -4,6 +4,10 @@
4
4
 
5
5
  Domain: **Tag Management**
6
6
 
7
+ ## Constraints
8
+
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
+
7
11
  ## Use Cases
8
12
  - List tag metadata accessible to the current user in the project.
9
13
  - Supports payload governance parameters: `query`, `fields`, `limit`, `offset`.
@@ -4,9 +4,37 @@
4
4
 
5
5
  Domain: **Model analysis**
6
6
 
7
+ ## Constraints
8
+
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
+
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
+
27
+ **Quick check workflow:**
28
+ 1. `list_reports --query <keyword>` - search matching reports
29
+ 2. `list_dashboards --query <keyword>` - search matching dashboards
30
+ 3. If found → use `query_report_data` or `query_dashboard_report_data`
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`
33
+
7
34
  ## Use Cases
8
- - Precondition helper: call `+get_analysis_query_schema` to get the structure before using this tool.
9
- - 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.
10
38
  - Event analysis: metrics such as event trigger counts, user counts, sums, averages, and more.
11
39
  - Retention analysis: metrics such as user churn and retention.
12
40
  - Funnel analysis: metrics such as multi-step conversion.
@@ -18,27 +46,41 @@ Domain: **Model analysis**
18
46
  - Heat map: visual heat map analysis of user interactions.
19
47
  - Rank list: ranking / leaderboard analysis.
20
48
  - SQL: custom SQL analysis.
21
- - Process: fetch events/properties and the schema first, then assemble the query JSON, and finally execute the analysis.
22
-
23
- ## Mandatory prerequisites (MUST)
24
- - Before constructing `--qp`, you must first read and follow these reference documents:
25
- - [`./get_analysis_query_schema.md`](./get_analysis_query_schema.md)
26
- - [`./list_events.md`](./list_events.md)
27
- - [`./list_properties.md`](./list_properties.md)
28
- - Do not generate the final `qp` until the documentation review and prerequisite command calls are complete.
29
-
30
- ## Prerequisite call chain (required for constructing qp)
31
- 1. First determine `--model_type`.
32
- 2. Read `get_analysis_query_schema.md`, then call `ae-cli analysis +get_analysis_query_schema --model_type <model_type>` to get the structure.
33
- 3. Read `list_events.md`, then call `ae-cli analysis_meta +list_events --project_id <project_id>` to get the available events.
34
- 4. Read `list_properties.md`, then call `ae-cli analysis_meta +list_properties --project_id <project_id>` to get the available properties.
35
- 5. Build `qp` from the schema + metadata, then call `+query_adhoc`.
36
-
37
- ## 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
38
80
  ```bash
39
- ae-cli analysis +query_adhoc --project_id <project_id> --model_type event --qp '{}'
40
- 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
41
- 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
42
84
  ```
43
85
 
44
86
  ## Parameters
@@ -46,12 +88,12 @@ ae-cli analysis +query_adhoc --dry-run
46
88
  |---|---|---|
47
89
  | `--project_id` / `-p` | Yes | Project ID used to identify the analysis project |
48
90
  | `--model_type` | Yes | Model type. Supported values: event, retention, funnel, distribution, attribution, heat_map, interval, path, rank_list, prop_analysis, sql. |
49
- | `--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. |
50
92
  | `--request_id` | No | Optional unique request ID used for tracking and deduplication. Generated automatically if omitted. |
51
93
  | `--use_cache` | No | Whether to use result cache. Default: true |
52
94
  | `--zone_offset` | No | Time zone offset in hours. For example, UTC+8 is 8 and UTC-5 is -5 |
53
95
  | `--is_sort_by_columns` | No | Whether to sort query results by columns. Default: false |
54
- | `--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. |
55
97
  | `--fields` | No | Optional fields to return. Must match column names in result. Invalid fields cause INVALID_FIELDS error. |
56
98
  | `--limit` | No | Optional limit. Default: 20, maximum: 50. |
57
99
  | `--offset` | No | Optional offset. Default: 0. |
@@ -59,18 +101,26 @@ ae-cli analysis +query_adhoc --dry-run
59
101
 
60
102
  ## Decision Rules
61
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.
62
106
  - For pagination, use `--limit` and `--offset` together. Default limit is 20.
63
107
  - Use `--fields` to select specific columns for lighter response payloads.
64
- - `qp` cannot be written from experience alone: it must satisfy both the schema structure and the project metadata constraints.
65
- - Before calling `list_events` / `list_properties`, you must first study the corresponding reference documents.
66
- - 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.
67
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.
68
113
 
69
114
  ## Next Steps on Failure
70
- - If required parameters are missing, fall back to the smallest runnable command and fill them in first (focus on `--project_id`, `--model_type`, `--qp`).
71
- - 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`.
72
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.
73
119
 
74
120
  ## Recommended chaining
75
- - +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)
76
126
  - +list_events -> +list_properties -> +query_adhoc -> +drilldown_users -> +drilldown_user_events