squirrelscan
GitHub

Storage Configuration

Control how many audits a project keeps on disk, and how large the shared content store can grow

The [storage] section controls how much of a project’s audit history squirrelscan keeps locally, and how large the content store that holds crawled pages can grow.

Configuration

[storage]
keep_audits = 3
content_store_max_bytes = "4GB"
store_scripts = false

Options

keep_audits

Type: number or boolean Default: 3

How many audits of this project stay fully renderable. After a successful audit, anything older than the newest keep_audits is retired: its per-check results are deleted and its report can no longer be opened.

The same pass runs at the end of squirrel analyze, the step that finishes an audit when you run crawl, analyze and report separately, so a project audited that way keeps the same bound as one audited with squirrel audit. It uses the keep_audits of the squirrel.toml in the directory you run it from, and only for the project that file names (with no [project] name, only for the latest crawl’s project), so analyzing another project’s crawl with --id never cuts its history. An analysis of a crawl that was blocked or failed retires nothing, as with squirrel audit.

Crawls left behind by audits that were killed before they finished (a watchdog, an out-of-memory kill, a deploy) are retired too, once a newer audit of the project has finished and the crawl has had no activity (no page fetched) for 30 minutes. stopped and paused crawls are what squirrel audit --resume continues, and Ctrl-C leaves one, so they wait 7 days idle instead. A failed crawl follows the same rule as the rest: retired once a newer audit has finished and it is idle, otherwise left alone, and it never takes a slot of the window. Abandoned crawls never count toward keep_audits and never take a slot from a finished audit. A crawl newer than the newest finished audit, or one still fetching pages, is never touched, because it may be a live audit or a crawl waiting for squirrel analyze.

Crawl status

A crawl’s status only moves along the edges below, so a late write can never undo a finished crawl: Ctrl-C or the crawl-phase time limit calling stop() after the crawl completed leaves it completed instead of turning it back into paused. A write the table does not allow changes nothing (it is ignored, never an error, and never stops a crawl). Ctrl-C ends the crawl as stopped, from running or from the paused that stop() writes first while the crawl is live, through the same guarded write, so squirrel audit --resume still continues it and a crawl that already finished stays as it was.

ToAllowed fromWhen
runningany statusthe crawl starts, --resume continues a paused or stopped crawl, or a re-crawl restarts the row
pausedrunning, pausedstop() while the crawl is live
completedrunning, paused, completedthe crawl drained
stoppedrunning, paused, stoppedthe crawl-phase time limit cut it, or Ctrl-C
crawledrunning, paused, completed, stopped, crawledthe crawl is over and the audit moves on
analyzedrunning, paused, completed, stopped, crawled, analyzedthe rules ran (a re-analysis stays analyzed)
failedrunning, paused, failedthe crawl could not continue

Writing a status a crawl already has is always allowed, so a repeated write is harmless.

Each URL the crawl queues has a status of its own: it is pending, becomes fetching when a worker takes it, and finishes as done, failed or skipped only from fetching. A finished URL is never rewritten, and --resume puts a URL that was fetching when the crawl died back to pending so it is fetched again.

While a command runs on a crawl it writes a lease on it (the process id, host name and a heartbeat every 15 seconds), cleared when the command ends. Retention reads it: a crawl with a live lease is never retired, even when a later audit finished first, and a crawled or running crawl whose owner was killed is retired without waiting for a later audit (after 5 minutes and 24 hours of silence). See self disk for the exact rules.

Every audit writes a fresh set of rows, so without a window a project grows by about one audit each time you run it. On a 1,000-page site that is roughly 95 MB per audit, forever. Three is the default because it covers squirrel report --diff against the previous run, and one before that as a fallback when the most recent audit is the odd one out.

[storage]
keep_audits = 10   # keep more history
keep_audits = 1    # keep only the audit that just ran
keep_audits = 0    # turn retention off (also: false)
keep_audits = false

Retention runs only after a successful audit, and a failed one does not count towards the window either. A run that ends failed or blocked, such as a site that is down or answers 403 to everything, neither deletes anything nor takes a place among the audits you are keeping. A week of downtime cannot fill the window with runs that learned nothing and then take the history you would use to find out when it broke.

An audit says so whenever it retires something, on stderr. The pointer to this setting appears the first time a project retires anything and not afterwards:

