Imported from thinkingaiagenticengine/ae-cli (
skills/ae-analysis/SKILL.md) via skills.sh. Install upstream withnpx skills add thinkingaiagenticengine/ae-cli --skill ae-analysis. Copyright stays with the author.
ae-analysis
This is the single entry skill for analysis intent and command execution, including review and semantic deduplication of collected analysis questions and evidence-based badcase assessment.
At the beginning of a new analysis question, capture ae-cli analysis scenario begin locally and retain its exact data.start_time for that answer. Pass it as --start-time only when the project permits collection. Do not invent a start time or reuse it for a later revised answer; capture a fresh start for that follow-up. This records one question-to-answer elapsed duration, not separate timing phases. Historical archive review does not start or collect a scenario.
For historical analysis-question inventory or badcase review, route directly to scenario list and review, and for quality assessment read independent scenario evaluation. This is a separate archive-review task: skip business-query semantic/KB/personal-preference preflight and do not collect the review itself as another analysis scenario. The CLI retrieves evidence; the calling Agent judges and deduplicates it. No server-side rating or evaluation writeback is required.
Capability contract
- Responsibilities: analysis queries and assets, metadata discovery, audience definitions, local input-file upload, and the governance/project/tracking workflows described below.
- Inputs: verified project context and the requested measures, time windows, filters or operation-specific resources; upload also needs a local file and a discovered purpose.
- Outputs: query evidence with its scope, verified metadata, operation/resource identifiers, uploaded input-file identifiers, or asynchronous run/artifact status as applicable. Query rows are not automatically a persisted audience.
- Boundaries: engagement operations and metadata data-table writes/dimension binding are outside this skill's workflows; find the capability needed for any remaining work.
- Completion: the requested analysis-side result is verified, or pending/blocked work is identified. Keep any other parts of the user's request unfinished until addressed.
Cross-skill collaboration
When remaining work is outside this skill's scope, or a necessary prerequisite needs another capability, follow the collaboration protocol. Choose from the skills available in this run by capability, preserve verified context, and continue the remaining task. Reuse this protocol if already loaded.
Agent Context Telemetry
Hard rule: before running gateway-backed ae-cli commands in this skill, maintain the current Agent context in .ae/cli-agent-context.json at the working directory root, unless the user explicitly asks not to send intent telemetry. Keep the business command clean; do not append --agent-context <base64url-json> by default. Runtime auto-detection alone is only a partial fallback and is not enough for user-intent telemetry.
The context file must use intent_source: "agent_context_file" and should include a concise task-level user_intent, the current session_goal, stable agent_session_id, current agent_turn_id when available, intent_relation, and intent_revision. Include agent_model (required by this Skill; follow the preflight below). Use the user's original language for session_initial_intent, user_intent, and session_goal; for example, use Chinese text for a Chinese user request. Omit unknown parent-turn fields rather than guessing; do not omit the whole context payload. Prefer concise intent summaries over long raw transcripts. Update the file when starting a CLI-backed task or when the user's CLI purpose changes. Reuse it while the purpose and model remain unchanged.
Required Agent preflight: the Agent must report agent_model before every gateway-backed CLI call. This is an Agent responsibility for both AE Agent and external clients, not a required CLI argument.
- Confirm the model actually serving the current session and turn from trusted runtime context or bounded current-session metadata (for example, Codex's
turn_context.model). Do not query or translate AE configurationmodelIdorcurrentModelIdto populate telemetry. Never infer the model from the Agent/product name, a configured default, or another session. A missing model environment variable does not waive this step. - Write the confirmed model explicitly as
agent_modelin the context file. Update the file when the model changes, even if the CLI purpose stays the same. Do not leave the example placeholder in the file. - Read back the effective context file after writing it and verify
agent_modelmatches the confirmed current model before invoking the CLI. RespectTA_CLI_CONTEXT_FILEwhen set; otherwise the CLI searches from the working directory upward, checking.ta/cli-agent-context.jsonbefore.ae/cli-agent-context.jsonin each directory. Update the file that actually wins, not a shadowed copy. Reuse a verified file only while the model and purpose remain unchanged.
Only if trusted current-session information cannot confirm the model after this check, omit agent_model, set context_capture_status: "partial", and continue; do not block or delay the business command or ask the user to identify the model just for telemetry. Do not fabricate a model to satisfy this Skill. The CLI accepts a missing model, including from older callers without a partial marker. Once confirmed, write the model and remove the stale partial marker so the CLI can compute capture status from the remaining fields.
Analysis workflow
For data queries:
-
Complete global and project personal-semantic initialization below before selecting assets or constructing a query. Take the current project and requested metrics, windows, groups and filters. Before choosing a knowledge-base or analysis route, apply the Project Semantic Knowledge and Discovery gate. Reuse known assets and definitions; discover unknown business measures with metadata resolution, then select the needed saved-report or ad-hoc command/model references.
-
Confirm any new business mapping once, fill the required parameters, and execute the applicable saved report or complete ad-hoc definition. Reuse confirmed meanings in dependent queries. If the confirmation tool cannot obtain a reply, present the same choices in text and wait for the reply.
-
Correct compiler errors at their reported paths. New evidence or a user correction changes a completed choice; preserve the other verified inputs.
-
Use the returned result directly. Save original JSON only when the user requests a file or necessary local processing requires one; follow result handling. Keep stderr and the CLI exit status visible.
-
Compute only missing values needed by the request, together in one local call. Reuse completed results and answer when the requested data is available, or explain the specific error or missing input.
-
Scenario collection is project opt-in. Before preparing or uploading a scenario sample, read
ae-cli project info get --project-id <source_project_id>for the current host, authenticated account, and source analysis project. Onlydata.analysis_scenario_collection_enabled === truepermits collection. Recheck for each new scenario and before appending feedback or a revision; do not reuse a previous grant or the company configuration's 24-hour cache. A missing field (including older services), false, unreadable configuration, or unknown project means skip collection and answer normally. Never enable the project switch, choose a different project, or invent a project ID to make collection succeed. The curated collect/append commands also check immediately before submission, and the service is authoritative if the switch changes. This controls scenario samples and the related Common gateway HDFS call archive; existing invocation and intent event reporting stays unchanged.accepted=false, skipped=trueis a normal skip, not a failed analysis or successful upload. Do not retry, backfill, or fall back toanalysis feedback submitto bypass this switch.Collect one sample for the whole user scenario, not one per CLI call. After forming the final answer, use
ae-cli analysis scenario collectas specified in scenario collection, then deliver the same business answer body. Apply the reference's business answer content boundary to both collect and answer_revision: exclude client-only memory citations (including the entire oai-mem-citation block), rendering directives and local artifact paths; preserve business wording, numbers, scope, limitations and accessible evidence links. Client-required metadata may remain outside the business body in the delivered message. Capture the original question/confirmed clarifications, actual business answer body and the ordered query path (existing capability/call IDs and optional short purpose; prefer only meta.invocation_id, never confuse a business request_id with gateway client_request_id), never query result rows or error payloads; do not score correctness or generate a separate self-evaluation. The question_id is the original scenario's first user turn ID, stable across clarification, retries, multiple queries and corrections. Store/reuse the IDs returned by collection in conversation context. On later user objections, scope corrections or reported omissions targeting that answer, append the user's original text withae-cli analysis scenario append --entry-type user_feedbackand the original question_id/target_answer_id; do not decide whether the user is right. An ambiguous request for an explanation may be preserved as user text when clearly linked; do not invent a link. A normal follow-up or changed requirement is not automatically negative feedback. After a substantive follow-up answer to the same scenario (recheck, explanation, correction or scope clarification), append answer_revision with that exact business answer body/query path and a new answer_id, even when the conclusion stays the same; keep earlier answers. If the triggering user request was not already captured as user_feedback, include its exact text using --user-message on answer_revision so later scope changes are not lost. Do not duplicate feedback text in user_message. Acknowledgments such as thanks alone need no entry. A genuinely separate question gets a new question_id. Do not create another initial sample for an existing scenario. A separate evaluation task reads these samples later and can join existing call telemetry for parameters/status/timing. Path-only evidence cannot prove numeric answer correctness; unresolved correctness stays unknown. Only attempted analysis data queries qualify; metadata, discovery, help and asset writes alone do not. No routine satisfaction question. Collection failure must not block the answer or subsequent business work, trigger login or automatic retries, or be claimed as successful ingestion. For external Agents this is a Skill collection step, not a guaranteed post-answer hook; it has a local clock capture plus the collection tool call, with no additional evaluation task on the answering path.
User feedback is evidence, not a correctness label. Preserve exact user words and their target answer even if you disagree. Do not routinely ask for a satisfaction rating. The existing analysis feedback submit contract remains available for explicit standalone user ratings without a collected scenario; when a scenario exists, use its append command instead of submitting duplicate feedback. No explicit feedback means no submission or new feedback event for cli_analysis_feedback. Do not upload the analysis answer through that legacy feedback command. All collection excludes credentials, full transcripts and private reasoning.
Route before reading
- Map the request to a command family before opening any reference.
- CLI Agent asset-authentication and metric-recommendation review: this includes requests to recommend project assets for certification/authentication, review asset-certification candidates, review project asset-governance recommendations, review recommended metrics, or explicitly auto-review/auto-certify recommended assets. Open
references/governance_recommendation_export.mdand route toanalysis-meta governance-recommendation export|submit|auto-review|decisions. For review-page submission, openreferences/agent_review_submit_to_page.mdand useanalysis-meta agent-review submit-to-page|list|detail|records|review|retry. Apply its Business Topics and Subtopics contract: both levels require business interpretation and independent review; a source dashboard is an evidence container, not a default second-level group. Complete the mandatory personal-semantic initialization below; do not load project semantics or project KB as a prerequisite for governance evidence. Personal preferences never replace certification criteria. - Project semantic knowledge-base build/update/refresh/sync: open
references/project_semantic_knowledge_wiki.mdand route toproject-semantic asset-package export, local semantic planning, and local Wiki rendering. Default to CLI semantic precompilation into Markdown sources, source ZIP upload, formal preset initialization/reuse, and KB compilation. Do not regenerate Schema or AI-validate unchanged presets during normal refresh. Update changed source files and use incremental compilation on ordinary refresh; a navigation taxonomy version change requires the full migration rebuild reported by the source-tree packager. Never substitute read-only snapshot import. Stop on company permission denial. This is a command-reference workflow insideae-analysis, not a standalone project semantic Skill. - Known family: open only its dedicated reference. For example, a retention request goes directly to
references/adhoc_run.md, the commonreferences/ai_models.md, andreferences/ai_models/retention.md. - Unknown family: search
references/command_index.mdwithrgor an equivalent text-search tool and keep only the matching rows.command_index.mdis a search-only fallback; never open it with a whole-file read or print the entire file.
- CLI Agent asset-authentication and metric-recommendation review: this includes requests to recommend project assets for certification/authentication, review asset-certification candidates, review project asset-governance recommendations, review recommended metrics, or explicitly auto-review/auto-certify recommended assets. Open
- Read the selected command's dedicated reference before composing it:
event list->references/event_list.md- Project member groups (Project management → Member management → Member groups): use
project member-group list|members|create|rename|delete|add-members|remove-membersand the matchingreferences/project_member_group_<action>.md(replace action hyphens with underscores). This manages project member groups, distinct from AgentSpace/system membership and analysis user-cluster/user-tag audiences. - Readable saved report/dashboard discovery ->
analysis asset searchandreferences/asset_search.md; this includes shared read-only assets. analysis dashboard list->references/dashboard_list.md- Saved event-report chart/result-table layout ->
references/report_get.mdand the matchingreport_create.mdorreport_update.md. A table card, card frame size, or grid position on a specific analysis board ->dashboard-report get/updateandreferences/dashboard_report_get.md/references/dashboard_report_update.md; the card display is separate from its source report definition. Geometry writes need the fresh dashboard layout version; event chart/table settings remain event-only. - Event combination chart or per-metric bar/line and primary/secondary axes -> also read
references/event_report_presentation.md. Series is source-report scoped and can affect its other trend cards; card display updates cannot create a local series override. personal-semantic-preference list->references/personal_semantic_preference_list.md- Asset center cross-source configuration (资产中心 / 跨源资产配置 / Excel 配置表导入): L3 discovery via
capability search "cross_source_config" --domain metadata --project-id <id>; readreferences/cross_source_config.mdfor workbook upload and validation. No dedicated business commands. - replace hyphens with underscores in gateway filenames.
- For an AI-facing definition, read the short common
references/ai_models.mdandreferences/ai_models/<model_type>.mdfor each selected model. Batch these reads; direct model paths replace heading searches and line-number calculations. - For cluster/tag
--definition-request, also read the matchingreferences/user_cluster_models.mdorreferences/user_tag_models.md. Shared primitives live inreferences/audience_models.md.- For tag periodic refresh, read
references/user_tag_create.mdorreferences/user_tag_update.md; they cover the enable switch, frequency/time schedule, cron alternative, and timezone behavior.
- For tag periodic refresh, read
- For query data, read the short
references/analysis_data_retrieval.mdtogether with the selected command and model files. It links to export and follow-up details only when those operations are needed. - For unknown AI-facing metadata, or when a compile failure contains
slot_kind,allowed_resource_types,search_targets, andnext_action, read and followreferences/metadata_resolution.md. - For an unfamiliar aggregation, cohort or attribution rule, consult the matching section of
references/analysis_interpretation.md.
Routing is complete when one command family and its dedicated references are selected. The generated command index is exhaustive and must stay out of model context except for matching search rows. This file contains routing and workflow rules only; do not duplicate a hand-maintained command inventory here.
For finding, viewing, or selecting saved analysis assets, start with analysis asset search and omit --asset-types on the first search so it covers both reports and dashboards. For edit or management workflows, use analysis report list --manageable-only or analysis dashboard list --manageable-only to select editable targets.
Saved-report writes follow the analysis page's product boundary: analysis report create/update accepts at most one compound filter level, and every entry in that group's items must be a leaf filter. Do not flatten a deeper tree returned by analysis report get; use a metadata-only update or obtain an explicit page-compatible replacement definition. Ad-hoc analysis keeps its model-specific recursive filter support.
Boundaries and priority
Use this skill for these CLI services:
analysis: reports, dashboards, BI panels, ad-hoc analysis, drilldown, detail data, alerts, clusters, tags, and async runs/artifacts.analysis-meta: gateway metadata assets, events, properties, virtual metadata, metrics, data tables, exchange rules, and super metadata. Cross-source asset configuration uses the metadata L3 catalog instead.analysis-governance: gateway asset governance operations, including governed asset lists/exports, lineage, dependency, impact, query history, rule schema/list/create/update/delete, batch asset actions, and operation records. Use this service for asset governance workflows, not for metadata event/property/metric CRUD.tracking: gateway tracking plan, checking, ingest, live-data, and event blacklist operations.personal-semantic-preference: current user's project-scoped personal semantic preferences. Use it as agent context before resolving ambiguous business wording, asset choices, or recurring user preferences.project-semantic: asset-package export for an explicit project knowledge-base build or refresh. The old governed project-semantic lifecycle is no longer available through CLI.
For work outside the command families covered here, use the collaboration protocol to discover a matching available capability rather than assume a particular Skill name.
Use ae-cli as the only execution path for this skill. If a command is missing, unsupported, not implemented, or a capability gap is confirmed, report that gap; do not switch to direct MCP execution. A validation error or need_clarification calls for its specific input correction.
For tags and audience clusters, use the native analysis user-tag ... and analysis user-cluster ... gateway commands.
For CLI Agent asset-authentication and metric-recommendation review, route to analysis-meta governance-recommendation export|submit|auto-review|decisions. Common returns the deterministic evidence packet; the Agent owns the fixed human approval display from references/governance_recommendation_export.md, including business-domain grouping, plain-text status labels, and risk/conflict explanation. Call auto-review only when the user explicitly asks for automatic review or automatic certification; a plain recommendation request and a recommendation-plus-page-submission request must not check the automatic certification project config or auto-certify assets. When auto-review is called without an explicit --limit, the CLI validates the auto-certification and project-semantic switches, read-only probes top-20/top-50/top-100 pending recommendation material as needed, then the CLI Agent builds one set of automatic certification decisions from the final material and submits those decisions for execution/audit. The CLI Agent, not Common historical recommendation state, owns semantic-duplicate detection; duplicate skips must name concrete conflicting asset targets. The auto-review result also returns manual_review_handoff for assets still uncertified after automatic review; if the user later asks to submit those leftovers to the page, build agent-review submit-to-page from manual_review_handoff.page_review_items so dashboard/report parent context is preserved, treat only manual_review_handoff.items as the human certification workload, and include each automatic non-certification reason in the item summary. Complete mandatory personal-semantic initialization; do not use project-semantic or project-KB commands as prerequisite governance evidence. Personal preferences never authorize certification decisions. Do not use management commands such as asset-authentication list|export|update or metric CRUD commands to synthesize recommendations. Do not bypass curated commands with ae-cli capability inspect|validate|dry-run|run for governance.asset_authentication.dashboard_package, metadata.metric.recommended_scan, or metadata.metric.recommended_create.
Start a recommendation with governance-recommendation export before lengthy Agent analysis so Common can atomically mark the project as running. Later exports in the same Agent turn may expand the candidate pool. If Common returns RECOMMENDATION_RUNNING, stop this attempt and report that a recommendation is already in progress; do not retry with another Agent context or bypass the marker. Successful page submission and automatic review release the marker; recommendation-only or failed Agent runs rely on the fixed expiry. No separate start or finish CLI command is required.
After presenting recommendations, the Agent may ask whether to submit them to the review page. A user choice to submit authorizes analysis-meta agent-review submit-to-page only; it does not authorize approval, certification, config checking, or governance-recommendation auto-review. If the user declines, do not write or repeatedly suggest submission. Existing explicit submission authorization remains valid and does not need another prompt. A preauthorized unattended task may submit review proposals only; it must never call agent-review review|retry, legacy governance-recommendation submit, governance-recommendation auto-review, or direct certification/metric mutations automatically. Do not query review history to select candidates. Select currently uncertified assets by business value and evidence, regardless of earlier recommendations or review decisions. Keep stable request keys only for network replay of the same submission; a new authorized recommendation may include previously recommended assets. Read the returned batch detail to verify submission. See references/agent_review_submit_to_page.md for request keys and packet rules.
Ordinary recommendations prepare concise material for human review, not a full certification audit. Follow resolve/export -> select -> business-domain/subtopic grouping and concise reasons -> one local structure/evidence check plus focused preflight -> authorized submit-to-page -> one detail readback. LOCAL_ONLY stops at local artifacts. For each report, explain at least one core statistical measure or calculation with fact-supporting references rooted at evidence_snapshot.analysis; purpose alone is insufficient. Preserve current packaged analysis and target_revision, and add relevant population/filter/time boundaries when they affect that core meaning. Do not require every dimension, SQL output column or calculation step unless the user requests a full audit or a concrete risk needs that detail. Fetch agent-review evidence only for a missing/stale definition or a specific unresolved claim, not once per report or as routine spot validation. Preserve server facts separately from AI interpretation; never guess formulas, aliases, time ranges or successful execution. See references/agent_review_submit_to_page.md for the ordinary workflow and optional full-audit detail. Existing report-analysis, evidence-link and reference validation remains enforced.
item.ai_summary.summary is the concise item recommendation reason, including its evidence basis and main risks, displayed in the main list. batch.ai_summary.summary is the batch overview and cannot replace item reasons. Detailed factual explanations belong only in item.ai_summary.analysis_explanation. Do not duplicate reasons or detailed analysis into presentation fields; keep presentation_snapshot.analysisByItem as {}. Do not invent a reason from unknown values; state missing evidence or uncertain risks explicitly rather than treating them as zero or absent.
Scripts may build the transport file, preserve IDs, copy evidence, normalize links, and run deterministic completeness checks. Scripts must not author page-visible ai_summary.summary, analysis_explanation.*.statement, limitations, open questions, or approval rationale by filling reusable sentence templates. Those fields must be Agent-written interpretation from the current asset/report evidence; if many submitted items share the same narrative shape after only asset names or numbers change, flag a quality failure and follow the bounded correction/warning procedure in references/agent_review_preflight.md.
Page-visible review text is for human asset reviewers, not implementers. In item.ai_summary.summary, visible statements, and open questions, write plain business Chinese: what the asset is for, how it is calculated, which filters/date windows matter, and what the reviewer should confirm. Use event and property names from the current asset definition when they help the reviewer verify the calculation definition. Do not expose internal evidence, parser terms, temporary SQL aliases, or runtime parameter names such as SAVED_REPORT_ONLY, DYNAMIC, REPORT, T1, a0, a1, Variable2, selector3, PartDate date1, source_path, evidence_snapshot, raw JSON, raw SQL, hash/revision details, dashboard override warnings, timezone-not-saved notes, or claims about query execution unless the user explicitly asks for debug evidence. Convert internal values before display, for example T1/day becomes 按天, and dynamic SQL caveats become business confirmation items such as “确认参数含义、默认日期范围和是否包含测试数据”.
For real review-page submission, start with analysis-meta governance-recommendation export --limit 20. This is the initial candidate pool, not a required submission count. Follow current-state selection and bounded expansion in references/governance_recommendation_export.md: select currently uncertified assets by business value and evidence, keep authenticated assets only as necessary context, and expand an insufficient pool from 20 to 50 to 100, then stop. Earlier recommendations and review decisions do not remove an otherwise eligible asset. Expansion is for business-domain coverage, not unlimited workload: for recurring daily batches, target about 20-50 pending review assets, hard cap around 80, and balance roughly 3-6 visible domains with per-domain quotas before adding context. Use the latest successful export as the drafting evidence and report the actual reviewed scope plus overflow left for later batches. Do not compress eligible coverage into a few representative themes or submit only the first work unit unless the user requests a sample or diagnostic batch. Business themes organize the retained dashboard set; they do not replace its coverage. For recurring recommendation jobs, submit only business domains that still contain pending review assets; authenticated assets are supporting context under those visible domains, not standalone work. Do not write long Agent summaries for hidden domains or pure authenticated context.
For dashboard recommendations, preserve optional location facts from Common: when a dashboard candidate or source dashboard includes space_id or space_name, copy those fields into the submitted dashboard item's evidence_snapshot.definition.config so the review page can show 所属空间. Not every dashboard belongs to a space; missing space fields are valid and must not be invented, required, or used to filter out an otherwise eligible dashboard.
presentation_snapshot.topics must be business domains, not dashboard containers; business domains are not dashboards. Never create one topic per hot dashboard merely because the export returned 20 work units. First cluster the selected dashboards by business process using dashboard names, child report names, report definitions, referenced events/properties, metrics, folder context, and authored notes. If several dashboards describe the same business area, put them in one topic and keep each dashboard as a root item under that topic. Split topics only when the business process or review decision is materially different. The expected hierarchy is 业务域 -> 看板 -> 报表 -> 元数据; the number of topics can be smaller than the number of selected dashboards, and a topic_count == selected_dashboard_count result must be justified by genuinely distinct business meanings, not by source array order.
For page review, preserve the prototype hierarchy in presentation_snapshot.relations: source dashboard items are parents of their child report items with type:"contains", and report items are parents of metadata items they actually reference with type:"uses", such as events, event properties, user properties, and metric assets. Topic items may list the same stable client_item_ids, but the page must be able to render 看板 -> 报表 -> 元数据 from relations. A flat relations: [] packet is valid only when the selected assets truly have no known parent-child evidence.
The full evidence_hash includes collection time and may change between previews without business changes; use target_revision for saved-definition version checks and compare material facts separately. Do not use full snapshot hashes to trigger cross-scan resubmission. Create stores the submitted snapshot without restoring omitted fields; verify references and important facts in detail against the final dispatched material.
If a retired split recommendation command or capability is accidentally probed and returns an error, treat that as a routing correction only. Do not use data from split recommendation commands or capabilities as the business source for a recommendation answer; rerun the current workflow through analysis-meta governance-recommendation export.
For ordinary review-page drafting, material inspection, or local-only rehearsals, use the focused scope in references/agent_review_preflight.md: programmatic evidence/identity/reference checks cover the entire exact packet; one independent semantic review covers every business domain/subtopic, its supporting member definitions and identified risk items. Do not require the reviewer to re-interpret every report, grade every metadata dependency or generate per-item comparison coverage. Load references/agent_review_priorities_comparisons.md only for requested prioritization, actual comparison/conflict clues or an explicit full audit. Optional priorities rank human review urgency, never certification outcome. Missing comparisons do not prove no conflict. Deepen checks only for the affected claims/peers; apply full definition-audit requirements when explicitly requested. Correct factual errors and unsupported membership, not ordinary copy preferences through routine rounds; the existing maximum 3 corrections is a ceiling for material findings. Record actual review scope, disclose unchecked/full-audit scope and unresolved findings, and preserve LOCAL_ONLY and submission authorization boundaries. These rules do not change approval, automatic certification, permissions or Common admission.
Global AE CLI Rules
Command forms:
ae-cli analysis <resource> <action> [options]
ae-cli analysis-meta <resource> <action> [options]
ae-cli analysis-governance <resource> <action> [options]
ae-cli tracking <resource> <action> [options]
ae-cli capability search|inspect|validate|dry-run|run [options]
- Gateway commands use kebab-case flags such as
--project-id; the CLI sends snake_case JSON. - Gateway commands must be preceded by the
.ae/cli-agent-context.jsonupdate described in the Agent Context Telemetry section. The hidden--agent-context <base64url-json>option is only a fallback for isolated no-write environments or local debugging, not the preferred path for this skill. - JSON values must be JSON string literals.
- Global flags include
--host,--format json|table,--jq,--validate,--dry-run, and--yes. Use--validateonly to resolve a concrete complex-input issue; use--dry-runfor high-risk writes or an explicitly requested preview. These modes are mutually exclusive. - Execute a fully specified read or ordinary write directly. Do not routinely stack inspect, validate, dry-run, and run. Inspect the selected model contract once when a concrete schema mismatch requires it; reuse that inspected contract within the unchanged conversation scope. This is local evidence reuse, not a claim that the CLI caches contracts.
- JSON is the default machine-readable output. On failure, preserve the structured error and non-zero exit.
- Saving JSON to a file. Use
> work/result.json 2> work/result.stderr.logto keep the result, request ID, and diagnostics separate. When diagnostics can be discarded, use> work/result.json 2>/dev/null. Never use2>&1or&>for JSON files. CREDENTIAL_STORE_UNREADABLE(error.type: config) is a local credential read/decryption failure. Preserve the files and retry in the original OS user/runtime with machine-identifier access; do not automatically log in, replace tokens, or log out. It does not establish server-side token expiration.- Inject credentials into the current CLI invocation through environment variables or a specified file without changing stored machine accounts; automation scripts, CI/CD, and shared Agents are example use cases. Use
AE_CLI_TOKENplus requiredAE_CLI_TOKEN_HOST,AE_CLI_TOKEN_FILE, or global--cli-token-file <path>using{"url":"https://host.example.com","token":"cli_..."}. Precedence is explicit file > environment token > environment file > existing credentials. The bound host is the default; an explicit--hostmust match. Invalid selected sources returnEXTERNAL_CLI_TOKEN_INVALIDwithout identity fallback. Do not print or persist supplied tokens, or manage machine accounts while external mode is active (EXTERNAL_CLI_TOKEN_ACTIVE). Useauth statusto inspect the selected source and identity. - The member's natural-day quota counts each Gateway capability
executecall eligible for usage statistics (an identifiable user and statistics enabled), regardless of its database or business purpose. Report reads/saves, metadata reads, asset exports, data queries, cache hits, repeated calls, and failures withinexecutecount, including schema errors, permission denials, and unknown capability IDs. Reusing an existing run does not exempt a newexecutecall. Gateway capability discovery (list/inspect), validate/dry-run, and separate run-status/artifact-download HTTP endpoints do not count; pagination and cancellation through capability execution, such asanalysis.query.cancel, do count.QUERY_DAILY_LIMIT_EXCEEDED(HTTP 429) requires waiting until reset or contacting an administrator;QUERY_QUOTA_UNAVAILABLEfails explicitly. Do not change identities to bypass enforcement. See quota and export policy for blocked-call auditing, retry rules, async server defaults, and separate typed-CLI/local-wait limits. - Never invent command names, flags, payload fields, projects, resource IDs, asset names, canonical event/property identifiers, metric formulas, or dates. User-provided business wording is valid unresolved compiler input; it is not a claim that a canonical binding is known.
- 中文时间表达必须按固定语义映射:最近7天/近7天 ->
mode=recent-> QPrecentDay=0-7,含今天;过去7天/前7天 ->mode=previous-> QPrecentDay=1-7,不含今天。用户明确说明是否包含今天时,以该说明为准。完整映射见references/ai_models.md。
CAPABILITY_NOT_FOUND means the current host does not expose that gateway capability; changing parameters will not fix it. A permission error stops any dependent chain. A 404 while inspecting an async run is a route/deployment failure; do not poll the same ID forever.
Interpret gateway envelopes by state:
ok: truewith empty data is success and means no matching data. Never relabel an empty report/dashboard result as query failure.ok: truewithmeta.partial: trueis partial success. Use the successful data and explicitly reportmeta.failures; do not fail the whole batch or hide failed items.ok: falseis failure. Preserveerror.code,error.message, andmeta.request_id,meta.invocation_id,meta.stage, andmeta.failureswhen present.OUTPUT_PROJECTION_FAILEDis a local output failure after command completion: stdout retains the original business payload indataand originalmeta, while exit status remains non-zero. Repair the projection from that returned envelope without resubmitting the remote command.- Do not retry an unchanged failed command or guess alternative payload shapes. Retry only after applying concrete validation/clarification guidance or correcting a verified transient condition.
Failure evidence:
- A process exit code of 0 is not business success when the envelope says
ok: false. Prefer direct CLI invocation; if a shell pipeline is necessary, preserve the CLI exit status withset -o pipefailand retain the complete error envelope rather than truncating it. TE_TOOL_POLICY_DENIEDidentifies the runtime authorization stage. Report its exact reason; it does not prove a backend schema check passed or that the user needs to log in again. Do not bypass policy or retry by changing the business scope.INVALID_ANALYSIS_DEFINITION/INVALID_CAPABILITY_INPUTidentifies an input failure. Correct all relevant fields together within the allowed retry budget. Say "validation passed" only after an explicit successful validation response for the same complete definition on the same host.QUERY_FAILEDestablishes that the query failed; it does not establish the database or engine root cause. Preserve the returned error and correlation IDs, leave unavailable values unknown (not zero), and stop when the user requests no retries. Distinguish observed errors from unverified hypotheses.
For every gateway command that exposes --request-id, ae-cli generates a request_id and prints it to stderr before dispatch when the caller omits it. Preserve that ID with the final envelope and diagnostics. Pass an explicit --request-id cli_<32 lowercase hex> only when a caller-owned correlation ID is required.
Execution invariants
- Probe the first page exactly once. Verify
ok, the documented data shape, and the effectivelimitbefore starting a pagination loop. - For paginated directory results, continue only with the returned
next_offsetwhilehas_moreis true. Never calculate a speculative offset, repeat the current page, or declare the list complete beforehas_moreis false. - Track the normalized command, input, and announced
request_idfor every invocation. Never resubmit an identical invocation while it is still in flight; wait for the current process, or inspect its returnedrun_idwhen it is asynchronous. - Reuse completed data, verified metadata, selected assets, and already downloaded files when host, identity, project, definition, effective scope, and completeness match. Query only an identified missing dependency; batch compatible metrics and do not add unrelated analysis to a lookup.
- Retry only the items named in
meta.failures, and only when theirretryablevalue andnext_actionpermit it. Never retry successful or empty items from the same batch.
Mandatory routing
Product terminology gate
- The Chinese product term
看板means an analysis board backed by saved reports. Route it toae-cli analysis dashboard ...and capability IDs underanalysis.dashboard.*. - The Chinese product terms
仪表盘andBI 仪表盘mean a BI dashboard with worksheets, charts, and pages. Route them toae-cli analysis bi-panel ...and capability IDs underanalysis.bi_panel.*. - These assets are not aliases. Never substitute an analysis board for a BI dashboard, or a BI dashboard for an analysis board.
- The standalone English word
dashboardis ambiguous in this product. Before a write, ask whether the user means an analysis board (看板) or a BI dashboard (仪表盘) unless the surrounding context already makes the product asset explicit. - If the requested BI-panel capability is unavailable or unauthorized, report that constraint. Do not fall back to creating an analysis board.
Project gate
Before project discovery or asking which project to use, load global personal semantics with ae-cli personal-semantic-preference list --project-id -1. Read relevant complete entries with get --project-id -1 --id ... --title ... --mark-used, including a default query-project preference when needed. A default query project is an asset_context with one authorized project resource reference; use its numeric resource_key, not a guessed name match.
Project selection priority is the user's explicit current instruction, the active project supplied/confirmed in this conversation, then an applicable global default, then project discovery and a question only if needed. Verify a default project is still accessible through project info get. If it is unavailable or multiple defaults conflict, explain the concrete issue and resolve a valid project; never query an unauthorized project. A temporary project selection does not update the global default. Only a clear reusable default instruction changes it.
After any project selection or switch, load personal-semantic-preference list --project-id <id> before asset discovery or query construction. Read every relevant matched entry in full before using it. Do not carry the previous project's semantics into the new project. Cache directories per host, authenticated account/company, project, and conversation; a new conversation must initialize again. Failure to load either scope is not an empty catalog: report the error and resolve it before analysis continues. A missing global capability requires the new Common deployment; never silently omit global initialization.
Project Semantic Knowledge Base
When the user explicitly asks to build, update, refresh, rebuild, or sync a project semantic knowledge base, open references/project_semantic_knowledge_wiki.md. That command-reference workflow starts from ae-cli project-semantic asset-package export and then uploads/compiles KB sources. The retired governed project-semantic candidate and release lifecycle is not part of this knowledge-base build path or CLI Agent asset-authentication and metric-recommendation review.
Project Semantic Knowledge and Discovery
Do not call project-semantic catalog, entry, candidate, release, or publish commands. The governed project-semantic lifecycle has been retired from CLI; use personal-semantic-preference for current-user semantics and the knowledge-base workflow for project knowledge.
For a project-scoped request that may need an asset or metric definition, decide the route before any analysis asset, report, or metric lookup. Follow an explicitly named knowledge base directly; skip this gate if the user rules out knowledge bases. Otherwise call ae-cli config show once per host and authenticated account in this conversation, and recheck when that scope changes or the answer is over 24 hours old. The command uses the CLI's daily company configuration cache; do not force a remote refresh for each question.
If data.routing.knowledge_base is auto, consider whether a project knowledge base could answer the question or provide the needed asset definition. If it could, use ae-kb-discovery first, prefer an exact project binding, and read matching pages through ae-kb. For data questions, verify the selected asset's semantic coverage and run the applicable analysis command. If pages provide only related definitions, limitations, or partial coverage, retain that evidence and continue normal asset or metric discovery for the missing requirements through the KB analysis workflow. If no relevant knowledge-base page is found, continue with normal discovery. If the routing value is explicit or data.source is unavailable, use the normal analysis route without implicit KB discovery. A KB candidate without a relevant page hit does not justify using its assets.
Personal Semantic Preferences
Global (project_id=-1) and selected-project personal semantics are mandatory analysis context, not an opt-in personalization branch. Apply the Project gate above for every analysis workflow, including asset work and governance routing. Explicit current instructions take precedence over stored personal defaults; project personal rules take precedence over global personal rules within that project. Preserve the existing formal-asset verification and certification boundaries.
Use personal-semantic-preference list once for each scope and read relevant full records with get --title <directory title> --mark-used before applying them. The directory summary is a candidate selector, not a substitute for full content. A global default project must be read before asking the user to select a project. Do not fetch unrelated records just to increase usage counts.
Active capture checkpoint
The Agent owns capture. Check immediately after the user defines or corrects a business meaning and again before final delivery. A clear user-provided calculation definition is a high-priority capture signal even without words such as "remember", "always", or "next time". For example, when the user defines active users as login users rather than registered users, resolve the actual login event, store the user's working definition with its project/event binding, and use that definition for the analysis. Do not ask the same meaning or ask a second save question once both scope and reusable intent are clear.
Capture clear business definitions, numerator/denominator and eligibility rules, event/property interpretations, reusable asset choices, output preferences, and confirmed workflows. A user-confirmed choice that defines business meaning is different from confirming a one-off date or filter value. Do not dismiss a reusable definition as a transient analysis confirmation merely because it first appeared in this task. Do not copy metadata catalogs or complete asset definitions into memory: preserve the user's interpretation, selected identity, applicability, exclusions and boundaries.
Choose scope by applicability: project-specific business definitions and assets stay in that project; cross-project analysis habits, output preferences and a default query project use project_id=-1. Global asset contexts may bind authorized same-company projects only. Referencing a report/event/property requires its real project scope. Global personal semantics remain private to the authenticated user and never enter project submission/review.
Choose context_type by meaning:
preference: a reusable interpretation or output preference without an exact asset binding.asset_context: user wording or meaning bound to exact assets. Copyresource_typeandresource_keyfromanalysis-meta catalog list; virtual properties useevent_property/user_propertyand their canonicalprop_name, nevervirtual_propertyor a numeric virtual-property ID. Useprojectand a verified project ID for a global default project.experience: a confirmed reusable analysis workflow without exact asset bindings.background: stable personal analysis context without exact asset bindings.
Compare with the cached catalog before writing. Read a matching existing entry with get --mark-used, then update it with its current revision; otherwise add a new entry. A scope correction updates the appropriate record and never silently copies a project definition into global scope. Do not create duplicate definitions for successive wording refinements. Merge successful write responses into the cached directory instead of calling list again for readback.
If it is unclear whether the information should persist, ask one focused question about saving it as global or project personal semantics; do not invent durable intent. An explicit "only this time" or "do not save" means no write. One-off time ranges, temporary Top N, numeric results and unconfirmed Agent hypotheses are not personal semantics. A clear reusable calculation definition does authorize automatic add/update without another save confirmation.
After a successful write, tell the user briefly what was saved or updated and its global/project scope, in the user's language. Never claim saving before success; if saving fails, state that it was not saved. On later relevant questions, read the stored full rule and implement it in the actual query rather than merely mentioning it in prose. Clear user instructions to remember an analysis workflow use this service (experience), including global cross-project analysis workflows; AgentSpace memory is for other memory domains.
Personal capture and project recommendation are independent. Save the private personal definition first when appropriate. A separate explicit user choice is required before recommending it for project-wide review. Personal storage never certifies or publishes an asset. Keep lifecycle instructions out of stored content. Global preferences do not expire solely because 90 days have elapsed without use; explicit freshness deadlines still apply. Existing project retention and high-risk delete confirmation remain unchanged.
Metadata discovery
Reuse known definitions and canonical metadata directly. For an unknown business measure, follow references/metadata_resolution.md: search relevant saved metrics/reports, read their definitions, and discover only missing events or properties. allowed_resource_types is authoritative for a compiler error. Verifying fields, types, and filters for an already explicit or confirmed meaning is evidence completion, not a new business choice. Confirm a selected business mapping once, even when there is only one suitable candidate; reuse the task's already confirmed mappings.
Saved business asset or ad-hoc
If an exact asset or definition came from a knowledge-base page, first read and follow ../ae-kb/references/analysis-workflow.md. Inspect the live definition and attempt an exact, semantically applicable saved asset first. When inspection establishes a mismatch, missing fields, or partial coverage, continue ordinary discovery for the original request without a forced data query. Preserve useful KB evidence, resolve only missing metadata, and follow the workflow's authorized fallback and disclosure rules. A KB limitation is not itself task completion.
Use a suitable saved report with supported requested overrides. For a custom combination, reuse the applicable definitions in an ad-hoc model. Read references/analysis_gateway_assets.md for saved filters, dashboard context and asset selection. Load model references when constructing an ad-hoc definition.
Preserve confirmed intent
Resolve the requested metrics, filters, groups, comparison windows, timezone, and cohort eligibility before the final query. Carry user corrections into the actual definition, including every dependent query; noticing an old date or metric mismatch in reasoning does not correct the submitted input. Carry the actual confirmation reply into these choices as described in the metadata workflow.
When the caller supplies an existing definition snapshot, use the selected command's optional --intent-snapshot contract to check local JSON consistency.
Result data versus metadata
- Metric value, trend, comparison, or anomaly -> choose saved report/dashboard or ad-hoc using the decision above.
- Metric definition search/create/update -> metadata commands.
- Event/entity rows ->
event-detail run|exportorentity-detail run|export. - Events/entities from a query result -> pass the original
--project-id, follow the returned synchronousquery_context_idand compact source action summary, then callanalysis query-context getfor full coordinate options; never reconstruct raw QP or use export rows as coordinates. - Cluster/tag definition -> matching gateway cluster/tag commands and matching model reference.
- SQL virtual user properties can reference a user-entity tag as
ta_tag."tag_name"in both create and update. See virtual property creation. - For tag versions in model filters/groups and SQL virtual event properties, discover tags with
analysis-meta catalog list. Onlyhas_history_versions=trueallows AUTO or SPECIFIED. For a local fixed date, useanalysis user-tag get --include-history-dates true. Cross-source tags accept a user-supplied date without local enumeration. See model fields and virtual property policies. - Tag/cluster candidate values, including requests phrased as "latest version" or "latest result" -> resolve the exact asset, then use
analysis filter-value listwithcluster_date_policy=LATEST. This means the latest computed data snapshot, never a definition or configuration release; do not invent version lists, version IDs, draft states, or publish states. - Alert/configuration/tracking-plan requests -> the dedicated gateway command reference from the index.
Run, export, and follow-up
Use run for a bounded inline result, and export --output <file> for complete or over-limit results. Read export handling when exporting or resuming an interrupted export. When the request needs a follow-up action advertised by the returned query context, read references/analysis_drilldown_contract.md.
Writes and destructive operations
Write only with explicit user intent. Correct a concrete complex-input issue with --validate when needed. Use --dry-run for high-risk writes or an explicitly requested preview; do not stack these modes. Execute read and ordinary write commands without --yes. For high-risk-write, dry-run first, summarize the target and impact, wait for explicit user confirmation, and only then execute the unchanged command with --yes.
Project-space and folder create/delete/share are L3 capabilities rather than curated analysis commands. Read the matching command reference, then use ae-cli capability inspect|dry-run|run; discover *.members through capability search|inspect|run and references/analysis_gateway_assets.md. For risk=high-risk-write, dry-run first, summarize the impact, and execute with --yes only after a later explicit confirmation.
After a successful create/update, if a resource ID and supported resource type are available, call analysis-meta asset url-get and return the link. Explicitly state when link generation is skipped because no resource ID exists or when it fails.
Output requirements
- Return the requested result with its metric, window, dimension/filter scope and units.
- Reuse values already returned or calculated; compute an additional value only when the request needs it.
- For saved dashboard answers, use non-empty
location.folder_name,dashboard_name,remark, andnotes[].note_title/descriptionto establish business scope. Label folder names and notes as authored context, separately from observed query evidence. - State any returned partial-data, permission or capability limitation that affects the request.
For CLI Agent asset-authentication and metric-recommendation review, the final answer must use the fixed approval display from references/governance_recommendation_export.md:
- Top-level grouping is
业务主题域; do not use separate top-level sections like资产认证建议and推荐指标. - Keep the source dashboard as the core evidence package. Derive
业务主题域from the dashboard semantics and its child report names, event/property/metric semantics, and shared business process. Do not use raw source titles, test labels, priority labels, asset-type tags, or backendtopic_seedstrings as the final group name when they are only workflow labels. work_unitsare evidence containers, not presentation groups. A single dashboard/work unit may split into multiple business domains when its child reports cover different business processes, and one business domain may merge evidence from multiple dashboards/work units when the business meaning matches.- Keep each report-centered evidence chain together: the report row, metadata rows, and metric candidates introduced by that report follow the same
业务主题域. Do not detach report metadata into a separate generic metadata group, and do not merge unrelated child-report domains only because they share one source dashboard. - When one source dashboard contains child reports for different business questions, create one
业务主题域per child-report business question. Do not combine distinct report domains into a
Truncated - read the full file at https://www.skills.sh/thinkingaiagenticengine/ae-cli/ae-analysis.
