@jupiterone/jupiterone-mcp 2.7.0 → 2.9.0

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 (143) hide show
  1. package/README.md +26 -10
  2. package/dist/client/graphql/mutations.d.ts +6 -0
  3. package/dist/client/graphql/mutations.d.ts.map +1 -1
  4. package/dist/client/graphql/mutations.js +37 -1
  5. package/dist/client/graphql/mutations.js.map +1 -1
  6. package/dist/client/graphql/queries.d.ts +16 -1
  7. package/dist/client/graphql/queries.d.ts.map +1 -1
  8. package/dist/client/graphql/queries.js +62 -1
  9. package/dist/client/graphql/queries.js.map +1 -1
  10. package/dist/client/jupiterone-client.d.ts +7 -0
  11. package/dist/client/jupiterone-client.d.ts.map +1 -1
  12. package/dist/client/jupiterone-client.js +19 -0
  13. package/dist/client/jupiterone-client.js.map +1 -1
  14. package/dist/client/services/criticality-service.d.ts +16 -0
  15. package/dist/client/services/criticality-service.d.ts.map +1 -0
  16. package/dist/client/services/criticality-service.js +72 -0
  17. package/dist/client/services/criticality-service.js.map +1 -0
  18. package/dist/client/services/rule-service.d.ts +11 -1
  19. package/dist/client/services/rule-service.d.ts.map +1 -1
  20. package/dist/client/services/rule-service.js +17 -0
  21. package/dist/client/services/rule-service.js.map +1 -1
  22. package/dist/generated/description-map.d.ts.map +1 -1
  23. package/dist/generated/description-map.js +428 -39
  24. package/dist/generated/description-map.js.map +1 -1
  25. package/dist/server/mcp-server.d.ts +10 -0
  26. package/dist/server/mcp-server.d.ts.map +1 -1
  27. package/dist/server/mcp-server.js +64 -1
  28. package/dist/server/mcp-server.js.map +1 -1
  29. package/dist/server/tools/compliance/attestations.d.ts.map +1 -1
  30. package/dist/server/tools/compliance/attestations.js +11 -10
  31. package/dist/server/tools/compliance/attestations.js.map +1 -1
  32. package/dist/server/tools/compliance/authoring.d.ts.map +1 -1
  33. package/dist/server/tools/compliance/authoring.js +36 -35
  34. package/dist/server/tools/compliance/authoring.js.map +1 -1
  35. package/dist/server/tools/compliance/controls.d.ts.map +1 -1
  36. package/dist/server/tools/compliance/controls.js +12 -11
  37. package/dist/server/tools/compliance/controls.js.map +1 -1
  38. package/dist/server/tools/compliance/exemptions.d.ts.map +1 -1
  39. package/dist/server/tools/compliance/exemptions.js +16 -15
  40. package/dist/server/tools/compliance/exemptions.js.map +1 -1
  41. package/dist/server/tools/compliance/framework.d.ts.map +1 -1
  42. package/dist/server/tools/compliance/framework.js +24 -23
  43. package/dist/server/tools/compliance/framework.js.map +1 -1
  44. package/dist/server/tools/compliance/graph.js +1 -1
  45. package/dist/server/tools/compliance/graph.js.map +1 -1
  46. package/dist/server/tools/compliance/requirements.d.ts.map +1 -1
  47. package/dist/server/tools/compliance/requirements.js +11 -10
  48. package/dist/server/tools/compliance/requirements.js.map +1 -1
  49. package/dist/server/tools/compliance/shared.d.ts +4 -32
  50. package/dist/server/tools/compliance/shared.d.ts.map +1 -1
  51. package/dist/server/tools/compliance/shared.js +11 -76
  52. package/dist/server/tools/compliance/shared.js.map +1 -1
  53. package/dist/server/tools/compliance/summary.d.ts.map +1 -1
  54. package/dist/server/tools/compliance/summary.js +16 -15
  55. package/dist/server/tools/compliance/summary.js.map +1 -1
  56. package/dist/server/tools/compliance/tests.d.ts.map +1 -1
  57. package/dist/server/tools/compliance/tests.js +26 -25
  58. package/dist/server/tools/compliance/tests.js.map +1 -1
  59. package/dist/server/tools/compliance/transitions.d.ts.map +1 -1
  60. package/dist/server/tools/compliance/transitions.js +15 -14
  61. package/dist/server/tools/compliance/transitions.js.map +1 -1
  62. package/dist/server/tools/criticality/context.d.ts +48 -0
  63. package/dist/server/tools/criticality/context.d.ts.map +1 -0
  64. package/dist/server/tools/criticality/context.js +90 -0
  65. package/dist/server/tools/criticality/context.js.map +1 -0
  66. package/dist/server/tools/criticality/index.d.ts +11 -0
  67. package/dist/server/tools/criticality/index.d.ts.map +1 -0
  68. package/dist/server/tools/criticality/index.js +15 -0
  69. package/dist/server/tools/criticality/index.js.map +1 -0
  70. package/dist/server/tools/criticality/ladder-delta.d.ts +86 -0
  71. package/dist/server/tools/criticality/ladder-delta.d.ts.map +1 -0
  72. package/dist/server/tools/criticality/ladder-delta.js +475 -0
  73. package/dist/server/tools/criticality/ladder-delta.js.map +1 -0
  74. package/dist/server/tools/criticality/levels-read.d.ts +43 -0
  75. package/dist/server/tools/criticality/levels-read.d.ts.map +1 -0
  76. package/dist/server/tools/criticality/levels-read.js +101 -0
  77. package/dist/server/tools/criticality/levels-read.js.map +1 -0
  78. package/dist/server/tools/criticality/read.d.ts +13 -0
  79. package/dist/server/tools/criticality/read.d.ts.map +1 -0
  80. package/dist/server/tools/criticality/read.js +214 -0
  81. package/dist/server/tools/criticality/read.js.map +1 -0
  82. package/dist/server/tools/criticality/resource.d.ts +35 -0
  83. package/dist/server/tools/criticality/resource.d.ts.map +1 -0
  84. package/dist/server/tools/criticality/resource.js +84 -0
  85. package/dist/server/tools/criticality/resource.js.map +1 -0
  86. package/dist/server/tools/criticality/schemas.d.ts +114 -0
  87. package/dist/server/tools/criticality/schemas.d.ts.map +1 -0
  88. package/dist/server/tools/criticality/schemas.js +99 -0
  89. package/dist/server/tools/criticality/schemas.js.map +1 -0
  90. package/dist/server/tools/criticality/update.d.ts +5 -0
  91. package/dist/server/tools/criticality/update.d.ts.map +1 -0
  92. package/dist/server/tools/criticality/update.js +243 -0
  93. package/dist/server/tools/criticality/update.js.map +1 -0
  94. package/dist/server/tools/index.d.ts.map +1 -1
  95. package/dist/server/tools/index.js +2 -0
  96. package/dist/server/tools/index.js.map +1 -1
  97. package/dist/server/tools/j1ql.d.ts.map +1 -1
  98. package/dist/server/tools/j1ql.js +69 -18
  99. package/dist/server/tools/j1ql.js.map +1 -1
  100. package/dist/server/tools/reference.d.ts +1 -1
  101. package/dist/server/tools/reference.d.ts.map +1 -1
  102. package/dist/server/tools/reference.js +2 -0
  103. package/dist/server/tools/reference.js.map +1 -1
  104. package/dist/server/tools/rule-preview-checks.d.ts +95 -0
  105. package/dist/server/tools/rule-preview-checks.d.ts.map +1 -0
  106. package/dist/server/tools/rule-preview-checks.js +380 -0
  107. package/dist/server/tools/rule-preview-checks.js.map +1 -0
  108. package/dist/server/tools/rule-preview.d.ts +98 -0
  109. package/dist/server/tools/rule-preview.d.ts.map +1 -0
  110. package/dist/server/tools/rule-preview.js +490 -0
  111. package/dist/server/tools/rule-preview.js.map +1 -0
  112. package/dist/server/tools/rules.d.ts +1 -1
  113. package/dist/server/tools/rules.d.ts.map +1 -1
  114. package/dist/server/tools/rules.js +245 -30
  115. package/dist/server/tools/rules.js.map +1 -1
  116. package/dist/server/tools/shared.d.ts +44 -0
  117. package/dist/server/tools/shared.d.ts.map +1 -0
  118. package/dist/server/tools/shared.js +95 -0
  119. package/dist/server/tools/shared.js.map +1 -0
  120. package/dist/server/tools/usage.d.ts +8 -1
  121. package/dist/server/tools/usage.d.ts.map +1 -1
  122. package/dist/server/tools/usage.js +170 -2
  123. package/dist/server/tools/usage.js.map +1 -1
  124. package/dist/server/tools/value-probe.d.ts +12 -1
  125. package/dist/server/tools/value-probe.d.ts.map +1 -1
  126. package/dist/server/tools/value-probe.js +39 -13
  127. package/dist/server/tools/value-probe.js.map +1 -1
  128. package/dist/types/jupiterone.d.ts +123 -5
  129. package/dist/types/jupiterone.d.ts.map +1 -1
  130. package/dist/utils/criticality-query.d.ts +97 -0
  131. package/dist/utils/criticality-query.d.ts.map +1 -0
  132. package/dist/utils/criticality-query.js +319 -0
  133. package/dist/utils/criticality-query.js.map +1 -0
  134. package/dist/utils/j1ql-filters.d.ts +3 -1
  135. package/dist/utils/j1ql-filters.d.ts.map +1 -1
  136. package/dist/utils/j1ql-filters.js +19 -7
  137. package/dist/utils/j1ql-filters.js.map +1 -1
  138. package/dist/utils/j1ql-validator.d.ts +2 -0
  139. package/dist/utils/j1ql-validator.d.ts.map +1 -1
  140. package/dist/utils/j1ql-validator.js +9 -2
  141. package/dist/utils/j1ql-validator.js.map +1 -1
  142. package/node_modules/dtrace-provider/build/Makefile +1 -1
  143. package/package.json +1 -1
