Menu Autopilot

Guides

Autopilot

One request, the right skills in order: flows for reviews, fixes, detections, hunts, alerts and incidents, a check after each step, a ledger, resume, and the gates where it asks.

sh-autopilot is one skill that takes any security request and runs the other indra skills for you. It picks a flow, runs the skills in order, checks each step with a command, and keeps a ledger so a stopped run can resume. Use it when you do not want to pick the skills yourself, or when you want a whole sequence (review, fix, retest, detections, hardening) from one sentence.

It is written as a literal procedure. The rows of every flow are data in a shell file (the prelude), a function prints the next row with its arguments filled in, and a command says whether each row worked. That makes it work with small models too (see Running it with a small model).

When to use it

When to call a skill directly instead

How to call it

In Claude Code, Gemini CLI or any agent that loads the skills, say what you want, or call the skill:

/sh-autopilot secure this repo
/sh-autopilot start my shift source:wazuh-prod
/sh-autopilot handle this alert: 2026-12-02T15:13:52Z webshell detected on web-01 source:wazuh-prod
/sh-autopilot flow:review .
/sh-autopilot secure this repo dry-run
/sh-autopilot resume
/sh-autopilot fix the verified findings ask:never

Without a request, it runs the everything flow. The argument string is split on spaces. These are the forms it understands:

WordMeaning
a request in plain wordssecure this repo, review PR 42, we think host web-01 is compromised. Every word that is not one of the forms below is part of the request, and the request chooses the flow
a folderThe target. A word is the target only if it is ., starts with /, ./, ../ or ~, or contains a / and is an existing folder. The first such word wins; a later one becomes part of the request. The default is the current folder. The path may not contain a space (the run stops and says so)
source:<name>The SIEM source to use, as indra siem list names it. A name that is not configured stops the run and lists the configured names. Without it, the first configured source is used, and only if it passes indra siem test. In shift it also limits the run to that one source; without it shift goes through every configured source
config:<path>The indra.toml that holds the sources. A relative path is read from the folder you started in. A file that does not exist is noted and ignored. indra has no environment variable for the config path, so autopilot adds --config <path> itself to its own commands and tells every called skill to add it to the indra siem, indra ioc sweep and indra detect backtest commands it runs (a config: line in each skill row)
flow:<name>Skip the guessing and run this flow
dry-runPrint the steps it would run and which would be skipped, write them to PLAN.md, and stop. No skill and no row runs. It writes only the run folder (state.json, steps.md with its header, prelude.sh, marks/0) and PLAN.md; there is no REPORT.md and no final message, the plan table is the last output
resumeContinue the last run whose status is running or stopped. See Resume
ask:never|gates|alwaysHow much it asks. gates is the default; any other value is replaced by gates. See Where it asks

If no keyword fits and ask is not never, it asks which flow you mean (gate G5). With ask:never it runs everything.

The flows

The first row that matches your words (whole words, any case) wins, in this order: pr (also a PR URL or a number after pr), incident, alert, shift, hunt, purple, coverage, rules, harden, retest, fix, threat-model, review, everything. A flow:<name> always wins.

FlowSay something likeWhat it runs
everythingsecure this repo, do everythingReview (or reuse a recent one), attack surface, then fix the verified critical and high findings on a branch (after a gate), retest each fix, check detection coverage, draft up to 5 rules and validate them, hardening plan, memory
reviewreview this codeSecurity review (or reuse), attack surface, memory
prreview PR 42, a PR URLsh-pr-review as a dry run. It never posts to the pull request or sets a status
threat-modelthreat model this servicesh-threat-model, then a hardening plan from it
fixfix the findingsA review if none exists, the fix gate, sh-fix on a branch, sh-retest for each fixed finding
retestis it fixedsh-retest for the finding ids you name, else up to 10 verified findings of the last review
hardenwhat should we fix firstsh-hardening
shiftstart my shiftFor each source: shift summary, what changed, silent hosts, triage of the top alerts (at most 10 incidents), tuning rules for noisy rules, and a handover note
alerthandle this alert ...sh-log-triage, indicators extracted and swept, a timeline, a verdict. A malicious verdict asks gate G3 and can go on to the incident rows
incidentwe are breached, host X is compromisedA SIEM timeline, an indicator sweep, sh-incident-response, a STIX bundle of the indicators, rules for what should have fired, hardening
ruleswrite a detection for T1059.001sh-detection-rules for the request, then lint, fixture test and backtest of the rule
coveragewhat are we not detectingsh-detection-coverage, and the first 3 gaps as ready-to-run commands
hunthunt for password sprayingsh-threat-hunt. A confirmed hunt asks gate G3 and can go on to the incident rows. A gap in telemetry goes to hardening
purplevalidate our detectionssh-purple-team writes a plan. Inside an engagement and after gate G2 it runs the plan, drafts rules for what was missed, then hardening. Without an engagement: plan only

