@thinkingai/ae-cli 6.1.16 → 6.1.18

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 (103) hide show
  1. package/README.md +5 -2
  2. package/README.zh.md +5 -2
  3. package/dist/{auth-2WTQOP77.js → auth-GBMV6TEJ.js} +3 -3
  4. package/dist/{auth-77BUFLGC.js → auth-ROB2EDYV.js} +12 -13
  5. package/dist/{capability-72DTW5M2.js → capability-DKMYUTLC.js} +50 -13
  6. package/dist/{capability-PJHNI4GJ.js → capability-HYVVPG25.js} +49 -12
  7. package/dist/chunk-3FY3RJ26.js +293 -0
  8. package/dist/{chunk-PTE56QPL.js → chunk-3KWQYGYI.js} +4 -0
  9. package/dist/{chunk-UOUS37JQ.js → chunk-4XXOWOTA.js} +3 -3
  10. package/dist/{chunk-GT46FPXN.js → chunk-BYYS3ANB.js} +17 -8
  11. package/dist/{chunk-YA6SMTXG.js → chunk-EFH4XWYC.js} +3 -3
  12. package/dist/{chunk-4SGZG4XY.js → chunk-J2DEBMRF.js} +9 -7
  13. package/dist/{chunk-LYVNONC4.js → chunk-JHENBQ5B.js} +35 -0
  14. package/dist/{chunk-VR3LCBHW.js → chunk-JRJY5DMJ.js} +5 -5
  15. package/dist/{chunk-ILIU36SU.js → chunk-OMPRXM3V.js} +3 -3
  16. package/dist/{chunk-VPKZ7I72.js → chunk-QNOLN2LJ.js} +2 -2
  17. package/dist/{chunk-SAU3QFIQ.js → chunk-QZ3AS4KK.js} +3 -3
  18. package/dist/chunk-RJDU7NYP.js +1198 -0
  19. package/dist/{chunk-4KVPKXFX.js → chunk-RNAALWJK.js} +2 -2
  20. package/dist/{chunk-C4MGVGJW.js → chunk-SERWF6G5.js} +1 -1
  21. package/dist/{chunk-RGKJGKT7.js → chunk-Y3LOALAV.js} +5 -5
  22. package/dist/{chunk-P3FGXJTU.js → chunk-ZQ47LWTI.js} +4 -4
  23. package/dist/chunk-ZQKDZXDO.js +317 -0
  24. package/dist/{client-TKG4WBHN.js → client-L2YDMHQ6.js} +5 -4
  25. package/dist/{community-report-client-FI4LNVYS.js → community-report-client-C7WDGET3.js} +1 -2
  26. package/dist/{config-RE6CMGPK.js → config-BMYZX2UE.js} +7 -6
  27. package/dist/{data-integration-2MYMANJI.js → data-integration-QEKDWQDY.js} +1741 -212
  28. package/dist/index.js +131 -1241
  29. package/dist/{local-data-upload-client-BWHSUQQK.js → local-data-upload-client-4YYHSYD6.js} +1 -2
  30. package/dist/{memory-CHRU2F7W.js → memory-3ORCR7JH.js} +6 -6
  31. package/dist/{memory-YK33G4T7.js → memory-I2WXDTV2.js} +5 -5
  32. package/dist/{metadata-XXR34N5P.js → metadata-I4C2EWUN.js} +10 -10
  33. package/dist/{metadata-UILXHBWF.js → metadata-VUOQJE26.js} +9 -9
  34. package/dist/{model-NR3JHFSJ.js → model-HLHIEFMU.js} +5 -5
  35. package/dist/{model-K3KLWIW6.js → model-UGRDX4MW.js} +6 -6
  36. package/dist/personal-semantic-preference-LIPACBDX.js +239 -0
  37. package/dist/personal-semantic-preference-OEISBRHM.js +239 -0
  38. package/dist/project-semantic-FFPWFPIW.js +1114 -0
  39. package/dist/project-semantic-RT3R2VQD.js +1114 -0
  40. package/dist/{sync-FCKOVWWS.js → sync-HKIOZXQE.js} +6 -6
  41. package/dist/{sync-DAVKYVMW.js → sync-TFHU2UTG.js} +7 -7
  42. package/dist/{te-agent-HLW4VTQK.js → te-agent-BR6VDBNX.js} +9 -8
  43. package/dist/{te-agent-4BKBODMF.js → te-agent-VLYOV7S4.js} +8 -7
  44. package/dist/{te-analysis-ZMNGOVNW.js → te-analysis-4YGQL5RC.js} +437 -38
  45. package/dist/{te-analysis-O6DCO6BS.js → te-analysis-7VUNUYWZ.js} +436 -37
  46. package/dist/{te-community-HLC43QKH.js → te-community-5DMNKJWY.js} +5 -5
  47. package/dist/{te-community-6HPBWJUZ.js → te-community-ISDQWJU7.js} +6 -6
  48. package/dist/{te-dataops-HDRUXY4K.js → te-dataops-6P5IKWNJ.js} +8 -7
  49. package/dist/{te-dataops-EJP56W3K.js → te-dataops-CVULXNVB.js} +7 -6
  50. package/dist/{te-engage-RAK5PESW.js → te-engage-KZPR5R22.js} +9 -9
  51. package/dist/{te-engage-FGBGQ4IY.js → te-engage-N5WI32H6.js} +8 -8
  52. package/dist/{te-experiment-SO5MPDMJ.js → te-experiment-6BITX4RD.js} +226 -8
  53. package/dist/{te-experiment-VZF7BT6G.js → te-experiment-UVR4HLND.js} +227 -9
  54. package/dist/{te-kb-APXBWBDY.js → te-kb-RCLSSH2Q.js} +251 -127
  55. package/dist/{te-system-Z77IKZFN.js → te-system-FXITO2JG.js} +5 -5
  56. package/dist/{te-system-YARIK4S5.js → te-system-K2GYMCTB.js} +6 -6
  57. package/dist/{te-team-EFKWYKMK.js → te-team-ADOC2ROP.js} +6 -6
  58. package/dist/{update-OGPSZM5A.js → update-YCYCKJOO.js} +7 -6
  59. package/package.json +2 -1
  60. package/skills/ae-agent/SKILL.md +3 -4
  61. package/skills/ae-agent/references/edit-skill.md +3 -0
  62. package/skills/ae-agent/references/get-skill-content.md +1 -1
  63. package/skills/ae-agent/references/rescan-skills.md +15 -13
  64. package/skills/ae-agent/references/upload-skill.md +7 -4
  65. package/skills/ae-analysis/SKILL.md +45 -4
  66. package/skills/ae-analysis/metadata_resolution.md +38 -4
  67. package/skills/ae-analysis/references/analysis_data_retrieval.md +29 -0
  68. package/skills/ae-analysis/references/asset_authentication_export.md +22 -0
  69. package/skills/ae-analysis/references/asset_authentication_list.md +18 -14
  70. package/skills/ae-analysis/references/asset_authentication_update.md +29 -14
  71. package/skills/ae-analysis/references/command_index.md +17 -9
  72. package/skills/ae-analysis/references/dashboard_get.md +18 -1
  73. package/skills/ae-analysis/references/dashboard_update.md +3 -0
  74. package/skills/ae-analysis/references/personal_semantic_preference_add.md +23 -0
  75. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +17 -0
  76. package/skills/ae-analysis/references/personal_semantic_preference_get.md +19 -0
  77. package/skills/ae-analysis/references/personal_semantic_preference_list.md +21 -0
  78. package/skills/ae-analysis/references/personal_semantic_preference_update.md +19 -0
  79. package/skills/ae-data-integration/SKILL.md +23 -4
  80. package/skills/ae-data-integration/references/custom-layer.md +93 -0
  81. package/skills/ae-data-integration/references/error-handling.md +92 -0
  82. package/skills/ae-data-integration/references/handoff.md +77 -18
  83. package/skills/ae-data-integration/references/local-analysis.md +1 -1
  84. package/skills/ae-data-integration/references/reuse.md +9 -5
  85. package/skills/ae-data-integration/references/sink-upload.md +1 -1
  86. package/skills/ae-data-integration/references/source-inspect.md +32 -13
  87. package/skills/ae-data-integration/references/tracking-plan.md +7 -5
  88. package/skills/ae-data-integration/references/transform.md +10 -10
  89. package/skills/ae-data-integration/references/ue-mapping.md +33 -11
  90. package/skills/ae-engage/references/build-task-save-guide.md +9 -0
  91. package/skills/ae-engage/references/save-task.md +82 -0
  92. package/skills/ae-experiment/SKILL.md +8 -2
  93. package/skills/ae-experiment/references/manage_feature_whitelist.md +66 -0
  94. package/skills/ae-experiment/references/manage_guardrail_metrics.md +26 -0
  95. package/skills/ae-experiment/references/save_experiment.md +1 -1
  96. package/skills/ae-kb/SKILL.md +56 -51
  97. package/skills/ae-kb/references/query-workflow.md +112 -0
  98. package/skills/ae-kb-discovery/SKILL.md +105 -0
  99. package/skills/ae-project-semantic/SKILL.md +193 -0
  100. package/skills/ae-project-semantic/references/query-routing-v5.md +165 -0
  101. package/skills/ae-project-semantic/references/recommendation-quality.md +68 -0
  102. package/dist/chunk-QGM4M3NI.js +0 -37
  103. package/dist/chunk-ZZUOD757.js +0 -598
