English · فارسی
Point it at any codebase. Get one report an AI assistant can actually use.
Quick start · Install · Usage · The report · More tools · Uninstall
Not to be confused with Sarand, a bioinformatics tool for antimicrobial-resistance gene neighbourhoods. This is an unrelated developer tool.
sarand scans a project, works out what it is, runs its tests, linters and security checks, and writes one file with everything an AI coding assistant needs: the project tree, the full source, the results, a health score and a written summary. Run it before you hand a codebase to an assistant, so the assistant starts with facts instead of guesses.
Why sarand
| One command, one file Tree, source, test results, lint output, security findings and a health score, in a single Markdown, JSON, text, HTML, PDF or SARIF file. |
Written for AI Includes an AI summary and a suggested reading order, so a model knows where to look first. |
| 42 language and format analyzers Python, Rust, Go, Node.js, TypeScript, C/C++, Java, Kotlin, Android, C#, Swift, PHP, Ruby, Lua, Dart, Zig, Haskell, Elixir, Erlang, Scala, shell, SQL, Nix, assembly (with its dialect) and more, plus Dockerfile, Kubernetes (Helm and Kustomize), GitHub Actions, Terraform, Protobuf, YAML, JSON, TOML, XML and Markdown. See the coverage matrix. |
Safe by default Files that contain secrets, and credential-shaped files, are left out of the report. With --security the git history is scanned too. |
| Fast, and never blocked The heavy scanning runs in a Rust core. If it is not available, an equivalent pure-Python scanner takes over. A missing tool is skipped with a hint, never a crash. |
Cross-platform by design Meant to behave the same on Linux, macOS, Windows and Android (Termux). CI runs on all three desktop systems. |
Quick start
Install it once with pipx (Python 3.11+; no Rust needed, the wheels are prebuilt):
pipx install sarand-cli
sarand --version
Other ways (from source, Arch, development) are under Install.
Then run it inside any project:
cd ~/my-project
sarand --full
The last lines tell you where the report went (by default the Downloads folder). Example output:
→ Detected: Rust, Python (cargo)
→ Scan engine: Rust core
→ Running tests (Python, Rust, Shell, JSON, TOML, Markdown)...
→ Running quality checks (Python, Rust, Shell, JSON, TOML, Markdown)...
→ Running security checks (Python, Rust, Shell, JSON, TOML, Markdown)...
→ Rendering Markdown report...
✓ Report completed
============================================================
Project: /home/you/my-project
Detected: Rust, Python
Engine : Rust core
Output : /home/you/Downloads/sarand-my-project-report.md
Files : 163 included / 0 skipped / 1 excluded (secrets)
Health : 76.0/100 (C)
============================================================
How it works
flowchart LR
P[("Your project")] --> D["Detect languages<br/>and layout"]
D --> S["Rust core scan<br/>tree, stats, hashes"]
D --> A["Language analyzers<br/>tests, quality, security"]
D --> G["Git, environment,<br/>TODOs, secrets"]
S --> H["Health score<br/>and AI summary"]
A --> H
G --> H
H --> R{"Renderer"}
R --> O1["Markdown"]
R --> O2["JSON, text, HTML"]
R --> O3["PDF, SARIF"]
O1 --> AI(["Your AI assistant"])
The CPU-heavy part (walking the tree, counting lines, hashing files to find duplicates) is a Rust crate exposed to Python through PyO3 and maturin. Everything that changes often, the analyzers, renderers, health score and CLI, is plain Python. If the Rust extension cannot be built or loaded on your platform, sarand falls back to a pure-Python scanner that produces the same report, only slower.
What's in the report
| Section | What it tells you |
|---|---|
| Quick Context | A short, bounded block at the top: project, structure, checks, critical findings, declared frameworks and what to read first |
| Architecture and risks | Components, workspace members, entry points, Compose and Kubernetes items, and nine rule-based risks; each risk names the report fields it comes from and says what it does not show |
Relevant source (--relevant-source) |
A small, byte-bounded selection of source snippets chosen by fixed signals; secret patterns are withheld line by line |
| Detected project | Languages, build tools and entry points |
| Environment | OS, CPU, memory and toolchain versions |
| Git | Branch, dirty state and recent history |
| Health score | 0–100 with a grade and concrete recommendations |
| AI summary | A written overview and a suggested reading order |
| Project statistics | Files, lines and language breakdown |
| TODO / FIXME markers | Every marker, with its location |
| Test results | Pass or fail per language, with output |
| Quality checks | Linters, formatters and type checkers (--quality) |
| Security checks | Vulnerability, secret and supply-chain checks (--security) |
| Known issues | Problems sarand recognised in the tool output |
| Project tree and files | The tree and, unless you pass --no-source, every included file |
Which tools does sarand use for each language?
sarand drives the standard tools of each ecosystem. Nothing here is required: a tool that is not installed is skipped and sarand --doctor tells you how to install it.
| Ecosystem | Tools sarand can drive |
|---|---|
| Python | tests: pytest · quality: ruff, mypy · security: pip-audit, bandit |
| Rust | tests: cargo · quality: rustfmt, cargo-clippy · security: cargo-audit, cargo-deny |
| Go | tests: go · quality: staticcheck · security: govulncheck |
| Node.js | tests: npm · quality: eslint |
| TypeScript | quality: tsc |
| CSS | quality: stylelint |
| Zig | tests: zig |
| Assembly | built in: names the dialect of every assembly file, no external tool needed |
| Swift | tests: swift, xcodebuild · quality: swift-format, swiftlint |
| SQL | quality: sqlfluff |
| C/C++ | detection: cmake · quality: clang-tidy · security: cppcheck |
| Java / Kotlin / Android | tests: mvn, gradle (uses ./gradlew when present) · quality: checkstyle and spotbugs |
| Lua | tests: busted · quality: luacheck |
| Ruby | tests: bundle |
| PHP | security: composer |
| Dart / Flutter | tests: dart |
| Kotlin | quality: ktlint, detekt |
| C# | tests: dotnet |
| Shell | tests: bats · quality: shellcheck, shfmt |
| YAML | quality: yamllint |
| Markdown | quality: markdownlint |
| JSON | quality: jsonlint |
| TOML | quality: taplo |
| XML | quality: xmllint |
| R | tests: Rscript |
| Perl | tests: prove · quality: perlcritic |
| Julia | tests: julia |
| Objective-C | tests: xcodebuild |
| Groovy | quality: codenarc |
| PowerShell | tests: pwsh |
| Nix | tests: nix · quality: nixpkgs-fmt |
| Haskell | tests: stack, cabal · quality: hlint |
| Elixir | tests, quality, security: mix (Credo and MixAudit only when the project depends on them) |
| Erlang | tests, quality: rebar3 (EUnit, xref) |
| Scala | tests: sbt · quality: scalafmt through sbt, when the project uses it |
| Dockerfile | quality: hadolint |
| Kubernetes | quality: helm lint per chart, kustomize build per overlay (never applies anything; remote bases and unbuilt dependencies are skipped); opt-in: with SARAND_KUBECONFORM_SCHEMAS set, rendered charts and overlays are validated by kubeconform against local schemas (docs/KUBERNETES.md) |
| Docker Compose | quality: docker compose config per Compose file, with its override or variant (never builds, pulls or starts anything; variables are not interpolated, remote include: files are skipped) |
| GitHub Actions | quality: actionlint |
| Terraform | quality: terraform fmt, tflint (never init, plan or apply) |
| Protobuf | quality: buf lint |
Assembly needs no external tool. sarand recognises .asm, .s/.S, .nasm, .yasm, .masm, .fasm, .a51, .a65, .a86 and .z80 files in the project root and in the first-level src/, asm/, boot/, kernel/ and firmware/ folders, and names the dialect of each file in the "Detected project" section: x86 (NASM, GNU as with AT&T or Intel syntax, MASM/TASM, FASM; 16, 32 or 64-bit), ARM (A32/T32), AArch64, RISC-V, MIPS, PowerPC, 6502, Z80, AVR, Motorola 68000 and 8051. It is a transparent heuristic, not a parser: a file it cannot place is reported as Unidentified instead of a guess, and nothing is ever assembled or run.
Project-wide checks that run with --security: gitleaks (secrets, including git history) and syft (software bill of materials with a license summary). PDF output needs an HTML-to-PDF engine: wkhtmltopdf (upstream archived it in 2023, so some distributions no longer ship it) or WeasyPrint (pip install weasyprint, or pipx inject sarand-cli weasyprint for a pipx install; it also needs the Pango system library). If no engine works, sarand says why, writes the same report as Markdown next to the intended PDF path and exits non-zero. On Termux and Android neither engine has been verified; use --format html and print from a browser there.
Install
Requirements
| Needed | For |
|---|---|
| Python 3.11 or newer | Running sarand |
| A Rust toolchain, 1.88 or newer (rustup.rs) | Only to build from source; the PyPI wheels need none |
| pipx | Recommended installer |
| Per-language tools | Optional, see sarand --doctor |
From PyPI (no Rust needed)
pipx install sarand-cli
sarand --version
The package is called sarand-cli on PyPI (the name sarand there belongs to an unrelated project); the command it installs is sarand. Prebuilt wheels cover Linux (glibc) on x86_64 and aarch64, macOS on Intel and Apple silicon, and Windows on x64, for every Python from 3.11 on. Other systems build from source, as below. To upgrade: pipx upgrade sarand-cli.
From source with pipx
pipx builds sarand in its own isolated environment and puts the sarand command on your PATH.
pipx install ~/sarand
sarand --version
To upgrade after pulling new source, use the installer script instead of a plain pipx install, which does not refresh an existing copy. It builds the current source first and only then replaces the old installation; if the build fails (no network, no Rust toolchain) your previous installation is restored, and it retries slow network failures on its own:
./install.sh
It finishes by printing the version it installed and tells you if a different sarand earlier on your PATH would still run instead of it.
If pipx itself is missing, install it with your package manager (sudo pacman -S python-pipx, brew install pipx, sudo apt install pipx) or with pip, then reload your shell:
python3 -m pip install --user pipx
pipx ensurepath
Arch Linux (AUR)
The AUR package is drafted but not published yet, so yay -S sarand does not work today. Use pipx.
Development install
pip install maturin
cd sarand
maturin develop --release
Building the package needs a Rust toolchain: the build backend is maturin, and pip install -e . fails without one (it tries to download Rust and gives up when it cannot). If the extension will not build on your platform (possible on some Termux/aarch64 toolchains), run sarand straight from the source tree instead. With no compiled core importable it uses the pure-Python scanner, and the report says Scan engine: pure-Python fallback:
python3 -m venv .venv && . .venv/bin/activate
pip install rich PyYAML filelock pathspec
PYTHONPATH=python python -m sarand --help
Point it at a project with -p, for example PYTHONPATH=/path/to/sarand/python python -m sarand -p ..
Platform notes: Windows, macOS, Android/Termux
- Windows.
install.shis a Bash script. In PowerShell runpipx install .from the repository instead. - macOS. Nothing special: install pipx with Homebrew and follow the steps above.
- Android / Termux. Everything works in the terminal. The paste helper (
sarand.rc) copies to the clipboard through the OSC 52 terminal sequence, so it needs no clipboard tool and no graphical session.
Usage
| I want to… | Command |
|---|---|
| Analyse the current directory | sarand |
| Analyse another project and lint it | sarand --project ~/my-project --quality |
| Get the most complete report possible | sarand --full |
| Run security checks | sarand --security |
| Skip the slow vulnerability lookups | sarand --security --skip-audit |
| Write JSON without running tests | sarand --skip-tests --format json -o report.json |
| Export a PDF | sarand --format pdf |
| Feed code-scanning tools | sarand --security --format sarif |
| Leave the source out of the report | sarand --no-source |
| Choose the output folder once | sarand --set-output-dir ~/ai-reports |
| Cap the size of each embedded file | sarand --full --max-file-size 1M |
| Speed up repeat runs | sarand --cache |
| Check the environment | sarand --doctor |
--full is shorthand for "give me everything": it turns on --quality and --security and removes the limits on file size, tree depth and tree entries. A --max-depth, --max-entries or --max-file-size you pass yourself still wins.
Large projects and small devices
Before it renders anything, sarand tells you how much source it is about to embed (Embedding about 12.4 MiB of source from 163 file(s)) and warns when that looks too large for the memory this machine has free. A complete --full report of a big project can be slow, or run out of memory, on a phone or a 2 GB laptop; the warning never blocks the run. To get a lighter report, use --no-source, lower --max-file-size (the default is 2M; --full removes it), or leave --full out.
Running sarand again on the same project replaces its previous report at that path and says so, so reports never pile up under one filename.
All options
| Option | Meaning |
|---|---|
-p, --project PATH |
Project root (default: current directory) |
-d, --output-dir PATH |
Folder for the report |
-o, --output-name NAME |
Report file name, one plain filename (no path, no separators; default: sarand-<project>-report.<ext>) |
--set-output-dir PATH |
Save PATH as the default output folder and exit |
-f, --format FORMAT |
markdown (default), json, text, html, pdf or sarif |
--skip-tests |
Do not run tests |
--jobs N |
Start at most N external tools at once (default: one per CPU and per GiB of free memory, at most 8; the SARAND_JOBS variable works too) |
--quality |
Run lint, format and type checks for each detected language |
--security |
Run security and vulnerability checks for each detected language |
--skip-audit |
Skip pip-audit and cargo-audit, whose database lookups can take tens of seconds |
--full |
--quality + --security + no truncation limits |
--max-depth N |
Maximum project tree depth |
--max-entries N |
Maximum entries per tree level |
--max-file-size SIZE |
Largest source file to embed, for example 512K, 2M or 1G (default 2M; larger files are listed as skipped). Overrides the no-limit behaviour of --full |
--no-source |
Do not embed file contents |
--no-health |
Skip the health score |
--relevant-source[=TOKENS] |
Add a small selection of source snippets to read first, at most TOKENS × 3 bytes (default 6000 tokens, allowed 200 to 200000). Off by default |
--focus TEXT |
With --relevant-source: prefer files whose path contains these words |
--structure |
Read the project's Python source with ast (nothing is executed) and add its structure: modules, what they import, unresolved and dynamic imports, and import cycles. Off by default. See docs/STRUCTURE.md |
--structure-baseline PATH |
With --structure: compare the structure with a reference (a snapshot, or a JSON report that has a structure) and add what changed. An unusable reference is an error. See docs/STRUCTURE_BASELINE.md |
--structure-snapshot PATH |
With --structure: write the structure to PATH as a snapshot, after the report succeeded. Refuses to overwrite an existing file |
--replace-structure-snapshot |
Allow --structure-snapshot to replace an existing file; the old one is kept as PATH.prev |
--baseline-gate POLICY |
With --baseline: make the comparison decide the exit code. never (default) changes nothing; new fails with exit code 3 on any new valid finding; new-critical on a new Critical finding; critical on any Critical finding, new or old. Critical is a secret that is not a test fixture, an advisory of severity critical, or a health critical condition; what cannot be decided is listed as uncertain and never fails. Exit codes: 0 success, 1 error, 3 gate failed, 4 unusable baseline. See docs/FINDINGS_BASELINE.md |
--baseline PATH |
Compare the findings with a previous JSON report: what is new, fixed, unchanged or changed. A finding is fixed only when the check that reports it ran in this run; otherwise it is not_checked. An unusable report is an error (exit code 4). See docs/FINDINGS_BASELINE.md |
--cache |
Skip re-scanning TODOs and secrets in files unchanged since the last --cache run |
--clear-cache |
Delete this project's scan cache and exit |
--doctor |
Diagnose the environment and exit |
-v, --verbose / --debug |
More logging |
--version |
Print the version and exit; warns when the running copy is a stale editable install |
Security checks
--security adds the security tools of every detected language (for example bandit and pip-audit for Python, cargo-audit and cargo-deny for Rust, govulncheck for Go) and three project-wide checks:
| Check | What it does |
|---|---|
| Secret scan | gitleaks looks for credentials in the working tree and the whole git history. Findings are redacted. |
| SBOM and licenses | syft lists every dependency per ecosystem and summarises licenses. Copyleft is advice only, unless you add a license policy. |
| Lockfile check | Confirms that the manifest has a lockfile and that the lockfile is not git-ignored. |
Independently of this flag, sarand never copies a file that contains a detected secret into the report, and reports how many files it left out.
Trust model: scanning runs project code
| You run | What sarand starts | Can project code run? |
|---|---|---|
sarand --skip-tests |
Nothing beyond reading and hashing files, the secret and TODO scans, version probes of installed tools and read-only git commands |
No project toolchain. git itself honours the repository's own configuration |
sarand (default) |
Adds the project's test suite with its own toolchain: pytest, cargo test, npm test, go test, mvn test or ./gradlew test, dotnet test, swift test, zig build test, phpunit, ... |
Yes: conftest.py, build.rs and procedural macros, the test script of package.json, the project's own gradlew wrapper script, ... |
--quality |
Linters, formatters and type checkers | Mostly read-only, but some run project-controlled code: npm run lint (a script from package.json), cargo clippy (build scripts and procedural macros), ESLint and stylelint (JavaScript config files), mypy plugins, bundle exec (the Gemfile is Ruby), Maven and Gradle plugin tasks |
--security |
Dependency audits, gitleaks, SBOM (syft) |
They read manifests and lock files, but cargo audit, npm audit, pip-audit, govulncheck and bundler-audit (it downloads its advisory database first) contact the network, and most of them send package names and versions, and ./gradlew dependencyCheckAnalyze runs Gradle |
--full |
All of the above | Yes |
What sarand does not do, and a test keeps it that way: install dependencies, run make, start a shell, or run a package.json script other than test and lint.
Safer ways to scan code you do not trust
- Use
sarand --skip-tests(without--quality,--securityor--full), which starts no project toolchain. - Or scan inside a disposable VM, container or throwaway user that holds no credentials and, if possible, has no network.
- Add
--no-sourcewhen you only want the structure and the health summary: it keeps file contents out of the report (it does not change what runs). - Read a report before you share it. Secret exclusion is best effort (a list of credential-shaped file names, 16 content rules, and
gitleakswith--security), not a guarantee.
To report a vulnerability privately, see SECURITY.md.
Check results and TODO markers
Each check ends as PASS, FAIL, SKIP (tool missing or not applicable) or INCONCLUSIVE. INCONCLUSIVE is for dependency-audit tools (cargo audit, pip-audit, npm audit, govulncheck, ...) that exited 0 but reported that they could not finish, usually because the network was unreachable. It counts as not run in the report's execution coverage instead of earning a green PASS, and a failing exit is never downgraded. The errors listed in a report come only from checks that failed.
The TODO scan skips golden, fixture and snapshot directories and Markdown or reStructuredText prose by default, and the report states how many markers it suppressed. Add project-specific exclusions in .sarand.toml:
[todo]
exclude_globs = ["vendor/*"]
Secret handling
Files whose name looks like a credential (.env*, *.pem, secrets.yaml, kubeconfig, .docker/config.json, *.tfvars, ...) are left out before their content is read, and so is any file in which the built-in scan finds a credential-shaped value. With --security, a file that gitleaks flags is left out too. If your project keeps deliberately fake credentials in its own tests, list those files so they stop lowering the health score:
[secrets]
fixture_paths = ["tests/test_secrets.py"]
Entries are fnmatch globs on the project-relative path (case-sensitive; * also matches /). The default is an empty list, so every finding counts. A listed file is still never copied into the report and its findings are still listed. A glob that would match every file is rejected, and so is any mistake in the table: sarand warns and counts every finding instead.
Waivers
A finding you accept on purpose can be waived so that --baseline-gate stops failing on it. A waiver never hides the finding: it stays in the report, marked as waived, with its reason, owner and end date. Waivers live in .sarand.toml and are read only when a gate is on:
[[waivers]]
id = "dependency_advisory:0123456789ab"
reason = "No fixed release; the vulnerable path is not reachable"
owner = "m.soleimani"
created = 2026-11-27
expires = 2027-02-27
Use id for one exact finding (the id the report prints) or rule = "<class>:<family>" with a required covers = N for a whole rule. created and expires are real dates at most 366 days apart; an expired waiver covers nothing; a rule waiver that matches more findings than covers applies to none; a waiver that matches nothing is listed as unused; any mistake in the file is an error (exit code 1). See docs/FINDINGS_BASELINE.md.
License policy
By default sarand only advises about copyleft licenses, because whether one matters depends on your project. If you know your rules, write them in a .sarand.toml at the project root and --security enforces them against the SBOM:
[licenses]
allow = ["MIT", "Apache-2.0", "BSD-*", "ISC", "PSF-2.0"]
deny = ["AGPL-*", "GPL-*"]
warn = ["MPL-2.0"]
unknown = "allow"
[[licenses.exceptions]]
package = "somelib"
reason = "GPL-3.0, used only as a build tool and never shipped"
| Key | Meaning |
|---|---|
allow |
If set, every license must match one of these (or warn). Patterns are case-insensitive and support *. |
deny |
A match is a violation and fails the check. deny always wins. |
warn |
Acceptable, but reported for review. |
unknown |
What to do with a package that reports no license: allow (default), warn or deny. |
exceptions |
Per-package exceptions. A written reason is required, a version is optional. |
A OR Blets you choose, so a package is judged by its best alternative;A AND Bneeds every part to pass.- Common non-SPDX spellings such as
Apache 2.0orPSFLare mapped to their SPDX ids. Any other unrecognised string must be listed inallowexactly as it is reported. - A mistake in the file (a typo like
alow, a wrong type, invalid TOML) is an error, never silently ignored. syftreads no license for Rust crates becauseCargo.lockcarries none, so keepunknown = "allow"there and letcargo denycover Rust.
Health score
The score is transparent and adds up to 100:
| Part | Points |
|---|---|
| Tests pass | 25 |
| No critical errors in quality or security | 20 |
| Test and quality tooling present | 15 |
| Reasonable TODO count and code hygiene | 15 |
| Security tooling run and clean | 15 |
| Clean git state | 10 |
Grades: A 90 and above, B 80, C 70, D 60, F below 60.
A score is only as trustworthy as the checks behind it, so every report states its execution coverage: how many of the checks you asked for ran to a verdict (6 of 11 requested checks), which ones did not run and why, and which groups had nothing requested. A check whose tool is not installed is skipped, and a skipped check proves nothing. When no check was requested at all there is no percentage and the report says so; it is never 100%. Coverage says what ran, not how complete or correct the analysis is. A security run in which every check was skipped no longer earns the full security points. See docs/EXECUTION_COVERAGE.md.
A security tool that fails can mean it could not run, it found an advisory, or a dependency broke a policy; sarand keeps these apart, lists every cargo audit / cargo deny advisory by id with its severity only when the tool printed one, and marks its applicability as unknown: an advisory is a tool result, not proof of exploitability. See docs/SECURITY_EVIDENCE.md.
Every finding has a stable id, so one problem told in several places is counted once (docs/FINDINGS.md); only a TODO or FIXME written as a task counts as debt and the other markers are shown by category (docs/MARKERS.md); every check has exactly one state (docs/CHECK_STATES.md); and Markdown, HTML, JSON, SARIF and text carry the same facts (docs/RENDERERS.md). The evidence behind these rules, with a before and after on a real project, is in docs/R13_COMPLETION_REPORT.md.
Configuration
The report folder is chosen in this order:
--output-diron the command line- The
SARAND_OUTPUT_DIRenvironment variable - The folder saved with
--set-output-dir ~/Downloads
The saved setting lives in a per-user config file:
| System | Location |
|---|---|
| Linux | $XDG_CONFIG_HOME/sarand/config.json or ~/.config/sarand/config.json |
| macOS | ~/Library/Application Support/sarand/config.json |
| Windows | %APPDATA%\sarand\config.json |
The --cache data is stored in the output folder under .sarand-cache.
More tools
Read the JSON report from a script
sarand --format json starts with a schema_version (MAJOR.MINOR). Adding a key raises MINOR and a script must ignore keys it does not know; removing, renaming or retyping one raises MAJOR and the CHANGELOG says so. Every key and field is listed in docs/JSON_SCHEMA.md (فارسی), and a test fails if the code and that page drift apart.
Give an AI only the code that matters
A report of a whole project can be far larger than a chat can use. --relevant-source adds one small block at the end of the report's context sections: snippets from files the report already includes, chosen by fixed signals, not by meaning. It is a selection, not a summary.
sarand --relevant-source
sarand --relevant-source=3000 --focus "login auth" --format json --no-source
| Signal | Weight |
|---|---|
The path contains a --focus word |
5 |
| The file is changed or untracked in git | 4 |
| The file is an entry point | 3 |
| The file is in the report's "read first" list | 2 |
| A secret pattern matched in the file | 2 |
| The file has a TODO-style marker | 1 |
Files are ranked by the sum of their weights; ties go to the file with more marked lines, then to the path, so the same input always gives the same block. At most 20 files are shown, files with identical content count once (the others are named), and each snippet states its file, line range and reason.
The size limit is on bytes: the block, with its headings, labels and line numbers, never exceeds TOKENS × 3 UTF-8 bytes. That is a conservative estimate, not a promise about any one model's tokenizer; the JSON report states bytes_cap and bytes_used. When space runs short, file names are kept before snippets, and what was dropped is counted.
Secrets are handled twice. The content of a file that sarand excluded for secrets is never read, and every line of every snippet is checked against the secret patterns just before it is written; a match becomes a line saying which pattern matched, never its value. A secret that no pattern recognises is not withheld, which is the same limit the embedded source has.
Paste a large report into a chat
Some chats take no file upload. python3 -m sarand.rc.command splits any file, typically a sarand --full report, into paste-sized chunks. Every chunk sits inside an integrity-checked envelope (session id, per-chunk hash and a final report hash) that an AI receiver can verify. It walks you through the chunks one at a time and remembers where you stopped, and on terminals that support OSC 52 (Termux included) it copies each chunk straight to the clipboard.
sarand --full -d ~/reports
python3 -m sarand.rc.command --source ~/reports/sarand-my-project-report.md
Run the second command again with no options for the next chunk. State is kept in .sarand-rc/. See docs/RC-AI-RECEIVER.md for the protocol as the receiving AI sees it.
| Option | Effect |
|---|---|
--source FILE |
File to split (default: README.md, or the SARAND_RC_SOURCE variable) |
| (none) | Send the next unsent chunk |
-i, --info |
Show session and progress |
-b, --back |
Send the previous block again |
-br, --back-run |
Send the last history entry again |
-n N |
Jump to block N |
-c, --chunk N |
Send chunk N of the current block |
--verify |
Check that the saved chunks rebuild the source byte for byte; sends nothing |
--reset, --clean |
Delete the state and start a new session |
Device storage and environment audit
python3 -m sarand.device_report.command is a separate, read-only tool. It scans a whole device, not one project, for space hogs, duplicate and stale files, build caches, package-manager footprints and Android/Termux environment details, and writes one Markdown report as evidence for a cleanup decision. It never deletes, moves, changes or installs anything. The only environment variables it writes are SHELL, USER and, on Kali/proot, variables whose names start with PROOT, TERMUX, PREFIX or ANDROID; names that look like secrets and credentials inside URLs are redacted.
python3 -m sarand.device_report.command --full -o ~/device-report.md
Device audit options
| Option | Effect |
|---|---|
-o, --output PATH |
Report path |
-r, --root DIR |
Extra scan root, repeatable (default: $HOME, plus /sdcard if present) |
-x, --exclude PATH |
Exclude a path from every scan, repeatable |
-q, --quick |
Skip the duplicate and stale-file scans, the two slowest |
--full |
Always run those scans and remove the --top row cap |
-n, --top N |
Rows per top-space table (default 30) |
-d, --old-days N |
Age in days for a stale file (default 180) |
-m, --min-file-size MB |
Minimum size for the large-files section (default 50) |
-u, --dup-min-size MB |
Minimum size considered for duplicate scanning (default 5) |
-D, --max-depth N |
Maximum scan depth, 0 for unlimited (default) |
--min-top-space MB |
Minimum size for a row in the summary's top-space table (default 1.0) |
--expand-aggregates |
List every cache directory instead of one line per pattern |
--summary-only |
Render only the executive summary; excludes --full |
Built-in diagnostics
sarand --doctor checks the Rust core, your Python version, every per-language tool and the PDF engines. Each line says whether the tool is present and, if it is not, the exact command that installs it. A missing tool is informational; only an unsupported Python version fails the command. sarand --doctor also shows which copy of sarand is running (its version, where it lives, whether it is an editable development install) and warns when a second copy on your PATH shadows it or when an editable install lags behind its source tree. Every command above also answers to --help.
Add a language with a plugin
Implement the LanguageAnalyzer protocol (matches, entry_points, run_tests, run_quality, and optionally run_security) in your own package and register it in your pyproject.toml:
[project.entry-points."sarand.analyzers"]
zig = "sarand_zig_plugin:ZigAnalyzer"
sarand finds it and runs it alongside the built-in analyzers. A plugin that raises, returns the wrong type or cannot be loaded is skipped with a reported reason; it never crashes a scan. The full contract, version compatibility rules and author workflow are in docs/PLUGINS.md, with a working example in examples/sarand-plugin-justfile.
Monorepos and workspaces
sarand detects Cargo workspaces and npm, Yarn and pnpm workspaces and lists their members. For Node workspaces it runs tests and lint inside each member (labelled packages/api: npm test) and skips whatever the root script already fans out, so nothing is reported twice. What is and is not supported, and how the health score treats members, is in docs/WORKSPACES.md.
Troubleshooting
sarand --version shows an old version right after installing
Another copy of sarand comes first on your PATH, typically a development virtualenv that is still active, and it shadows the one pipx just installed. ./install.sh names both copies when this happens, and sarand --doctor lists them. Run deactivate (or remove the old copy) and then hash -r. If it is a development install whose recorded version lags the source, maturin develop --release refreshes it.
sarand: command not found
Run pipx ensurepath, then open a new terminal. On Windows, also check that the pipx bin folder is on PATH.
The build fails with a Rust error
Install a Rust toolchain from rustup.rs and try again, or run sarand from the source tree on the pure-Python scanner, which needs no build (see the development install section).
A check shows as skipped
The tool behind it is not installed. sarand --doctor lists it with the install command.
The security checks are slow
Vulnerability databases are queried over the network. Add --skip-audit to skip pip-audit and cargo-audit; the static checks still run.
The report says files were excluded because of secrets
That is intended. Files that contain a detected secret are never written into the report. Remove or rotate the secret, then run again.
Uninstall
Installed with pipx:
pipx uninstall sarand-cli
Installed as a development install:
pip uninstall sarand
sarand keeps a few things outside the package. Delete them if you want a clean removal:
| What | Where |
|---|---|
| Saved settings | The config file listed under Configuration |
| Reports | Your output folder, ~/Downloads by default |
| Scan cache | .sarand-cache inside the output folder (or run sarand --clear-cache first) |
| Paste-helper state | .sarand-rc/ in the directory where you ran it |
Contributing
AGENTS.md is the source of truth for architecture, conventions and the roadmap. Before opening a pull request, run:
ruff format .
ruff check .
mypy .
pytest -q
Continuous integration also runs cargo fmt, cargo clippy and cargo test, and repeats everything on Linux, macOS and Windows. The full checklist is in CONTRIBUTING.md. Please report vulnerabilities privately, as described in SECURITY.md.
License
Released under the MIT License.
Metadata
Release files for sarand-cli 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sarand_cli-0.9.0.tar.gz | 1.3 MB | With provenance | Details for sarand_cli-0.9.0.tar.gz |
Built distributions (wheels)
Total release size: 11.5 MB
Release files / sarand_cli-0.9.0.tar.gz
| Download URL | sarand_cli-0.9.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1ad4845b8c751a0efb58a4a91e3e836093ad80f3e18ae1a07807e2a4dcf6727
|
|
BLAKE2b-256 checksum How to use checksums |
13f3676c4486ed5ccb24a897f8221ce3920f1e8f7fa22006d938c0e39f11416e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / sarand_cli-0.9.0-cp311-abi3-win_amd64.whl
| Download URL | sarand_cli-0.9.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8f268e692b95687d29b3eda5c6b019d0f143ca15db41744bd35d263538bdf500
|
|
BLAKE2b-256 checksum How to use checksums |
96cade03d3ca3d94ccd14eced551c541a5f9c15dec817ab17df0110abfbb0e10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / sarand_cli-0.9.0-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | sarand_cli-0.9.0-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
27dc6ba840a7853e01aa61f421dc297279b0fe27c4031432ba0ca2d76ab626b8
|
|
BLAKE2b-256 checksum How to use checksums |
aa57d561450f2b7650653971b7bc11e77cad8a225a13add4540ca57fb146fb9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / sarand_cli-0.9.0-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | sarand_cli-0.9.0-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
1016d8e5b9ac215067bf06f30faf0820c51c459524ba8e882d30f5e440dc9504
|
|
BLAKE2b-256 checksum How to use checksums |
2bb0e7f6e2b0db4ed653d9888f007ad37969e0add863cbcb3f72275597a37a78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / sarand_cli-0.9.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | sarand_cli-0.9.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f65d03ff8c96937b7f96a20d79c03e1536a4174e20a5a1f8b1dced4bf07215ae
|
|
BLAKE2b-256 checksum How to use checksums |
da743f7d21fdd36cf7912ced7d9800446de2d5f95ac1c749f18364177e7f21cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / sarand_cli-0.9.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | sarand_cli-0.9.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
abd470a63fb718b3e86555c64061ad2cfb2c07d40039a0a47aa7eb26c0b9f27d
|
|
BLAKE2b-256 checksum How to use checksums |
38f5f4c3cf29c930fa14a67d475d6ea18243bf546520e486b71ac1ed277c1178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / sarand_cli-0.9.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | sarand_cli-0.9.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8dec88e56ec80d45cc8955bdb4bab6bef3d4521454447f7f140a86306829ec27
|
|
BLAKE2b-256 checksum How to use checksums |
a5cfa6f0440b4601ed822f937c648939f15c2f9ed6d2c17504fe52ede7e16ec5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / sarand_cli-0.9.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | sarand_cli-0.9.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
102c02a7ba11bb905e63ff015721ffa4d3b8c9c7c6f2d15ed4a25bc27412bb0b
|
|
BLAKE2b-256 checksum How to use checksums |
59b4fa90774879d38b5b4a93d89c6142923f331c6b4a6d156e5b75f2dab581a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for sarand-cli 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for sarand_cli-0.9.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.