@@ -41,6 +41,7 @@ Key results off each one's \`subjectId\`, not position. \`status\` is \`checked\
41
41
  - \`assetExposure: null\` means unknown, not "not internet-facing"; it is set only when a matched device carries an exposure classification.
42
42
  - A count is only as fresh as the scanner behind it; a feed that stopped months ago still reports its last findings. Drill in and check when they were last observed, with \`unifiedVulnerabilityId\` (the \`_id\` of this account's \`unified_entity\` for the CVE): \`FIND * WITH _id = '<unifiedVulnerabilityId>' THAT RELATES TO Finding AS f THAT RELATES TO (Host|Device|Domain) AS a RETURN a.displayName, a._type, f._type, f._beginOn ORDER BY f._beginOn DESC LIMIT 50\`. Keep the second hop restricted as shown, or control tests and alerts dominate it.
43
43
  - Ids are upper-cased before the lookup.
44
+ - Which affected devices matter most: break them down by the account's asset criticality levels (\`get-graph-context\` lists them): \`FIND UnifiedVulnerability WITH cveId = 'CVE-2021-44228' AS uv THAT IS Vulnerability WITH open = true THAT HAS (Host|Device) THAT IS UnifiedDevice AS ud RETURN ud.j1.criticality AS level, count(ud) AS devices\`. Devices with no level are unclassified, not unimportant.
44
45
 
45
46
  ## Access
46
47
 
@@ -239,7 +240,7 @@ Needs the Compliance (CCM) entitlement and framework create permission; an acces
239
240
 
240
241
  Full reference: get-reference topic framework-authoring
241
242
  `,
242
- "create-inline-question-rule.md": `Create an alert rule from an inline J1QL question: the query runs on a schedule and, when its condition holds, the actions fire (alert, email, Slack, Jira ticket, tag, webhook, S3). Test the query with \`execute-j1ql-query\` first; the rule stores it as written. Siblings: \`update-inline-question-rule\` replaces an existing rule, \`get-rule-details\` reads one, \`list-rules\` finds them, \`evaluate-rule\` runs one now. Vocabulary: rule, alert, monitor, notify, schedule, polling interval, condition, actions, labels.
243
+ "create-inline-question-rule.md": `Create an alert rule from an inline J1QL question: the query runs on a schedule and, when its condition holds, the actions fire (alert, email, Slack, Jira ticket, tag, webhook, S3). Test the query with \`execute-j1ql-query\` first; the rule stores it as written. Siblings: \`update-inline-question-rule\` replaces an existing rule, \`get-rule-details\` reads one, \`list-rules\` finds them, \`evaluate-rule\` runs one now, \`preview-rule-actions\` renders what its actions would send without saving. Vocabulary: rule, alert, monitor, notify, schedule, polling interval, condition, actions, labels.
243
244
 
244
245
  ## Payload
245
246
 
@@ -253,7 +254,11 @@ Full reference: get-reference topic framework-authoring
253
254
 
254
255
  ## Actions
255
256
 
256
- Types: \`SET_PROPERTY\`, \`CREATE_ALERT\`, \`SEND_EMAIL\`, \`TAG_ENTITIES\`, \`SEND_SLACK_MESSAGE\`, \`SEND_TO_S3\`, \`CREATE_JIRA_TICKET\`, \`WEBHOOK\` and \`FOR_EACH_ITEM\`, which runs nested actions once per entity. Always include \`CREATE_ALERT\`. \`SET_PROPERTY\` on \`alertLevel\` takes \`LOW\`, \`MEDIUM\`, \`HIGH\`, \`CRITICAL\` or \`INFO\`. Slack, S3 and Jira actions need an \`integrationInstanceId\`: find the definition with \`get-integration-definitions\`, list instances with \`get-integration-instances\`, and ask the user which. Ask for recipients, channels, project and wording before writing an action that notifies someone.
257
+ Types: \`SET_PROPERTY\`, \`CREATE_ALERT\`, \`SEND_EMAIL\`, \`TAG_ENTITIES\`, \`SEND_SLACK_MESSAGE\`, \`SEND_TO_S3\`, \`CREATE_JIRA_TICKET\`, \`WEBHOOK\` and \`FOR_EACH_ITEM\`, which runs nested actions once per entity. Always include \`CREATE_ALERT\`. \`SET_PROPERTY\` on \`alertLevel\` takes \`LOW\`, \`MEDIUM\`, \`HIGH\`, \`CRITICAL\` or \`INFO\`. Slack, S3 and Jira actions need an \`integrationInstanceId\`: find the definition with \`get-integration-definitions\`, list instances with \`get-integration-instances\`, and ask the user which. Ask for recipients, channels, project and wording before writing an action that notifies someone, and show the user what it will send with \`preview-rule-actions\` before creating the rule.
258
+
259
+ ## Critical assets
260
+
261
+ Scope a rule about critical assets by the account's asset criticality levels (\`j1.criticality\`, \`j1.normalizedCriticality\`; \`get-graph-context\` lists them), not by tags. A rename or reorder of the levels changes what the rule matches.
257
262
 
258
263
  ## Refusals and response
259
264
 
@@ -376,7 +381,7 @@ Full reference: get-reference topic framework-authoring
376
381
  `,
377
382
  "execute-j1ql-query.md": `Run a J1QL query against the account's asset graph and return its rows. Use it for any question
378
383
  about real inventory, findings, identities or relationships, and to prove a query before it goes
379
- into a widget or rule. Discover, then verify: \`list-entity-types\`, sample a type with
384
+ into a widget or rule. Discover, then verify: \`get-graph-context\`, sample a type with
380
385
  \`FIND <type> AS e RETURN e.* LIMIT 5\`, then run the finished query and confirm it returns rows.
381
386
  Relationship direction filters nothing; filter on the edge's own properties (\`rel.ingress = true\`).
382
387
  \`get-query-results\` collects a query still running. J1QL reads FIND, WITH, THAT, RETURN, count,
@@ -428,7 +433,34 @@ move simple filters from WHERE into indexed WITH, lower the LIMIT, traverse fewe
428
433
  identities and vulnerabilities and usually what the user means, so answer in unified terms. They
429
434
  relate only to their source entities; traverse through those for context.
430
435
 
436
+ ## Critical assets
437
+
438
+ An asset's business criticality is \`j1.criticality\` (its level's value) and
439
+ \`j1.normalizedCriticality\` (its rank, 0 most critical), set by the account's asset criticality
440
+ levels; filter on these, not tags. A query that reads them returns the levels as
441
+ \`assetCriticality\`.
442
+
431
443
  Full reference: get-reference topic j1ql-language or j1ql-discovery
444
+ `,
445
+ "get-asset-criticality.md": `Read the account's asset criticality config: its ordered levels (most critical first), the J1QL queries that place assets in each level, how many assets each level holds, and the latest runs that applied it. Use it before changing the config with \`update-asset-criticality\`, and to answer which assets are critical and why. The levels alone, without their queries, also come back on \`get-graph-context\`. Vocabulary: asset criticality, crown jewels, business impact, tiers, levels, critical assets.
446
+
447
+ ## How criticality works
448
+
449
+ Each level is filled by J1QL queries; an asset matching several levels gets the most critical. JupiterOne applies the config every hour and after every save, writing \`j1.criticality\` (the level's value, made from its name) and \`j1.normalizedCriticality\` (its rank, 0 most critical) onto each matched asset, any class, and removing them from assets no query matches. Levels feed the vulnerability risk score.
450
+
451
+ ## Outcomes
452
+
453
+ - \`configured\`: \`levels[]\` carries each level's \`name\`, \`slug\` (the value on assets), \`rank\`, \`multiplier\` (risk-score weight, null when unset), \`assetCount\`, \`appliedAs\` (the two filters that select it), \`assetsQuery\` (its assets, ready to run) and \`queries\` (\`id\`, \`name\`, \`j1ql\`, \`enabled\`). \`taggingNothing: true\` means no level has an enabled query, so the next run clears every asset's level. \`unplacedQueries\` holds queries whose level no longer exists; every save is refused until they are moved or removed. \`suggestedQueries\` counts assets by level, lists the two most critical levels and the unclassified assets.
454
+ - \`not_configured\`: no levels yet, so no asset carries \`j1.criticality\`; a query on it returns nothing, which means "not classified", never "no critical assets".
455
+ - \`read_failed\`: the config could not be read in time; it says nothing about the config. Call again.
456
+
457
+ \`assetCountsStatus\` is \`complete\`, \`pending\` (the count query was still running; run \`suggestedQueries.countByLevel\`) or \`unavailable\`. \`assetCount\` counts the value on assets, which only a run writes, so it trails a save until a run started after it completes. \`runPending: true\` means a run is requested, running or still applying, or the latest ended \`PARTIAL\` or \`FAILED\`, hourly runs included (null when the runs could not be read); \`valuesOutsideLevels\` counts assets still carrying a value no level has, such as a renamed level's old one. Then report the counts as the last applied state, without waiting: a save is applied once \`runs.latest\` holds a \`COMPLETE\` run started after it. \`runsStatus\` is \`unavailable\` when the caller may read the config but not its run history, and \`failed\` when the history read failed or ran late; the config beside it is complete either way. \`runs.latest\` lists each run's \`status\` (\`APPLYING\`, \`COMPLETE\`, \`PARTIAL\`, \`SUPERSEDED\`, \`FAILED\`), \`trigger\` (\`SETUP\` after a save, \`SCHEDULED\` hourly, \`MANUAL\`), who started it and the per-level changes, as the levels stood at that run (not the current ladder). \`inProgressSince\` is when the run executing now started; a save made after that waits for the next run. \`applyPendingUntil\` is set while a finished run's changes are still being written onto assets. \`PARTIAL\` means capped, continuing on the next run; \`SUPERSEDED\`, capped and then overtaken by a save. \`pendingRequest\` is a run queued to apply a config that is already saved, often the caller's own save (\`performedBy\`), never an unsaved change: the levels and queries read here are current, and saving again is safe.
458
+
459
+ ## Access
460
+
461
+ Needs Assets: Admin, Vulnerabilities: Admin or full admin.
462
+
463
+ Full reference: get-reference topic asset-criticality
432
464
  `,
