@thinkingai/ae-cli 6.1.25 → 6.1.26

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 (121) hide show
  1. package/README.md +28 -9
  2. package/README.zh.md +25 -9
  3. package/bin/ae-cli.js +6 -1
  4. package/cli-installation-guide.md +91 -0
  5. package/dist/{auth-LHM7NQPR.js → auth-YHMC3GDH.js} +6 -8
  6. package/dist/automation-NWWVLWG2.js +459 -0
  7. package/dist/{capability-SJI5KOCK.js → capability-3QLLIVFB.js} +6 -6
  8. package/dist/chunk-4655PUNX.js +43 -0
  9. package/dist/{chunk-KS4DE3MX.js → chunk-5XJYLEVC.js} +4 -4
  10. package/dist/{chunk-N4BLPJC7.js → chunk-7QXISROD.js} +1 -1
  11. package/dist/{chunk-7WZACOAI.js → chunk-AP7YP2NX.js} +2 -2
  12. package/dist/{chunk-SO5LKIWP.js → chunk-CT7QDJS6.js} +2 -2
  13. package/dist/chunk-D6ACFILC.js +56 -0
  14. package/dist/{chunk-QYXDJOLA.js → chunk-EOYSKMXN.js} +19 -11
  15. package/dist/{chunk-5XRQ3CZR.js → chunk-FMNNGNYO.js} +43 -8
  16. package/dist/{chunk-DU72X2IO.js → chunk-GIK6EDUG.js} +22 -10
  17. package/dist/chunk-HVHR4SCP.js +133 -0
  18. package/dist/{chunk-2FJM4HRV.js → chunk-KAEHZZH4.js} +3 -3
  19. package/dist/{chunk-BW7JUDEI.js → chunk-KFNMQTZI.js} +514 -213
  20. package/dist/{chunk-KJDOTPYU.js → chunk-PLE722AJ.js} +28 -11
  21. package/dist/chunk-RK6GLDGI.js +27 -0
  22. package/dist/{chunk-GK7WDY7E.js → chunk-S6M42KND.js} +1 -1
  23. package/dist/{chunk-IG3DYEIR.js → chunk-UQ77JXYH.js} +4 -3
  24. package/dist/{chunk-YVGXGTD6.js → chunk-WNGFSIOB.js} +7 -1
  25. package/dist/{chunk-XKIW3QMF.js → chunk-XCHAYMSF.js} +3 -3
  26. package/dist/{community-report-client-6VJDDMJJ.js → community-report-client-PEERQCX2.js} +1 -1
  27. package/dist/{config-XQWOPDHN.js → config-AHPMEW5A.js} +4 -4
  28. package/dist/context-YAE3QXP3.js +136 -0
  29. package/dist/{data-integration-XBTCGXQT.js → data-integration-HESZET7E.js} +6 -6
  30. package/dist/index.js +123 -46
  31. package/dist/{local-data-upload-client-3P7NIVQ4.js → local-data-upload-client-TWMHFLUA.js} +1 -1
  32. package/dist/memory-62BJOULV.js +580 -0
  33. package/dist/{metadata-JRYKNUS5.js → metadata-C7CEDHOJ.js} +7 -7
  34. package/dist/{model-ZS7HVGKN.js → model-SBV2JFJI.js} +9 -5
  35. package/dist/{personal-semantic-preference-IDE2GE5T.js → personal-semantic-preference-QECDPHND.js} +117 -11
  36. package/dist/{project-semantic-36KOCYN7.js → project-semantic-Z4QAMBWF.js} +6 -6
  37. package/dist/{sync-EQLSTUS7.js → sync-SU33KYX7.js} +12 -8
  38. package/dist/{te-agent-Z3HCTKR7.js → te-agent-F5QBZSQA.js} +90 -454
  39. package/dist/{te-analysis-5ZZ6YHVH.js → te-analysis-2ECAAIFK.js} +297 -20
  40. package/dist/{te-community-Z7JACGF3.js → te-community-PFLDLPP4.js} +3 -3
  41. package/dist/{te-dataops-F7GQOIS6.js → te-dataops-FOQSRIAZ.js} +5 -5
  42. package/dist/{te-engage-RNRMYDO3.js → te-engage-QKUGIWSR.js} +6 -6
  43. package/dist/{te-experiment-BTAC2UNK.js → te-experiment-26PXR2UO.js} +6 -6
  44. package/dist/{te-kb-QJLJEX5K.js → te-kb-MHDOST62.js} +494 -214
  45. package/dist/{te-system-IXC43QHZ.js → te-system-J2FQF5ER.js} +6 -6
  46. package/dist/{te-team-BIZIKIHZ.js → te-team-5UOZPTU3.js} +6 -6
  47. package/dist/things-VPPXXLHB.js +1091 -0
  48. package/dist/{update-W2SGQNKT.js → update-EEUTEI6R.js} +59 -51
  49. package/dist/workspace-O3EEIYQM.js +554 -0
  50. package/package.json +21 -9
  51. package/skills/ae-agent/SKILL.md +89 -139
  52. package/skills/ae-agent/references/add-model.md +1 -1
  53. package/skills/ae-agent/references/create-agent.md +1 -1
  54. package/skills/ae-agent/references/find-archived-conversations.md +12 -5
  55. package/skills/ae-agent/references/get-agent.md +1 -1
  56. package/skills/ae-agent/references/list-agents.md +2 -2
  57. package/skills/ae-agent/references/list-models.md +2 -2
  58. package/skills/ae-agent/references/restore-conversation.md +3 -1
  59. package/skills/ae-analysis/SKILL.md +15 -6
  60. package/skills/ae-analysis/references/ai_models/funnel.md +5 -3
  61. package/skills/ae-analysis/references/ai_models.md +27 -0
  62. package/skills/ae-analysis/references/command_index.md +12 -4
  63. package/skills/ae-analysis/references/dashboard_move.md +21 -0
  64. package/skills/ae-analysis/references/dashboard_report_add.md +2 -0
  65. package/skills/ae-analysis/references/dashboard_report_get.md +19 -0
  66. package/skills/ae-analysis/references/dashboard_report_update.md +27 -0
  67. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  68. package/skills/ae-analysis/references/event_report_presentation.md +76 -0
  69. package/skills/ae-analysis/references/feedback_submit.md +37 -0
  70. package/skills/ae-analysis/references/metadata_resolution.md +15 -0
  71. package/skills/ae-analysis/references/personal_semantic_preference_review.md +9 -0
  72. package/skills/ae-analysis/references/personal_semantic_preference_review_list.md +7 -0
  73. package/skills/ae-analysis/references/personal_semantic_preference_submit.md +7 -0
  74. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +68 -27
  75. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +40 -1
  76. package/skills/ae-analysis/references/report_create.md +13 -3
  77. package/skills/ae-analysis/references/report_get.md +5 -1
  78. package/skills/ae-analysis/references/report_update.md +15 -4
  79. package/skills/ae-analysis/references/system_query_monitor_overview.md +2 -0
  80. package/skills/ae-analysis/references/system_query_task_cancel.md +2 -0
  81. package/skills/ae-analysis/references/system_query_task_export.md +6 -2
  82. package/skills/ae-analysis/references/system_query_task_get.md +2 -0
  83. package/skills/ae-analysis/references/system_query_task_list.md +7 -3
  84. package/skills/ae-analysis/references/system_query_task_options.md +2 -2
  85. package/skills/ae-analysis/references/system_query_task_realtime_list.md +15 -0
  86. package/skills/ae-analysis/references/user_tag_models.md +2 -0
  87. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-empty-skeleton.mjs +105 -0
  88. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +337 -22
  89. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +21 -8
  90. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +24 -11
  91. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +66 -0
  92. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +1 -0
  93. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +109 -40
  94. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +1 -1
  95. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/prepare-compile-schema.mjs +64 -0
  96. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/refresh-state-parts.mjs +91 -0
  97. package/skills/ae-automation/SKILL.md +16 -0
  98. package/skills/ae-automation/references/cli.md +53 -0
  99. package/skills/ae-automation/references/command_index.md +17 -0
  100. package/skills/ae-capability/SKILL.md +15 -6
  101. package/skills/ae-current-context/SKILL.md +3 -2
  102. package/skills/ae-kb/SKILL.md +62 -12
  103. package/skills/ae-kb/references/analysis-workflow.md +73 -36
  104. package/skills/ae-kb/references/query-workflow.md +67 -33
  105. package/skills/ae-kb/references/schema-import.md +5 -3
  106. package/skills/ae-kb/references/source-mutations.md +6 -4
  107. package/skills/ae-kb/references/text-sources.md +53 -0
  108. package/skills/ae-kb-discovery/SKILL.md +1 -1
  109. package/skills/ae-team/SKILL.md +23 -17
  110. package/skills/ae-things/SKILL.md +85 -0
  111. package/skills/ae-things/references/cli.md +103 -0
  112. package/skills/ae-things-progress/SKILL.md +43 -0
  113. package/skills/ae-things-review/SKILL.md +42 -0
  114. package/skills/ae-workspace/SKILL.md +43 -0
  115. package/skills/ae-workspace/references/commands.md +51 -0
  116. package/dist/chunk-E2JKXMVO.js +0 -29
  117. package/dist/context-M3HDGEIR.js +0 -46
  118. package/dist/memory-6APEB2JB.js +0 -892
  119. package/skills/ae-agent/references/create-automation.md +0 -125
  120. package/skills/ae-agent/references/list-automations.md +0 -56
  121. package/skills/ae-agent/references/update-automation.md +0 -107
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: ae-automation
3
+ description: "Manage AE Agent and Agent team automations with ae-cli: create and edit schedules, enable or disable, run now, stop or retry executions, delete, inspect history and read execution results. Use for scheduled tasks and unattended recurring Agent work, from a local computer or an AE sandbox."
4
+ ---
5
+
6
+ # AE Automation
7
+
8
+ See [command risks](references/command_index.md). Read [the command contract](references/cli.md) before writing or executing an automation. Use `ae-cli automation --help` and leaf help to discover flags.
9
+
10
+ 1. Resolve the host and space. A local user signs in with `ae-cli auth login`; a sandbox uses its injected credentials. Pass `--agent-space-id` when the user identifies a space. Without a space, the server uses a bound sandbox space or the personal default. Show the resolved space when it matters.
11
+ 2. Discover the automation with `automation list` and inspect `automation get`. Use the returned IDs; names are not unique.
12
+ 3. For creation, select an Agent or team through the corresponding discovery commands. Match configuration to the target type. Preview writes with `--dry-run` when useful; the CLI shows a redacted request and asks the server to validate authentication, space, permissions, target state, fields, and idempotency without applying the operation.
13
+ 4. Execute the requested operation. Deleting an automation or stopping an execution requires confirmation; use `--yes` only when the user already authorized that action. In a non-interactive shell, these operations fail immediately unless global `--yes` is present.
14
+ 5. Read the returned run ID, then `automation runs result`. Report acceptance separately from completion. Use `--wait` only when the user needs the final outcome now.
15
+
16
+ Results are read from the server and work outside the sandbox. This skill does not read complete conversations or continue a chat. Never infer an output from a different execution sharing the same conversation.
@@ -0,0 +1,53 @@
1
+ # Automation command contract
2
+
3
+ Transition status: transitional
4
+ Owning module: te-claude automation and team scheduling
5
+ Current transport: authenticated TE REST /api/cli/automation/v1
6
+ Gateway target: TBD (automation lifecycle)
7
+ Review after: 2026-12-15
8
+ Exit condition: equivalent gateway capabilities preserve permissions, idempotency, typed configuration and read-only results.
9
+
10
+ ## Discovery and management
11
+
12
+ - `ae-cli automation list [--agent-space-id ID] [--target-type agent|team] [--q NAME] [--status active|paused] [--limit 20] [--cursor CURSOR]`
13
+ - `ae-cli automation get --id ID`
14
+ - `ae-cli automation create --target-type agent --agent-id ID --name NAME --message TEXT --schedule-kind daily --time 09:00 [--model MODEL_CONFIG_ID] [--reuse-conversation true|false]`
15
+ - `ae-cli automation create --target-type team --team-id ID --name NAME --message TEXT --trigger-type manual [--scope JSON] [--channels JSON_ARRAY]`
16
+ - `ae-cli automation update --id ID --target-type agent|team <changed fields>`
17
+ - `ae-cli automation enable|disable --id ID`
18
+ - `ae-cli automation delete --id ID --yes`
19
+
20
+ Scheduled creation needs `--schedule-kind` or `--cron-expression`. Frequencies: hourly with `--minute 0..59`; daily with `--time HH:mm`; weekly also `--weekday 0..6`; monthly also `--day-of-month 1..28`. Times use the server timezone. Manual creation does not require a schedule. `--trigger-immediately` executes after creation; `--wait` then waits for that execution. Creation and immediate execution have separate results: do not create another automation if only its execution failed.
21
+
22
+ On update, omitted fields retain their values. `--model null`, `--scope null`, destination IDs set to `null`, and `--save-to-knowledge-base-id null` clear nullable fields. `--channels '[]'` clears notifications; `--clear-message` clears instructions; `--reuse-conversation false` disables reuse. An automation's target is immutable on update. Team fields are rejected for Agent targets and vice versa.
23
+
24
+ Team configuration supports `--scope`, `--channels`, `--feishu-chat-id`, `--lark-chat-id`, `--slack-channel-id`, `--save-to-knowledge-base-id`. Other supported notification channels use the team's existing notification configuration. Team visibility and management permissions follow the Web application.
25
+
26
+ `--dry-run` returns a redacted local request preview plus the server preflight result. The preflight applies the same authentication, space, schema, permissions, target state, run state, field applicability and idempotency checks as execution, but does not write data, create or cancel runs, or emit product events. A later real request validates current state again.
27
+
28
+ Disable stops future schedules and leaves the current execution running. Stop cancels one execution and leaves the schedule enabled. Delete soft-deletes the automation and cancels active execution.
29
+
30
+ Delete and stop are high-risk writes. Interactive shells ask for confirmation. Non-interactive shells require global `--yes` and otherwise exit with `CONFIRMATION_REQUIRED` before sending a request.
31
+
32
+ ## Executions and results
33
+
34
+ ```bash
35
+ ae-cli automation run --id ID --command-id REQUEST_ID
36
+ ae-cli automation runs list --id ID --limit 20
37
+ ae-cli automation runs get --id ID --run-id RUN_ID
38
+ ae-cli automation runs result --id ID --run-id RUN_ID
39
+ ae-cli automation runs stop --id ID --run-id RUN_ID --yes
40
+ ae-cli automation runs retry --id ID --run-id FAILED_RUN_ID --command-id REQUEST_ID --wait --timeout 300
41
+ ```
42
+
43
+ Retry creates a new complete execution from current configuration after failure or cancellation. It retains the original result and returns a new run ID with a source reference. It does not resume failed steps or erase the old run.
44
+
45
+ `--command-id` makes run/retry repeatable after uncertain responses. Within each target type, reuse the same value for the same request; changing its automation ID or source run produces a conflict. Preserve the generated command ID from output or an error hint. A network timeout is not proof that execution was rejected.
46
+
47
+ Without `--wait`, success means accepted. With `--wait`, output includes completion or timeout information; timeout preserves the run ID and does not restart or cancel the execution. Read the same result later. If polling fails, the accepted response and identifiers remain available with an `observation` error; query that run instead of triggering again. `partial_success` is distinct from success. Result availability is `pending`, `available`, `empty` or `unavailable`; missing historical links are not replaced with newer output.
48
+
49
+ `--format json` produces scriptable envelopes; `--format table` is available for interactive inspection. Full conversations, tool traces and terminal continuation are outside this interface. URLs are optional Web references and contain no credentials. The CLI does not automatically open a browser.
50
+
51
+ ## Compatibility
52
+
53
+ The retired Agent-domain automation commands are unavailable. Use the `automation` domain for the complete lifecycle, including teams.
@@ -0,0 +1,17 @@
1
+ # Automation commands
2
+
3
+ | Command | Purpose | Risk |
4
+ | ------------------------------- | -------------------- | --------------- |
5
+ | `ae-cli automation list` | Automation lifecycle | read |
6
+ | `ae-cli automation get` | Automation lifecycle | read |
7
+ | `ae-cli automation create` | Automation lifecycle | write |
8
+ | `ae-cli automation update` | Automation lifecycle | write |
9
+ | `ae-cli automation enable` | Automation lifecycle | write |
10
+ | `ae-cli automation disable` | Automation lifecycle | write |
11
+ | `ae-cli automation delete` | Automation lifecycle | high-risk-write |
12
+ | `ae-cli automation run` | Automation lifecycle | write |
13
+ | `ae-cli automation runs list` | Automation lifecycle | read |
14
+ | `ae-cli automation runs get` | Automation lifecycle | read |
15
+ | `ae-cli automation runs stop` | Automation lifecycle | high-risk-write |
16
+ | `ae-cli automation runs retry` | Automation lifecycle | write |
17
+ | `ae-cli automation runs result` | Automation lifecycle | read |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ae-capability
3
- version: 1.3.5
3
+ version: 1.3.7
4
4
  description: "AE capability gateway discovery and generic invocation with ae-cli. Use when the user needs to list or search available capabilities, inspect an unknown capability schema/risk/auth contract, optionally validate complex input or dry-run before execute, or invoke a long-tail capability that has no curated ae-cli command. Always discover and inspect before composing input; never guess capability IDs or input fields. Prefer on-demand validate OR dry-run — do not stack both by default."