The rows of each flow

These tables are the row data of each flow, in order. A row id with a placeholder in it (E6-<finding id>) is one row per item, or one skipped row when there is no item. "Only if" is the test that decides between running a row and recording it as skipped; the tests are listed under Tests that skip a row. "On failure" is retry (one more try, then the run stops), skip (go on) or stop (the run stops, the report row still runs). Every flow ends with a report row that has on-failure stop.

everything

RowWhat it runsOnly ifOn failure
E0Gate G4a review is less than 24 hours oldskip
E1sh-security-review <target>no reuse chosen, and the folder has source filesretry
E2r_counts: counts verified findings, lists up to 10 fixable ids (verified, critical or high)alwaysstop
E3sh-attack-surface <target> run:<review run id>at least one verified findingskip
E4Gate G1fixable ids exist, and the folder is a git repositoryskip
E5sh-fix run:<run dir> finding:<ids> branch:currentG1 answered yesskip
E5br_fixed: which ids the fix record namesG1 answered yesskip
E6-<finding id>sh-retest for each fixed findingsomething was fixed, indra presentskip
E7r_wanted: the wanted ATT&CK techniques and the gapsindra presentskip
E8sh-detection-coverage detections techniques:<techniques> source:<source>indra presentskip
E9-<gap>sh-detection-rules for each gap, named ap-<technique>gaps exist, indra presentskip
E10-<rule name>r_new_rule: count the rule, lint, fixture test, backtestits E9 row is doneskip
E10b-<rule name>sh-detection-rules once more, to fix lint and test errorsits E10 row failedskip
E11sh-hardening <target> from:allalwaysskip
E12sh-memory record <run dir> <target>indra present, verified.jsonl exists, the review did not already record itselfskip
E13Final reportalwaysstop

review

RowWhat it runsOnly ifOn failure
RV0Gate G4a recent review existsskip
RV1sh-security-review <target>no reuse chosen, source files existretry
RV2r_countsalwaysstop
RV3sh-attack-surfaceat least one verified findingskip
RV4sh-memory recordsame test as E12skip
RV5Final reportalwaysstop

pr

RowWhat it runsOnly ifOn failure
P1sh-pr-review <pr> --dry-runa PR number, or a git repositoryretry
P2r_pr_verdict: prints the start of the verdict filealwaysskip
P3Final reportalwaysstop

threat-model

RowWhat it runsOnly ifOn failure
T1sh-threat-model <target>source files existretry
T2r_tm_ok: the threat model is valid JSONalwaysskip
T3sh-hardening <target> from:threat-modelalwaysskip
T4Final reportalwaysstop

fix

RowWhat it runsOnly ifOn failure
F0sh-security-review <target>no verified review yet, source files existretry
F1r_countsalwaysstop
F1br_fix_pick: narrows the list to the finding ids (SH-...-001) or the class slug your request namesalwaysskip
F2Gate G1fixable ids exist, git repositoryskip
F3sh-fix run:<run dir> finding:<ids> branch:currentG1 answered yesskip
F3br_fixedG1 answered yesskip
F4-<finding id>sh-retest for each fixed findingsomething was fixed, indra presentskip
F5Final reportalwaysstop

retest

RowWhat it runsOnly ifOn failure
RT0sh-security-review <target>no verified review yet, source files existretry
RT0br_have_verified: a verified review existsalwaysstop
RT1-<finding id>sh-retest for each id named in the request, else up to 10 verified idsindra presentskip
RT2Final reportalwaysstop