433
465
  "get-compliance-summary.md": `Return the account's compliance posture from JupiterOne Compliance (CCM): a scorecard per framework and, for one framework, its sections and failing requirements, plus attestations expiring soon or already lapsed. Answer posture questions from it rather than re-deriving pass/fail in J1QL. Siblings: \`list-controls\` for the controls behind a number, \`get-control\` for why one control passes or fails, \`update-attestation\` to renew an attestation. Vocabulary: compliance, framework, SOC 2, ISO 27001, requirements, controls, health, attestations, audit.
434
466
 
@@ -515,6 +547,28 @@ does not echo everything (\`drilldownQuery\`). \`get-dashboards\` finds the \`da
515
547
  "get-dashboards.md": `List every dashboard in the account, personal and account-level, with \`id\`, \`name\`, \`category\`
516
548
  and \`isJ1ManagedBoard\`. Use it to find a \`dashboardId\`; \`get-dashboard-details\` reads one board.
517
549
  No parameters.
550
+ `,
551
+ "get-graph-context.md": `Start here before writing J1QL: the account's graph context. Returns the entity classes and types the account holds, each with a count (\`classes\`, \`types\`), and its asset criticality levels with the filters that select each (\`assetCriticality\`). Call it first so a query names a class or type that exists, and filters critical assets by the account's own levels. Classes are TitleCase (\`User\`, \`Finding\`), types snake_case (\`aws_instance\`). \`execute-j1ql-query\` runs queries; sampling a type's properties is a query. Vocabulary: entity types, classes, schema, critical assets, crown jewels.
552
+
553
+ ## What the list proves
554
+
555
+ The counts come from a stored index, not from the graph: on a live tenant it disagreed with
556
+ direct queries on counts and omitted types that queries returned. A type listed here exists; a
557
+ type missing from it may still exist. When a type matters, confirm it directly with
558
+ \`FIND <type> AS e RETURN count(e) AS value\`.
559
+
560
+ ## Asset criticality
561
+
562
+ \`assetCriticality.levels\` lists the account's levels, most critical first: \`name\`, \`slug\` (the value
563
+ runs write on each asset as \`j1.criticality\`, hourly and after each change), \`rank\`
564
+ (\`j1.normalizedCriticality\`, 0 most critical), \`appliedAs\` (the two filters that select the level)
565
+ and \`assetsQuery\`. \`suggestedQueries\` count assets by level, list the two most critical levels and
566
+ the unclassified assets. For "critical assets" in a query, rule or widget, filter on these, not on
567
+ tags or smart classes. \`configured: false\` means no levels exist, so nothing carries
568
+ \`j1.criticality\`; \`assetCriticality: "unavailable"\` means the levels could not be read in time, not
569
+ that there are none. The queries that fill each level are on \`get-asset-criticality\`.
570
+
571
+ Full reference: get-reference topic j1ql-discovery
518
572
  `,
519
573
  "get-integration-definitions.md": `List the integration definitions available to the account: the kinds of integration that can be configured (AWS, Azure, GitHub, Slack, Jira) and, with \`includeConfig\`, their configuration fields. Start here when another task needs an integration instance id, such as a Slack, Jira or S3 rule action: find the definitions whose \`name\` or \`title\` match the product, then list that definition's instances with \`get-integration-instances\`. When several definitions could fit, say how they differ and let the user choose. Vocabulary: integration, connector, definition, provider, Slack, Jira, AWS.
520
574
 
@@ -562,7 +616,7 @@ The handle expires about an hour after the query started. If it expired or was l
562
616
  original query with \`execute-j1ql-query\`; an identical re-run within 5 minutes re-attaches to the
563
617
  same execution. Do not re-issue a query that is still running just to collect it.
564
618
  `,
565
- "get-reference.md": `Return one reference page; read it before writing a query, widget, rule or compliance answer that needs more than a tool description gives. Topics: \`j1ql-language\` (grammar), \`j1ql-discovery\` (types, properties, values), \`widget-types\` (chart types, RETURN columns), \`widget-settings\` (settings by chart type), \`dashboard-layout\` (grid, autoLayout), \`rule-authoring\` (payloads, actions, templates), \`compliance-model\` (how CCM scores a control), \`compliance-fields\` (field glossary), \`framework-authoring\` (frameworks, controls, tests, lifecycle, exemptions). Read-only; needs no account.
619
+ "get-reference.md": `Return one reference page; read it before writing a query, widget, rule or compliance answer beyond what a tool description gives. Topics: \`j1ql-language\` (grammar), \`j1ql-discovery\` (types, properties, values), \`widget-types\` (chart types, RETURN columns), \`widget-settings\` (per chart type), \`dashboard-layout\` (grid, autoLayout), \`rule-authoring\` (payloads, actions), \`rule-templates\` (templates, previews), \`compliance-model\` (control scoring), \`compliance-fields\` (field glossary), \`framework-authoring\` (controls, tests, exemptions), \`asset-criticality\` (levels). Read-only; needs no account.
566
620
  `,
567
621
  "get-rule-details.md": `Read one alert rule in full by its id: queries, condition, actions, schedule, labels, tags, version and remediation steps. Call it before \`update-inline-question-rule\`, which needs every field sent back. Siblings: \`list-rules\` finds the id, \`list-rule-evaluations\` lists the rule's runs. Vocabulary: rule configuration, the query behind an alert, version.
568
622
 
@@ -570,7 +624,7 @@ same execution. Do not re-issue a query that is still running just to collect it
570
624
 
571
625
  \`managedBy\` is \`'ccm'\` for a rule named \`CONTROL-TEST:<test name>\`, otherwise \`null\`. JupiterOne Compliance (CCM) runs each control test as a rule, hidden from this tool and from \`list-rules\`, so a control test's \`referencedRuleId\` from \`get-control\` comes back as not found here. Read that rule's runs with \`list-rule-evaluations\`, and the control and its tests with \`get-control\`. A CCM rule is changed through its control, never with \`update-inline-question-rule\` or \`delete-rule\`, which refuse it.
572
626
  `,
573
- "get-rule-evaluation-details.md": `Read one evaluation run of a rule: each query's status and duration, the condition verdict, and each action's status and logs. \`timestamp\` comes from \`list-rule-evaluations\`. For the entities the run matched, call \`get-rule-evaluation-query-results\` with that run's \`rawDataKey\` instead. Vocabulary: why did the rule fire, did the action run, evaluation log.
627
+ "get-rule-evaluation-details.md": `Read one evaluation run of a rule: each query's status and duration, the condition verdict, and each action's status, logs and \`externalOutputs\` (what it produced outside JupiterOne: a Slack permalink in \`webLink\`, an email's recipients, a ticket). \`timestamp\` comes from \`list-rule-evaluations\`. For the entities the run matched, call \`get-rule-evaluation-query-results\` with that run's \`rawDataKey\` instead. Vocabulary: why did the rule fire, did the action run, evaluation log.
574
628
  `,