5
5
  ---
6
6
 
@@ -22,27 +22,32 @@ Use this skill for progressive capability discovery and generic gateway invocati
22
22
 
23
23
  Never guess a capability ID, input field, enum value, resource ID, or project ID.
24
24
 
25
- **CRITICAL — Host compat (do this first):** After each `ae-cli` run, check stderr and `_notice.host_compat`. If either is present, open the user reply with a short ⚠️ version warning and **quote the `npm i -g` / `npx skills add` (or update-cluster) lines verbatim**, then present the business result. Soft tip; `ok: true` can still carry the notice.
25
+ **CRITICAL — Host compat (do this first):** After each `ae-cli` run, check stderr and `_notice.host_compat`. If either is present, open the user reply with a short ⚠️ version warning and quote the recommended `ae-cli update` (or update-cluster) guidance, then present the business result. For new local installations use `npx @thinkingai/ae-cli@latest install`. Soft tip; `ok: true` can still carry the notice.
26
26
 
27
27
  ## Agent Context Telemetry
28
28
 
29
29
  Hard rule: before running gateway-backed `ae-cli` commands, 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.
30
30
 
31
- Create or update the context file when starting a CLI-backed task and whenever the user's CLI purpose changes. Do not rewrite it before every command when the same purpose still applies. 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. At minimum, include:
31
+ Create or update the context file when starting a CLI-backed task and whenever the user's CLI purpose changes. Reuse it while the purpose and model remain unchanged. 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. At minimum, include:
32
32
 