@@ -426,6 +426,11 @@ When the guide points to event-based completion or experiment-driven main-goal r
426
426
  Read `fieldRules.blocks.controlConfig.completionIndicatorDef.filterPropertySelectTypes` and exclude
427
427
  every property type listed under `excluded` before constructing its `filters`.
428
428
 
429
+ For a main goal (`completionIndicatorType=0`), always include `touch_cycle_num` and
430
+ `touch_cycle_num_unit`. If the user does not request another completion window, use
431
+ `touch_cycle_num=1` and `touch_cycle_num_unit="day"`. Static Capability validation may accept a
432
+ main goal without these fields, but the Hermes save service rejects it.
433
+
429
434
  Important constraints that still apply:
430
435
 
431
436
  - `doNotDisturb.enableDoNotDisturb=true` requires `startTime` and `endTime` in `HH:mm`
@@ -444,6 +449,81 @@ compatibility field, and partial task updates preserve the existing server value
444
449
  client-side condition has no semantic field in the current contract, stop and report that it cannot
445
450
  be safely authored through this Capability.
446
451
 
452
+ ### 4.7 Verified A/B Task Template
453
+
454
+ Use this shape as the starting point for a server-channel split experiment. Replace every
455
+ placeholder with metadata discovered from the current project.
456
+
457
+ ```json
458
+ {
459
+ "baseInfo": {
460
+ "taskName": "<taskName>",
461
+ "taskDesc": "<taskDescription>",
462
+ "tzOffset": "<projectTimezoneOrDefaultSentinel>"
463
+ },
464
+ "channelConfig": {
465
+ "channelType": 1,
466
+ "channelId": "<verifiedChannelId>",
467
+ "groupContentList": [
468
+ {
469
+ "expGroupName": "Control",
470
+ "expGroupType": 1,
471
+ "percentageInExperiment": 50,
472
+ "order": 0,
473
+ "contentList": [{ "pushLanguageCode": "default", "content": "<channelContentJsonString>" }]
474
+ },
475
+ {
476
+ "expGroupName": "Experiment A",
477
+ "expGroupType": 2,
478
+ "percentageInExperiment": 50,
479
+ "order": 1,
480
+ "contentList": [{ "pushLanguageCode": "default", "content": "<channelContentJsonString>" }]
481
+ }
482
+ ]
483
+ },
484
+ "targetConfig": {
485
+ "targetClusterType": 1,
486
+ "definitionRequest": "<semanticAudienceDefinition>"
487
+ },
488
+ "triggerConfig": { "triggerType": 2 },
489
+ "controlConfig": {
490
+ "completionIndicatorDef": {
491
+ "completionIndicators": [
492
+ {
493
+ "completionIndicatorType": 0,
494
+ "touch_cycle_num": 1,
495
+ "touch_cycle_num_unit": "day",
496
+ "eventDefinition": {
497
+ "type": "event",
498
+ "event": "<verifiedGoalEvent>",
499
+ "aggregation": "count",
500
+ "operator": "gte",
501
+ "value": 1
502
+ }
503
+ }
504
+ ]
505
+ },
506
+ "frequencyLimits": { "enableFrequencyLimits": false, "ruleList": [] }
507
+ },
508
+ "expConfig": {
509
+ "enableExp": true,
510
+ "expType": 1,
511
+ "percentageInLayer": 100,
512
+ "expIndicatorBizType": 1,
513
+ "controlGroupSkipPush": false,
514
+ "expGroupList": [
515
+ { "expGroupName": "Control", "expGroupType": 1, "percentageInExperiment": 50, "order": 0 },
516
+ { "expGroupName": "Experiment A", "expGroupType": 2, "percentageInExperiment": 50, "order": 1 }
517
+ ]
518
+ }
519
+ }
520
+ ```
521
+
522
+ The experiment group tuple (`expGroupName`, `expGroupType`, `percentageInExperiment`, `order`)
523
+ must be identical between each `expConfig.expGroupList` entry and its corresponding
524
+ `channelConfig.groupContentList` entry. Validate the final request, save it, then call `task get`
525
+ and verify both persisted lists; a successful task ID alone is not sufficient verification.
526
+
447
527
  ---