575
629
  "get-rule-evaluation-query-results.md": `Return the entities a rule evaluation matched, from the \`rawDataKey\` in a run's \`rawDataDescriptors\` (\`list-rule-evaluations\`), or a signed link to download the whole set. For a compliance control test's evidence, the key is the \`latestEvaluation.rawDataKey\` that \`get-control\` returns for that test: the assets the test scored on its latest run. Sibling: \`get-rule-evaluation-details\` for the run's conditions and actions. Vocabulary: matched entities, evidence, affected assets, download, export, raw results.
576
630
 
@@ -724,23 +778,6 @@ Needs the Compliance (CCM) entitlement and control read permission. CCM silently
724
778
  \`{ "frameworkId": "<frameworkId>", "status": ["FAIL"], "states": ["LIVE"] }\`
725
779
 
726
780
  Full reference: get-reference topic compliance-fields
727
- `,
728
- "list-entity-types.md": `List the entity classes and types the account's index holds, each with a count, as two maps:
729
- \`classes\` and \`types\`. Call it before writing a J1QL query, so the query names a class or type
730
- that exists: a query naming one the account does not hold returns nothing, and guessing names
731
- from memory is how that happens. It also shows what data the account holds and which integrations
732
- feed it. \`execute-j1ql-query\` runs the query; sampling a type's properties and values is a query,
733
- not this tool. Classes are TitleCase (\`User\`, \`Finding\`), types snake_case (\`aws_instance\`,
734
- \`github_user\`).
735
-
736
- ## What the list proves
737
-
738
- The counts come from a stored index, not from the graph: on a live tenant it disagreed with
739
- direct queries on counts and omitted types that queries returned. A type listed here exists; a
740
- type missing from it may still exist. When a type matters, confirm it directly with
741
- \`FIND <type> AS e RETURN count(e) AS value\`.
742
-
743
- Full reference: get-reference topic j1ql-discovery
744
781
  `,
745
782
  "list-rule-evaluations.md": `List a rule's evaluation runs, each with its \`timestamp\`, \`outputs\`, \`tag\` and \`rawDataDescriptors[].rawDataKey\`. \`beginTimestamp\` and \`endTimestamp\` are epoch milliseconds; \`tag\` filters the runs. Chain: \`list-rules\` → \`list-rule-evaluations\` → \`get-rule-evaluation-details\` with a run's \`timestamp\` for its conditions and actions, or \`get-rule-evaluation-query-results\` with its \`rawDataKey\` for the entities it matched. Vocabulary: evaluation history, when did the rule run, why did it fire.
746
783
  `,
@@ -757,6 +794,29 @@ Page with \`cursor\` set to \`pageInfo.endCursor\` while \`pageInfo.hasNextPage\
757
794
  ## Why a rule fired
758
795
 
759
796
  \`list-rules\` → \`list-rule-evaluations\` (each run's \`timestamp\` and \`rawDataDescriptors[].rawDataKey\`) → \`get-rule-evaluation-details\` with the timestamp for the run's conditions and actions, or \`get-rule-evaluation-query-results\` with the \`rawDataKey\` for the entities it matched.
797
+ `,
798
+ "preview-rule-actions.md": `Show what a rule's actions would send, without sending anything: renders each action's templates (Slack message, Jira ticket, email, webhook body, tags) against a sample of the rule's current query results, and checks them. Pass \`ruleId\` for a saved rule, or \`question\`, \`operations\`, \`templates\`, \`name\` and \`description\` in the \`create-inline-question-rule\` shape for a draft. Call it before saving a rule that notifies anyone. Vocabulary: dry run, test rule, what would this alert send, render template, action impact.
799
+
800
+ ## What runs
801
+
802
+ Each query runs once; the first 10 rows are kept and \`total\` counts them all. \`fixtures: { <query name>: [rows] }\` renders against those rows instead and does not run that query: use it to reach a branch the data does not. Nothing is created, posted, filed or tagged, and the rule is not saved. Conditions (\`when\`) are not evaluated: every action renders as if its condition held, so compare each condition with the totals before saying an action will fire.
803
+
804
+ ## Reading the result
805
+
806
+ - \`queries[]\`: \`status\` \`ok\` or \`empty\`, \`sampledRows\` of \`total\`; \`estimate: true\` when \`total\` is the query engine's estimate, not a count. Lists such as \`{{queries.query0.data|mapProperty('displayName')|join(', ')}}\` show only the sampled rows; a run holds every row. \`notes\` says so.
807
+ - \`actions[]\`, in rule order, each with its \`path\` (\`operations[0].actions[2]\`) and \`status\`:
808
+ - \`rendered\`: \`rendered\` is the action as sent when its condition holds; \`messages\` are template errors; Slack actions carry \`envelope\`, the whole post (name, description, severity, timestamp, body as truncated).
809
+ - \`render_failed\`: \`error\` says why.
810
+ - \`loop\`: a \`FOR_EACH_ITEM\`; \`iterations\` counts its items when \`items\` is \`{{queries.<name>.data}}\`. Its nested actions follow, rendered for the first sampled row (\`loopRows\` up to 10 for more), each with \`row\` and \`itemBound\`.
811
+ - \`not_run\` (loop with no items), \`skipped\` (\`CREATE_ALERT\` in a loop), \`not_previewable\` (\`JUPITERONE_QUERY\`, a loop in a loop).
812
+ - Fix before saving: \`warnings[]\` (\`{ code, field, message }\`: Slack body over the 1,500-character cap or truncated, missing description, malformed recipient, unknown transform, a named template mapped inside a loop), \`unresolvedPaths\` (fields that rendered \`undefined\`) and \`undefinedReads[]\` (reads that found nothing, with the expression, including ones used as tests, which print nothing).
813
+ - \`{{alertWebLink}}\` renders a sample link and \`param.*\` \`[REDACTED PARAMETER]\`. With \`triggerActionsOnNewEntitiesOnly\`, a run acts only on entities the last run did not see; the preview uses every match.
814
+
815
+ ## Refusals
816
+
817
+ \`query_failed\` (a query failed or was still running; repeating the call re-attaches to a running one), \`render_failed\` (no action rendered), \`invalid_query\` (a draft query does not parse), \`not_found\`, \`read_failed\` (the saved rule could not be read in time; call again), \`no_queries\` (pass the queries as a draft), \`no_actions\`, \`invalid_input\` (neither or both of \`ruleId\` and a draft, a draft without both \`question\` and \`operations\`, or a fixture naming no query). Needs permission to create or update rules.
818
+
819
+ Full reference: get-reference topic rule-templates
760
820
  `,