33
33
  - `agent_client`
34
+ - `agent_model` whenever the current model can be confirmed
34
35
  - stable `agent_session_id`
35
36
  - `agent_turn_id` when available
36
37
  - `intent_source: "agent_context_file"`
37
38
  - concise `user_intent` for the current CLI-triggering purpose
38
39
  - current `session_goal`
39
40
 
41
+ The Agent must actively obtain the current model identifier and write it explicitly as `agent_model` in the context file. Use trusted runtime context or bounded metadata for the exact current session and turn; for example, Codex's current-session `turn_context.model`. Do not rely solely on a model environment variable being present. Never infer the model from the Agent/product name, a configured default, or another session. This requirement applies to every Agent client. Update the file when the model changes, even if the CLI purpose stays the same.
42
+
43
+ If the model cannot be confirmed, 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. Once confirmed, write the model and remove the stale partial marker so the CLI can compute capture status from the remaining fields.
44
+
40
45
  Write this JSON object to `.ae/cli-agent-context.json`:
41
46
 
42
47
  ```json
43
48
  {
44
49
  "agent_client": "codex",
45
- "agent_model": "gpt-5.5",
50
+ "agent_model": "<confirmed-current-model-id>",
46
51
  "agent_session_id": "<stable conversation id>",
47
52
  "agent_turn_id": "<current turn id>",
48
53
  "parent_turn_id": "<previous turn id>",
@@ -55,13 +60,13 @@ Write this JSON object to `.ae/cli-agent-context.json`:
55
60
  }
56
61
  ```