448
528
 
449
529
  ## 5. Final Self-Check Before `engage-task task save`
@@ -461,6 +541,8 @@ Before submission, verify:
461
541
  9. No unsupported `triggerType=6` is used.
462
542
  10. Ordered steps contain `eventDefinition` and sequence metadata, not persisted aggregate fields.
463
543
  11. No placeholder IDs or fabricated resource names remain in the request.
544
+ 12. Every main goal includes `touch_cycle_num` and `touch_cycle_num_unit`.
545
+ 13. For experiments, `expGroupList` and `groupContentList` contain identical group tuples.
464
546
 
465
547
  ---
466
548
 
@@ -56,6 +56,7 @@ Naming and response boundary:
56
56
  - `experiment feature save`
57
57
  - `experiment metric save`
58
58
  3. Create or patch the experiment draft with `experiment experiment save`.
59
+ Use `experiment experiment update-metrics` when replacing metric bindings or assigning guardrail roles.
59
60
  4. Check readiness with `experiment experiment ready-check`.
60
61
  5. For a non-mutex traffic layer, run `experiment experiment conflict-check` before submit (needs `feature_key_list` from context or `experiment get`).
61
62
  6. Move status with `experiment experiment manage`.
@@ -66,6 +67,7 @@ If an experiment save returns `error_code: METRIC_NOT_FOUND`, list metrics for t
66
67
  ## Parameter Conventions
67
68
 
68
69
  - Experiment save payloads distinguish two allocation fields: experiment-level `req.allocation` (**integer only; no decimals**) and group-level `req.groups[].allocation` (**integer only; sum must equal `100` exactly**).
70
+ - Public experiment metric roles are `primary`, `secondary`, and `guardrail`. The internal `observation` role is currently unavailable for saves. Guardrail is a binding role; updating metrics replaces the full binding list.
69
71
 