761
821
  "prompt-build-dashboard.md": `Build a JupiterOne Insights dashboard for: {{objective}}
762
822
 
@@ -771,9 +831,11 @@ design the board on paper before creating anything.
771
831
  validated on a demo tenant and delivered as production is the failure whose output looks
772
832
  entirely correct.
773
833
 
774
- 2. **Discover what this account actually holds.** \`list-entity-types\` for the classes and types
834
+ 2. **Discover what this account actually holds.** \`get-graph-context\` for the classes and types
775
835
  present — treat it as a positive check only; a type missing from it may still exist. Sample
776
- every type you intend to use: \`FIND <type> AS e RETURN e.* LIMIT 5\`.
836
+ every type you intend to use: \`FIND <type> AS e RETURN e.* LIMIT 5\`. Its \`assetCriticality\`
837
+ lists the account's criticality levels: a board about risk or critical assets filters and
838
+ groups by them (\`j1.criticality\`, \`j1.normalizedCriticality\`), not by tags.
777
839
 
778
840
  3. **Check the values you plan to filter or group on.** String comparison is case-sensitive and
779
841
  stored casing varies by integration — the same property routinely holds \`high\`, \`HIGH\` and
@@ -941,12 +1003,151 @@ applicability bars — use PRODUCT PRESENCE as the default bar:
941
1003
  presence. Remember: count \`0\` means "none found," not "not affected," and
942
1004
  \`unavailable\` is a retry state, not a zero.
943
1005
 
1006
+ For each scanner-confirmed threat, say how many of the affected devices sit in the
1007
+ account's most critical asset criticality levels (\`get-graph-context\` lists the levels;
1008
+ \`check-threat-exposure\` gives the by-level query). Devices with no level are
1009
+ unclassified, not unimportant.
1010
+
944
1011
  Present the relevant threats ranked, each showing which bar it met (product present
945
1012
  vs scanner-confirmed) and its escalation reason and remediation urgency. If nothing
946
1013
  is relevant, say so plainly rather than padding the list.
947
1014
 
948
1015
  (A future option may let the user require a direct match only; for now the default
949
1016
  bar is product presence.)
1017
+ `,
1018
+ "reference/asset-criticality.md": `# Asset criticality
1019
+
1020
+ How JupiterOne classifies assets by business impact, how to read the result in J1QL, rules and
1021
+ widgets, and how to set it up or change it with \`get-asset-criticality\` and
1022
+ \`update-asset-criticality\`.
1023
+
1024
+ ## The model
1025
+
1026
+ - **Levels are ordered, most critical first.** A setup has 2-6 levels. Each level's name becomes its
1027
+ value on assets (\`j1.criticality\`): lowercased, every run of other characters turned into one
1028
+ hyphen, cut at 40 characters, so a level named \`Crown jewels\` applies as \`crown-jewels\`. Its
1029
+ position is its rank (\`j1.normalizedCriticality\`), 0 for the most critical.
1030
+ - **Queries fill the levels.** Each level holds J1QL queries; an asset joins a level when any of
1031
+ its queries returns it. Any entity class can be classified.
1032
+ - **The most critical match wins.** An asset returned by queries in several levels takes the most
1033
+ critical of them.
1034
+ - **JupiterOne keeps it current.** The config runs every hour, and a save requests a run of its
1035
+ own, which waits for any run in progress or still applying its changes and starts no sooner than
1036
+ 15 minutes after the last run started. On a large account a run can take half an hour, and a
1037
+ run applies at most 100,000 asset changes, the rest on the next, so a change can take a while to
1038
+ reach assets. Each run writes the level onto every matched asset and removes it from assets no
1039
+ query matches any more, so a level with no enabled query loses all its assets, and a setup with
1040
+ none clears every asset's level.
1041
+ - **Unmatched assets stay unclassified.** They carry neither property.
1042
+ - **Levels feed risk scoring.** Each level can carry a risk-score multiplier (1 to 1.5, set in the
1043
+ vulnerability risk configuration, not by these tools); \`j1.riskScore(uv, ud)\` weights a
1044
+ vulnerability by the level of the device it is on.
1045
+ - **Only the run writes these properties.** Values written to \`j1.*\` through the entity API are
1046
+ ignored; to change an asset's level, change the queries that place it.
1047
+
1048
+ ## Reading it
1049
+
1050
+ - One level, by value: \`FIND * WITH j1.criticality = 'crown-jewels' LIMIT 250\`
1051
+ - The most critical level, by rank: \`FIND * WITH j1.normalizedCriticality = 0 LIMIT 250\`
1052
+ - Hosts in the two most critical levels: \`FIND Host WITH j1.normalizedCriticality <= 1 LIMIT 250\`
1053
+ - Assets by level: \`FIND * WITH j1.criticality != undefined AS e RETURN e.j1.criticality AS level, count(e) AS total\`
1054
+ - Unclassified entities (findings and records included, not only assets):
1055
+ \`FIND * WITH j1.criticality = undefined AS e RETURN count(e) AS unclassified\`
1056
+ - Open vulnerabilities on devices in the two most critical levels, by risk score:
1057
+ \`FIND UnifiedVulnerability AS uv THAT IS Vulnerability WITH open = true THAT HAS (Host|Device) THAT IS UnifiedDevice WITH j1.normalizedCriticality <= 1 AS ud RETURN ud.displayName AS device, ud.j1.criticality AS level, j1.riskScore(uv, ud) AS score ORDER BY score DESC LIMIT 25\`
1058
+
1059
+ Rules for reading:
1060
+
1061
+ - Select one level by value, compare levels by rank. Ranks are positions, so \`<= 1\` is the top two
1062
+ levels only when ranks have no gaps; \`get-graph-context\` and \`get-asset-criticality\` return each
1063
+ level's rank and a ready query for the top two.
1064
+ - An unclassified asset has no value, so \`!= 'crown-jewels'\` counts it as "not crown jewels".
1065
+ Filter on what an asset is, not on what it is not.
1066
+ - \`j1.riskScore\`'s second argument must be bound to \`UnifiedDevice\`, not \`Host\` or \`Device\`.
1067
+ - With no levels configured, no asset carries either property: an empty result means "not
1068
+ classified", never "no critical assets".
1069
+ - A rename changes a level's value and a reorder or removal renumbers ranks. Once a run applies
1070
+ the change, a rule or widget on the old value matches nothing and one on the old rank selects
1071
+ whichever level holds that rank then; until that run, the new value matches nothing and the new
1072
+ rank selects the level that held it before. \`update-asset-criticality\`'s \`filters_stale\` effect
1073
+ names, per level, the filter that selects the same assets before and after the run; move the
1074
+ rest once a run started after the save is \`COMPLETE\`.
1075
+ - \`tag.crownJewel\` is the older single crown-jewel flag and no longer feeds risk scoring. A
1076
+ \`#CriticalAsset\` smart class or a \`tag.CriticalAsset\` tag is a marker the account defined for
1077
+ itself; where levels exist, they are the definition risk scoring reads.
1078
+
1079
+ ## Writing level queries
1080
+
1081
+ A level query selects the complete set of assets for its level:
1082
+
1083
+ - It returns one entity's \`_id\` aliased \`entityId\`: \`FIND Database WITH tag.Environment = 'prod' AS d RETURN d._id AS entityId\`.
1084
+ Written as a plain filter (\`FIND Database WITH tag.Environment = 'prod'\`), the RETURN is added.
1085
+ A traversal whose first term has no alias cannot be completed: alias it.
1086
+ - No \`LIMIT\` or \`SKIP\`: whatever the query leaves out loses the level on the next run.
1087
+ - At most 1,024 characters, counting an added RETURN; at most 50 queries across all levels.
1088
+ - The returned term may be any class, and need not be the first:
1089
+ \`FIND aws_iam_policy WITH policyName = 'AdministratorAccess' THAT ASSIGNED AS a aws_iam_role AS r RETURN r._id AS entityId\`.
1090
+ It must come before any negated step: a \`THAT !\` step matches what is absent, so nothing on or
1091
+ after it can be returned (\`FIND Host AS h THAT !HAS Agent RETURN h._id AS entityId\`).
1092
+ - String comparison is case-sensitive and stored casing varies. Probe a property's values before
1093
+ filtering on one:
1094
+ \`FIND aws_s3_bucket AS b RETURN b.classification AS value, count(b) AS n ORDER BY n DESC LIMIT 250\`.
1095
+ - Prove every query with \`execute-j1ql-query\` before saving it; \`update-asset-criticality\`
1096
+ returns each saved query's match count, and a zero there is worth a second look.
1097
+
1098
+ ## What makes an asset critical
1099
+
1100
+ The product's own setup agent follows these rules; a setup built through these tools should too.
1101
+
1102
+ - **Criticality is consequence.** Ask what breaks, and for whom, if the asset is lost or
1103
+ compromised: root and administrator identities, production data stores and their backups,
1104
+ credentials and keys, workloads with privileged access, the systems revenue runs on.
1105
+ - **It is not exposure or vulnerability.** Internet reachability, open ports, findings, severity,
1106
+ exploitability and risk scores are scored separately; using them here counts them twice. Cost,
1107
+ size and age are not consequence either.
1108
+ - **The customer's own declarations come first.** A criticality, tier, classification or
1109
+ data-sensitivity property the customer fills, a \`tag.*\` value, or a CMDB field is their stated
1110
+ judgement: probe its values and map them onto levels before inventing anything. Data a customer
1111
+ derives in another system reaches JupiterOne as a property on the entity (an integration, or the
1112
+ entity API), and a level query then matches that property.
1113
+ - **Production belongs in the top levels.** Where data marks assets as development, test or
1114
+ sandbox, exclude them from every level but the least critical; exclude devices not seen in 180
1115
+ days from the more critical levels.
1116
+ - **Assets, not records.** Findings, vulnerabilities, alerts, controls, reviews and similar
1117
+ record-like classes are not assets; do not classify them.
1118
+ - **Few, clear levels.** The recommended model is four: Critical, High, Medium, Low. Use the
1119
+ customer's own names (Tier 0-3, Crown jewels) when they have them, most critical first.
1120
+
1121
+ ## Setting it up
1122
+
1123
+ 1. \`get-asset-criticality\` (or \`get-graph-context\`) to see whether levels exist.
1124
+ 2. Discover what the account holds and what it already declares: \`get-graph-context\`, then value
1125
+ probes on candidate properties.
1126
+ 3. Agree the levels and what belongs in each with the user.
1127
+ 4. Write and prove one query per idea with \`execute-j1ql-query\`.
1128
+ 5. \`update-asset-criticality\` with \`levels\` and \`upsertQueries\` in one call: the config is created
1129
+ in one save, and the next run applies it (a change past 100,000 assets spans several).
1130
+ 6. Report \`effects\` and each \`matchCount\` as what the run will apply. Once \`get-asset-criticality\`
1131
+ lists a \`COMPLETE\` run started after the save, its counts are the assets per level, and that
1132
+ run holds the per-level changes.
1133
+
1134
+ ## Changing it
1135
+
1136
+ Send only the change. To keep a level, send its \`slug\` with its name; a new name renames it and
1137
+ re-tags its assets. Removing a level is refused while it holds queries: move them
1138
+ (\`upsertQueries\` with \`id\` and \`level\`) or remove them (\`removeQueryIds\`) in the same call. A
1139
+ repeated call is safe: a query already created is reported as already present, a removed one as
1140
+ already removed, and levels a first call added by name answer \`unchanged\`. Two writers saving at once: the tool re-reads and applies the change again once;
1141
+ past that it answers \`conflict\`.
1142
+
1143
+ ## Limits
1144
+
1145
+ | Item | Limit |
1146
+ | ------------ | ------------------------------------------------------------------------------------------- |
1147
+ | Levels | 2-6, names 1-64 characters, unique ignoring case |
1148
+ | Queries | 50 across all levels |
1149
+ | Query length | 1,024 characters |
1150
+ | Runs | hourly, plus one after each save; up to 100,000 asset changes per run, the rest on the next |
950
1151
  `,