57
62
 
58
- Use this local template when updating the file:
63
+ Use this local template when updating the file. Replace every placeholder with verified context before running it; write the confirmed model explicitly rather than reading an optional environment variable. For an unknown model, omit that field and add the partial status described above.
59
64
 
60
65
  ```bash
61
66
  mkdir -p .ae
62
67
  node -e 'const fs = require("fs"); const payload = {
63
68
  agent_client: "codex",
64
- agent_model: process.env.CODEX_MODEL,
69
+ agent_model: "<confirmed-current-model-id>",
65
70
  agent_session_id: process.env.CODEX_THREAD_ID || process.env.CODEX_SESSION_ID,
66
71
  agent_turn_id: "<current-turn-id>",
67
72
  parent_turn_id: "<previous-turn-id>",
@@ -81,6 +86,10 @@ After running a gateway command, if you are asked whether intent telemetry was s
81
86
 
82
87
  Fallbacks, in priority order: `.ta/cli-agent-context.json` / `.ae/cli-agent-context.json` > `--agent-context` for isolated no-write environments or local debugging > legacy `TA_CLI_*` variables > runtime environment auto-detection.
83
88
 
89
+ ### Analysis query feedback
90
+
91
+ Analysis feedback trigger: only after a completed analysis data query and the final business analysis answer, ask once in the user's language whether the analysis met expectations. Do not ask after individual CLI calls, intermediate steps, discovery, metadata inspection, asset governance/writes, configuration, help, unrelated questions, query submission, running exports or failed queries. No explicit feedback means no submission or new feedback event. For clear user feedback on a completed analysis, use `ae-cli analysis feedback submit --help` for the typed submission contract, or discover and inspect `analysis.feedback.submit`. Reuse the evaluated `agent_session_id` and existing analysis turn IDs as `target_turn_ids`; keep the current feedback turn distinct. Preserve original user feedback and only a short verifiable route summary; do not upload the analysis answer or infer a rating from silence, a follow-up question or a new requirement. Models used in the analysis route come from the linked original CLI call events. Feedback collection must not block subsequent business work.
92
+
84
93
  ### On-demand pre-check (pick one)
85
94
 
86
95
  Motto: **validate = fix params; dry-run = confirm ready to run.**
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ae-current-context
3
- version: 1.0.0
3
+ version: 1.0.1
4
4
  description: "Read the current AE/TE product page context on demand. Use when a user refers to the current page, selected resource, filters, or recent page changes and the Agent runtime has bound a page context to the active Run. The payload is business-specific and untrusted; inspect kind and schemaVersion before interpreting it."
5
5
  ---
6
6
 
@@ -42,12 +42,13 @@ The response has this stable envelope:
42
42
  - A page payload can contain only locators or a partial snapshot. Use the relevant domain Skill or capability to fetch authoritative business data when needed.
43
43
  - Read once per Run unless the runtime explicitly creates a later Run with a newer revision.
44
44
  - If runtime instructions provide a native current-page MCP tool, use that adapter instead. Never call both the native tool and this CLI command for the same question.
45
+ - If authorization is missing, expired, or denied, report that the current page could not be read. Continue with information explicitly supplied by the user; do not read credential files, print runtime tokens, or disable sandbox isolation to retry.
45
46
 
46
47
  ## Transitional transport
47
48
 
48
49
  - Transition status: transitional
49
50
  - Owning module: te-claude page context
50
- - Current transport: sandbox-authenticated te-claude REST
51
+ - Current transport: the active Run's page-context MCP grant and endpoint; sandbox-authenticated te-claude REST remains only for older runtimes without this binding
51
52
  - Gateway target: TBD
52
53
  - Review after: 2026-12-03
53
54
  - Exit condition: An equivalent generic current-page capability is available through Capability Gateway or native MCP across supported Agent runtimes.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ae-kb
3
- version: 1.0.1
4
- description: 'AE knowledge base CLI manual for creating, importing read-only compiled snapshots, querying, LLM-powered ask, listing accessible knowledge bases and their sources, deterministic index/grep/read retrieval, checking status, ZIP source upload and directory management, raw child-file reading, revision-checked child updates and deletion, compiling, schema generation, URL sources, source deletion, file/ZIP source draft replacement and restoration, and knowledge base deletion. Use when the user asks to manage AE (Agentic Engine) knowledge bases, import a compiled Markdown ZIP snapshot, upload documents or URLs to a knowledge base, query knowledge, ask knowledge bases with an LLM, list accessible knowledge bases or source metadata, inspect knowledge base indexes, search knowledge base pages, read a specific knowledge base page, check knowledge base status, generate schemas, compile knowledge, remove sources, or delete a knowledge base. To choose which knowledge base is worth searching, use the ae-kb-discovery skill first; this skill runs the retrieval once a target is chosen. Must use ae-cli kb commands and must not guess knowledge base names, scopes, page paths, source IDs, source display names, JSON payload shapes, or URL formats.'
3
+ version: 1.0.4
4
+ description: 'AE knowledge base CLI manual for creating, importing read-only compiled snapshots, querying, LLM-powered ask, listing accessible knowledge bases and their sources, deterministic index/grep/read retrieval, checking status, ZIP source upload and directory management, raw child-file reading, revision-checked child updates and deletion, compiling, schema generation, URL sources, source deletion, ordinary text source creation, full reads and revision-checked editing, file/ZIP source draft replacement and restoration, and knowledge base deletion. Use when the user asks to manage AE (Agentic Engine) knowledge bases, import a compiled Markdown ZIP snapshot, upload documents or URLs to a knowledge base, query knowledge, ask knowledge bases with an LLM, list accessible knowledge bases or source metadata, inspect knowledge base indexes, search knowledge base pages, read a specific knowledge base page, check knowledge base status, generate schemas, compile knowledge, remove sources, create or edit text sources, or delete a knowledge base. To choose which knowledge base is worth searching, use the ae-kb-discovery skill first; this skill runs the retrieval once a target is chosen. Must use ae-cli kb commands and must not guess knowledge base names, scopes, page paths, source IDs, source display names, JSON payload shapes, or URL formats.'
5
5
  ---
6
6
 
7
7
  # ae-kb
@@ -14,15 +14,15 @@ AE CLI (`ae-cli`) knowledge base commands are invoked through:
14
14
 
15
15
  ```bash