70
72
  ```bash
71
73
  ae-cli experiment experiment get --project-id 1 --exp-id exp_123
@@ -92,7 +94,9 @@ Read [`save_build_guide.md`](references/save_build_guide.md) and
92
94
 
93
95
  ### Experiment
94
96
 
95
- `experiment experiment save`, `capability run experiment.experiment.save-submit`, `experiment experiment list`, `experiment experiment list-archived`, `experiment experiment get`, `experiment experiment ready-check`, `experiment experiment conflict-check`, `experiment experiment manage`, `experiment experiment update-group`, `experiment experiment batch-delete`, `experiment operation-log query`
97
+ `experiment experiment save`, `experiment experiment update-metrics`, `capability run experiment.experiment.save-submit`, `experiment experiment list`, `experiment experiment list-archived`, `experiment experiment get`, `experiment experiment ready-check`, `experiment experiment conflict-check`, `experiment experiment manage`, `experiment experiment update-group`, `experiment experiment batch-delete`, `experiment operation-log query`
98
+
99
+ Read [`manage_guardrail_metrics.md`](references/manage_guardrail_metrics.md) before assigning or replacing metric roles.
96
100
 
97
101
  ### Traffic Layer and Buckets
98
102
 
@@ -104,4 +108,6 @@ Read [`save_build_guide.md`](references/save_build_guide.md) and
104
108
 
105
109
  ### Metric and Feature
106
110
 
107
- `experiment metric save`, `experiment metric get`, `experiment metric list`, `experiment metric delete`, `experiment feature save`, `experiment feature update-status`, `experiment feature get`, `experiment feature list`, `experiment feature version-list`, `experiment feature operation-log query`, `experiment feature batch-delete`
111
+ `experiment metric save`, `experiment metric get`, `experiment metric list`, `experiment metric delete`, `experiment feature save`, `experiment feature update-status`, `experiment feature get`, `experiment feature list`, `experiment feature version-list`, `experiment feature operation-log query`, `experiment feature batch-delete`, `experiment feature whitelist list`, `experiment feature whitelist save`, `experiment feature whitelist update-status`, `experiment feature whitelist batch-delete`
112
+
113
+ Read [`manage_feature_whitelist.md`](references/manage_feature_whitelist.md) before querying or changing Feature whitelist rules.
@@ -0,0 +1,66 @@
1
+ # Feature Whitelist Rules
2
+
3
+ List, create, modify, enable, disable, or delete explicit Feature whitelist rules.
4
+
5
+ ## List
6
+
7
+ ```bash
8
+ ae-cli experiment feature whitelist list \
9
+ --project-id <id> --feature-key <feature_key>
10
+ ```
11
+
12
+ The result contains only explicit whitelist rules for the Feature. Each item exposes `rule_id`,
13
+ `feature_key`, `priority`, `status`, and a structured snake-case `whitelist` array. Use the returned
14
+ `rule_id` for modification, status changes, or deletion.
15
+
16
+ ## Save
17
+
18
+ ```bash
19
+ ae-cli experiment feature whitelist save \
20
+ --project-id <id> \
21
+ --feature-key <feature_key> \
22
+ --status enable \
23
+ --whitelist '[{"bucket_id":"#user_id","rules":[{"ids":["u1","u2"],"value":"on"}]}]'
24
+ ```
25
+
26
+ Pass `--rule-id` to modify an existing whitelist rule. Omit it to create a rule. The Hermes
27
+ Capability fixes the Atlas rule type to `targeting` and serializes the supplied buckets into the
28
+ server's explicit whitelist rule configuration.
29
+
30
+ Rules:
31
+
32
+ - Resolve the Feature with `experiment feature get` before writing.
33
+ - `bucket_id` is the split subject, such as `#user_id` or `#account_id`.
34
+ - Each bucket contains one or more rows with a non-empty `ids` array and a string `value`.
35
+ - An empty string Feature value is allowed. Bucket IDs cannot be empty or duplicated. IDs must be
36
+ unique within one bucket, while different buckets may use the same string ID.
37
+ - The server validates each value against the Feature type and limits the total ID count.
38
+ - Only one explicit whitelist rule can be enabled for the same Feature.
39
+ - Enabling, modifying, disabling, or deleting an enabled whitelist rule immediately creates a new
40
+ version and syncs RCC when the Feature itself is online.
41
+
42
+ ## Status
43
+
44
+ ```bash
45
+ ae-cli experiment feature whitelist update-status \
46
+ --project-id <id> --rule-id <rule_id> --status enable
47
+ ```
48
+
49
+ Valid status transitions exposed by this command are `enable` and `disable`.
50
+
51
+ ## Delete
52
+
53
+ ```bash
54
+ ae-cli experiment feature whitelist batch-delete \
55
+ --project-id <id> --rule-ids '["0001"]'
56
+ ```
57
+
58
+ Deletion is high risk and requires confirmation. Enabled whitelist rules may be deleted; Hermes
59
+ resynchronizes affected online Features afterward.
60
+
61
+ All four commands use Capability Gateway with CLI-token authentication:
62
+
63
+ - `experiment.feature_whitelist.list`
64
+ - `experiment.feature_whitelist.save`
65
+ - `experiment.feature_whitelist.update_status`
66
+ - `experiment.feature_whitelist.batch_delete`
@@ -0,0 +1,26 @@
1
+ # experiment experiment update-metrics
2
+
3
+ Replace the metric bindings of an existing experiment draft and assign metric roles, including
4
+ guardrail metrics.
5
+
6
+ ```bash
7
+ ae-cli experiment experiment update-metrics \
8
+ --project-id <id> \
9
+ --exp-id <exp_id> \
10
+ --metrics '[{"metricId":"conversion","metricRole":"primary"},{"metricId":"error_rate","metricRole":"guardrail"}]'
11
+ ```
12
+
13
+ ## Contract
14
+
15
+ - Discover every `metricId` with `experiment metric list`; never invent metric IDs.
16
+ - `--metrics` must be a non-empty array. Each item requires camelCase `metricId` and `metricRole`.
17
+ - `metricRole` is one of `primary`, `secondary`, or `guardrail`. Do not submit the internal
18
+ `observation` role; Hermes currently rejects it at save boundaries.
19
+ - This command replaces all saved metric bindings because Hermes treats a non-empty `metrics` list
20
+ in a draft patch as a replacement. Include bindings that must remain, not only the new guardrail.
21
+ - Guardrail is a binding role, not a separate metric type. Create the underlying metric first with
22
+ `experiment metric save` when it does not exist.
23
+ - At least one `primary` metric is still required before readiness succeeds.
24
+
25
+ Run with `--dry-run` first, then verify the persisted roles with `experiment experiment get` and
26
+ run `experiment experiment ready-check`.
@@ -104,7 +104,7 @@ ae-cli experiment experiment save --project-id 1 --req '{"expId":"exp_123","allo
104
104
  - `expCycle.cycleType` can be `day` or `sample`; when `cycleType=day`, `dayNum` is `1..90`. Blank cycle defaults to day + 30.
105
105
  - Before readiness, `groups` must be non-empty, contain exactly one control group (`isControl=1`), group allocations must sum to exactly `100`, and each `expGroupValue` must be a non-empty JSON string array.
106
106
  - Feature experiments must bind `featureKeyList` before readiness. `featureKeyList` contains Feature key strings, not Feature objects. The MCP currently supports one `featureKey` for feature experiments.
107
- - Metrics use `metricRole=primary|secondary|guardrail|observation`; before readiness at least one primary metric is required.
107
+ - Metrics use `metricRole=primary|secondary|guardrail`; the internal `observation` role is currently unavailable for saves. Before readiness at least one primary metric is required.
108
108
  - `targeting` replaces the saved targeting object when provided.
109
109
  - Custom audience QP must be supplied as the semantic object