harden

RowWhat it runsOnly ifOn failure
H1sh-hardening <target> from:allalwaysretry
H2Final reportalwaysstop

shift (rows S1 to S6b are repeated for each source, the row ids carry the source name, for example S1-logs)

RowWhat it runsOnly ifOn failure
S1-<source>s_summary: the 24 hour summary, text and JSONindra presentskip
S2-<source>s_compare: against the last 7 daysthe compare command exists, a source is setskip
S3-<source>s_silent: hosts silent in 24 hours that had events beforethe silent command exists, a source is setskip
S4-<source>shift_alerts: writes alerts.txt (rules to triage) and tuning.txt (noisy rules, at most 3)S1 done and the source had events in 24 hoursskip
S5-<source>sh-log-triage of the rules in alerts.txt, at most the incident budget leftS4 done and alerts.txt not emptyskip
S5b-<source>shift_count: adds them to the incident countS5 doneskip
S6-<source>sh-detection-rules tuning request for the rules in tuning.txt, at most 3 rules, named tuning-<source>. Done when it wrote a rule file that passes lint and test, or a README.md with a line starting No rule change proposed: (no filter was justified; the row is done, note no change proposed)rule budget left, tuning.txt not emptyskip
S6b-<source>r_new_rule tuning-<source>S6 done and a rule file exists (skipped after no change proposed)skip
S7write_handover: writes HANDOVER.mdalwaysstop
S8Final reportalwaysstop

For a wazuh source the alerts are the rules whose highest level is 10 or more; for every other kind they are the top 10 by highest level, then by count. The (no rule) row is never listed. At most 10 incidents are triaged over all sources.

alert

RowWhat it runsOnly ifOn failure
A0r_alert_start: your words, plus the first 200 lines of any file named in the request, go to alert/alert.txt; the first timestamp becomes the alert timealwaysstop
A1sh-log-triage of the alert in alert.txtalwaysretry
A2r_alert_iocs: indicators from the alert and the triage report (at most 200)a source is setskip
A3r_sweep: sweep every configured source for them over 7 daysa source is set, indicators foundskip
A4r_timeline: events 30 minutes either side of the alert time (else the last 24 hours)a source is setskip
A5r_alert_verdict: the worst verdict so far (none counts as suspicious)alwaysstop
A6Gate G3the verdict is maliciousstop
I3 to I7The incident rows I3 to I7G3 answered yesas in incident
A7Final reportalwaysstop

With no source but a file named in the request, the flow runs on that file and the rows that need a source are skipped.

incident

RowWhat it runsOnly ifOn failure
I0r_incident_notes: prints the no-response-action line, writes incident/notes.txtalwaysstop
I1r_timeline: SIEM timelinea source is setskip
I2r_incident_sweep: indicators from the notes, swept over 7 daysa source is setskip
I3sh-incident-response on the notesalwaysretry
I4r_stix: a STIX 2.1 bundle of the indicatorsthe ioc extract command knows stix, indra presentskip
I5sh-detection-rules for what should have fired, at most 3 rulesrule budget leftskip
I6r_new_rule incident-<slug>I5 doneskip
I7sh-hardening <target> from:all incident:<report>alwaysskip
I8Final reportalwaysstop

rules

RowWhat it runsOnly ifOn failure
U1sh-detection-rules <request> name:<rule name> (the name is ap- plus the first technique id in the request, else ap- plus the run slug)indra presentretry
U2r_new_rule: lint, fixture test, backtestU1 doneskip
U3sh-detection-rules to fix lint and test errorsU2 failedskip
U4Final reportalwaysstop

coverage

RowWhat it runsOnly ifOn failure
C1r_wanted_req: the techniques named in the request, else from findings, open threats or a starter list; then the gapsindra presentstop
C2sh-detection-coverage detections techniques:<techniques>indra presentretry
C3r_handoff: the first 3 gaps as sh-autopilot flow:rules write a detection for <gap> lines in handoff.mdgaps existskip
C4Final reportalwaysstop

hunt