16
16
  ae-cli kb +<command> [options]
17
- ae-cli kb source <replace|restore|preview|commit|cancel|check-updates> [options]
17
+ ae-cli kb source <create-text|read-text|replace|restore|preview|commit|cancel|check-updates|check-url-updates> [options]
18
18
  ```
19
19
 
20
20
  ## Global Rules
21
21
 
22
22
  - Use this skill for AE knowledge base tasks: create, import a compiled snapshot, query, ask with LLM, list accessible knowledge bases and their sources, inspect indexes, grep pages, read pages, check status, upload sources, add URL sources, generate schema, compile, remove source files, and delete knowledge bases.
23
23
  - **Searching a knowledge base for an answer is the most common task. If that is what you are doing, go straight to [Explore Knowledge Base Pages](#explore-knowledge-base-pages) and read [`references/query-workflow.md`](references/query-workflow.md) first — it is the retrieval procedure. The other commands below are for managing knowledge bases, not answering from them.**
24
- - **When retrieved pages will guide project-scoped business data analysis, read and follow [`references/analysis-workflow.md`](references/analysis-workflow.md) before running any data query. This is mandatory after a KB hit identifies a saved asset, definition, parameter, time rule, conflict, or decision boundary; do not jump directly to ad-hoc analysis or SQL.**
25
- - Read operations can run directly after required inputs are known. Write operations require explicit user intent and normally keep the confirmation prompt unless the user asks to bypass it.
24
+ - **When retrieved pages will guide project-scoped business data analysis, read and follow [`references/analysis-workflow.md`](references/analysis-workflow.md) before running any data query. This is mandatory after a KB hit identifies an asset, definition, parameter, time rule, conflict, or decision boundary. Verify semantic coverage before execution; a related page or KB limitation is not task completion. Continue ordinary analysis for uncovered requirements without jumping directly to unverified ad-hoc analysis or SQL.**
25
+ - Read operations can run directly after required inputs are known. Write operations require explicit user intent. Only `high-risk-write` commands require the CLI confirmation prompt; use `--yes` after explicit authorization.
26
26
  - Prefer `--dry-run` before destructive or broad writes when the user has not already validated the target.
27
27
  - Do not invent knowledge base names, scopes, source IDs, source display names, or JSON payloads. Ask the user or query known context when values are missing.
28
28
  - When building a `--sources` ref (or `+read --source`), copy the exact `scope` and `name` from `+list` output — run `ae-cli kb +list` first when the scope of a named knowledge base is unknown.
@@ -36,6 +36,9 @@ ae-cli kb source <replace|restore|preview|commit|cancel|check-updates> [options]
36
36
 
37
37
  | Command | Risk | Purpose |
38
38
  |---|---:|---|
39
+ | `source create-text` | write | Create one ordinary Markdown source from text, UTF-8 file or explicit stdin; saves without compiling. |
40
+ | `source read-text` | read | Read complete ordinary text with its corresponding revision; optionally save original UTF-8 bytes to a new file. |
41
+ | `source check-url-updates` | write | Submit an asynchronous check for one compiled custom URL source; success means accepted only. |
39
42
  | `source check-updates` | write | Check one compiled Feishu source with the scheduled detector; mark changes without compiling. |
40
43
  | `+ask` | read | LLM-powered Q&A over knowledge bases; for multi-page synthesis or multi-hop questions. |
41
44
  | `+ask-status` | read | Query the current status of an ask execution by `--execution-id` without polling. |
@@ -52,9 +55,30 @@ ae-cli kb source <replace|restore|preview|commit|cancel|check-updates> [options]
52
55
  | `+schema` | write | Generate the compile schema for a knowledge base. |
53
56
  | `+compile` | write | Compile a knowledge base in incremental or full mode. |
54
57
  | `+status` | read | Query the current status of a knowledge base. |
58
+ | `usage list` | read | List one page of compilation usage logs, including elapsed time in milliseconds. |
55
59
  | `+rm-source` | high-risk-write | Delete one source from a knowledge base by stable ID; exact display name is legacy compatibility only. |
56
60
  | `+remove` | write | Delete an entire knowledge base. |
57
61
 
62
+ ## Compilation Usage Logs
63
+
64
+ ```bash
65
+ ae-cli kb usage list --name handbook --scope personal --page 1 --page-size 20
66
+ ae-cli kb usage list --name handbook --jq '.items | map({createdAt, taskType, status, durationMs})' --format table
67
+ ```
68
+
69
+ - Returns `{ items, total, page, pageSize }`. `--page` defaults to 1; `--page-size` defaults to 20 and accepts 1–100. Fetch each page explicitly.
70
+ - `durationMs` is the usage log's `finishedAt - startedAt`, in milliseconds. A missing or invalid timestamp yields `null`; zero remains zero. Failed records can have duration even when `usageAvailable` is false.
71
+ - Historical missing durations are not reconstructed from compile runs. `startedAt` and `finishedAt` are ISO timestamps or `null`.
72
+ - Requires the same Schema-read permission as the Web compilation usage list. Imported snapshots do not expose usage. `--scope` selects exactly personal or company; omission keeps the existing personal-then-company lookup.
73
+ - `--dry-run` previews the read without sending a request. Default output retains numeric/null values; use the existing `--jq` and `--format table` options for a compact table.
74
+
75
+ Transition status: transitional
76
+ Owning module: te-claude External Knowledge Base Usage API
77
+ Current transport: authenticated External REST via `kbApi`
78
+ Gateway target: TBD (compilation usage list)
79
+ Review after: 2026-12-14
80
+ Exit condition: migrate to the Gateway equivalent when available, preserving typed pagination and duration/null semantics.
81
+
58
82
  ## Published Version History
59
83
 
60
84
  Use the nine version commands described in [`references/versions.md`](references/versions.md) to inspect immutable published history, compare source changes, and explicitly roll back an earlier version as a new publication. These commands manage history; `+index/+grep/+read/+ask` continue to use current published content.
@@ -298,7 +322,7 @@ ae-cli kb +list --build-status compiled
298
322
 
299
323
  Use the deterministic retrieval primitives when an agent needs to explore knowledge base content like a code repository. These endpoints do not call an LLM on the server side.
300
324
 
301
- **Before running a real query, read [`references/query-workflow.md`](references/query-workflow.md)** — it is the step-by-step procedure for turning a question into an answer without crawling. It covers candidate indexing, copied-path grep, same-page read windows, linked-page re-grep, outline-derived ranges, and coverage assessment. This section below is the per-command reference the workflow draws on.
325
+ **Before running a real query, read [`references/query-workflow.md`](references/query-workflow.md)** — it selects the next useful retrieval step without crawling. It covers candidate indexing, copied-path grep, direct bounded reads of linked short pages, same-page read windows, linked-page re-grep when needed, optional outline-derived ranges, and coverage assessment. This section below is the per-command reference the workflow draws on.
302
326
 
303
327
  Start with `+list` or `+index` to discover accessible knowledge bases. Use `+index` when you also need navigation maps:
304
328
 
@@ -343,6 +367,10 @@ ae-cli kb +read \
343
367
  --expand block
344
368
  ```