951
1152
  "reference/compliance-fields.md": `# Compliance fields
952
1153
 
@@ -1300,7 +1501,7 @@ one or an attestation. A test is \`effective\` when its query parses and names e
1300
1501
  account holds; \`effective: false\` after creation means the query names a type this account does
1301
1502
  not have (a Justworks CrowdStrike test found no data because the integration ingested no alerts).
1302
1503
 
1303
- Write the query the way the J1QL tools expect: discover the type with \`list-entity-types\`, sample
1504
+ Write the query the way the J1QL tools expect: discover the type with \`get-graph-context\`, sample
1304
1505
  it (\`FIND <type> AS e RETURN e.* LIMIT 5\`), probe stored values before comparing them (casing varies
1305
1506
  by integration: \`critical\` and \`CRITICAL\` coexist), then run the finished query with
1306
1507
  \`execute-j1ql-query\` and confirm the rows are the ones the auditor would accept. \`create-control-test\`
@@ -1382,7 +1583,7 @@ How to find the types, properties, stored values and relationship verbs a query
1382
1583
 
1383
1584
  ## Workflow
1384
1585
 
1385
- 1. \`list-entity-types\` lists the classes and types the account holds, with a count for each. Never
1586
+ 1. \`get-graph-context\` lists the classes and types the account holds, with a count for each. Never
1386
1587
  guess a name from memory: a query naming a class or type the account does not hold returns
1387
1588
  nothing.
1388
1589
  2. Sample a type's properties and values: \`FIND <type> AS e RETURN e.* LIMIT 5\`.
@@ -1428,7 +1629,35 @@ FIND UnifiedIdentity AS identity
1428
1629
  RETURN identity.displayName, rel._class, device.displayName
1429
1630
  \`\`\`
1430
1631
 
1431
- ## What list-entity-types proves
1632
+ ## Asset criticality and risk
1633
+
1634
+ An account that has set up asset criticality classifies its assets into ordered levels, and the
1635
+ run writes two properties onto every classified asset, of any class:
1636
+
1637
+ - \`j1.criticality\`: the level's value, made from its name (\`crown-jewels\` for "Crown jewels").
1638
+ - \`j1.normalizedCriticality\`: the level's rank, 0 for the most critical.
1639
+
1640
+ \`get-graph-context\` returns the account's levels with the two filters that select each
1641
+ (\`assetCriticality.levels[].appliedAs\`). When the account has levels, they are its definition of
1642
+ a critical asset: filter on them rather than on a tag, a smart class or an integration's own
1643
+ \`criticality\` field.
1644
+
1645
+ - Select one level by value, compare levels by rank:
1646
+ \`FIND * WITH j1.criticality = 'crown-jewels' LIMIT 250\`,
1647
+ \`FIND Host WITH j1.normalizedCriticality <= 1 LIMIT 250\`.
1648
+ - Unclassified assets carry neither property, so \`!=\` counts them; find them with
1649
+ \`FIND * WITH j1.criticality = undefined AS e RETURN count(e) AS unclassified\`.
1650
+ - With no levels configured, nothing carries these properties: an empty result means "not
1651
+ classified", never "no critical assets". A customer's own marker (\`#CriticalAsset\`,
1652
+ \`tag.CriticalAsset\`) is then their definition; use it and say so. \`tag.crownJewel\` is the older
1653
+ single flag and no longer feeds risk scoring.
1654
+ - \`j1.riskScore(uv, ud)\` scores a vulnerability on a device, weighted by the device's level; \`ud\`
1655
+ must be bound to \`UnifiedDevice\`:
1656
+ \`FIND UnifiedVulnerability AS uv THAT IS Vulnerability WITH open = true THAT HAS (Host|Device) THAT IS UnifiedDevice WITH j1.normalizedCriticality <= 1 AS ud RETURN ud.displayName AS device, j1.riskScore(uv, ud) AS score ORDER BY score DESC LIMIT 25\`.
1657
+
1658
+ How levels are built and changed: get-reference topic asset-criticality.
1659
+
1660
+ ## What get-graph-context proves
1432
1661
 
1433
1662
  Its counts come from a stored index, not from the graph. Measured on a live tenant, it disagreed
1434
1663
  with direct queries on counts and omitted types that queries returned. A type listed there exists;
@@ -2073,15 +2302,18 @@ type.
2073
2302
  }
2074
2303
  \`\`\`
2075
2304
 
2076
- ## Template variables
2305
+ ## Templates and previewing
2306
+
2307
+ Action text is built with \`{{ }}\` expressions over the query results:
2308
+ \`{{queries.query0.data|mapProperty('displayName')|join(', ')}}\` is a comma-separated list of names,
2309
+ \`{{queries.query0.total}}\` their count and \`{{alertWebLink}}\` a link to the alert. List shapes: HTML
2310
+ \`join('<br>* ')\`, Markdown \`join('\\n- ')\`, plain text \`join('\\n* ')\`. Topic \`rule-templates\` has
2311
+ the variables, every transform, the patterns, what each action wraps around the text, and how to
2312
+ read a preview.
2077
2313
 
2078
- - \`{{alertWebLink}}\`: a link to the alert in JupiterOne.
2079
- - \`{{queries.<name>.data}}\`: the entities the query returned; \`{{queries.<name>.total}}\`: their
2080
- count.
2081
- - \`|mapProperty('field')\` picks one field from each entity and \`|join('separator')\` joins the
2082
- list: \`{{queries.query0.data|mapProperty('displayName')|join(', ')}}\` is a comma-separated list
2083
- of names.
2084
- - List shapes: HTML \`join('<br>* ')\`, Markdown \`join('\\n- ')\`, plain text \`join('\\n* ')\`.
2314
+ Before saving a rule that notifies anyone, render it with \`preview-rule-actions\` (the draft's
2315
+ \`question\`, \`operations\`, \`templates\`, \`name\` and \`description\`, or a saved rule's \`ruleId\`), show
2316
+ the user what it will send, and fix its \`warnings\`, \`unresolvedPaths\` and \`undefinedReads\`.
2085
2317
 
2086
2318
  ## Integration dependencies
2087
2319
 
@@ -2094,6 +2326,13 @@ the integration's definition with \`get-integration-definitions\`, list the acco
2094
2326
  - New entities: \`triggerActionsOnNewEntitiesOnly: true\` with the condition
2095
2327
  \`["AND", ["queries.query0.total", ">", 0]]\`.
2096
2328
  - Threshold: \`["AND", ["queries.query0.total", ">=", 5]]\`.
2329
+ - Critical assets: scope the query by the account's asset criticality levels, which
2330
+ \`get-graph-context\` returns with the filters that select each, not by tags. Public critical
2331
+ databases: \`FIND Database WITH j1.normalizedCriticality <= 1 AND public = true\`. A change to the
2332
+ levels reaches assets only when a run applies it (hourly and after each save; a save's run waits
2333
+ behind one in progress, and a large change spans several runs). Renaming or reordering levels
2334
+ changes the value or rank a rule filters on, so the rule stops matching once a run applies it;
2335
+ \`update-asset-criticality\` lists the new values.
2097
2336
  - Several actions in one operation:
2098
2337
 
2099
2338
  \`\`\`json
@@ -2112,6 +2351,116 @@ the integration's definition with \`get-integration-definitions\`, list the acco
2112
2351
  }
2113
2352
  ]
2114
2353
  \`\`\`
2354
+ `,
2355
+ "reference/rule-templates.md": `# Rule templates
2356
+
2357
+ How action text is built from query results, what each action wraps around it, and how to read a
2358
+ \`preview-rule-actions\` result. Payloads and action fields are in topic \`rule-authoring\`.
2359
+
2360
+ ## Expressions
2361
+
2362
+ Any string field of an action can hold \`{{ expression }}\`. Expressions are JEXL: \`a ? b : c\`,
2363
+ \`&&\`, \`||\`, \`!\`, \`==\`, \`!=\`, \`>\`, \`<\`, \`+\` (adds numbers, joins strings), member access
2364
+ (\`queries.query0.data[0].entity.displayName\`), and array and object literals. A field that is one
2365
+ expression and nothing else takes the expression's value (a number, a list); otherwise the result
2366
+ is text.
2367
+
2368
+ There is no function to print a whole object: \`{{queries.query0.data[0].properties}}\` prints
2369
+ \`[object Object]\`, so name each field. \`json\`, \`stringify\`, \`keys\`, \`toJSON\`, \`date\`, \`substring\`
2370
+ and \`split\` do not exist.
2371
+
2372
+ ## Variables
2373
+
2374
+ - \`queries.<name>.data\`: the query's rows; \`queries.<name>.total\`: how many rows it returned.
2375
+ - \`alertWebLink\`: a link to the alert in JupiterOne.
2376
+ - \`evaluationBeginOn\`: when the run started, in epoch milliseconds.
2377
+ - \`param.<name>\`: an account parameter; a preview shows \`[REDACTED PARAMETER]\`.
2378
+ - Inside a named template called by \`mapTemplate\`: \`item\` (the element), \`itemIndex\`, \`itemCount\`.
2379
+ - Inside \`FOR_EACH_ITEM\`: the loop variable named by \`itemRef\` (default \`item\`). \`items\` is
2380
+ \`{{queries.<name>.data}}\` or a literal list; a query name with \`-\` needs brackets,
2381
+ \`{{queries['open-findings'].data}}\`, or JEXL reads it as subtraction. A named template called
2382
+ inside the loop does not see the loop variable, only its own \`item\`.
2383
+
2384
+ Row shapes differ. A query with no RETURN gives \`{ id, entity, properties }\` rows: read
2385
+ \`data[0].entity.displayName\` or \`data[0].properties.<name>\`. A query with RETURN gives flat rows
2386
+ keyed by alias: \`data[0].<alias>\`. \`mapProperty\` and \`mapTemplate\` flatten entity rows, so
2387
+ \`item.displayName\` and \`mapProperty('displayName')\` work on both.
2388
+
2389
+ ## Transforms
2390
+
2391
+ Applied with \`|\`: \`{{queries.query0.data|mapProperty('displayName')|join(', ')}}\`.
2392
+
2393
+ | Transform | Does |
2394
+ | ------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
2395
+ | \`mapProperty('p')\`, \`mapProperty('p', 'q')\` | Each row's \`p\`; with several names, an object per row |
2396
+ | \`join(sep)\` | Joins a list into text |
2397
+ | \`length\` | A list's length; 0 when not a list |
2398
+ | \`capitalize\` | Upper-cases the first letter |
2399
+ | \`mapTemplate('name')\` | Renders the named template once per element (see Variables) |
2400
+ | \`merge(list, ...)\` | Concatenates lists: \`queries.a.data\\|merge(queries.b.data)\` |
2401
+ | \`uniquePropertyValues('p')\` | The distinct, non-empty values of \`p\` |
2402
+ | \`queryDataDifference('name')\` | \`[a, b]\\|queryDataDifference('name')\`: rows of \`b\` not in \`a\`, by \`_id\` or \`_key\`, also stored as \`name\` |
2403
+ | \`dateAdd(amount, unit)\` | Shifts a date; units \`hour\`, \`day\`, \`week\`, \`month\`, \`year\` (plural too); returns ISO 8601 |
2404
+ | \`formatDate(format, timeZone)\` | dayjs format, default \`YYYY-MM-DD\`; IANA zone, default \`UTC\` |
2405
+
2406
+ \`dateAdd\` and \`formatDate\` accept epoch milliseconds, a numeric string or ISO 8601, and give
2407
+ nothing for anything else: \`{{evaluationBeginOn|dateAdd(30, 'days')|formatDate('MMM D, YYYY', 'America/New_York')}}\`.
2408
+
2409
+ ## Missing data
2410
+
2411
+ A read that finds nothing is \`undefined\`. Printed, it renders the text \`undefined\`. Used as a test,
2412
+ it silently takes the false branch: \`{{queries.j1.data[0].mfa ? 'MFA on' : 'MFA off'}}\` says
2413
+ "MFA off" for someone the \`j1\` query does not return. Test for the row first:
2414
+ \`{{queries.j1.total > 0 ? (queries.j1.data[0].mfa ? 'MFA on' : 'MFA off') : 'not in J1'}}\`.
2415
+
2416
+ ## Patterns
2417
+
2418
+ - **Components.** A named template is a reusable block, and a literal list of objects feeds it:
2419
+ \`templates: { "row": "<tr><td>{{item.sys}}</td><td>{{item.ok ? 'yes' : 'no'}}</td></tr>" }\`,
2420
+ body \`{{[{sys: 'GitHub', ok: queries.gh.total > 0}, {sys: 'Okta', ok: queries.okta.total > 0}]|mapTemplate('row')|join('')}}\`.
2421
+ Templates can read \`queries\` and call \`mapTemplate\` on other templates.
2422
+ - **One row per person.** The same person seen by several integrations is several entities. Group
2423
+ with a RETURN to get one row each, with the count as a column:
2424
+ \`FIND User WITH email = 'a@example.com' AS u RETURN u.username AS handle, count(u) AS seenBy\`.
2425
+ - **Lists.** HTML \`join('<br>* ')\`, Slack and Markdown \`join('\\n- ')\`, plain text \`join('\\n* ')\`.
2426
+ - **Several queries, one message.** Name each query and build one body from all of them rather than
2427
+ one action per query.
2428
+
2429
+ ## What each action sends
2430
+
2431
+ - **Slack** (\`SEND_SLACK_MESSAGE\`) posts the text \`*JupiterOne Alert - <rule name>*\` and one
2432
+ attachment: the rule name (linked to the alert when the run raises one), \`*Description*: <rule
2433
+ description>\`, \`*Severity*: <level>\` (the action's \`severity\`, else the raised alert's level;
2434
+ absent with neither), \`*Timestamp*: <run start, UTC>\`, then the body. The colour follows the level:
2435
+ CRITICAL and HIGH \`#AF2418\`, MEDIUM \`#EF9436\`, LOW \`#DFBF40\`, INFO \`#6699ff\`, none \`#000000\`. A
2436
+ rule with no description posts \`*Description*: null\`. The body template may be at most 1,500
2437
+ characters (the save rejects longer), and a rendered body over 1,500 is cut to 1,497 plus \`...\`.
2438
+ Bodies use Slack mrkdwn: \`*bold*\`, \`_italic_\`, \`<url|text>\`.
2439
+ - **Email** (\`SEND_EMAIL\`): the body, HTML allowed, goes inside JupiterOne's alert email. No length
2440
+ cap.
2441
+ - No other action type caps a field's length.
2442
+
2443
+ ## Reading a preview
2444
+
2445
+ \`preview-rule-actions\` renders against a 10-row sample per query and sends nothing.
2446
+
2447
+ - \`envelope\` (Slack): the post as built above. Angle-bracketed values are known only to a live
2448
+ run; pass \`name\` and \`description\` with a draft to fill them.
2449
+ - \`warnings[]\`, each \`{ code, field, message }\`: \`slack-body-over-limit\` (the save will fail),
2450
+ \`slack-body-truncated\` (the post is cut), \`description-missing\`, \`recipient-malformed\`,
2451
+ \`unknown-transform\` (lists the transforms that exist), \`loop-template-preview\` (a named template
2452
+ mapped inside a loop, which the preview cannot render exactly: its renderer lays the loop row
2453
+ over the template's own \`item\`).
2454
+ - \`unresolvedPaths\`: fields that rendered \`undefined\` or nothing.
2455
+ - \`undefinedReads[]\`, each \`{ field, expression, path, query, emptyQuery }\`: reads that found
2456
+ nothing in the sample, including ones used as tests, which render no \`undefined\` at all. A read
2457
+ guarded with \`||\` or a ternary is expected to, but check which branch it took. Reads of \`item\`
2458
+ inside a named template, and of a query a \`JUPITERONE_QUERY\` action adds at run time, are not
2459
+ checked.
2460
+ - \`fixtures: { <query name>: [rows] }\` renders against those rows instead of running the query: use
2461
+ it to reach a branch the data does not, without pulling real people's records.
2462
+ - \`loopRows\` (1–10) renders each \`FOR_EACH_ITEM\` nested action for that many sampled rows; each
2463
+ entry carries its \`row\`.
2115
2464
  `,