110
110
  `targeting.definitionRequest`. Do not submit the internal `targeting.targetConfig`
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ae-kb
3
3
  version: 1.0.0
4
- description: "AE/TE knowledge base CLI manual for creating, querying, LLM-powered ask, listing accessible knowledge bases, deterministic index/grep/read retrieval, checking status, uploading, compiling, schema generation, URL sources, source deletion, and knowledge base deletion. Use when the user asks to manage TE/AE/ThinkingEngine knowledge bases, upload documents or URLs to a knowledge base, query knowledge, ask knowledge bases with an LLM, list accessible knowledge bases, 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. Must use ae-cli kb commands and must not guess knowledge base names, scopes, page paths, source display names, JSON payload shapes, or URL formats."
4
+ description: "AE/TE knowledge base CLI manual for creating, querying, LLM-powered ask, listing accessible knowledge bases, deterministic index/grep/read retrieval, checking status, uploading, compiling, schema generation, URL sources, source deletion, and knowledge base deletion. Use when the user asks to manage TE/AE/ThinkingEngine knowledge bases, upload documents or URLs to a knowledge base, query knowledge, ask knowledge bases with an LLM, list accessible knowledge bases, 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 display names, JSON payload shapes, or URL formats."
5
5
  ---
6
6
 
7
7
  # ae-kb
@@ -15,25 +15,27 @@ ae-cli kb +<command> [options]
15
15
  ## Global Rules
16
16
 
17
17
  - Use this skill for TE/AE knowledge base tasks: create, query, ask with LLM, list accessible knowledge bases, inspect indexes, grep pages, read pages, check status, upload sources, add URL sources, generate schema, compile, remove source files, and delete knowledge bases.
18
+ - **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.**
18
19
  - 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.
19
20
  - Prefer `--dry-run` before destructive or broad writes when the user has not already validated the target.
20
21
  - Do not invent knowledge base names, scopes, source display names, or JSON payloads. Ask the user or query known context when values are missing.
22
+ - 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.
21
23
  - JSON flags must be valid JSON strings, usually wrapped in single quotes in shell commands.
22
24
  - Successful commands return JSON by default. Use `--format table` only when a table is easier for a human to scan. Envelope may include optional `_notice.host_compat`.
23
25
  - `--host <url>` overrides the active AE host. It is available on every command and may be placed after the subcommand, e.g. `ae-cli kb +<command> --host <url>`.
24
26
  - **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
- - For external-agent retrieval, prefer the deterministic flow `+index` -> `+grep` -> `+read`: inspect navigation, locate candidate pages, then open the exact page or line window. Use `+ask` only when the user wants an LLM-synthesized answer and accepts token consumption.
27
+ - Retrieval (`+index` / `+grep` / `+read`) is deterministic and server-side LLM-free; use it for simple factual lookups. Use `+ask` when the question requires synthesizing across multiple pages or multi-hop reasoning.
26
28
 
27
29
  ## Commands
28
30
 
29
31
  | Command | Risk | Purpose |
30
32
  |---|---:|---|
31
- | `+query` | read | Query one or more knowledge bases with a natural-language question. |
32
- | `+ask` | read | LLM-powered Q&A over knowledge bases. Consumes platform tokens. |
33
+ | `+ask` | read | LLM-powered Q&A over knowledge bases; for multi-page synthesis or multi-hop questions. |
34
+ | `+ask-status` | read | Query the current status of an ask execution by `--execution-id` without polling. |
33
35
  | `+list` | read | List accessible knowledge bases filtered by buildStatus (default: compiled). |
34
36
  | `+index` | read | List accessible knowledge bases and their `index.md` navigation maps. |
35
37
  | `+grep` | read | Keyword-search knowledge base pages and return matched lines with context. |
36
- | `+read` | read | Read a full knowledge base page or a line window. |
38
+ | `+read` | read | Read a full knowledge base page, a line window, or (with `--outline`) only the page heading tree. |
37
39
  | `+new` | write | Create a new personal or company knowledge base. |
38
40
  | `+add` | write | Upload local files, a non-recursive directory, or HTTP(S) pages converted to markdown. |
39
41
  | `+url` | write | Upload a URL source directly with optional display name and parsing instruction. |
@@ -95,7 +97,7 @@ ae-cli kb +url \
95
97
  --parse-instruction "Keep headings and code blocks"
96
98
  ```
97
99
 
98
- `--url` must be `http(s)`.
100
+ `--url` must be `http(s)`. The server detects the platform from the URL automatically: URLs on a `*.feishu.cn` or `*.larksuite.com` subdomain are parsed with the Feishu pipeline (including sub-documents, using the server's own Feishu parsing instruction — `--parse-instruction` is ignored for them); all other URLs are fetched as regular web pages.
99
101
 
100
102
  ### Generate Schema and Compile
101
103
 
@@ -123,34 +125,26 @@ Use `+status` to inspect the current status of a knowledge base.
123
125
  ae-cli kb +status --name engineering-handbook
124
126
  ```
125
127
 
126
- ### Query Knowledge
127
-
128
- Use `+query` with a natural-language question. Optionally scope to specific knowledge bases or tune result count and locale.
129
-
130
- ```bash
131
- ae-cli kb +query \
132
- --query "How do we release a dashboard?" \
133
- --sources '[{"scope":"company","name":"engineering-handbook"}]' \
134
- --top-k 10 \
135
- --locale zh
136
- ```
137
-
138
- When `--sources` is provided, each entry requires:
139
-
140
- - `scope`: knowledge base scope such as `personal` or `company`.
141
- - `name`: knowledge base name.
142
-
143
128
  ### Ask Knowledge (LLM)
144
129
 