345
369
 
370
+ ### Create, read or edit text sources
371
+
372
+ Read [the text source workflow](references/text-sources.md) when collecting text, reading full editable source content, or updating an ordinary `.md`, `.markdown` or `.txt` source. It covers explicit scope, UTF-8/BOM/newline preservation, exclusive local output, revision conflicts, redacted dry-run and manual compilation. Web and CLI maintain the same source ID.
373
+
346
374
  ### List Sources
347
375
 
348
376
  List sources first to discover the stable identifier for the intended source:
@@ -354,10 +382,10 @@ ae-cli kb +list-sources --name engineering-handbook --scope company
354
382
  Copy the exact `id` from the response into `+rm-source`. Do not guess a source ID from a local filename, URL, display name, or an older upload response.
355
383
 
356
384
  - Transition status: transitional
357
- - Owning module: te-claude External Knowledge Base Sources API
358
- - Current transport: authenticated KB external REST through `kbApi`.
359
- - Gateway target: TBD (`kb.source.list` proposed)
360
- - Review after: 2026-12-03
385
+ - Owning module: te-claude knowledge-base source management
386
+ - Current transport: External Knowledge Base REST API
387
+ - Gateway target: TBD
388
+ - Review after: 2026-11-12
361
389
  - Exit condition: migrate to a typed Gateway capability when an equivalent source-list capability is available, or remove this command if dynamic Gateway execution provides the same discoverability and safe output contract.
362
390
 
363
391
  ### Remove One Source
@@ -441,7 +469,7 @@ ae-cli kb +grep --query "<keywords>" --sources '[{"scope":"company","name":"kb-n
441
469
 
442
470
  - `--query`, alias `-q`: required keywords to search.
443
471
  - `--sources`: required JSON array of knowledge base refs.
444
- - `--paths`: required JSON array of wiki pages or subdirectories **copied** from `+index`. A single page is still an array, e.g. `["wiki/sandbox.md"]`. Distinct from `+read --path` (one string).
472
+ - `--paths`: required JSON array of wiki pages or subdirectories **copied** from current `+index`, `+grep` or `+read` navigation links. Do not invent paths. A single page is still an array, e.g. `["wiki/sandbox.md"]`. Distinct from `+read --path` (one string).
445
473
  - `--top-k`: optional max number of hits, 1-50, default 10.
446
474
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
447
475
  - Each page entry in results carries `hitCount` (full match count), `pageKind`, and `sections` previews with `sectionStartLine` / `sectionEndLine` — use the section range as the `+read` window.
@@ -530,10 +558,11 @@ ae-cli kb +status --name "<name>" [--scope personal|company]
530
558
  ### `+list-sources`
531
559
 
532
560
  ```bash
533
- ae-cli kb +list-sources --name "<name>" [--scope personal|company]
561
+ ae-cli kb +list-sources --name "<name>" [--scope personal|company] [--content-type all|text]
534
562
  ```
535
563
 
536
564
  - `--name`: required knowledge base name.
565
+ - `--content-type`: defaults to `all`; `text` selects ordinary `.md`, `.markdown` and `.txt` sources (case-insensitive), excluding URL and ZIP sources. Scope remains optional for this list command.
537
566
  - Output: `items` contains effective sources with stable `id`. `pendingDeletions` contains soft-deleted sources still included in the current successful version. `deletionMaintenance` is separate and may report already-published deletions awaiting cleanup. Paths, hashes, credentials, and source content are not returned.
538
567
  - Check `deletionProjection.state` and its `baseline` before interpreting deletion lists. `ready` with `pendingDeletions: []` means no pending deletion at that baseline. `changing`, `review_required`, or `unavailable` with `pendingDeletions: null` means undetermined; display the `reasonCode`, never turn null into an empty list. Legacy libraries without a verifiable complete publication manifest return unavailable until a real version is published.
539
568
  - A rollback creates a new current version. An older deletion receipt cannot override membership in that version. A later source deletion needs publication again.
@@ -580,3 +609,24 @@ Transport: `POST /agent/api/external/knowledge-bases/sources/check-updates`, bod
580
609
  - Gateway target: TBD; reuse an equivalent source update-check capability when available.
581
610
  - Review after: 2026-10-16.
582
611
  - Exit condition: once the Gateway exposes equivalent authorization and detector semantics, migrate the typed command to L2 or use L3 if it adds no value.