Retired 1 older audit and freed 95.2 MB inside project.db for the next audit; keep more with [storage] keep_audits (now 3)
Retired 1 older audit and freed 95.2 MB inside project.db for the next audit

The notice never goes to stdout, so it cannot get into -f json output.

store_scripts

Type: boolean Default: false (off, so nothing changes in what an audit stores or requests) Flags: squirrel audit --store-scripts turns it on for one run, and --no-store-scripts turns it off for one run when the config has it on

Keeps the first-party scripts an audit fetched in the content store, for corpus and research runs that analyse a crawl again later (new secret rules, new technology fingerprints, labelling) without fetching the site again.

  • Retrievable by URL. Each audit gets an index of its scripts: the script URL (and the final URL when it redirected), the content hash, its size, and the pages that load it, so a page and its bundles can be rebuilt offline. The index lives in the project database (crawl_scripts).
  • Deduplicated. The body is stored once per distinct content hash, so a vendor chunk shared by many pages, audits or sites is one row in the store.
  • Capped. A script over store_scripts_max_bytes is not stored; it is recorded as skipped with its size and the reason (too-large), and the audit says how many were skipped. The distinct bytes one audit stores stop at store_scripts_total_bytes (total-cap). A 200 that is an HTML page behind a script URL, such as a single page app’s fallback, is skipped as not-javascript. When scripts are skipped, the warning lists each reason with its count and the setting that applies: too large and total cap point at their store_scripts_* setting, while memory cap and time budget are fixed bounds, described below.
  • Stored like the HTML. Bodies live in the same gzipped store and count against content_store_max_bytes.
[storage]
store_scripts = true
store_scripts_max_bytes = "2MB"        # default: a larger script is recorded as skipped
store_scripts_total_bytes = "256MB"    # default: a quarter of content_store_max_bytes
store_scripts_max_scripts = 200        # default: scripts fetched per audit, 1 to 500

What it fetches. The audit’s own checks fetch only a share of the scripts the pages reference: at least 10, a tenth of the pages, at most 50, in page order. With store_scripts on, the audit fetches up to store_scripts_max_scripts (200 by default) instead. Those extra requests to the audited site are made only while store_scripts is on; with it off, an audit makes no request it did not make before. Scripts the pages reference past that limit are not requested: the audit warns with how many, and the count is kept in the project database (crawl_scripts_summary). Raise store_scripts_max_scripts to fetch more. Scripts on another domain are never fetched, and a script over 5 MB is not downloaded: it is recorded as skipped, with at least that size. Chunks a page only preloads are fetched only for pages that send a Content-Security-Policy.

Memory and time. The audit keeps every fetched script in memory for its rules, so peak memory rises with the number of scripts fetched, by up to the total size of the bodies (a script over 5 MB is never downloaded). To bound that, a store_scripts run stops requesting scripts once it holds 256 MB of script text, and stops after 120 seconds of script fetching. Scripts it did not request for either reason are recorded as skipped (memory-cap, time-budget) with no size.

The two bounds are checked when a request is about to start, not while it runs, so they are soft. The time bound can overshoot by up to about 20 seconds: a request already in flight runs to its 15 second timeout, and the body is then decoded. The memory bound can overshoot by the bodies of up to 10 requests in flight at that moment. Script text is held as a JavaScript string, which takes about 2 bytes per character for a bundle with non-Latin1 text (CJK, Cyrillic, emoji), so peak memory can reach roughly 3 times the 256 MB bound on such sites. The scripts a page only preloads are fetched the same way as without the option, and the rules read the same scripts either way. Parallel corpus runs each hold their own bodies, so size the number of runs to your memory.

It does not change the audit. store_scripts is storage only. The rules that read script bodies (file size, compression, minification, source maps, secrets, technology detection) evaluate the same scripts they evaluate with the option off: the first 10 to 50 the audit always fetched, in page order. The extra scripts, up to store_scripts_max_scripts, are fetched and stored for later analysis and are never shown to a rule, so findings and scores are the same with it on or off, and a corpus run with storage on compares with one without. Chunks a page only preloads are fetched the same way as without the option. A store_scripts_max_scripts below the audit’s own share (10 to 50) is raised to it, so the rules always see the same set. The JSON report says how many first-party scripts the script rules were given in meta.scriptsEvaluated (and the LLM output in <scripts-evaluated>), counting any that failed to fetch, so two runs can be checked. To analyse the stored scripts, read them from the content store.