145
- Use `+ask` when the user wants an LLM-synthesized answer. This endpoint calls a large language model and **consumes platform tokens**. Prefer `+index` -> `+grep` -> `+read` when deterministic retrieval is enough.
130
+ Use `+ask` when the question requires synthesizing across multiple pages or multi-hop reasoning — a server-side agent runs the full retrieval loop and returns a synthesized answer with its source paths. Prefer `+index` -> `+grep` -> `+read` when deterministic retrieval is enough.
131
+
132
+ The `+ask` command uses asynchronous submit/poll: by default, it automatically polls for completion (every 5s, up to 10 minutes) and prints the final answer. The output JSON is isomorphic to the previous synchronous response, so consumers require no changes.
146
133
 
147
134
  ```bash
135
+ # Default: submit and poll for completion
148
136
  ae-cli kb +ask \
149
137
  --question "How do we troubleshoot payment alerts?" \
150
138
  --sources '[{"scope":"company","name":"engineering-handbook"}]' \
151
139
  --model-id claude-sonnet-4-6 \
152
140
  --max-turns 50 \
153
141
  --locale zh
142
+
143
+ # Submit only, return executionId immediately (for batch processing)
144
+ ae-cli kb +ask --question "..." --no-wait
145
+
146
+ # Query execution status later
147
+ ae-cli kb +ask-status --execution-id <id>
154
148
  ```
155
149
 
156
150
  - `--question`, alias `-q`: required natural-language question (1-2000 characters).
@@ -158,10 +152,12 @@ ae-cli kb +ask \
158
152
  - `--model-id`: optional LLM model ID. Omit to use the platform default.
159
153
  - `--max-turns`: optional agent turn limit (1-100, server default 50).
160
154
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
155
+ - `--no-wait`: optional boolean flag. Return immediately after submission with `{executionId, status}`, without polling.
156
+ - **Failure handling**: If execution fails, the command exits non-zero and prints an error message on stderr prefixed with the typed error code, e.g. `[timeout] ...` / `[model_error] ...` / `[invalid_sources] ...` (followed by the executionId). Treat the bracketed code as the machine-readable failure type.
161
157
 
162
158
  ### List Accessible Knowledge Bases
163
159
 
164
- Use `+list` when you only need accessible knowledge base metadata without loading `index.md` navigation maps. By default it returns knowledge bases with `buildStatus: compiled`:
160
+ Use `+list` when you only need accessible knowledge base metadata without loading `index.md` navigation maps. Omit `--build-status` to default to `compiled`; pass `idle` / `pending` / `compiling` / `compiled` / `failed` to filter by a specific status (system knowledge bases are always listed regardless of status):
165
161
 
166
162
  ```bash
167
163
  ae-cli kb +list
@@ -173,6 +169,8 @@ ae-cli kb +list --build-status compiled
173
169
 
174
170
  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.
175
171
 
172
+ **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.
173
+
176
174
  Start with `+list` or `+index` to discover accessible knowledge bases. Use `+index` when you also need navigation maps:
177
175
 
178
176
  ```bash
@@ -190,26 +188,30 @@ Then use `+grep` to locate likely pages and line numbers:
190
188
  ae-cli kb +grep \
191
189
  --query "sandbox configuration" \
192
190
  --sources '[{"scope":"company","name":"engineering-handbook"}]' \
191
+ --paths '["wiki/sandbox.md"]' \
193
192
  --top-k 10
194
193
  ```
195
194
 
196
- Finally use `+read` to open the exact page, optionally with a line window:
195
+ Each grep hit carries `path`, `line`, `breadcrumb`, a context snippet, and the section range of the matched line (`sectionStartLine` / `sectionEndLine`). `line` is the hit anchor; `sectionStartLine` / `sectionEndLine` are the enclosing heading-section boundaries. Choose the smallest reliable `--offset` / `--limit` window that preserves the needed evidence; use the section range when the answer needs whole-section context.
196
+
197
+ Use `+read --outline` when the current target page has no reliable grep range and headings are needed to choose a section:
197
198
 
198
199
  ```bash
199
200
  ae-cli kb +read \
200
201
  --source '{"scope":"company","name":"engineering-handbook"}' \
201
202
  --path "wiki/sandbox.md" \
202
- --offset 1 \
203
- --limit 200
203
+ --outline
204
204
  ```
205
205
 
206
- Retrieval rules:
206
+ Then use `+read` to open the selected window, using the hit anchor, a section boundary from same-page or linked-page grep, or two adjacent outline headings:
207
207
 
208
- - `+list` accepts optional `--build-status` (default `compiled`) and `--locale`. Returns accessible knowledge base metadata including `buildStatus`, without `index.md` navigation maps.
209
- - `+index` accepts optional `--sources` and `--locale`; omit `--sources` to list all accessible knowledge bases.
210
- - `+grep` requires `--query` / `-q`; optional `--sources`, `--top-k` (1-50, default 10), and `--locale`.
211
- - `+read` requires `--source` pointing to exactly one knowledge base and `--path` relative to the knowledge base root; optional `--offset`, `--limit` (1-10000), and `--locale`.
212
- - Do not guess a `--path`; get it from `+index` or `+grep` results.
208
+ ```bash
209
+ ae-cli kb +read \
210
+ --source '{"scope":"company","name":"engineering-handbook"}' \
211
+ --path "wiki/sandbox.md" \
212
+ --offset 42 \
213
+ --limit 60
214
+ ```
213
215
 
214
216
  ### Remove One Source
215
217
 
@@ -233,29 +235,29 @@ ae-cli kb +remove --name engineering-handbook
233
235
 
234
236
  ## Command Reference
235
237
 
236
- ### `+query`
238
+ ### `+ask`
237
239
 
238
240
  ```bash