RowWhat it runsOnly ifOn failure
HU0r_hunt_before: remembers how long hunts/LOG.md isa source is setstop
HU1sh-threat-hunt <hunt request>a source is setretry
HU2r_hunt_verdict: confirmed, benign, inconclusive or gapalwaysstop
HU3Gate G3the verdict is confirmedstop
I1 to I7The incident rows I1 to I7G3 answered yesas in incident
HU3bsh-hardening <target> from:allthe verdict is gapskip
HU4Final reportalwaysstop

purple

RowWhat it runsOnly ifOn failure
PU1sh-purple-team ... mode:plan (from the threat model if there is one, else from the backlog)alwaysretry
PU2Gate G2an engagement is activestop
PU3sh-purple-team runs the approved plan and writes results.mdG2 answered yesstop
PU4sh-detection-rules for techniques scored missed (telemetry but no rule, or rule too narrow), at most 3 rulesplan run, rule budget leftskip
PU4br_new_rule purple-<slug>PU4 doneskip
PU5sh-hardening <target> from:engagementplan runskip
PU6Final reportalwaysstop

What a flow needs

Autopilot checks the machine first (the capability table it prints) and tells you what it found. Where a flow cannot run it stops with one line, before any row runs and with the words Nothing was run:

NeedsFor flows
the indra binarypr, retest, coverage, rules, shift, alert, incident, hunt. Without it, everything runs only the review, fix and hardening rows, and purple only plans. review, threat-model, fix and harden do not need it
jqshift, alert, incident stop without it. See What needs jq
source files or a manifest in the foldereverything, review, threat-model, fix, harden
a configured, reachable SIEM sourceshift and hunt stop without one. alert stops too, unless the request names a file (the file is then triaged as the alert)
gh, logged inpr

For incident, everything, rules and coverage a missing source is not a stop: the rows that need a source are skipped and the rest run. purple without INDRA_ENGAGEMENT set is a plan only: PU2 to PU5 are skipped and the report says plan only: no engagement. In everything and fix, a folder that is not a git repository means gate G1 is not asked and its answer is no. If indra is missing, autopilot tries the installer from references/tooling-setup.md once (not in dry-run).

Tests that skip a row