One known gap: the 256 MB and 120 second fetch bounds above also apply to the scripts the rules read. On a site where script fetching hits a bound before the first 10 to 50 scripts are done, the option-off audit would have fetched some that a store_scripts run skips, and the rules see fewer scripts.

Bodies are the decoded text. A script is stored as the UTF-8 text the audit read after the transfer encoding (gzip, brotli) was removed, so the content hash is the hash of that text, not of the bytes on the wire. A redirected script is indexed under the URL the page asked for, with the final URL beside it, and either finds it.

Retention and the size cap. Bodies are evicted least recently used first, like stored HTML, under the shared content_store_max_bytes (1 GB by default). Nothing keeps them past that cap once the audit that stored them has finished: keep_audits and self disk --prune retire an older audit’s index (crawl_scripts), not the bodies, which stay in the store until the cap evicts them. An index row whose body was evicted is marked evicted. For a corpus you intend to keep, raise content_store_max_bytes well above the size of the crawl: bundles compress less than HTML, and the default is shared with every project on the machine. Each site has its own project database, so keep_audits only matters when you audit the same site again.

Both caps count the script text, not the compressed bytes. store_scripts_max_bytes and store_scripts_total_bytes are measured on the decoded size of each script, while content_store_max_bytes counts compressed bytes in the store. The default total, a quarter of content_store_max_bytes, is therefore a quarter of the cap in uncompressed script text, which takes less than a quarter of the store once gzipped.

Disk cost. A script bundle is large, so a corpus run over thousands of sites needs gigabytes. Check squirrel self doctor for the store’s size and cap.

Privacy. Stored scripts stay on your machine in ~/.squirrel/content-store.db. Nothing is sent to the cloud for them. Bundles can contain keys that the site ships to every visitor, so treat the content store as you would the crawl. content-store.db and each project database (and their -wal and -shm files) are created readable and writable by you only (mode 0600, in folders 0700), with the mode set before the database is first written, and an existing file is tightened the next time it is opened. link-cache.db gets the same. On file systems without POSIX modes (Windows, FAT) that does nothing.

When it is off. The project database still has the empty crawl_scripts and crawl_scripts_summary tables, created with the rest of its schema. They hold no rows and take no space until a run stores scripts.

content_store_max_bytes

Type: number (bytes) or a size string such as "4GB" Default: 1GB Environment variable: SQUIRREL_CONTENT_STORE_MAX_BYTES (overrides the config for one run)

The size cap for the content store, ~/.squirrel/content-store.db. Every page an audit crawls is stored there gzipped, and the rules and reports read it back from there. When the store grows past 90% of the cap, the least recently used pages are evicted until it is back at 80%.

[storage]
content_store_max_bytes = "8GB"        # a size string: KB, MB, GB, TB (binary, 1 GB = 1024³ bytes)
content_store_max_bytes = 8589934592   # or a whole number of bytes
SQUIRREL_CONTENT_STORE_MAX_BYTES=8GB squirrel audit https://example.com

The cap counts compressed bytes. HTML usually compresses five to ten times, so the default holds roughly 5 to 10 GB of pages, a few thousand pages of a heavy storefront.

An audit never evicts its own pages. While an audit or crawl runs, every page it stores or reads is protected from eviction, including by another audit running at the same time. A crawl larger than the cap therefore finishes with all of its pages, and the store can sit above the cap until the next audit, which evicts the least recently used pages back down to it before it stores anything.

The store is shared. It belongs to the machine, not to a project, so the cap in force is the one set by whatever is auditing. To use one cap everywhere, set it in ~/squirrel.toml or export the environment variable rather than setting it per project.

Eviction is reported, not silent. Evicting an audit’s pages after it finished does not change its findings, which are stored separately, but anything rebuilt from page HTML is missing for those pages. When that happens squirrelscan says how many pages are affected:

  • squirrel report, squirrel pages and squirrel entities on an audit whose pages were evicted since it ran. pages and entities are built from the page data stored with the audit and do not read the HTML, so their rows are complete, but the notice still names how many pages’ HTML is gone. With --format json the same count is in the output, as storeIntegrity (below).
  • A re-audit, which requests evicted pages again in full instead of reusing them as unchanged, and says how many.
  • squirrel audit --resume and squirrel crawl --resume, when pages the interrupted crawl stored are gone. Run without --resume to fetch them again.
