Docs
CLI Reference
Command-line options for Mikoshi
Basic Usage
mikoshi (--target <target> | --target-list <path>) [options]Options
--target, -tstring
Target to test. Accepts URLs, repositories, local directories, domains, IP addresses, API spec files (OpenAPI/Swagger .json/.yaml, a Postman collection export), or a live Postman collection by id (postman://<collection-uuid>). Can be specified multiple times. Fresh runs require at least one target source: --target or --target-list.
When the target is an API spec, Mikoshi copies it into the agent's workspace and authorizes the base URLs it declares (including those resolved from a Postman environment) as in-scope hosts - so the agent reads the contract and tests the full declared surface instead of discovering endpoints by crawling. Pair the spec with the deployed base URL (e.g. --target ./openapi.yaml --target https://api.example.com) so the agent has a reachable host to attack.
--target-liststring
Path to a file containing targets, one per non-empty, non-comment line. Lines starting with # are ignored. Can be specified multiple times and combined with --target.
--instructionstring
Custom instructions for the scan. Use for credentials, focus areas, or specific testing approaches.
--instruction-filestring
Path to a file containing detailed instructions.
--skillsstring
Comma-separated skills to load into the root agent before the scan starts, for
example idor,mass_assignment,custom/my_method. Use the bare name or
<category>/<name>. Unknown names stop the run and list the available skills.
See Skills.
--skills-dirstring
Directory with extra skills, in the same <category>/<name>.md layout as the
built-in set. Repeat the option for more directories. A skill with the same
path as a built-in skill replaces it. Mikoshi also reads MIKOSHI_SKILLS_DIR. See
Add your own skills.
--workspace-filestring
Path to a file on your machine to place into the sandbox workspace before the
scan starts. Repeat the option for more files. Write PATH:DEST to choose the
destination inside /workspace. DEST defaults to the file name. See
Workspace files.
--scan-mode, -mstringdefault: deep
Scan depth: quick, standard, or deep.
--scope-modestringdefault: auto
Code scope mode: auto (enable PR diff-scope in CI/headless runs), diff (force changed-files scope), or full (disable diff-scope).
--diff-basestring
Target branch or commit to compare against (e.g., origin/main). Defaults to the repository's default branch.
--non-interactive, -nboolean
Run in headless mode without TUI. Ideal for CI/CD. When no terminal is
attached (CI, nohup, pipes) and a target is given, Mikoshi runs headless
automatically and says so on one line.
--fail-onstring
Headless mode only (requires -n). Minimum severity that makes the run exit
2: critical, high, medium, low, or info. Findings below the
threshold are still written to every report artifact. A finding whose
severity Mikoshi does not recognize always counts, so the gate never passes on a
value it cannot rank. Omit the flag to exit 2 on any finding.
--blue, --no-bluebooleandefault: on
When the scan ends, write the blue-team report into the run directory:
blue_team_report.md, blue_team.json, and detections/ (Sigma, YARA, and
Splunk/Elastic/Sentinel queries). On by default for headless and interactive
runs. --no-blue, or MIKOSHI_BLUE_TEAM=false in the environment or config
file, turns it off; the flag wins over the setting.
The report is generated when the run wrote vulnerabilities.json (completed,
budget-stopped, or interrupted runs alike) and for a completed run with no
findings. Otherwise it is skipped. A resumed run regenerates it at its end.
The step never changes the exit code. Its outcome is recorded in run.json
under blue_team (status: ok, skipped, or error). To regenerate it
later, run mikoshi blue RUN.
--blue-logsstring
Target log file for the blue-team detection-gap analysis (JSON lines,
Apache/nginx combined, syslog, or text). Repeat for more files. A missing
file is a warning in the report, not an error. Not allowed with --no-blue.
--configstring
Path to a custom config file (JSON) to use instead of ~/.mikoshi/cli-config.json.
--max-budgetnumber
Maximum LLM spend in USD for the whole scan, counted cumulatively across the root agent and every child agent. The budget is checked after each model response.
In non-interactive mode (-n), once the running cost reaches the threshold,
the scan stops cleanly with a stopped status (not a failure) and the sandbox
is torn down. Sub-agents are stopped early, at 90% of the budget, reserving
the final slice for the root agent to wind down and produce the final report.
In interactive mode, reaching the budget pauses the scan instead of ending it: every agent parks, and sending any message resumes the scan with the cap extended by the original budget amount. There is no sub-agent reserve in interactive mode.
As the budget is approached, graduated wrap-up warnings are surfaced to every agent so they can finish their work and call their lifecycle tool before the hard stop. The bands sit just below each role's own stop point: the root is warned at 70%, 85% and 95% (it stops at 100%), while sub-agents are warned at 75%, 80% and 85% (they stop at the 90% reserve). In interactive mode every agent uses the 70%, 85% and 95% bands. Percentages shown in the warnings are the real cumulative spend against the full budget.
Must be greater than 0. Omit the flag for no limit.
Limitations
- The check fires after a response is returned, so the final spend can slightly overshoot the limit by any calls already in flight when the threshold is crossed (most relevant with several child agents running concurrently).
- Cost is a best-effort estimate derived from token usage and model pricing; providers that do not expose priced usage may under-count.
- For LiteLLM-routed models, Mikoshi enables streaming success callbacks to capture provider-reported cost. Message content remains excluded, but third-party LiteLLM callbacks configured in the same process can receive other streaming metadata such as model names, request IDs, and token counts.
--max-turnsintegerdefault: 500
Maximum number of turns (one model response plus its tool round) allotted to each agent, applied per run. When an agent reaches this limit it is force-stopped.
As the limit is approached, graduated wrap-up warnings (at 70%, 85% and 95%)
are injected into that agent's next model turn so it can prioritise its
remaining work and call its lifecycle tool (finish_scan for the root agent,
agent_finish for sub-agents) before the hard stop.
Must be greater than 0.
Examples
# Basic scan
mikoshi --target https://example.com
# Authenticated testing
mikoshi --target https://app.com --instruction "Use credentials: user:pass"
# Focused testing
mikoshi --target api.example.com --instruction "Focus on IDOR and auth bypass"
# CI/CD mode
mikoshi -n --target ./ --scan-mode quick
# CI/CD mode, failing only on high or critical findings
mikoshi -n --target ./ --scan-mode quick --fail-on high
# Blue-team report with a detection-gap check against the target's logs
mikoshi -n --target https://example.com --blue-logs ./access.log --blue-logs ./app.jsonl
# Skip the blue-team report
mikoshi -n --target ./ --scan-mode quick --no-blue
# Cap cost and per-agent turns
mikoshi --target https://example.com --max-budget 25 --max-turns 300
# Force diff-scope against a specific base ref
mikoshi -n --target ./ --scan-mode quick --scope-mode diff --diff-base origin/main
# Multi-target white-box testing
mikoshi -t https://github.com/org/app -t https://staging.example.com
# API spec + live target (OpenAPI/Swagger file or Postman collection)
mikoshi -t ./openapi.yaml -t https://api.example.com
# Postman collection pulled live by id (+ optional environment)
mikoshi -t "postman://<collection-uuid>?env=<environment-uuid>"
# Targets from a file
mikoshi --target-list ./targets.txt
# Extra files placed in the sandbox workspace
mikoshi --target ./my-project --workspace-file ./wordlist.txt
mikoshi --target https://app.com --workspace-file ./openapi.yaml:specs/openapi.yamlExit Codes
| Code | Meaning |
|---|---|
| 0 | Scan completed successfully (interactive mode always exits 0; in headless mode, 0 means no vulnerabilities were found, or with --fail-on, none at or above the threshold; lower findings are still in the report) |
| 1 | A fatal error occurred before or during the scan (e.g. missing environment variables, Docker unavailable, invalid config file, diff-scope resolution failure, or an unhandled error) |
| 2 | Vulnerabilities found (headless mode only; with --fail-on, at least one finding at or above that severity) |