612
+
613
+
614
+ ### Submit an ordinary URL update check
615
+
616
+ ```bash
617
+ ae-cli kb source check-url-updates --name "Engineering Handbook" --id "<source-id>" --scope company --dry-run
618
+ ae-cli kb source check-url-updates --name "Engineering Handbook" --id "<source-id>" --scope company
619
+ ```
620
+
621
+ Only existing `sourceType=url`, `platform=custom`, compiled sources without pending updates qualify. The request is rejected while Wiki/Schema compilation or input preparation is active. Success returns `{accepted:true,sourceId}` and only means accepted. It has no final counts, task ID, checking state, wait mode or completion query. Read `kb +list-sources` for update markers; unchanged state cannot distinguish execution, no change, failure or a discarded result. When marked changed, explicitly run the existing incremental compile. Feishu continues to use synchronous `source check-updates`.
622
+
623
+ Transport: `POST /agent/api/external/knowledge-bases/sources/check-url-updates`, body `{name,sourceId,scope?}`. Dry-run previews without sending a request. Submission errors preserve the server error code, details and nonzero exit.
624
+
625
+ ### Admission record: source check-url-updates
626
+
627
+ - Transition status: transitional (this new KB external capability has no Gateway equivalent).
628
+ - Owning module: te-claude knowledge-base source management.
629
+ - Current transport: KB external REST through kbApi and CLI token.
630
+ - Gateway target: TBD; reuse an equivalent asynchronous ordinary URL source-check capability.
631
+ - Review after: 2026-10-24.
632
+ - Exit condition: when the Gateway provides equivalent authorization and asynchronous submission semantics, migrate to L2 if typed flags add value, otherwise use L3.
@@ -1,10 +1,10 @@
1
1
  # Knowledge-guided analysis workflow
2
2
 
3
3
  Use this workflow after knowledge-base retrieval when the pages will guide a
4
- project-scoped business data analysis. The knowledge base determines which
5
- saved asset to execute, which business definition applies, and which
6
- conclusions are out of bounds. Current values still require an `ae-analysis`
7
- data query.
4
+ project-scoped business data analysis. The knowledge base supplies candidate
5
+ assets, verified definitions, and decision boundaries. Check their coverage of
6
+ the user's original question before choosing execution. Current values still
7
+ require an `ae-analysis` data query; a related KB page is not task completion.
8
8
 
9
9
  This workflow does not define knowledge-base compilation rules. Do not use it
10
10
  to create, upload, generate a schema for, compile, or delete a knowledge base.
@@ -89,25 +89,33 @@ pages actually read:
89
89
  | Decision boundaries | Case-only, frontend-only, adoption-only, not revenue, non-generalizable, expired, conflicting, or human-decision-required constraints |
90
90
  | KB evidence | Exact KB name, page path, and section actually read |
91
91
 
92
- Classify the contract before querying:
92
+ Classify each candidate's coverage before querying. These states classify the
93
+ asset, not completion of the original task:
93
94
 
94
95
  - `executable`: exact asset identity and semantics cover the question, with no
95
96
  unresolved conflict.
96
- - `partially_executable`: evidence covers only some subquestions; query and
97
- answer only those parts.
97
+ - `partially_executable`: evidence covers only some subquestions; execute the
98
+ applicable parts and retain their results, then continue discovery for the
99
+ uncovered parts.
100
+ - `semantic_only`: read evidence supplies useful events, properties, or
101
+ limitations, but the candidate's definition cannot produce the requested
102
+ measure, entity, or scope. Retain that evidence and continue ordinary analysis.
98
103
  - `blocked`: a required asset, metric, aggregation, entity, filter, parameter,
99
- time rule, or decision boundary is missing or conflicting; stop the affected
100
- query and report the gap.
104
+ time rule, or decision boundary is missing or conflicting; do not execute
105
+ that unsupported definition. Continue discovery for the affected requirement
106
+ when an independently verified, authorized path remains possible.
101
107
 
102
108
  Do not fill a contract gap with general knowledge, a similarly named asset, or
103
- a technically valid query. When the task forbids clarification, return that the
104
- available evidence cannot answer the affected part instead of choosing an
105
- interpretation silently.
109
+ a technically valid query. Resolve missing evidence through the ordinary
110
+ analysis path below. If a material business choice remains ambiguous, request
111
+ that choice once; if clarification is forbidden, disclose the unresolved part
112
+ instead of choosing silently. Do not ask the user to authorize continuation of
113
+ the same read-only data request merely because the KB covers only part of it.
106
114
 
107
115
  ## Execute the exact saved-asset chain
108
116
 
109
- An exact asset identified by a source page takes priority over fuzzy search and
110
- ad-hoc analysis:
117
+ An exact, semantically applicable asset identified by a source page takes
118
+ priority over fuzzy search and ad-hoc analysis:
111
119
 
112
120
  1. For a dashboard ID, call `analysis dashboard get` once with the verified
113
121
  project ID. Verify its name, child reports, `effective_settings`,
@@ -116,6 +124,10 @@ ad-hoc analysis:
116
124
  2. For a report ID, call `analysis report get` with the verified project ID.
117
125
  Verify its model, metric, aggregation, dimensions, filters, saved parameters,
118
126
  and time definition before querying data.
127
+ Definition inspection that establishes an unsuitable saved asset does not
128
+ require a data query to prove the mismatch. Record the incompatible fields
129
+ and continue ordinary discovery; do not execute a known wrong definition
130
+ merely to satisfy an attempt-first rule.
119
131
  3. Read the matching `ae-analysis` data-command reference before execution. Use
120
132
  [`report_data_run.md`](../../ae-analysis/references/report_data_run.md) for a
121
133
  bounded saved report result and
@@ -131,9 +143,9 @@ ad-hoc analysis:
131
143
  `ae-analysis`.
132
144
  6. For a metric or another saved asset, use its exact identity and corresponding
133
145
  command. Never replace it with a same-name object.
134
- 7. Use the saved-asset discovery procedure from `ae-analysis` only when the KB
135
- page provides no exact identity. A discovered candidate still requires
136
- semantic equality, not title similarity.
146
+ 7. Use the saved-asset discovery procedure from `ae-analysis` when the KB
147
+ provides no suitable executable identity or leaves requirements uncovered.
148
+ A discovered candidate still requires semantic coverage, not title similarity.
137
149
 
138
150
  If the user asks for multiple groupings that one saved dynamic report supports,
139
151
  execute that same report once per required parameter variant. Keep the common
@@ -142,9 +154,11 @@ identical data command merely to inspect output that was locally truncated;
142
154
  capture or export the complete result through the supported data command.
143
155
 
144
156
  The statement "the KB contains definitions but not current values" means that
