AGENTS.md — Talk to your MySecutec data through the CLI¶
This file tells an AI agent (Claude Code, Cursor, Copilot, a custom agent, etc.)
how to use the mysecutec CLI to answer questions about a user's security
posture. The CLI is the agent's tool; this document is its manual.
For the agent: You answer questions about assets, threats, leaked credentials, dark-net exposure, and security-module KPIs by running
mysecuteccommands and reading their JSON output. You never invent data — every figure you report must come from a command you actually ran.
Golden rules¶
- Always pass
-o json. Text output is for humans and is truncated/aligned for terminals. JSON is stable, complete, and parseable. Use it for every command, then summarize for the user in prose. - Never fabricate. If a command returns no data or errors, say so. Do not guess IDs, counts, severities, or dates.
- Read before you write.
list/get/kpis/filtercommands are safe and read-only.update,delete, andrestorechange customer data — see Mutations. Get explicit user confirmation first. - Discover filters before filtering. Many modules expose a
filtersubcommand (assets filter,threats filter) that returns the exact accepted values and live counts. Use it instead of guessing. - Confirm the context. Run
mysecutec statusto see the active environment and whether an organization is being impersonated. Data is scoped to that context.
Setup the agent can assume¶
The user authenticates themselves — the agent does not run login (it opens
a browser for OAuth2). Verify the session instead:
1 | |
If this shows an expired token, tell the user to run mysecutec login. Do not
attempt to log in on their behalf.
Staying current¶
The CLI self-updates. If a command warns that a new version is available, or
that this version is no longer supported, run mysecutec update (or tell the
user to). mysecutec update --check reports availability without installing.
The binary targets the environment baked in at install time (production,
staging, or testing) and updates from that environment's host.
Global flags (valid on every command)¶
| Flag | Meaning |
|---|---|
-o, --output json |
Use this always. json or text. |
-e, --env <name> |
Target testing, staging, or production. Defaults to the configured environment. |
-v, --verbose |
Print raw HTTP request/response — use only when debugging an error. |
--no-color |
Disable ANSI color (harmless with -o json). |
Context: environment and impersonation¶
1 2 3 4 5 | |
Impersonation is stateful and persists between commands. If the user asks
about "Acme Corp", impersonate that org first, run the queries, then offer to
impersonate clear when done. Always tell the user which org's data you are
reporting on.
The data commands¶
All modules follow the same shape: a noun, a verb, JSON out. Pagination is
--limit / --offset everywhere except orgs list, which uses --per-page.
Assets — the inventory¶
1 2 3 4 5 6 7 | |
List responses include pagination (total, offset, limit, next). To
report a true total, read pagination.total — do not count the returned
page. To enumerate everything, follow pagination.next / increment --offset.
Threats — the findings¶
1 2 3 4 5 6 7 8 9 10 | |
threats filter returns statuses, severities, etc. with filtered_total
counts — use it to answer "how many critical threats?" without paging.
threats aggregate is the generic counting engine behind the dashboards: pass
--group-by path[:alias] (repeatable), --module <license_module>, and
--filter path=v1,v2. It's the most efficient way to answer "break down X by
Y" questions.
Security modules (mostly read-only KPIs)¶
Each module exposes some of: kpis (current snapshot), years (data years
available), year-kpis --year YYYY, plus module-specific list commands.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
CSV export (asynchronous)¶
1 2 3 4 5 | |
Exports are async: create returns an ID and a queued/processing status;
poll export list until the record's download_available is true, then
export download <id>.
Account & operations (IAM, reports, notifications)¶
1 2 3 4 5 6 7 8 9 10 11 12 | |
Discover years before requesting year-kpis:
1 | |
Mutations require confirmation¶
These commands write to the customer's live data. Always show the user the
exact command and the current value first, get a clear yes, then run it. All
mutating commands accept -y/--yes to skip the interactive confirmation (use
only when the user has already approved); without it they prompt.
Single-record:
1 2 3 4 | |
Bulk (up to 1000 IDs; IDs via args, repeated --id, or piped --stdin):
1 2 3 4 5 6 7 8 9 | |
The bulk threat endpoint uses partial-success semantics: it reports how many succeeded vs failed (per-ID), so always surface the failed count to the user.
IAM, report, and notification settings commands also mutate (iam create-user,
iam update-user, report settings set/delete, report generate,
notification read, notification settings set/delete, notification devices
remove) — same confirmation rules apply.
Run mysecutec <module> <verb> --help to see the exact flags before executing a
mutation. Prefer reading the current state with get first so you can report
what is about to change.
Recommended agent workflow¶
mysecutec status -o json— confirm auth + which org/env you're in.- If the question is about another org:
orgs list --search …thenimpersonate <id>. - For "how many / breakdown" questions: prefer a
filterorkpiscommand (server-side aggregates) over paging throughlist. - For specifics:
listwith the narrowest flags, thenget <id>for detail. - Parse JSON, summarize for the user, and cite the numbers you actually got
(
pagination.total, KPI fields, filter counts). - If you impersonated, offer to
impersonate clear.
Example: "How exposed are we — give me the headline numbers"¶
1 2 3 4 5 6 | |
Then report: total assets, threats by severity/status, leaked-credential count, dark-net findings, and XDR agent/detection counts — each value traced to one of the commands above.
Error handling¶
- Auth/expiry errors → tell the user to run
mysecutec login. Never log in for them. unknown flag→ you used the wrong pagination flag. Rememberorgs listuses--per-page; everything else uses--limit/--offset. Re-check with--help.- Empty results → report "no data found for that query," don't invent any.
- Unexpected HTTP error → re-run once with
-vto capture the raw response, then surface the actual error message to the user.
Sensitive data¶
LCM (leaked credentials), DNM pii/im (personal info, intercepted content),
and threat details can contain personal or confidential data. Report aggregate
counts and summaries by default; reproduce raw records (emails, passwords,
message contents) only when the user explicitly asks, and never write them to
files or external services without being told to.