239
- ae-cli kb +query --query "<question>" [--sources '[{"scope":"company","name":"kb-name"}]'] [--top-k 10] [--locale zh|en|ja|ko]
241
+ ae-cli kb +ask --question "<question>" [--sources '[{"scope":"company","name":"kb-name"}]'] [--model-id claude-sonnet-4-6] [--max-turns 50] [--locale zh|en|ja|ko] [--no-wait]
240
242
  ```
241
243
 
242
- - `--query`, alias `-q`: required natural-language question.
244
+ - `--question`, alias `-q`: required natural-language question (1-2000 characters).
243
245
  - `--sources`: optional JSON array of knowledge base refs. Omit to search all accessible knowledge bases.
244
- - `--top-k`: optional max number of hits, 1-50, default 10.
246
+ - `--model-id`: optional LLM model ID. Omit to use the platform default.
247
+ - `--max-turns`: optional agent turn limit (1-100, server default 50).
245
248
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
249
+ - `--no-wait`: optional. Return immediately with `{executionId, status}` instead of polling.
250
+ - When to use: multi-page synthesis or multi-hop questions. For simple factual lookups, prefer `+index` / `+grep` / `+read`.
251
+ - Output: By default, polls and returns `{executionId, answer, sources, modelUsage, toolCallCount, maxTurns, modelId}` (same fields as the previous synchronous response, plus `executionId`). With `--no-wait`, returns `{executionId, status}` immediately. On failure, exits non-zero with a stderr message prefixed by the typed error code (`[timeout]`, `[model_error]`, `[invalid_sources]`, `[process_restart]`).
246
252
 
247
- ### `+ask`
253
+ ### `+ask-status`
248
254
 
249
255
  ```bash
250
- ae-cli kb +ask --question "<question>" [--sources '[{"scope":"company","name":"kb-name"}]'] [--model-id claude-sonnet-4-6] [--max-turns 50] [--locale zh|en|ja|ko]
256
+ ae-cli kb +ask-status --execution-id <id>
251
257
  ```
252
258
 
253
- - `--question`, alias `-q`: required natural-language question (1-2000 characters).
254
- - `--sources`: optional JSON array of knowledge base refs. Omit to search all accessible knowledge bases.
255
- - `--model-id`: optional LLM model ID. Omit to use the platform default.
256
- - `--max-turns`: optional agent turn limit (1-100, server default 50).
257
- - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
258
- - **Token cost**: this command invokes an LLM on the server and consumes platform tokens. Prefer `+index` -> `+grep` -> `+read` for token-free deterministic retrieval.
259
+ - `--execution-id`: required. The execution ID returned by `+ask` submission.
260
+ - Output: Returns the current execution state: `{executionId, status, elapsedMs?, answer?, sources?, modelUsage?, toolCallCount?, error?}`. Does not poll; returns a single snapshot.
259
261
 
260
262
  ### `+list`
261
263
 
@@ -263,7 +265,7 @@ ae-cli kb +ask --question "<question>" [--sources '[{"scope":"company","name":"k
263
265
  ae-cli kb +list [--build-status compiled] [--locale zh|en|ja|ko]
264
266
  ```
265
267
 
266
- - `--build-status`: optional build status filter (default: `compiled`).
268
+ - `--build-status`: optional; one of `idle` / `pending` / `compiling` / `compiled` / `failed`. Omit to default to `compiled` (system knowledge bases are always listed regardless of status).
267
269
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
268
270
  - Response items include `buildStatus`.
269
271
 
