AI drafting¶
Some known-exploited CVEs have exposed hosts in your organization and no Mitigations record that covers them. AI drafting asks an AI agent that you choose to write a draft record for such a CVE. A person reviews the draft and decides whether to activate it.
AI drafting is off by default. It runs only when you name an agent, and the agent runs on the AI provider and credential that you pick. Nothing falls back to anyone's connected provider.
What it does¶
- The engine finds a known-exploited CVE with exposed hosts that no record lists, active or draft. It opens a coverage episode for the CVE and emits
mitigation.uncovered_exposure. This happens whether or not an agent is configured, so you can automate on it yourself. It needs auto-propose on or an agent set: with both off, newly exposed hosts are not tracked and no episode opens. - If an agent is configured, the CVE joins a queue. The engine sends queued CVEs to the agent, highest priority first, up to your daily allowance, by emitting
mitigation.draft_requested. - A rule that the engine installs in your organization answers that event by starting an AI session for your agent. The session gets the CVE's public facts.
- The agent reads the vendor advisory and the CISA Known Exploited Vulnerabilities entry, writes one draft record, checks it with the record validator, and reports an outcome.
- The engine emits
mitigation.draft_outcome. When a record listing the CVE appears, in any status, the episode ends and the engine emitsmitigation.covered.
A draft does nothing by itself. It is not proposed and it is not applied. A person (or a key you have allowed) activates it. With auto-propose on, activating a record then proposes it for every host already exposed, and your mode decides the rest.
The agent the web app installs cannot propose, approve, remove or task a sensor, because its key holds none of those permissions. An agent of your own can do whatever its key allows.
Configuration¶
ai:
agent: mitigation-drafter # the name of one of your ai_agent records; empty means no AI
capability: draft # draft | draft_and_activate
daily_drafts: 10 # drafting requests per UTC day, 1 to 200
| Key | Default | Meaning |
|---|---|---|
agent |
empty | The ai_agent record that drafts. Empty means no AI. Up to 256 bytes of printable characters, with plain spaces allowed. |
capability |
draft |
draft: the agent writes drafts only. draft_and_activate: it may also ask the engine to activate the draft it reported. This needs auto_propose.enabled. |
daily_drafts |
10 |
How many drafting requests the engine sends per UTC day. Each request starts one AI session, billed by the provider you chose. |
The engine does not check, when you save, that the agent exists, because Git Sync may write the configuration before the agent. If the agent is missing, disabled or has no credentials, no session starts and the platform reports an error for the ext-mitigation-ai-draft rule. The web app shows "Agent not found" for a missing record and the rule error for the rest.
Install the agent from the web app¶
On the Mitigations page, the AI drafting card offers Install the LimaCharlie drafting agent, or Use one of my agents.
The install dialog asks for:
- the AI provider, which has no default;
- the model, which has no default;
- the provider API key, as an existing organization secret or a new one, which is never shown again;
- what the agent may do, Write drafts only or Write drafts and activate them;
- the agent's record name,
mitigation-drafterby default.
It then creates, in order: an organization API key holding only the permissions listed below, stored as the secret <name>-lc-key; the ai_agent record from a template you can read before you confirm; and the ai settings in the extension configuration. If a step fails, what was already created stays listed with a Remove action.
You need ai_agent.set, secret.set, apikey.ctrl and ext.conf.set. The dialog names any you are missing before it creates anything.
The agent is an ordinary ai_agent record. You can open it in the agent editor, change its model or prompt, and replace the provider. The engine appends the task for the current capability to the agent's prompt on each run, so changing capability never requires editing the agent.
Stop AI drafting clears ai.agent and removes the trigger rule. It keeps the agent record, its API key and its secret. Remove them yourself if you no longer need them.
Use your own agent¶
Set ai.agent to any ai_agent record in the organization. The agent runs with the API key you gave it and keeps every permission that key holds. The capability setting limits it only if the key holds neither mitigation.activate nor mitigation.set together with sensor.task. For the agent to draft, its key needs the permissions in the next section.
Permissions of the drafting agent¶
The agent's key holds exactly these permissions, whatever the capability:
| Permission | Why |
|---|---|
ai_agent.operate |
Every agent session checks it. |
ext.request, ext.conf.get |
The platform checks them on every extension request. |
mitigation.get |
Read exposure, the catalog and its own drafts. |
mitigation.draft |
Write draft records, and nothing else in the mitigation hive. |
With mitigation.draft the key cannot create or change an active record, activate a draft, deactivate or delete an active record, or task a sensor. See the draft and activate permissions.
The key does not change when you change capability. With draft_and_activate, the agent asks the engine to activate its draft, and the engine does it with its own credential after checking its own configuration at that moment. Switching the capability is one configuration save.
Capabilities¶
draft (default)¶
The agent writes a draft and reports it. Every draft waits for a person to activate it. Review the record, what it breaks and its references, then set it to active in the web app or the mitigation hive.
draft_and_activate¶
After reporting drafted, the agent may call the engine's activate_own_draft request. The task text the engine gives the agent says to do so only when the breakage is low and the mitigation is the vendor's own published workaround. That is an instruction to the model, not a check the engine makes. What the engine does check, every time:
- the capability is
draft_and_activateandai.agentis set; - the request comes from an AI session of exactly that agent, which the platform signs and the agent cannot forge;
- the record is the draft that agent reported as
draftedfor a round the engine requested, and it is still the revision reported: every field exceptstatusis unchanged, includingenforcementandmonitor_for; - the record is still an enabled draft, and was created and last written by the identity of the agent's session.
If all hold, the engine sets status: active and changes nothing else, in one write that checks all of this again. It claims the activation first, so one session activates at a time: a second caller gets in_progress, and a retry from the same session resumes. Whichever pass records the change emits, together, mitigation.draft_outcome with outcome: activated and mitigation.record_activated with actor_kind: ai_agent and the session. The proposals that auto-propose then makes carry activated_by_kind: ai_agent and activated_by_ai. They still pass through your mode: in approve mode someone approves them. The credit follows who wrote active: only a version the extension's own credential wrote is the agent's. If a person or another key activates the same draft at that moment, they are the actor of the change, the engine's claim goes back, and the call answers changed.
The engine refuses with forbidden, not_own_draft, not_a_draft, changed or in_progress. A draft a person wrote is never accepted as the agent's.
If you do not want an AI agent to put anything into production, leave the capability at draft. If you want it to activate drafts but still want a person in the loop, use draft_and_activate with mode approve.
The coverage check¶
With an agent set, the engine also checks coverage against the Vulnerability Reporting extension's per-CVE totals. It runs at the organization's daily slot, and at once when you name an agent or when a covering record is deleted or stops listing a CVE. It compares every known-exploited CVE that the organization's hosts have against a fresh listing of your records. It finds exposures no finding event brought, such as hosts exposed before you set the agent, and it ends the episode, silently, of a CVE that no host has any more. That second step happens only from totals that counted every host, and the coverage keeps its episode and round numbers. A due 30-day retry checks the totals first, so you never pay for a retry on a CVE that is gone from your organization. If that check fails because Vulnerability Reporting does not answer, the retries wait an hour. A CVE waiting for the daily allowance is still sent at the next pass.
An episode that this check opens takes the facts of the CVE's findings that still wait for their batch window (the KEV entry and the package names), and the KEV entry the totals carry: name, vendor, product, and the dates and ransomware use when Vulnerability Reporting sends them. An exposure only the totals know has no package names.
The queue and the daily allowance¶
Each uncovered CVE waits in a queue. The engine takes queued CVEs in priority order, which is known ransomware use first and then the number of exposed hosts seen. It sends requests while the day's allowance (daily_drafts, per UTC day) lasts. The allowance is claimed in the same transaction that emits mitigation.draft_requested, so concurrent passes never send more requests than you allowed. The rest wait for the next UTC day.
A request that ended no_mitigation or failed, or never got an outcome, is sent again 30 days after it was sent, with the next round, if the CVE is still uncovered. This interval is fixed, and new hosts of the same episode never send it sooner. A new episode does.
Naming an agent makes a coverage check run at once, so CVEs that are already uncovered are queued without waiting for a new finding. To draft for a specific CVE right now, use Ask the agent to draft on the CVE's row in the Exposure tab, or the request_draft request. A manual request goes first in the queue and counts against the same allowance. When the allowance is used up the answer has rate_limited: true and retry_after_seconds, and the CVE stays queued first. It is refused when no agent is set (no_agent), when a record already lists the CVE (covered), and when it was sent in the last day with no outcome yet (already_requested).
The AI drafting card shows N of M drafting sessions used for today, how many CVEs wait for tomorrow, the last 10 outcomes with links to the sessions and records, and any error the platform reported for the trigger rule. The same data is in status under ai: agent, capability, queue (waiting, used_today, limit) and recent_outcomes. exposure_summary gives each CVE its draft state: queued, requested or done, with the time and outcome. The draft state also says whether a new request is allowed: request_allowed is false while a request has gone out and has no outcome yet, for less than a day, and request_allowed_at is then when it becomes true (the request time plus a day). A CVE that is queued or has an outcome allows a request, and so does one with no draft state. This reflects the queue only: no_agent and covered still refuse a request whatever request_allowed says.
The trigger rule¶
While ai.agent is set, the engine keeps a rule named ext-mitigation-ai-draft in your organization's service rules. It is listed with the extension's other rules. It matches mitigation.draft_requested events that name your agent, so a stale event for a previous agent starts nothing, and responds with start ai agent using your agent record, a session name that includes the CVE, and the CVE's facts as the session's data.
A configuration save rewrites the rule at once, and the engine's regular pass rewrites a stale one. Clearing ai.agent, or unsubscribing, removes it.
The data the agent receives holds only public facts: the CVE, its KEV entry, EPSS and severity, the package names (at most 20), the platforms, and the number of hosts seen. It holds no hostnames, sensor IDs or addresses.
What the agent can use¶
The agent works with the limacharlie CLI. Three extension requests help it write a valid record and report the result:
| Request | Needs | Returns |
|---|---|---|
authoring_kit |
mitigation.get |
The record's fields, each action type served on a platform with its arguments and limits, whether it can be monitored, up to three catalog records of each type as examples, the validator's problem codes and the stable reason codes. It is generated from the validator itself. |
validate |
mitigation.get |
{ok, hash, problems, request} for a record you pass in. It writes nothing. |
draft_outcome |
mitigation.draft or mitigation.set |
Records the outcome of a round: drafted with record_id, no_mitigation or failed, with a summary of up to 2,000 characters. |
The template agent first reads the catalog and stops with no_mitigation if a catalog record already lists the CVE, because you can install catalog records from the web app. It writes one draft with status: draft, references to what it read, an honest breakage, breaks, expires_after of at most 90 days, and remove_when_patched: true. Its instructions tell it never to invent a mitigation: when the vendor publishes none and none is clearly safe, it reports no_mitigation and says why.
A drafted outcome is accepted only for a draft that lists the CVE and that the reporting credential wrote itself. A draft a person wrote for the same CVE is refused with not_own_draft.
How you see AI work¶
Every record, proposal and decision shows who made it. Records written by an agent show "Drafted by AI" with the agent's name and a link to the AI session. The identity comes from the platform: LimaCharlie signs "this credential was minted for AI agent X, session Y" and carries it to the extension, so the agent cannot leave it off or claim another. It is never guessed from a key's name.
Events carry actor_kind: ai_agent and an ai object with the agent and session. See Events.
Limits¶
- A redelivered
mitigation.draft_requestedevent can start a second session for the same CVE round. Events are delivered at least once. The daily allowance counts requests, not sessions. - The agent can only draft a mitigation the record language can express. It reports
no_mitigationotherwise.