2116
2465
  "reference/widget-settings.md": `# Widget settings
2117
2466
 
@@ -2324,6 +2673,16 @@ RETURN
2324
2673
  count(ds) AS value
2325
2674
  \`\`\`
2326
2675
 
2676
+ Assets by asset criticality level, one slice per level (the label is the level's value; the
2677
+ account's levels and their names are on \`get-graph-context\`):
2678
+
2679
+ \`\`\`j1ql
2680
+ FIND * WITH j1.criticality != undefined AS e
2681
+ RETURN
2682
+ e.j1.criticality AS name,
2683
+ count(e) AS value
2684
+ \`\`\`
2685
+
2327
2686
  Or one query per slice, each returning only \`value\` and labelled by its query name. This form is
2328
2687
  valid only as one of several queries on the widget; alone it draws a single \`undefined\` slice:
2329
2688
 
@@ -2525,12 +2884,12 @@ Full reference: get-reference topic framework-authoring
2525
2884
  entities and relationships, queried with J1QL. Use these tools for any question about the user's real
2526
2885
  inventory, exposures, identities, integrations, alerts, dashboards or compliance posture; never answer
2527
2886
  from memory, never guess entity types or property names. Tools: execute-j1ql-query (run and page J1QL),
2528
- list-entity-types, rules and alerts, dashboards and widgets, integrations, threat intelligence,
2887
+ get-graph-context, rules and alerts, dashboards and widgets, integrations, threat intelligence,
2529
2888
  compliance (CCM). get-reference serves the J1QL guide, widget contract, rule actions, layout and
2530
2889
  compliance model on demand.
2531
2890
 
2532
2891
  ## Build a query before you build anything on it
2533
- Discover first (\`list-entity-types\`, then \`FIND <type> AS e RETURN e.* LIMIT 5\`), run the finished query
2892
+ Discover first (\`get-graph-context\`, then \`FIND <type> AS e RETURN e.* LIMIT 5\`), run the finished query
2534
2893
  through \`execute-j1ql-query\` and confirm rows, then embed it in a widget or rule; an empty query still
2535
2894
  creates a widget that renders blank with no error. String comparison is case-sensitive and casing varies
2536
2895
  by integration (high / HIGH / High coexist): probe values first with
@@ -2603,7 +2962,7 @@ standard it is or what material they have, ask.
2603
2962
  prebuilt version: offer \`import-framework\` and then tune it, instead of building from scratch.
2604
2963
  \`covered\` or \`partial\` means it is already here: work with what exists.
2605
2964
  - Confirm what is queryable: \`get-integration-instances\` for the connected integrations and
2606
- \`list-entity-types\` for the data the account holds. A control whose evidence lives in a tool that
2965
+ \`get-graph-context\` for the data the account holds. A control whose evidence lives in a tool that
2607
2966
  is not connected can only be attested, not tested.
2608
2967
 
2609
2968
  ## 2. Structure
@@ -2632,7 +2991,7 @@ standard it is or what material they have, ask.
2632
2991
  For each automated control: read the requirement (the domain and how broad it is), the control
2633
2992
  (the tool or process), and the auditor's evidence request (the exact data). Then:
2634
2993
 
2635
- 1. Discover the entity type (\`list-entity-types\`), sample it, probe stored values (casing varies).
2994
+ 1. Discover the entity type (\`get-graph-context\`), sample it, probe stored values (casing varies).
2636
2995
  2. Write the query and run it with \`execute-j1ql-query\`; confirm the rows are what an auditor
2637
2996
  would accept. Narrow with \`WITH\`, never broaden to make rows appear.
2638
2997
  3. Decide \`resultsAre\`: \`BAD\` when rows are violations (the test fails on any row), \`GOOD\` when
@@ -2769,6 +3128,32 @@ Needs the Compliance (CCM) entitlement and edit permission on each control's res
2769
3128
  \`{ "frameworkId": "<id>", "targetState": "LIVE" }\`
2770
3129
 
2771
3130
  Full reference: get-reference topic framework-authoring
3131
+ `,
3132
+ "update-asset-criticality.md": `Set up or change the account's asset criticality: create the levels, rename, reorder or remove them, and add, change, move or remove the J1QL queries that place assets in each level. Works on an account with no config (send the levels and their queries in one call) and on an existing one (send only the change). The config is saved at once; assets carry the change only once runs apply it, which can take a while on a large account. Read the current config with \`get-asset-criticality\` first. Vocabulary: asset criticality, crown jewels, tiers, set up, create, classify assets.
3133
+
3134
+ ## Input
3135
+
3136
+ - \`levels\`: the whole ladder, most critical first, 2-6 levels, sent only when levels change. Keep an existing level by sending its \`slug\` from the read with its name; a changed name renames it. A level missing from the list is removed. An entry without \`slug\` is a new level, and one whose name matches an existing level is refused unless the call changes nothing (a repeat answers \`unchanged\`). Swapping two levels' names, or giving a new level the name a renamed one gives up, is refused too: make it two calls.
3137
+ - \`upsertQueries\`: without \`id\` creates a query (\`level\`, \`name\`, \`j1ql\` required); with \`id\` changes only the fields given, and a new \`level\` moves it. One entry per query id. \`level\` is a level's name or slug in the ladder this call produces.
3138
+ - \`removeQueryIds\`: queries to delete.
3139
+
3140
+ A query selects the complete set of its level's assets, any class: no \`LIMIT\` or \`SKIP\`, at most 1,024 characters. Write a plain filter (\`FIND DataStore WITH tag.PCI = true\`) and \`RETURN e._id AS entityId\` is added, or return one entity's \`_id AS entityId\` yourself. Prove the query with \`execute-j1ql-query\` first.
3141
+
3142
+ ## Outcomes
3143
+
3144
+ - \`saved\`: \`changes\` lists what changed; \`queries\` echoes each created or changed query as saved, with \`returnAdded\` (true when the tool appended the \`RETURN\` to a plain filter) and its \`matchCount\`, what the query returns now and the next run applies, not what assets carry yet (null while still counting: run its \`countQuery\`); \`levels\` carries each level's \`slug\`, \`rank\` and \`appliedAs\` as saved; \`effects\` says what a change to the levels does to assets on the next run: a rename, reorder or removal, or a level or the ladder left without an enabled query. It is empty for a call that adds, changes or removes queries and leaves every level an enabled one; their reach is each query's \`matchCount\`.
3145
+ - \`unchanged\`: the config already says this (a repeated call is safe): nothing was saved.
3146
+ - Refusals, nothing saved: \`invalid_query\` (\`invalidQueries\`: each failing query's index and why), \`invalid_input\`, \`level_has_queries\` (move or remove the \`queryIds\` in the same call), \`queries_without_level\`, \`query_not_found\`, \`conflict\` (re-read and resend), \`read_failed\` (call again), \`interrupted\` (the save may have landed; sending the same call again is safe).
3147
+
3148
+ ## Effects to tell the user
3149
+
3150
+ A renamed level changes its value on every asset (\`retag\`); a reorder or removal renumbers ranks (\`renumber\`); a removed level un-levels its assets and drops its risk-score multiplier; a level or ladder left without an enabled query un-levels its assets. A rule or widget on a changed value or rank selects other assets, or none, once a run applies the change, and one on the new value or rank does until then (\`filters_stale\` names, per level, the filter that holds across the run).
3151
+
3152
+ ## Access
3153
+
3154
+ Needs Assets: Admin (with Shared: Graph Data: Read) or full admin.
3155
+
3156
+ Full reference: get-reference topic asset-criticality
2772
3157
  `,