@@ -279,24 +281,27 @@ ae-cli kb +index [--sources '[{"scope":"company","name":"kb-name"}]'] [--locale
279
281
  ### `+grep`
280
282
 
281
283
  ```bash
282
- ae-cli kb +grep --query "<keywords>" [--sources '[{"scope":"company","name":"kb-name"}]'] [--top-k 10] [--locale zh|en|ja|ko]
284
+ ae-cli kb +grep --query "<keywords>" --sources '[{"scope":"company","name":"kb-name"}]' --paths '["wiki/page.md"]' [--top-k 10] [--locale zh|en|ja|ko]
283
285
  ```
284
286
 
285
- - `--query`, alias `-q`: required keywords to search across knowledge bases.
286
- - `--sources`: optional JSON array of knowledge base refs. Omit to search all accessible knowledge bases.
287
+ - `--query`, alias `-q`: required keywords to search.
288
+ - `--sources`: required JSON array of knowledge base refs.
289
+ - `--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).
287
290
  - `--top-k`: optional max number of hits, 1-50, default 10.
288
291
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
292
+ - Each hit includes `sectionStartLine` / `sectionEndLine`: the line range of the section (bounded by the nearest headings) containing the matched line. Use it as the `+read` window.
289
293
 
290
294
  ### `+read`
291
295
 
292
296
  ```bash
293
- ae-cli kb +read --source '{"scope":"company","name":"kb-name"}' --path "index.md" [--offset 1] [--limit 200] [--locale zh|en|ja|ko]
297
+ ae-cli kb +read --source '{"scope":"company","name":"kb-name"}' --path "index.md" [--offset 1] [--limit 200] [--outline] [--locale zh|en|ja|ko]
294
298
  ```
295
299
 
296
300
  - `--source`: required JSON object pointing to exactly one knowledge base.
297
301
  - `--path`: required page path relative to the knowledge base root, such as `index.md` or `wiki/concepts/data-model.md`.
298
302
  - `--offset`: optional 1-based start line.
299
303
  - `--limit`: optional max line count, 1-10000.
304
+ - `--outline`: optional. Return only the whole-page heading tree (`{level, heading, line}`) with empty content, independent of `--offset` / `--limit`. Use it on long pages to choose which section to read.
300
305
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
301
306
 
302
307
  ### `+new`
@@ -0,0 +1,112 @@
1
+ # ae-kb deterministic query workflow
2
+
3
+ How to answer a knowledge question with the deterministic retrieval primitives
4
+ (`+list` / `+index` / `+grep` / `+read`) instead of `+ask`. Follow this order;
5
+ it is designed to reach the right section in a few calls and to avoid crawling a
6
+ page line by line.
7
+
8
+ Use `+ask` when the question requires synthesizing across multiple pages or
9
+ multi-hop reasoning; simple factual lookups are served by the steps below.
10
+ Everything below is server-side LLM-free.
11
+
12
+ ## The loop
13
+
14
+ This picks up **after** `ae-kb-discovery` has listed accessible knowledge bases
15
+ and ranked candidates. Start here with a chosen candidate; scope every `+index`
16
+ / `+grep` / `+read` call to it with `--sources` / `--source`. If the candidate
17
+ turns out not to cover the question, go back to `ae-kb-discovery` for the next
18
+ candidate rather than searching everything blindly.
19
+
20
+ 1. **Index the candidate.** Call `+index --sources` with the discovery pick.
21
+ Use `index.md` for navigation, a fit check, and **query wording** — the real
22
+ terms in the index (product names, API identifiers, section titles) become
23
+ your `+grep` keywords.
24
+
25
+ **Done when:** you have the candidate's `index.md`, and a list of `wiki/...`
26
+ links you can **copy** (0 items still counts as done).
27
+
28
+ 2. **Grep copied paths.** Copy 1–3 `wiki/...` entries from the index (a page
29
+ such as `wiki/sandbox.md`, or a subdirectory such as `wiki/guides`). Call
30
+ `+grep` with the candidate `--sources` and the copied list as `--paths`. Search
31
+ with the index terms. If the first grep misses, rewrite the query **once**
32
+ using different index terms — still with this same `--paths` — then stop
33
+ rewriting.
34
+
35
+ **Done when:** you have hits, or you have rewritten once, or step 1 copied
36
+ 0 paths. Copied 0 paths → skip grep and `+read --outline` the likeliest
37
+ title page, or go back to discovery for the next candidate.
38
+
39
+ A grep hit gives both a hit anchor and its enclosing section range:
40
+
41
+ - `line` is the exact matched line. Use it as the anchor when the evidence
42
+ is local.
43
+ - `sectionStartLine` / `sectionEndLine` are the enclosing heading-section
44
+ boundaries. Use them when the answer needs the whole section context, or
45
+ as the maximum boundary when choosing a smaller window.
46
+ - `+read --offset` / `--limit` are the actual read window. Choose the
47
+ smallest reliable window that preserves the needed evidence; do not
48
+ shell-truncate with `| head`.
49
+
50
+ 3. **Choose the section locator.** Pick one locator for the current target
51
+ page:
52
+
53
+ - **Same-page grep hit:** choose a read window from the hit. For narrow
54
+ fact/table/code evidence, read a bounded window anchored at `line`; stay
55
+ within `sectionStartLine`–`sectionEndLine`. For section-level meaning,
56
+ field definitions, caveats, or rows that depend on the heading context,
57
+ read the section range with
58
+ `--offset sectionStartLine` and
59
+ `--limit sectionEndLine - sectionStartLine + 1`. If the first window is
60
+ too small, widen once up to the section range. Do not crawl by shifting
61
+ offsets line by line.
62
+ - **Linked or related page:** if you follow a catalog/detail/related link to
63
+ a different page, the old grep range no longer applies. If you have
64
+ concrete terms for that new page, run `+grep --paths '["<new-page>"]'`
65
+ scoped to that page and use the new hit range.
66
+ - **No reliable range:** if the new page has no concrete grep terms, its
67
+ grep misses, or headings are needed to choose the right section, call
68
+ `+read --outline` for that page. It returns only the heading tree
69
+ (`{level, heading, line}`), independent of any offset/limit window, with
70
+ empty content.
71
+
72
+ A bare `+read` without `--offset` / `--limit` is only acceptable after the
73
+ response proves the whole page was returned (`startLine: 1`,
74
+ `endLine: totalLines`, and `truncated: false`).
75
+
76
+ **Done when:** you have a reliable range from the same-page grep hit, a new
77
+ page grep hit, an outline-derived heading range, or a complete untruncated
78
+ page response.
79
+
80
+ 4. **Read the selected window.** Read the selected window in one call. Windows
81
+ come from the hit anchor, the grep hit's section boundaries, or two adjacent
82
+ outline headings (`heading.line` of the target section to `heading.line - 1`
83
+ of the next). If a window turns out too small, widen to the section boundary
84
+ in one more call.
85
+
86
+ **Done when:** the needed evidence is in context without shell truncation,
87
+ or the page response is complete and untruncated.
88
+
89
+ 5. **Assess coverage, then answer or iterate.** Map the user's question into
90
+ subquestions and check each one against the sections you actually read. If a
91
+ subquestion is covered, answer with citations (knowledge base + page path +
92
+ section). If a gap remains, go back to step 2 with another set of `--paths`
93
+ **copied** from the index, or return to discovery for the next candidate.
94
+ If the evidence is missing after the allowed search, say which subquestion is
95
+ not covered instead of filling it from memory.
96
+
97
+ **Done when:** every answered subquestion is supported by read sections, or
98
+ the remaining gaps are explicitly reported as missing evidence.
99
+
100
+ ## Anti-pattern: same-page offset crawling
101
+
102
+ The failure this workflow prevents: grep returns a line number, you `+read` a
103
+ tiny window around it, it is cut mid-evidence, so you nudge the window one line
104
+ at a time. That wastes calls and never shows page structure. Instead: use the
105
+ hit anchor, widen once up to the section boundary, or open `--outline` and read
106
+ the selected heading range.
107
+
108
+ ## Related
109
+
110
+ - Command flags and JSON shapes: see the `+grep` / `+read` sections in
111
+ [`../SKILL.md`](../SKILL.md).
112
+ - Use `+ask` for multi-page synthesis or multi-hop questions. Default `+ask` submits then polls until the answer is ready; `--no-wait` and `+ask-status` are for batch submit/retrieve. See the `+ask` section in [`../SKILL.md`](../SKILL.md).