145
- the matched saved asset must be attempted first. It does not authorize jumping
146
- directly to a reconstructed SQL or ad-hoc query. If the attempt cannot produce
147
- a usable result, follow the explicit ordinary-analysis fallback below.
157
+ an exact, semantically applicable saved asset must be attempted first. It does
158
+ not require executing a related but unsuitable asset, nor authorize skipping
159
+ saved-asset discovery directly to SQL. If inspection establishes a mismatch or
160
+ execution cannot produce the requested result, follow the ordinary-analysis
161
+ fallback below.
148
162
 
149
163
  When the live definition agrees with the KB, use the query result as data
150
164
  evidence and the KB page as routing, semantic, and boundary evidence.
@@ -173,9 +187,10 @@ definition or hide it with a replacement query.
173
187
 
174
188
  ## Fall back without hiding the knowledge-base result
175
189
 
176
- None of these conditions alone authorizes an ad-hoc or SQL reconstruction:
190
+ These conditions require the state-specific handling and ordinary-analysis
191
+ checks below; none alone establishes a verified ad-hoc or SQL definition:
177
192
 
178
- - The exact saved asset has not yet been attempted.
193
+ - An applicable exact saved asset has not yet been attempted.
179
194
  - The exact saved asset returns an empty result.
180
195
  - The exact asset has a validation, transport, capability, or definition
181
196
  execution failure.
@@ -200,8 +215,8 @@ Handle these states without changing the contract:
200
215
  the input mapping allowed by its saved definition. Do not translate the report
201
216
  into SQL.
202
217
  - Partial success: retain successful saved-asset results and apply these rules
203
- independently to each failed part. Do not discard valid sub-results or replace
204
- the whole request with one reconstructed query.
218
+ independently to each failed or semantically uncovered part. Do not discard
219
+ valid sub-results or replace the whole request with one reconstructed query.
205
220
  - Permission denial: preserve the denied asset, error, and request ID. Do not
206
221
  retry the denied operation or use an undocumented lower-level API. The
207
222
  ordinary analysis fallback may still use another standard `ae-analysis`
@@ -222,8 +237,9 @@ Handle these states without changing the contract:
222
237
  may answer under a different, independently verified definition, but it must
223
238
  not claim to resolve the KB asset's conflict or present the result as
224
239
  definition-equivalent.
225
- - Fixed historical window: answer only for that window. If it cannot answer a
226
- current-period question, state that it cannot be extrapolated.
240
+ - Fixed historical window: do not extrapolate its values to the requested
241
+ period. If the window cannot be overridden, inspect alternatives through
242
+ ordinary analysis instead of presenting that window as the requested result.
227
243
  - Limited applicability: keep the conclusion within the declared scope. Do not
228
244
  expand adoption into revenue or intent, one module into the whole product, or
229
245
  one case into all customers.
@@ -234,25 +250,34 @@ applicable scope is not an equivalent validation.
234
250
 
235
251
  ## Degrade to the ordinary analysis path
236
252
 
237
- The KB path is preferred, not exclusive. If the exact KB-selected asset cannot
238
- produce the requested live result after a real attempt, continue as though no
239
- executable KB asset had been found and follow the ordinary `ae-analysis`
240
- "Existing business asset before ad-hoc" workflow:
253
+ The KB path is preferred, not exclusive. If definition inspection establishes
254
+ that the KB-selected asset cannot cover the request, or a real execution attempt
255
+ cannot produce the requested live result, continue through the ordinary
256
+ `ae-analysis` "Existing business asset before ad-hoc" workflow. Preserve the KB
257
+ evidence and already verified definitions; do not restart from zero:
241
258
 
242
259
  1. Search for another accessible saved report or dashboard whose current live
243
260
  definition covers the request.
244
- 2. Verify semantic equality before using it. A title match is not enough.
245
- 3. If no saved definition matches, use ad-hoc analysis only when the normal
261
+ 2. Compare live definitions with the original request, including distinctions
262
+ such as creation versus creation-and-editing, user versus customer, and
263
+ event count versus distinct entity count. A title match is not enough.
264
+ 3. Follow [`metadata_resolution.md`](../../ae-analysis/references/metadata_resolution.md)
265
+ for uncovered definitions. Reuse verified KB and live-asset evidence; discover
266
+ only missing metadata, filters, dimensions, or scope. A missing descriptive
267
+ field does not invalidate independently supported action counts.
268
+ 4. If no saved definition matches, use authorized ad-hoc analysis only when the normal
246
269
  `ae-analysis` rules permit it and the required event, properties, metric,
247
270
  aggregation, entity, filters, time, and timezone can be established.
248
- 4. Use only documented standard capabilities. Each fallback command remains
271
+ 5. Use only documented standard capabilities. Each fallback command remains
249
272
  subject to the backend's independent authorization checks.
250
273
 
251
274
  Fallback is available when the KB-selected asset is missing from the live
252
275
  project, inaccessible, empty for the requested scope, outside its supported
253
- time or breakdown, or persistently fails after the documented correction or
254
- retry path. The user does not need to restate the original data request merely
255
- to allow this ordinary fallback.
276
+ time or breakdown, semantically unsuitable, missing requested fields or
277
+ submetrics, or persistently fails after the documented correction or retry
278
+ path. Technical success with a partial or wrong definition is also a coverage
279
+ gap, not a reason to stop. The user does not need to restate the original data
280
+ request merely to allow this ordinary fallback.
256
281
 
257
282
  Ad-hoc analysis must still satisfy the safety conditions below. SQL must also
258
283
  satisfy the additional SQL constraints in `ae-analysis`.
@@ -274,6 +299,18 @@ material difference from the KB-selected definition. Never claim that the KB
274
299
  asset produced a fallback result. An empty or denied KB result remains part of
275
300
  the audit record even when the fallback succeeds.
276
301
 
302
+ ## Check task completion
303
+
304
+ Before answering, check each requirement of the original question against the
305
+ actual definition and returned data. Finish when it is answered, or when bounded
306
+ discovery establishes a concrete unavailable prerequisite, authorization
307
+ boundary, or material choice requiring clarification. An asset state of
308
+ `semantic_only`, `partially_executable`, or `blocked` is not by itself a terminal
309
+ task state. Do not label creation-and-editing totals as pure creation, substitute
310
+ another entity, or stop at a KB limitation while verified metadata supports a
311
+ remaining authorized query. Keep genuine unknown fields unknown and label
312
+ partial results explicitly; do not broaden an empty result merely to get rows.
313
+
277
314
  ## Answer with traceable boundaries
278
315
 
279
316
  Make these three layers distinguishable in the final answer: