@moda-ai/cli 1.55.40 → 1.55.42

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 (28) hide show
  1. package/dist/{agent-ck6y31n2.js → agent-86hghww1.js} +4 -4
  2. package/dist/{cli-f1jfrqgf.js → cli-4sy4tytm.js} +218 -15
  3. package/dist/{cli-4tg0hkbz.js → cli-he8csgsr.js} +6 -6
  4. package/dist/{cli-ypqwcf9n.js → cli-hjm9151g.js} +2 -2
  5. package/dist/{cli-7bn406mt.js → cli-mxfyq5nq.js} +1 -1
  6. package/dist/{cli-a8nxbtpk.js → cli-srwzar82.js} +2 -2
  7. package/dist/{cli-azage7s0.js → cli-vwpbspr5.js} +2 -2
  8. package/dist/cli.js +172 -37
  9. package/dist/{doctor-p8sp6cbk.js → doctor-c05njdv8.js} +3 -3
  10. package/dist/{fix-0r974yge.js → fix-aghp304m.js} +1 -1
  11. package/dist/{harness-github-actions-2qc4gg2w.js → harness-github-actions-112503xs.js} +2 -2
  12. package/dist/{harness-72ejenza.js → harness-vabp33ak.js} +2 -2
  13. package/dist/{index-w7v472w4.js → index-dtxvvcq2.js} +5 -5
  14. package/dist/{production-intelligence-hs2sm8t5.js → production-intelligence-e5vsc6cw.js} +140 -27
  15. package/dist/{prompt-attribution-3987hhqz.js → prompt-attribution-pbns1ya3.js} +2 -2
  16. package/dist/prompt-source-mcp.js +2 -2
  17. package/dist/{prompts-ab-gmd10n5d.js → prompts-ab-f5qrvpkt.js} +3 -3
  18. package/dist/{prompts-propose-q626zmm4.js → prompts-propose-jg2j41wx.js} +3 -3
  19. package/dist/{prompts-ysm9ra72.js → prompts-qppk0mhp.js} +2 -2
  20. package/dist/{registry-7xz09ry0.js → registry-8a1940sr.js} +1 -1
  21. package/dist/{skills-x6yszxxn.js → skills-sh93b156.js} +2 -2
  22. package/dist/{sync-trjzvam9.js → sync-0pp1c8hs.js} +4 -4
  23. package/package.json +1 -1
  24. package/skills/integration/index.json +2 -2
  25. package/skills/moda-cli/SKILL.md +4 -3
  26. package/skills/moda-cli/references/commands.md +4 -1
  27. package/skills/moda-cli/references/dashboard-parity.md +4 -2
  28. package/skills/moda-cli/references/production-intelligence.md +5 -1
package/dist/cli.js CHANGED
@@ -34,6 +34,7 @@ import {
34
34
  import {
35
35
  AuditSchema,
36
36
  BOOK_PROBLEM_SORTS,
37
+ CLUSTER_COHORT_TIME_RANGES,
37
38
  COMMAND_FLAG_SPECS,
38
39
  DETECTION_VERDICTS,
39
40
  DREAM_PROBLEM_SORTS,
@@ -68,6 +69,7 @@ import {
68
69
  kebabFlag,
69
70
  manifestFlagFields,
70
71
  renderFlagHelp,
72
+ runCohortCommand,
71
73
  runProblemReopenCommand,
72
74
  runSignalsManagementCommand,
73
75
  runUserCommand,
@@ -79,7 +81,7 @@ import {
79
81
  unknownSignalsSubcommandError,
80
82
  usageLine,
81
83
  writeDryRun
82
- } from "./cli-f1jfrqgf.js";
84
+ } from "./cli-4sy4tytm.js";
83
85
  import {
84
86
  ApiError,
85
87
  callControlAPI,
@@ -1453,6 +1455,69 @@ var CANONICAL_LEAVES = [
1453
1455
  summary: "One tool: calls, recorded schema and payload fields, usage over time, top failure categories",
1454
1456
  examples: ["moda tools get <tool_name>", "moda tools get <tool_name> --days-back=30 --full"]
1455
1457
  },
1458
+ {
1459
+ noun: "cohorts",
1460
+ verb: "list",
1461
+ path: "cohorts list",
1462
+ args: "",
1463
+ handler: "cohort-list",
1464
+ summary: "Built-in and saved user cohorts with their refs and definitions (the dashboard Users page)",
1465
+ examples: ["moda cohorts list", "moda cohorts list --include-archived"]
1466
+ },
1467
+ {
1468
+ noun: "cohorts",
1469
+ verb: "get",
1470
+ path: "cohorts get",
1471
+ args: "<ref>",
1472
+ handler: "cohort-get",
1473
+ summary: "One cohort: name, definition and revision (ref: builtin:<key> or a saved cohort id)",
1474
+ examples: ["moda cohorts get builtin:power_users", "moda cohorts get <cohort_id>"]
1475
+ },
1476
+ {
1477
+ noun: "cohorts",
1478
+ verb: "fields",
1479
+ path: "cohorts fields",
1480
+ args: "",
1481
+ handler: "cohort-fields",
1482
+ summary: "The fields and operators a cohort definition can use",
1483
+ examples: ["moda cohorts fields"]
1484
+ },
1485
+ {
1486
+ noun: "cohorts",
1487
+ verb: "preview",
1488
+ path: "cohorts preview",
1489
+ args: "",
1490
+ handler: "cohort-preview",
1491
+ summary: "Member count and a sample of users for an unsaved definition",
1492
+ examples: ["moda cohorts preview --file=cohort.json", `moda cohorts preview --definition='{"version":1,"window":"30d","where":{"field":"tool_failure_count","op":"gte","value":3}}'`]
1493
+ },
1494
+ {
1495
+ noun: "cohorts",
1496
+ verb: "compare",
1497
+ path: "cohorts compare",
1498
+ args: "<cohort_a> <cohort_b>",
1499
+ handler: "cohort-compare",
1500
+ summary: "Two cohorts side by side: size, health, top topics and failure mix",
1501
+ examples: ["moda cohorts compare builtin:new_this_week builtin:power_users --days=30"]
1502
+ },
1503
+ {
1504
+ noun: "cohorts",
1505
+ verb: "create",
1506
+ path: "cohorts create",
1507
+ args: "",
1508
+ handler: "cohort-create",
1509
+ summary: "Save a cohort from a definition (write; --dry-run prints the request)",
1510
+ examples: ['moda cohorts create --name="Enterprise" --file=cohort.json --dry-run']
1511
+ },
1512
+ {
1513
+ noun: "cohorts",
1514
+ verb: "update",
1515
+ path: "cohorts update",
1516
+ args: "<cohort_id>",
1517
+ handler: "cohort-update",
1518
+ summary: "Edit a saved cohort: name, definition, description, pin, color (write; --dry-run)",
1519
+ examples: ['moda cohorts update <cohort_id> --file=cohort.json --note="exclude trials" --dry-run']
1520
+ },
1456
1521
  {
1457
1522
  noun: "review",
1458
1523
  verb: "",
@@ -1486,12 +1551,13 @@ var CANONICAL_LEAVES = [
1486
1551
  examples: ["moda skills push --dry-run", "moda skills push"]
1487
1552
  }
1488
1553
  ];
1489
- var CANONICAL_NOUNS = ["traces", "problems", "detections", "tools", "review", "reviews", "skills"];
1554
+ var CANONICAL_NOUNS = ["traces", "problems", "detections", "tools", "cohorts", "review", "reviews", "skills"];
1490
1555
  var NOUN_SUMMARIES = {
1491
1556
  traces: "Traces (agent runs): list, search, read, findings, world state, raw spans",
1492
1557
  problems: "Problems ranked by root cause, their evidence, impact and lifecycle",
1493
1558
  detections: "Detections of every family, and the tool failure leaderboard",
1494
1559
  tools: "The Tool catalog: every tool with calls and success rate, and one tool's schema, usage and failure categories",
1560
+ cohorts: "User cohorts: list, read, preview and compare them, and save or edit one; scope lists with --cohort",
1495
1561
  review: "Mark a detection a false positive, correct, or clear the mark",
1496
1562
  reviews: "List false-positive marks and detection reviews",
1497
1563
  skills: "Generate, pull, push, and install agent skills"
@@ -3175,31 +3241,31 @@ function leafManifestFields(leaf, commands) {
3175
3241
  import { fileURLToPath } from "url";
3176
3242
  import { realpathSync } from "fs";
3177
3243
  async function runPromptsCommand(...args) {
3178
- return (await import("./prompts-ysm9ra72.js")).runPromptsCommand(...args);
3244
+ return (await import("./prompts-qppk0mhp.js")).runPromptsCommand(...args);
3179
3245
  }
3180
3246
  async function runSkillsCommand(...args) {
3181
- return (await import("./skills-x6yszxxn.js")).runSkillsCommand(...args);
3247
+ return (await import("./skills-sh93b156.js")).runSkillsCommand(...args);
3182
3248
  }
3183
3249
  async function runFixCommand(...args) {
3184
- return (await import("./fix-0r974yge.js")).runFixCommand(...args);
3250
+ return (await import("./fix-aghp304m.js")).runFixCommand(...args);
3185
3251
  }
3186
3252
  async function runFixesCommand(...args) {
3187
- return (await import("./fix-0r974yge.js")).runFixesCommand(...args);
3253
+ return (await import("./fix-aghp304m.js")).runFixesCommand(...args);
3188
3254
  }
3189
3255
  async function runHarnessCommand(...args) {
3190
- return (await import("./harness-72ejenza.js")).runHarnessCommand(...args);
3256
+ return (await import("./harness-vabp33ak.js")).runHarnessCommand(...args);
3191
3257
  }
3192
3258
  async function runSyncCommand(...args) {
3193
- return (await import("./sync-trjzvam9.js")).runSyncCommand(...args);
3259
+ return (await import("./sync-0pp1c8hs.js")).runSyncCommand(...args);
3194
3260
  }
3195
3261
  async function runRegistryCommand(...args) {
3196
- return (await import("./registry-7xz09ry0.js")).runRegistryCommand(...args);
3262
+ return (await import("./registry-8a1940sr.js")).runRegistryCommand(...args);
3197
3263
  }
3198
3264
  async function runDoctorCommand(...args) {
3199
- return (await import("./doctor-p8sp6cbk.js")).runDoctorCommand(...args);
3265
+ return (await import("./doctor-c05njdv8.js")).runDoctorCommand(...args);
3200
3266
  }
3201
3267
  async function runStatusCommand(...args) {
3202
- return (await import("./doctor-p8sp6cbk.js")).runStatusCommand(...args);
3268
+ return (await import("./doctor-c05njdv8.js")).runStatusCommand(...args);
3203
3269
  }
3204
3270
  async function runAuthCommand(...args) {
3205
3271
  return (await import("./profile-commands-se9947c1.js")).runAuthCommand(...args);
@@ -3211,10 +3277,10 @@ async function runProfilesCommand(...args) {
3211
3277
  return (await import("./profile-commands-se9947c1.js")).runProfilesCommand(...args);
3212
3278
  }
3213
3279
  async function runAgentCommand(...args) {
3214
- return (await import("./agent-ck6y31n2.js")).runAgentCommand(...args);
3280
+ return (await import("./agent-86hghww1.js")).runAgentCommand(...args);
3215
3281
  }
3216
3282
  async function runProductionCommand(...args) {
3217
- return (await import("./production-intelligence-hs2sm8t5.js")).runProductionCommand(...args);
3283
+ return (await import("./production-intelligence-e5vsc6cw.js")).runProductionCommand(...args);
3218
3284
  }
3219
3285
  function parseArgs(argv) {
3220
3286
  const args = argv.slice(2);
@@ -3515,6 +3581,7 @@ Production data:
3515
3581
  clusters Browse or search topic clusters
3516
3582
  cluster-traces <node_id> List traces in a cluster
3517
3583
  users / user <user_id> End users with health and activity (the dashboard Users page)
3584
+ cohorts list|get|compare User cohorts; --cohort=<ref> scopes problems, traces, detections, clusters
3518
3585
  tail Live-tail new traces/detections as NDJSON (one line per item)
3519
3586
 
3520
3587
  Traces, Problems, detections, tools and review (moda <noun> --help lists the verbs):
@@ -4858,10 +4925,7 @@ async function runProblemsList(flags, context, command) {
4858
4925
  ...listVersionWarning(params, listVersion),
4859
4926
  ...truncated ? [`--limit=${limit} also capped ${Object.entries(truncated).map(([block, count]) => `${block} (${count} more)`).join(", ")}; raise --limit (max ${PROBLEMS_MAX_LIMIT}) or open dashboard_url for the rest.`] : []
4860
4927
  ];
4861
- context.output.writeData(withLink, {
4862
- ...warnings.length > 0 ? { warnings } : {},
4863
- ...nextCommands.length > 0 ? { nextCommands } : {}
4864
- });
4928
+ context.output.writeData(withLink, withCohortScope(params.cohort, payload, { warnings, nextCommands }));
4865
4929
  }
4866
4930
  function writeDreamProblemsList(context, params, dream, page) {
4867
4931
  const problems = Array.isArray(dream.problems) ? dream.problems : [];
@@ -4903,7 +4967,7 @@ function writeDreamProblemsList(context, params, dream, page) {
4903
4967
  ...!page.daysGiven && windowHours !== undefined ? [`Counts cover the dream run's window (${windowHours} hours), the dashboard's default range; pass --days-back to choose another.`] : [],
4904
4968
  ...listVersionWarning(params, listVersion)
4905
4969
  ];
4906
- context.output.writeData(data, { warnings, ...nextCommands.length > 0 ? { nextCommands } : {} });
4970
+ context.output.writeData(data, { warnings, ...withCohortScope(params.cohort, dream, { warnings, nextCommands }) });
4907
4971
  }
4908
4972
  var DREAM_INCIDENTS_DEFAULT_LIMIT = 3;
4909
4973
  async function runDreamProblem(params, context, command) {
@@ -5008,6 +5072,27 @@ function setTraceFilters(query2, params, keys) {
5008
5072
  query2.set(key, String(value));
5009
5073
  }
5010
5074
  }
5075
+ function cohortScope(cohort, data) {
5076
+ if (!cohort || cohort === "all")
5077
+ return { warnings: [] };
5078
+ if (asString(asRecord(data)?.cohort) !== cohort) {
5079
+ return {
5080
+ warnings: [`--cohort=${cohort} was sent, but the response does not confirm the cohort scope, so these results may cover every user.`]
5081
+ };
5082
+ }
5083
+ return { line: `Scoped to cohort ${cohort}: only its members' traces count (moda cohorts get ${shellArg(cohort)} shows who is in it).`, warnings: [] };
5084
+ }
5085
+ function withCohortScope(cohort, data, options = {}) {
5086
+ const scope = cohortScope(cohort, data);
5087
+ const summary = [options.summary, scope.line].filter(Boolean).join(" ");
5088
+ const warnings = [...options.warnings ?? [], ...scope.warnings];
5089
+ const merged = {
5090
+ ...summary ? { summary } : {},
5091
+ ...warnings.length > 0 ? { warnings } : {},
5092
+ ...options.nextCommands && options.nextCommands.length > 0 ? { nextCommands: options.nextCommands } : {}
5093
+ };
5094
+ return Object.keys(merged).length > 0 ? merged : undefined;
5095
+ }
5011
5096
  function countingSummary(data) {
5012
5097
  const record = asRecord(data);
5013
5098
  const counting = asString(record?.counting);
@@ -5702,8 +5787,11 @@ async function runCommand(command, positional, flags, positionals = positional ?
5702
5787
  case "clusters": {
5703
5788
  const args = flagsToArgs(flags);
5704
5789
  const params = parseSpecFlags("clusters", args, command);
5790
+ if (params.cohort && params.cohort !== "all" && params.time_range && !CLUSTER_COHORT_TIME_RANGES.includes(params.time_range)) {
5791
+ throw new CliInputError(`--cohort reads the Topics tree windows, so --time-range must be ${CLUSTER_COHORT_TIME_RANGES.join(", ")} (got ${params.time_range}). Nothing was sent.`);
5792
+ }
5705
5793
  if (params.search !== undefined || params.node_id !== undefined) {
5706
- rejectInapplicableFlags(command, params, ["parent_id", "time_range"], "to a cluster search (--search/--node-id); they page the cluster hierarchy");
5794
+ rejectInapplicableFlags(command, params, params.cohort ? ["parent_id"] : ["parent_id", "time_range"], "to a cluster search (--search/--node-id); they page the cluster hierarchy");
5707
5795
  const query3 = new URLSearchParams;
5708
5796
  if (params.search !== undefined)
5709
5797
  query3.set("q", params.search);
@@ -5713,11 +5801,15 @@ async function runCommand(command, positional, flags, positionals = positional ?
5713
5801
  query3.set("mode", params.mode);
5714
5802
  if (params.limit)
5715
5803
  query3.set("limit", params.limit.toString());
5804
+ if (params.cohort)
5805
+ query3.set("cohort", params.cohort);
5806
+ if (params.cohort && params.time_range)
5807
+ query3.set("time_range", params.time_range);
5716
5808
  const data2 = await callDataAPI(`/task-clusters/search?${query3.toString()}`);
5717
5809
  const record = asRecord(data2) ?? {};
5718
5810
  const matches = Array.isArray(record.matches) ? record.matches : [];
5719
- const warnings = params.node_id !== undefined && matches.length === 0 ? [`No cluster matched node id "${params.node_id}" for this search. ${NOT_FOUND_HINTS.cluster}`] : [];
5720
- context.output.writeData(data2, warnings.length > 0 ? { warnings } : undefined);
5811
+ const warnings = params.node_id !== undefined && matches.length === 0 ? [`No cluster matched node id "${params.node_id}" for this search${params.cohort ? " within the cohort" : ""}. ${NOT_FOUND_HINTS.cluster}`] : [];
5812
+ context.output.writeData(data2, withCohortScope(params.cohort, data2, { warnings }));
5721
5813
  break;
5722
5814
  }
5723
5815
  rejectInapplicableFlags(command, params, ["mode", "limit"], "without --search or --node-id; they shape a cluster search");
@@ -5726,9 +5818,11 @@ async function runCommand(command, positional, flags, positionals = positional ?
5726
5818
  query2.set("parent_id", params.parent_id);
5727
5819
  if (params.time_range)
5728
5820
  query2.set("time_range", params.time_range);
5821
+ if (params.cohort)
5822
+ query2.set("cohort", params.cohort);
5729
5823
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
5730
5824
  const data = await callDataAPI(`/clusters${queryString}`);
5731
- context.output.writeData(data);
5825
+ context.output.writeData(data, withCohortScope(params.cohort, data));
5732
5826
  break;
5733
5827
  }
5734
5828
  case "cluster-traces":
@@ -5775,6 +5869,8 @@ async function runCommand(command, positional, flags, positionals = positional ?
5775
5869
  query2.set("outcome", params.outcome);
5776
5870
  if (params.sort)
5777
5871
  query2.set("sort_by", params.sort);
5872
+ if (params.cohort)
5873
+ query2.set("cohort", params.cohort);
5778
5874
  if (params.limit)
5779
5875
  query2.set("limit", params.limit.toString());
5780
5876
  if (params.offset !== undefined)
@@ -5800,7 +5896,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
5800
5896
  }
5801
5897
  }
5802
5898
  searchWarnings.push(...traceStateWarnings(data));
5803
- const writeOptions = searchWarnings.length > 0 ? { warnings: searchWarnings } : undefined;
5899
+ const writeOptions = withCohortScope(params.cohort, raw, { warnings: searchWarnings });
5804
5900
  if (params.include_world_state === true) {
5805
5901
  const enriched = asRecord(data) ?? {};
5806
5902
  const list = Array.isArray(enriched.conversations) ? enriched.conversations : [];
@@ -5974,8 +6070,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
5974
6070
  setTraceFilters(query2, params, TRACE_GRAIN_FLAGS.frustrations);
5975
6071
  const data2 = await callDataAPI(`/emotions?${query2.toString()}`);
5976
6072
  const warnings = processingDisabledWarning(data2, "frustration");
5977
- const summary = countingSummary(data2);
5978
- context.output.writeData(data2, { ...summary ? { summary } : {}, ...warnings.length > 0 ? { warnings } : {} });
6073
+ context.output.writeData(data2, withCohortScope(params.cohort, data2, { summary: countingSummary(data2), warnings }));
5979
6074
  break;
5980
6075
  }
5981
6076
  if (params.user_id)
@@ -5998,7 +6093,12 @@ async function runCommand(command, positional, flags, positionals = positional ?
5998
6093
  case "tool-failures": {
5999
6094
  const args = flagsToArgs(flags);
6000
6095
  const params = parseSpecFlags("tool-failures", args, command);
6001
- const queryString = params.days_back ? `?days_back=${params.days_back}` : "";
6096
+ const tfQuery = new URLSearchParams;
6097
+ if (params.days_back)
6098
+ tfQuery.set("days_back", String(params.days_back));
6099
+ if (params.cohort)
6100
+ tfQuery.set("cohort", params.cohort);
6101
+ const queryString = tfQuery.toString() ? `?${tfQuery.toString()}` : "";
6002
6102
  const data = await callDataAPI(`/tool-failures${queryString}`);
6003
6103
  const daysBack = params.days_back ?? 7;
6004
6104
  const failing = (Array.isArray(asRecord(data)?.tools) ? asRecord(data).tools : []).map((row) => asString(asRecord(row)?.tool_name)).filter((name) => Boolean(name)).slice(0, TOOL_FAILURE_CATALOG_LINKS);
@@ -6006,7 +6106,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
6006
6106
  ...index === 0 ? [{ command: toolFailureExamplesCommand(name, daysBack), purpose: `Read failure examples of ${name}, the tool with the most failures.`, mutability: "read", requires_approval: false }] : [],
6007
6107
  { command: toolCatalogGetCommand(name, daysBack), purpose: `Calls, recorded schema, usage over time and failure categories of ${name}.`, mutability: "read", requires_approval: false }
6008
6108
  ]);
6009
- context.output.writeData(data, nextCommands.length > 0 ? { nextCommands } : undefined);
6109
+ context.output.writeData(data, withCohortScope(params.cohort, data, { nextCommands }));
6010
6110
  break;
6011
6111
  }
6012
6112
  case "tool-catalog": {
@@ -6403,7 +6503,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
6403
6503
  const params = parseSpecFlags("signal", args, command);
6404
6504
  const id = encodeURIComponent(params.id);
6405
6505
  if (params.detections !== true) {
6406
- rejectInapplicableFlags(command, params, ["days_back", "limit", "offset"], "to the signal summary; they page its hits (--detections)");
6506
+ rejectInapplicableFlags(command, params, ["days_back", "limit", "offset", "cohort"], "to the signal summary; they page its hits (--detections)");
6407
6507
  const data2 = await callDataAPI(`/custom-signals/${id}`);
6408
6508
  context.output.writeData(data2);
6409
6509
  break;
@@ -6415,10 +6515,12 @@ async function runCommand(command, positional, flags, positionals = positional ?
6415
6515
  query2.set("limit", params.limit.toString());
6416
6516
  if (params.offset !== undefined)
6417
6517
  query2.set("offset", params.offset.toString());
6518
+ if (params.cohort)
6519
+ query2.set("cohort", params.cohort);
6418
6520
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
6419
6521
  const data = await callDataAPI(`/custom-signals/${id}/detections${queryString}`);
6420
6522
  const warnings = customSignalProcessingWarning(data, "detections");
6421
- context.output.writeData(data, warnings.length > 0 ? { warnings } : undefined);
6523
+ context.output.writeData(data, withCohortScope(params.cohort, data, { warnings }));
6422
6524
  break;
6423
6525
  }
6424
6526
  case "trace-signals": {
@@ -6649,8 +6751,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
6649
6751
  setTraceFilters(query2, params, TRACE_GRAIN_FLAGS.emotions);
6650
6752
  const data2 = await callDataAPI(`/emotions?${query2.toString()}`);
6651
6753
  const warnings = processingDisabledWarning(data2, "emotion");
6652
- const summary2 = countingSummary(data2);
6653
- context.output.writeData(data2, { ...summary2 ? { summary: summary2 } : {}, ...warnings.length > 0 ? { warnings } : {} });
6754
+ context.output.writeData(data2, withCohortScope(params.cohort, data2, { summary: countingSummary(data2), warnings }));
6654
6755
  break;
6655
6756
  }
6656
6757
  if (params.user_id)
@@ -6690,8 +6791,10 @@ async function runCommand(command, positional, flags, positionals = positional ?
6690
6791
  if (params.family)
6691
6792
  query2.set("family", params.family);
6692
6793
  if (params.conversation_id) {
6693
- rejectInapplicableFlags(command, params, ["search", "status", "sort", "order"], "to one trace's detections (--conversation-id); they filter and order the trace list");
6794
+ rejectInapplicableFlags(command, params, ["search", "status", "sort", "order", "cohort"], "to one trace's detections (--conversation-id); they filter and order the trace list");
6694
6795
  }
6796
+ if (params.cohort)
6797
+ query2.set("cohort", params.cohort);
6695
6798
  if (params.search)
6696
6799
  query2.set("search", params.search);
6697
6800
  if (params.status)
@@ -6702,8 +6805,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
6702
6805
  query2.set("order", params.order);
6703
6806
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
6704
6807
  const data = await callDataAPI(`/laziness${queryString}`);
6705
- const summary = countingSummary(data);
6706
- context.output.writeData(data, summary ? { summary } : undefined);
6808
+ context.output.writeData(data, withCohortScope(params.cohort, data, { summary: countingSummary(data) }));
6707
6809
  break;
6708
6810
  }
6709
6811
  case "hallucinations": {
@@ -6729,8 +6831,7 @@ async function runCommand(command, positional, flags, positionals = positional ?
6729
6831
  }
6730
6832
  const queryString = query2.toString() ? `?${query2.toString()}` : "";
6731
6833
  const data = await callDataAPI(`/hallucinations${queryString}`);
6732
- const summary = countingSummary(data);
6733
- context.output.writeData(data, summary ? { summary } : undefined);
6834
+ context.output.writeData(data, withCohortScope(params.cohort, data, { summary: countingSummary(data) }));
6734
6835
  break;
6735
6836
  }
6736
6837
  case "step-scores": {
@@ -6919,7 +7020,7 @@ var commandRegistry = createCommandRegistry([
6919
7020
  resetApiRequestCountBeforeRun: true,
6920
7021
  telemetry: "result-and-error",
6921
7022
  handler: async (context) => {
6922
- const { runInit } = await import("./index-w7v472w4.js");
7023
+ const { runInit } = await import("./index-dtxvvcq2.js");
6923
7024
  if (context.outputMode === "agent-stream") {
6924
7025
  context.output.writeEvent({
6925
7026
  event: "started",
@@ -7233,6 +7334,40 @@ var commandRegistry = createCommandRegistry([
7233
7334
  telemetry: "result-and-error",
7234
7335
  handler: runUserCommand
7235
7336
  },
7337
+ {
7338
+ name: "cohorts",
7339
+ description: NOUN_SUMMARIES.cohorts,
7340
+ examples: [...leavesOf("cohorts").flatMap((leaf) => leaf.examples.slice(0, 1))],
7341
+ subcommands: treeSubcommandHelp("cohorts"),
7342
+ auth: "api-key",
7343
+ outputModes: ["human", "json", "agent"],
7344
+ mutability: "write",
7345
+ validateConfigBeforeRun: false,
7346
+ resetApiRequestCountBeforeRun: false,
7347
+ telemetry: "result-and-error",
7348
+ handler: canonicalNounHandler
7349
+ },
7350
+ ...[
7351
+ ["cohort-list", "Built-in and saved user cohorts", "read"],
7352
+ ["cohort-get", "One cohort: name, definition and revision", "read"],
7353
+ ["cohort-fields", "The fields and operators a cohort definition can use", "read"],
7354
+ ["cohort-preview", "Member count and sample users for an unsaved definition", "read"],
7355
+ ["cohort-compare", "Two cohorts side by side: size, health, top topics, failure mix", "read"],
7356
+ ["cohort-create", "Save a cohort from a definition", "write"],
7357
+ ["cohort-update", "Edit a saved cohort", "write"]
7358
+ ].map(([name, description, mutability]) => ({
7359
+ name,
7360
+ description,
7361
+ examples: [...CANONICAL_LEAVES.find((leaf) => leaf.handler === name)?.examples ?? []],
7362
+ hidden: true,
7363
+ auth: "api-key",
7364
+ outputModes: ["human", "json", "agent"],
7365
+ mutability,
7366
+ validateConfigBeforeRun: false,
7367
+ resetApiRequestCountBeforeRun: false,
7368
+ telemetry: "result-and-error",
7369
+ handler: runCohortCommand
7370
+ })),
7236
7371
  {
7237
7372
  name: "replays",
7238
7373
  description: "Read replay results: sets, run history, per-seed verdicts, and playout transcripts",
@@ -3,13 +3,13 @@ import {
3
3
  promptsDiscoveredCheck,
4
4
  runDoctorCommand,
5
5
  runStatusCommand
6
- } from "./cli-a8nxbtpk.js";
6
+ } from "./cli-srwzar82.js";
7
7
  import"./cli-pmzh2qjy.js";
8
- import"./cli-4tg0hkbz.js";
8
+ import"./cli-he8csgsr.js";
9
9
  import"./cli-mm48br00.js";
10
10
  import"./cli-xq45etg1.js";
11
11
  import"./cli-xddtv3yn.js";
12
- import"./cli-f1jfrqgf.js";
12
+ import"./cli-4sy4tytm.js";
13
13
  import"./cli-0xc5htv7.js";
14
14
  import"./cli-t0pb7qbs.js";
15
15
  import"./cli-k4tqwah4.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./cli-daqkdnm1.js";
6
6
  import {
7
7
  assertFlags
8
- } from "./cli-f1jfrqgf.js";
8
+ } from "./cli-4sy4tytm.js";
9
9
  import {
10
10
  callControlAPI
11
11
  } from "./cli-0xc5htv7.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  buildSourceSnapshot
3
- } from "./cli-azage7s0.js";
3
+ } from "./cli-vwpbspr5.js";
4
4
  import"./cli-xq45etg1.js";
5
5
  import"./cli-97fnztpy.js";
6
6
  import"./cli-cesds766.js";
7
7
  import"./cli-qpq84eee.js";
8
8
  import"./cli-xddtv3yn.js";
9
- import"./cli-f1jfrqgf.js";
9
+ import"./cli-4sy4tytm.js";
10
10
  import"./cli-0xc5htv7.js";
11
11
  import {
12
12
  recordApiRequest
@@ -40,7 +40,7 @@ import {
40
40
  writeHarnessAnalyzeResult,
41
41
  writeHarnessArtifacts,
42
42
  writeHumanProgress
43
- } from "./cli-azage7s0.js";
43
+ } from "./cli-vwpbspr5.js";
44
44
  import"./cli-xq45etg1.js";
45
45
  import"./cli-97fnztpy.js";
46
46
  import {
@@ -48,7 +48,7 @@ import {
48
48
  } from "./cli-cesds766.js";
49
49
  import"./cli-qpq84eee.js";
50
50
  import"./cli-xddtv3yn.js";
51
- import"./cli-f1jfrqgf.js";
51
+ import"./cli-4sy4tytm.js";
52
52
  import"./cli-0xc5htv7.js";
53
53
  import"./cli-t0pb7qbs.js";
54
54
  import"./cli-k4tqwah4.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildDoctorReport
3
- } from "./cli-a8nxbtpk.js";
3
+ } from "./cli-srwzar82.js";
4
4
  import {
5
5
  selectTenantAndCreateKey
6
6
  } from "./cli-1z1sx8dg.js";
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  agentsMdProblem,
22
22
  runSkillSync
23
- } from "./cli-7bn406mt.js";
23
+ } from "./cli-mxfyq5nq.js";
24
24
  import"./cli-qm5b1vck.js";
25
25
  import {
26
26
  detectAgents
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  initPrompts,
34
34
  runPromptSync
35
- } from "./cli-4tg0hkbz.js";
35
+ } from "./cli-he8csgsr.js";
36
36
  import"./cli-mm48br00.js";
37
37
  import {
38
38
  codingAgentDisplayName,
@@ -46,7 +46,7 @@ import {
46
46
  runCodingAgent,
47
47
  runHarnessCommand,
48
48
  startRemoteAnalyze
49
- } from "./cli-azage7s0.js";
49
+ } from "./cli-vwpbspr5.js";
50
50
  import {
51
51
  canonicalText,
52
52
  renderInitBanner,
@@ -63,7 +63,7 @@ import"./cli-qpq84eee.js";
63
63
  import {
64
64
  createCommandContext
65
65
  } from "./cli-xddtv3yn.js";
66
- import"./cli-f1jfrqgf.js";
66
+ import"./cli-4sy4tytm.js";
67
67
  import"./cli-0xc5htv7.js";
68
68
  import {
69
69
  VERSION,