A row whose test is false is recorded as skipped with the name of the test in its note. Most are plain: INDRA (the binary works), SOURCE (a source is set and indra works), GIT, HAS_SOURCE, ENGAGEMENT, FIX_OK (G1 answered yes), FIXABLE, FIXED, GAPS, VERIFIED, RECENT, RULES_LEFT (fewer than 5 rules drafted), MALICIOUS, CONFIRMED, GAP_RESULT, GO_INCIDENT, HAS_STIX, HAS_COMPARE, HAS_SILENT, PURPLE_RUN (G2 answered yes), MEMORY, PR_OK, DONE:<row> and FAILED:<row> (an earlier row's ledger result), and per-source ones such as EVENTS:<source> and HAS_ALERTS:<source>. The names, and what each tests, are in the cond function of the prelude.

What it will never do

The only places it writes. The rule is a closed list:

  1. autopilot/<run-id>/ in the target folder, and one line autopilot/ in .git/info/exclude.
  2. The output folders the skills document, inside the target folder: .security-harness/ (run folders, latest, memory/, pr-*), detections/, triage/, incidents/, playbooks/, hunts/, purple/, hardening/, fixes/.
  3. One line .security-harness/ appended to the target's .gitignore (what sh-security-review and sh-threat-model do).
  4. The graft wiring sh-security-review does in the target (.mcp.json, .claude/settings.json, .claude/helpers/), and the tool installs of its setup steps (graft, syft, one CVE scanner, one PDF engine, indra), as references/tooling-setup.md says.
  5. Outside the target, only what the skills say: the global memory vault (indra mem where, sh-memory, portable learnings only), indra's data folder (the sh-pr-review cache and metrics, the sh-retest lessons), and the temporary clone sh-pr-review makes for a PR of another repository.
  6. After gate G1, the code of the fix branch.

Where it asks

There are six gates. There is no other question. Each is asked once, with numbered answers and a default; it prints the question as written and accepts only the listed digits. An empty or other reply means the default. The answer and whether it was asked or defaulted (G1=1 (asked)) go into the note of the ledger row.

If a skill itself asks a question that is not one of these, autopilot answers it with the safe answer (no, skip or plan only) and writes skill asked: <question> in the note. A skill that stops for a design decision (sh-fix) means that finding is left, and it goes under "needs a human".

GateWhenQuestion (as printed)AnswersDefault
G0ask:always, before the first rowAutopilot will run flow <flow> on <work_dir> and write only under autopilot/<run-id> and the skills' output folders. Start?1 Yes, 2 No (ends, status stopped)1
G1row E4 or F2 (ask is gates or always), only when there are fixable ids and the folder is a git repositoryAutopilot can fix <n> verified critical or high findings (<ids>) by changing code on a new branch indra/fixes-<run-id>. Nothing is committed or pushed. Fix them now?1 Yes, on the new branch, 2 No, skip the fixes1, but 2 when the working tree has uncommitted changes or the folder is not a git repository. Answer 2 records the row as skipped. If the branch cannot be made, the answer becomes 2
G2row PU2 (ask is gates or always), only inside an engagementAn engagement is active. The plan is in <purple dir>/plan.md; read it first. Answering 2 records you as its approver. Run its test cases against the engagement scope now? Each case is one benign, reversible action and every action is logged.1 No, plan only, 2 Yes, run the plan1
G3row A6 (verdict malicious) or HU3 (verdict confirmed), only when that is the verdict (ask is gates or always)The verdict is <malicious or confirmed>. Start the incident flow (scope, timeline, indicators, a response plan for humans)? The agent takes no response action.1 Yes, 2 No, stop with the triage report1. The incident flow only writes advice for humans and takes no response action, so starting it without a question (ask:never) is within the rules
G4row E0 or RV0 (ask is gates or always), when a review finished less than 24 hours agoA security review of this code finished less than 24 hours ago (<review run id>).1 Reuse it, 2 Run a new full review1
G5flow choice only (no row), when no keyword matched and ask is gates or alwaysI could not tell what you want. Which flow?1 everything, 2 review, 3 pr, 4 threat-model, 5 fix, 6 retest, 7 harden, 8 shift, 9 alert, 10 incident, 11 hunt, 12 purple, 13 coverage, 14 rules1 (everything)

How a step runs

Autopilot works one row at a time and carries only one value, the row id.

  1. next_row prints the next row that is not finished: its id, kind (skill, cmd, gate or report), the skill or command, the arguments with every placeholder filled in, the run-only-if tests, the done-when check and the on-failure cell. The last line starts with DO:: DO: RUN (run the row), DO: SKIP (record it as skipped) or DO: FLOW COMPLETE (no row is left: print the final_message output; next_row exits 0 there). A RETRY: line says the first try failed and what to add to the arguments. A placeholder with no value yet is printed as (not set). A gate's question is printed only when the gate's condition is true.
  2. DO: SKIP ...: it runs skip_row <id>, which records the row as skipped, and asks next_row again.
  3. DO: RUN ...: it opens the row with step_begin <row id>. This stores the open step in autopilot/<run-id>/open_step and the start time in marks/<n>. It refuses when another step is open or when the id is not the next row; autopilot does what the message says and never forces it.
  4. It does the row by its kind. A skill row runs the skill with the printed arguments (through the Skill tool, or by reading the skill's SKILL.md and following it when there is no Skill tool). A cmd row runs the printed command. A gate row prints the gate's question, waits for the reply, and runs gate_answer, which records the answer and prints the line to run next. A report row writes the report.
  5. It runs the done-when check the row printed. A chk_* function, a test command or a function; exit code 0 is done, anything else is failed. It never decides this by reading a skill's own summary. The checks read the open step, so they take no number.
  6. It closes the row with step_end <done|skipped|failed> "<evidence>" "<note>". This appends the ledger row and removes open_step. The flow step and what ran are written from the flow data, never typed. If step_end prints STOP the run is over (status stopped) and only the report is left. If it prints RETRY the row is offered once more.

On failure and when it stops

CaseWhat happens
Row with on-failure skip failsIt is recorded as failed and the run goes on
Row with on-failure retry failsIt is offered once more with a RETRY: line. A second failure stops the run (status stopped)
Row with on-failure skip failsThe row stays failed and the flow goes on; it is not offered again
Row with on-failure stop failsThe run stops
Three failed steps in a rowThe run stops. A done row resets the count, a skipped row does not
The 40th skill callnext_row offers no more skill rows, sets the status stopped and goes to the report (step_begin refuses a skill row too)
A skill is not foundThe row is failed, note skill not found (the name is tried as indra:<name> too)

A stopped run still gets a report: after the stop, next_row offers only the report row. The report lists every failed and skipped row with its note and says sh-autopilot resume. A run that reaches the end has status complete when no row ended failed and complete-with-failures when at least one did (a row that failed and then succeeded on its retry does not count); the report lists the failed ones. Neither is resumable, so for those the report gives the exact command to start the flow again instead of resume.

Files it writes

Everything autopilot writes itself is under autopilot/<run-id>/ in the target folder. The run id is the UTC date and time and the first words of your request (and an x is added until it is free; an old run folder is never reused or deleted). The skills write their own output folders as they always do (.security-harness/, detections/, triage/, incidents/, hunts/, fixes/, hardening/, purple/), and the rest of the closed list above applies. Autopilot adds autopilot/ to .git/info/exclude (not in dry-run, where the folder shows as untracked), so it never shows as an untracked folder in a real run.

FileWhat it holds
state.jsonThe run's state: status (running, stopped, complete, complete-with-failures or dry-run), the flow and how it was chosen, what it found about your machine, git state, counts, lists of finding ids, techniques, gaps and rules, the consecutive failure count
steps.mdThe ledger: one row per step with its number, flow step, what ran (skill name, cmd:<function>, gate:<G> or report), start and end time, result (done, skipped or failed), evidence and a note
prelude.shThe shell file every step loads: the flow data, the helper functions and the checks. Copied from the skill with sed, never retyped
open_stepThe step that is open right now (number, row id, label). It exists only between step_begin and step_end; a run cut off mid-step leaves it behind, and resume closes it as failed
marks/Time markers: 0 is the start of the run, <n> the start of ledger step n (the checks look for files newer than it), hunt.before the length of hunts/LOG.md before a hunt
verdicts.txtOne line per triage or hunt verdict (kind|file|verdict). The state verdict is the worst of them, and the report and handover list every line
PLAN.mdWith dry-run: the steps and which would run
REPORT.mdThe final report, written at the end of every flow that runs rows, also a stopped one (not by a dry run)
chk/The result of each done-when check that succeeded for a step, so a second call for the same step prints the same result and changes nothing
reopen.txtWritten by resume when the report row was already recorded: the report row is run again so the report is rewritten last
HANDOVER.mdshift only: the handover note
validate/Per drafted rule: <rule>.lint.txt, <rule>.test.txt, and with a source <rule>.backtest.json, .backtest.err and <rule>.note.txt (silent in 7d, noisy: N hits in 7d, needs tuning, or the hit count)
shift/<source>/summary.txt, summary.json, compare.txt, silent.txt, alerts.txt, tuning.txt
alert/alert.txt, iocs.json, iocs.txt, sweep-<source>.json, timeline.md
incident/notes.txt, timeline.md, iocs.txt, sweep-<source>.json (the STIX bundle is written next to the incident report under incidents/)
handoff.mdcoverage only: the ready-to-run commands for the first 3 gaps

A short-lived gate_note file (the note for the gate row about to be closed) and temporary *.tmp files can also appear. When indra siem timeline does not exist in your indra version, the timeline is built from indra siem search and a tl.json is left next to it.

The final report and message

REPORT.md is made by the write_report function, so every status, count and list in it comes from the state, the ledger and the files, not from the model. The parts, in this order: what was asked, what ran (the whole ledger), findings and verdicts, what was changed (the branch, git diff --stat, the folders the skills wrote), what needs a human now, what was skipped and why, how to continue. It ends with the commands to continue, for example how to put the findings in your tracker with sh-publish, or sh-autopilot resume. It states that nothing was committed, pushed, deployed, blocked, isolated or rotated.

write_report sets the final status first (running becomes complete when no row ended failed, else complete-with-failures; stopped stays) and writes its two summary sentences itself, in fixed patterns: "The <flow> flow finished <n> of <m> rows; skipped; <k> failed: <ids>." and "Result: <parts>." (verified findings, fixed, rule drafts, coverage gaps, incidents, verdict). No FILL: line is left in the normal case. report_check prints the path when the file exists and no FILL: is left; only then is the report row done. The final message prints the same status.

The last chat message is exactly the output of the final_message function, at most 12 lines and nothing else: run id, flow and status; step counts; findings, detections and SOC lines when there is something to say; the first "needs a human" item; the line that nothing was committed, pushed, deployed or blocked; the report path; and the next command.

Resume

A run that stopped (a cap, three failed steps, a stop-on-failure row) has status stopped. A run that was cut off has status running. Say:

/sh-autopilot resume

Add the target folder if the run is not in the current folder. Autopilot looks for the newest autopilot/*/state.json whose status is running or stopped. If there is none it says `nothing to resume: no autopilot run with status running or stopped`. Otherwise it loads that run's prelude, runs resume_prep (closes a step left open as failed with the note interrupted, sets the status running, clears the failure count and prints the last five ledger rows) and probe_all (checks again what is installed and which sources work), then carries on with next_row. If the report row was already recorded, resume_prep opens it again (a REPORT: line), so the report is the last row and REPORT.md is rewritten.

Rows whose ledger result is done or skipped are not run again, so work resumes at the first row that has not finished. A row that failed is run again only when its on-failure cell is retry and it has failed once; a row that failed for good stays failed. Resume does not give new tries to those, and it does not lift a cap. If the 40-call cap was the reason for the stop, resume_prep prints a CAP: line and keeps the status stopped: resume runs no more skills, offers only the report row, and the report says that the cap was reached, lists the rows not run and gives the command for a new run. The findings, rules and incident caps are in the state. A complete, complete-with-failures or dry-run run is not resumable.

Caps

CapLimitCounted by
Findings fixed per run10the fixable list holds at most 10 ids
Rules drafted per run5counts.rules_drafted; the gap list is cut to the budget left. Tuning, incident and purple rules are at most 3 each
Incidents triaged per run10counts.incidents, over all sources of a shift
Indicators swept per sweep200the first 200 of every indicator file; the state keeps the sum
Retries per step1only rows whose on-failure is retry
Failed steps in a row3, then it stopsconsecutive_failures
Skill calls per run40ledger rows whose What starts with sh- and that were not skipped; failed tries count

When a cap is hit, it does not do the extra work. The ledger note says how many items were left (cap: findings fixed 10, 4 more not fixed) and the report lists it under what was skipped, with the command for them (sh-fix with finding:<ids>, or flow:rules for a gap). resume does not lift a cap.

What needs jq

shift, alert, incident and hunt stop at the start without jq. For the other flows jq is optional. Autopilot's state file is read and written with jq, or with python3 -I when there is no jq, and these have the same python fallback: r_counts, r_wanted (without jq it uses the starter technique list when it has no verified finding to read), validate (the backtest hit count), r_fix_pick, r_retest_ids, r_tm_ok, siem_names and siem_kind. These have no fallback and need jq, which is why the four flows above stop without it: the SOC helpers (summary, alert list, indicator extraction, timeline) and the EVENTS test. The critical and high counts in the report are left out without jq. With neither jq nor python3, it stops and asks you to install one.

Probes

At the start probe_all runs these checks, stores each result in state.json and prints a capability table that autopilot shows you unchanged:

ProbeLooks forUsed for
P1, P2jq, python3state access, the jq rows
P3indra --versionflows that need indra
P4gh and a loginpr
P5source files or a manifest in the folderthe review, fix and hardening flows
P6git: is it a repository, branch, default branch, head, uncommitted changesgate G1 default, the fix branch
P7the sources from indra siem list, the chosen one, indra siem testSIEM rows
P8INDRA_ENGAGEMENT set (value never printed)purple
P9the latest review: exists, has verified.jsonl, newer than 24 hours, has a threat modelgate G4, reuse
P10rule files under detections/coverage and rule rows
P11newer commands: siem timeline, compare, silent, detect maps, STIX in ioc extractoptional rows
P12a PR URL or number in the requestpr

Running it with a small model

Autopilot is written so that a small model can follow it. It leans on code for everything that needs care and on the model only for the skills themselves:

  • One row at a time. The model never plans a sequence. It runs next_row and does exactly what is printed, with the arguments already filled in.
  • Choices are tables. Picking the flow, the downgrades, the gates and the budgets are tables or functions (pick_flow over the keyword data pick_data, downgrades, gate_text), and the row marked "otherwise" is the answer when nothing fits.
  • Checks are commands. Whether a step worked is the exit code of a check, never the model's reading of a skill's summary. The ledger, the counts, the lists, the report and the final message are written by functions, so the model fills in two sentences, not a status.
  • Refusals instead of drift. step_begin and step_end refuse to run out of order, and say what to do instead.
  • Safe defaults. A question that is not a gate gets no, skip or plan only. Text from logs and tickets is data and goes to a file, never into an argument.

It was run end to end with a Haiku-class model on a sample folder: a dry run, a shift start, an alert triage and a review. Those were the flows tried with a small model; treat the others as covered by the checks, not by that trial.

Limits to know about:

  • The skills autopilot calls still need the model to read logs and code. A small model can follow the procedure and still read a log or a code path badly.
  • The quality of triage, review and fixes depends on the model. A check proves that a file exists, a rule lints, a test passes or a verdict line is there. It does not prove the finding is real or the triage is right. Read the verdicts and the findings before you act on them.
  • Without a Skill tool and without subagents, autopilot reads each skill's SKILL.md and follows it, and the review stages (which are meant to be run by separate agents) run one after another in one context. That is slower and uses more of a small model's context window.

Adding a skill or a row to a flow

The flow data in the prelude is authoritative. The prelude lives in plugins/indra/skills/sh-autopilot/references/flows.md, in the function flow_data. One line is one row:

flow|id|kind|what|args|run-only-if names|produces|done when|on failure|each

kind is skill, cmd, gate or report; what is the skill name, the command, or the gate id; args may hold placeholders that next_row fills; the run-only-if names are conditions from the cond function, comma separated, all of which must be true; on failure is retry, skip or stop; each is fixed, gaps, retest or sources for one row per item, or empty. A line flow|@include|FLOW|FIRSTID|LASTID|EXTRA-NAME||||| adds rows of another flow with an extra condition (this is how alert and hunt reach the incident rows).

next_row, step_begin, skip_row, step_end, plan and flow_table all read that data. The tables in flows.md are a readable copy made from it, and if a table and next_row disagree, the data is right.

To add a skill to a flow:

  1. Give the skill a Contract block (call with, needs, writes, done when, never, then), with a "Done when" that is a command. Autopilot's checks are written from it.
  2. Write a chk_<name> function in the prelude for that "Done when" if no existing one fits. It prints the evidence path and exits 0 when the step is done, and reads the open step instead of taking a number.
  3. If the row needs a test that does not exist, add a name to cond (and to dyn if its value is only known while the flow runs).
  4. Add the row to flow_data, in the right flow, with the exact arguments, the tests, what it produces, the check and the on-failure cell. For a new command, write the function in the prelude too.
  5. Regenerate that flow's table with flow_table <flow> and paste it into flows.md.
  6. Run the sync check. It compares the row ids of the tables in the files with the ids in the data and must print flow tables and data agree:
    AD=<a run folder>; . "$AD/prelude.sh"   # or source the block between #PRELUDE-BEGIN and #PRELUDE-END
    flow_sync_check plugins/indra/skills/sh-autopilot/references/flows.md
  7. Run indra skills sync to refresh the generated skills/ mirror, and try the change with dry-run.

For a new flow, also add its name to the downgrades function and its table in SKILL.md Step 1, a keyword row in pick_flow and in the table of SKILL.md, and a place in the gate G5 question (gate_text) and in g5_flow. Never edit the root skills/ folder by hand.