Skip to content

Commit affbb5b

Browse files
maximelbclaude
andauthored
investigate: settings get|pause|resume replace the policy commands (#480)
* investigate: settings get|pause|resume replace the policy commands The template is the authority: remove investigate policy get|ai|ai-set|status|pause|resume and their SDK calls. Add settings get (engine read) and settings pause|resume (compare-and-set of the paused field on the default investigation_policy record). Kit section policy is now settings. Document the new act entry (do, approval, lease, on_lease_end, the close entry) and the template's ai_may_decide. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * investigate settings: verify the pause reads back, keep the write path honest Resume clears the field on a disabled record, a record without a version is never written, a permission denial is reported as one (exit code 2) and is not hidden by a re-read, and a pause that does not read back as paused fails. Report a record's expiry. The inbox rows show approval and approval_reason instead of the removed mode. Docs: lease-end limits and the caller-token rule, breaker defaults, the builtin settings fallback, stats counters, a migration note for the old pause record. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * investigate settings: resume races, read-back failure wording, migration note Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * investigate settings: keep the rate-limit exit code on a failed read-back; migration pauses in the same write Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 814b697 commit affbb5b

12 files changed

Lines changed: 650 additions & 642 deletions

‎CHANGELOG.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,45 @@
22

33
## Unreleased
44

5+
### Breaking (experimental Investigation Engine): the template is the authority
6+
7+
The engine now does what a template says: there is no policy layer above it, so
8+
the `investigate policy` commands are removed.
9+
10+
- Removed: `investigate policy get`, `ai`, `ai-set`, `status`, `pause` and
11+
`resume`. SDK: `Investigation.get_effective_policy()`, `get_ai_may_decide()`,
12+
`set_ai_may_decide()` and the constants `MANUAL_PAUSE_RECORD` and
13+
`DEFAULT_POLICY_RECORD`. Whether the AI may decide is the template's own
14+
`ai_may_decide` key. Run overrides can no longer carry `autonomy`,
15+
`ai_may_decide` or `operators`.
16+
- New: `investigate settings get` (SDK `get_settings()`) shows the org settings
17+
the engine enforces, including who last saved the record (`set_by`, `set_at`)
18+
and the circuit breaker's usage. `investigate settings pause` and `resume`
19+
(SDK `pause_actions()`, `resume_actions()`) set the `paused` field of the
20+
`investigation_policy` record `default` with a compare-and-set, instead of
21+
saving or deleting the `autonomy-manual-pause` record. The authoring kit
22+
section `policy` is now `settings`.
23+
- Migration: an org paused under the old scheme holds an
24+
`investigation_policy` record `autonomy-manual-pause` that `investigate` can
25+
no longer see or delete, and the engine no longer reads it. Check for it
26+
(`limacharlie hive get --hive-name investigation_policy --key autonomy-manual-pause`).
27+
If the org should stay paused, first make sure the `default` record holds none
28+
of the removed fields (`autonomy`, `ai_may_decide`, `match`, `operators`,
29+
`automation_routes`, `auto_investigation`): the Hive refuses a write that
30+
carries them, which would also refuse `settings pause` (the AI switch is now
31+
the template's `ai_may_decide`). A record that is clean already can simply be
32+
paused with `investigate settings pause`. When you have to convert the record
33+
by hand, save `paused: true` in that same write, so the org is never
34+
unpaused in between. Confirm with `investigate settings get`, and only then
35+
delete the old record with `limacharlie hive delete`.
36+
- New permissions for these calls: `settings pause` and `settings resume` need
37+
`investigation_policy.get` and `investigation_policy.set` (resume no longer
38+
needs `investigation_policy.del`). `settings get` needs only
39+
`investigation.get` and `insight.evt.get`.
40+
- `doc/cli/investigation-engine.md` describes the new `act` entry (`do`, a
41+
required `approval`, `lease`, `on_lease_end`, the close entry) and the
42+
template's `ai_may_decide`.
43+
544
### New permissions: hives that `sync pull --all` reads
645

746
- `sync pull --all` fails for the whole org when the API key cannot read one of

‎doc/cli/investigation-engine.md‎

Lines changed: 104 additions & 47 deletions
Large diffs are not rendered by default.

‎doc/sdk/other-classes.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ The Cloud Security (CNAPP) surface also includes Code Security: repository and c
196196

197197
## Investigation
198198

199-
`limacharlie.sdk.investigation.Investigation` wraps the Investigation Engine (experimental): the authoring kit, plan validation and dry runs on past alerts, template records (saved as drafts unless a person passes `status="active"`), runs, waves, the approvals inbox, the manual pause of automatic actions (`get_pause`, `pause_actions`, `resume_actions`: the `autonomy-manual-pause` policy record) and performance statistics (`get_stats`). Failures raise `InvestigationError`, which keeps the engine's `error_code`, `reason_code` (a refused run start), `path` (a refused policy field) and coded `issues`. See [CLI: investigate](../cli/investigation-engine.md) for the workflow and permissions.
199+
`limacharlie.sdk.investigation.Investigation` wraps the Investigation Engine (experimental): the authoring kit, plan validation and dry runs on past alerts, template records (saved as drafts unless a person passes `status="active"`), runs, waves, the approvals inbox, the org settings (`get_settings`) and the pause of automatic actions (`get_pause`, `pause_actions`, `resume_actions`: the `paused` field of the `default` settings record) and performance statistics (`get_stats`). Failures raise `InvestigationError`, which keeps the engine's `error_code`, `reason_code` (a refused run start), `path` (a refused settings field) and coded `issues`. See [CLI: investigate](../cli/investigation-engine.md) for the workflow and permissions.
200200

201201
## See Also
202202

‎limacharlie/commands/investigate.py‎

Lines changed: 95 additions & 134 deletions
Large diffs are not rendered by default.

‎limacharlie/discovery.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@
232232
"investigate runs cancel", "investigate runs delete",
233233
"investigate wave", "investigate stats",
234234
"investigate actions list", "investigate actions approve", "investigate actions deny",
235-
"investigate policy get", "investigate policy ai", "investigate policy ai-set", "investigate policy status",
236-
"investigate policy pause", "investigate policy resume",
235+
"investigate settings get", "investigate settings pause", "investigate settings resume",
237236
],
238237
},
239238
"cloud_security": {

‎limacharlie/help_topics.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,12 @@
794794
5. refine, repeat 3-4
795795
6. limacharlie investigate templates save my-plan --file plan.yaml --comment "<what you tested>"
796796
Always a DRAFT. A draft runs only through `templates test` or a run a
797-
person starts, with response actions capped at `suggest`.
797+
person starts, and it only suggests its actions.
798+
Each `act` entry needs `do`, `target` (not on a close), `on_rules` and `approval`
799+
(none | required | {when: <expr>}); a reversible action also needs
800+
`lease` and `on_lease_end` (release | hold | {check, args, extend, max,
801+
at_max}). A case close is an `act` entry with `do: close.false_positive`.
802+
Whether the AI may decide is the template's `ai_may_decide` key.
798803
7. A PERSON reviews and promotes: limacharlie investigate templates promote my-plan --confirm
799804
AI agents must not promote or save with --status active.
800805
@@ -804,8 +809,9 @@
804809
805810
Runs: `investigate runs start|get|list|events --follow|steps|case|cancel`.
806811
Approvals: `investigate actions list --state awaiting_approval`, `approve`, `deny`.
807-
Policy: `investigate policy get|status|pause|resume`. Whether the AI may
808-
decide, or only recommend, is `investigate policy ai` / `ai-set` (a person's call).
812+
Settings: `investigate settings get|pause|resume` (the org pause, circuit
813+
breaker, run identity, notifications, budgets). The template, not the org,
814+
decides what acts alone, what waits for a person and for how long.
809815
810816
Errors carry the engine's coded issues ({code, path, message, suggestion}).
811817
A 404 with no engine error means the feature is not enabled for the region.

0 commit comments

Comments
 (0)