Content store: 812 of 4,000 pages stored for this audit are no longer in the local content store, most likely evicted by its size cap (now 1.0 GB). Findings are unaffected; anything rebuilt from page HTML is missing for them. Raise [storage] content_store_max_bytes or SQUIRREL_CONTENT_STORE_MAX_BYTES to keep more.

In JSON, squirrel report carries it as meta.storeIntegrity, squirrel pages -f json and squirrel entities -f json as a top-level storeIntegrity:

{ "storeIntegrity": { "status": "evicted", "evicted": 812, "stored": 4000 } }

evicted is how many of the stored page bodies are gone. The field is absent when every body is still in the store, so absent means intact. It reports the content store only: findings, scores and the rows pages and entities list do not change.

squirrel self doctor shows the store’s size, the cap and the last eviction.

Running several audits at once

Any number of squirrel processes can run on one machine at once, for example a batch that audits ten sites in parallel. They share the content store and the external link cache in ~/.squirrel, and each project has its own database.

  • Every connection sets a 15 second lock timeout before it does anything else, and write transactions take the write lock when they begin, so a process that needs a lock waits for it instead of failing.
  • A new database file is switched to write-ahead logging with a short retry loop, because SQLite does not wait for that lock on its own.
  • If a lock is still held after 15 seconds, the audit fails with SQLite database is busy (locked) and the message names the database file and how long it waited. The wait is for the one statement that failed, not the whole audit.

This relies on SQLite write-ahead logging, which needs a local disk. Keep ~/.squirrel off a network file system (NFS, SMB): locking there is unreliable, and parallel runs can still fail or corrupt a database.

Two audits of the same site at once still contend for one project database. They stay safe, and the second waits its turn, but run them one after the other if you can.

What retiring an audit does and does not take

A retired audit stays listed. squirrel report --list still shows it, marked retired with the date its data went, rather than the history quietly shrinking. What it can no longer do is open:

Audit data was reclaimed on 2026-09-08: 06148d76-6c48-465a-bc16-deb44144350d

report <id>, report --diff, report --regression-since and analyze all refuse a retired audit that way. If you keep an older audit as a reference baseline, raise keep_audits or turn it off before it falls out of the window.

Re-auditing stays incremental. Retiring never takes the newest page record for a url, the sub-resource sizes, or the links and images a cached page is reused with, so the next audit still answers every unchanged page from its conditional GET rather than refetching the site. Measured on a 40-page site over five audits, the audits after retirement fetched 0 of 40 pages.

Smart audits are unaffected either way: carried findings are keyed by site, not by crawl.

Interrupted audits are cleaned up too. An audit killed (Ctrl-C, a crash, a reboot) after it crawled but before its report was built leaves a crawl that counts toward no window. A later audit of the same project retires it once all of these hold: its report has been building for more than six hours, no live process owns it (an owner process alive on this machine always counts as live, however long since its last heartbeat), a newer audit completed, and at least keep_audits audits are newer than it, so it is outside the window. When in doubt it is left alone, and self disk --prune plans around a crawl that is still building. A crawl from before squirrelscan recorded when the build began waits a week.

Older leftovers are repaired once. Before automatic retention existed, self disk --prune could leave page rows that a later audit then superseded. The next audits and self disk --prune runs of a project remove them, in small steps (500 rows at a time, each a fraction of a second, and at most a couple of seconds per run, so an audit never waits on it), and then record that it is done. A url whose only copy sits in a retired audit keeps it, so re-audits stay incremental. Those rows were the database’s only pointer to their page HTML in the content store, which the store’s size cap evicts as usual.

Retention and reclaiming are different things

Retention deletes rows. SQLite keeps the freed pages in the file and reuses them for the next audit, so the file stops growing rather than shrinking, and an audit does not pay to rewrite it. That is deliberate: at keep_audits = 3 an audit retires one audit’s worth of rows every time, and rebuilding the whole database that often would cost far more than the space it returns.

To hand the space back to the filesystem, rebuild the file explicitly:

squirrel self disk                       # what every project is using
squirrel self disk --prune --keep 3      # retire, then rebuild

See squirrel self disk for the full command.

See also

Type to search…

↑↓ navigate↵ openesc close