2773
3158
  "update-attestation.md": `Change an existing attestation on a JupiterOne Compliance (CCM) control, most often to renew it with a later \`expiresOn\`; an expired attestation given a future expiry is active again, so renewing works before and after it lapses. Find the attestation \`id\` in \`get-control\` (\`attestations\`) or \`get-compliance-summary\` (\`expiringAttestations\`, \`expiredAttestations\`). Siblings: \`create-attestation\` records a new one, \`revoke-attestation\` withdraws one for good. Vocabulary: compliance, renew, extend, expiry, attestation, evidence, exception, audit.
2774
3159
 
@@ -2912,6 +3297,10 @@ Full reference: get-reference topic dashboard-layout
2912
3297
 
2913
3298
  JupiterOne Compliance (CCM) runs each control test as a rule named \`CONTROL-TEST:<test name>\`, hidden from \`list-rules\` and \`get-rule-details\`. The tool asks the graph whether a control test references the id and refuses with \`lintCode: 'ccm-managed-rule'\`; a \`name\` with the prefix is refused too. The change belongs on the control, which \`get-control\` reads. The response carries \`ownershipCheck\`: \`'graph'\` when the check ran and found no control test, \`'skipped'\` when it could not run and the update went ahead.
2914
3299
 
3300
+ ## Before saving
3301
+
3302
+ When the update changes an action, render it with \`preview-rule-actions\` (pass the new \`question\`, \`operations\` and \`templates\`) and show the user what it will send; nothing is saved or sent by the preview.
3303
+
2915
3304
  ## Response
2916
3305
 
2917
3306
  \`rule.url\`; give it to the user.