ArchiveBox-compatible plugin suite (hooks and config schemas).
This package contains standalone plugin hook scripts and config schemas. A hook
can be run directly as a CLI; runners such as abx-dl
and archivebox add orchestration,
environment setup, and cache projection around the same scripts.
Tools like abx-dl and ArchiveBox can discover plugins from this package
without symlinks or environment-variable tricks.
Each plugin lives under plugins/<name>/ and may include:
config.jsonconfig schema- optional
config.json > screenshotpoints to a plugin-owned JSON recipe, such as"screenshot": "screenshot.json" - optional generic catalog metadata in
config.json:category,display_order,hidden, andx-auto-run(set false for hooks that require explicit host selection) - optional
snapshot_thumbnail_cardsdeclarations inconfig.jsonidentify ArchiveResult names whose existingcard.htmlmay represent a snapshot in list and grid views, with an explicitorder - optional presentation metadata includes
snapshot_output_group,snapshot_output_order,snapshot_display_name,archive_result_aliases,default_output_path,icon_hidden,card_hidden,card_interactive,output_extension_preference,presentation_module, and booleansnapshot_<role>declarations such assnapshot_list_icon,snapshot_primary_preview, andsnapshot_title_source; hosts consume these declarations generically while plugin templates and presentation modules retain the rendering behavior - ArchiveWeb.page replay optionally reads the sibling
chrome/navigation.jsonartifact to select the recorded final navigation for the requested URL. Missing, malformed, unrelated, or unrecorded navigation metadata preserves selection from the WACZ page index alone. - ArchiveWeb.page defaults
ARCHIVEWEBPAGE_STRIP_COOKIES=true: the native recorder cookie policy omits requestCookieand itsx-wabac-preset-cookiereplay copy. A guarded pinned-extension correction removes Cookie from the actual serialized header dictionary. Policy is snapshot-local, including inherited child recorders; concurrent captures cannot change each other through global extension settings. Set it tofalseonly to intentionally retain cookies. In ArchiveBox, choose this setting in the persona editorβs ArchiveWeb.page plugin settings; the storedPersona.configoverride is{"ARCHIVEWEBPAGE_STRIP_COOKIES": false}. Persona-owned plugin overrides remain live unless a crawl or snapshot explicitly overrides them. Standalone abx-dl accepts the same setting through its normal runtime config/environment; selecting a persona directory alone does not load ArchiveBoxβs persona database settings. Live authentication and persona cookies are unchanged. This is not general secret sanitization: responseSet-Cookie,Authorization, URLs, bodies and browser storage may still contain secrets. It does not clean existing archives. - ArchiveWeb.page removes its temporary recorder collection only after the exact WACZ has finished downloading and reached the snapshot output path. Failed exports retain their recording; unrelated collections and persona state are untouched. This prevents every exported capture from remaining duplicated in the browser profile.
- ArchiveWeb.page's pinned 0.17.0 replay worker uses a hash-validated Storage proxy correction so archived pages can remove the legacy
Object.prototype.__proto__accessor. Only served worker bytes change; installed extension and archive bytes remain intact. Updating that dependency requires reviewing the worker hash and the three exact prototype-lookup replacements inpresentation.py, then passing native replay Storage tests. - Chrome MHTML previews optionally use unambiguous saved font responses from the sibling
responses/index.jsonlwhen native MHTML omits them. Native MIME parts take precedence; missing/malformed metadata or different font bodies for one URL leave the native preview unchanged. Downloaded MHTML bytes are never rewritten. - Chrome navigation retries a temporary HTTP 429/503 GET at most once, using
Retry-After(seconds or HTTP date), or a 60-second cooldown when that hint is absent or invalid. The existingCHROME_TIMEOUTstill bounds the entire navigation: a cooldown that cannot fit is never shortened and the response is reported as failed. POST responses, access challenges, and other HTTP errors are not retried. Browser identity remains unchanged.chrome/navigation.jsonpreserves the HTTP status, attempt count, and failure reason; completed HTTP error pages are not reported as successful navigation. - Managed Chrome selects the IndexedDB
UseLevelDbForNewStoresrollout stage. Chromium's SQLite key-path encoding turns one-element array key paths into strings after a browser restart, corrupting both object-store and index schemas. New origin databases use LevelDB; existing SQLite databases remain accessible. Disabling the rollout entirely would hide existing SQLite state in Chrome 157. This setting does not repair metadata already persisted incorrectly. config.json > required_binariesbinary dependency declarations (optional)on_CrawlSetup__...crawl setup hook scripts (optional) - shared setup/process startup, emit no stdout JSONL recordson_Snapshot__...per-snapshot hooks - emitArchiveResultand may also emitSnapshot/Tag
ArchiveBox templates that need sibling output manifests should bind
{% snapshot_results snapshot 'responses,wget' as captures %} after
{% load core_tags %}, then reuse captures across their loops. The host selects
only the named plugins' manifests or reuses already-prefetched results; it does
not load every result's fields and files for each loop. This works in live cards
and static exports.
Hooks run with:
- SNAP_DIR = base snapshot directory (default:
.) - CRAWL_DIR = base crawl directory (default:
.) - Snapshot hook output =
SNAP_DIR/<plugin>/... - Crawl hook output =
CRAWL_DIR/<plugin>/... - Other plugin outputs can be read via
../<other-plugin>/...from your own output dir
Snapshot hooks may receive CACHE_CANDIDATES, a JSON list of records with
url, snapdir (relative to DATA_DIR), and created_at. ArchiveBox provides
sealed captures from the same owner, persona and visibility, preferring exact
URLs and including nearby paths. Hints may be absent, stale or incomplete.
On a cache miss, Git captures acquire a fresh shallow repository, all branch tips, and recursive
submodules in TMP_DIR/git/<hash of SNAP_DIR>/repo before replacing the saved
checkout. A failed acquisition preserves previous output. A local OS lock is
inherited by Git processes so an interrupted hook cannot leave a live child whose
scratch is deleted by another attempt. The next attempt discards only its own
abandoned scratch; it does not repair saved Git locks or resume a transaction.
This temporarily needs space for one additional repository/checkout. Publication
preserves runner sidecars, removes obsolete repository files, and reports copy
failures as failures. The saved layout remains git/.
Plugins may depend on other plugins through required_plugins. Plugin code must
not import or require archivebox or abx-dl.
config.json key |
Contract |
|---|---|
commands |
Command name β [relative executable, ...arguments]; JSON input/output follows the command's contract. |
output_str_type |
"path" (default) or "text"; text results never identify output files. default_output_path identifies their saved artifact. |
default_output_path |
Saved filename relative to the plugin output directory. |
crawler_output_paths |
Exact plugin-relative .html/.htm files suitable for inexpensive crawler access; omitted means none. Hosts may allow identified crawlers to read only these stored bytes after normal authorization, without previews, rewrites, directory scans, or generated exports. This declaration does not grant access to private captures. |
archive_result_aliases |
List of historical ArchiveResult plugin names owned by this plugin. |
snapshot_output_group, snapshot_output_order, snapshot_display_name |
Card group (html, article_text, images, embedded_media, metadata, other), integer order, and label. |
snapshot_thumbnail_cards |
List of {archive_result_name, order} entries selecting existing card templates for list/grid previews. |
icon_hidden, card_hidden, card_interactive |
Hide icons, hide cards, or allow interactive cards respectively; booleans default to false. |
output_extension_preference |
Ordered lists of equivalent file extensions, e.g. [[".html", ".htm"], [".txt"]]. |
snapshot_<role> / snapshot_<role>_order |
Boolean participation and integer priority (default 0, lower first, then plugin name). Roles include list_icon, primary_preview, title_source, html_replay, live_preview, file_inventory. |
snapshot_live_preview_route |
Registered Django URL name accepting snapshot_id. |
replay_assets |
Format β relative asset paths; an export uses one provider's complete bundle. |
replay_document_patterns |
MIME type β snapshot-relative path globs handled by rewrite_replay_document. |
search_order, search_fallback, search_scan |
Integer priority (default 1000), fallback eligibility, filesystem-scan flag (both default false). |
presentation_module |
Importable module providing the presentation functions below. |
app_module |
Importable app.py providing optional native application functions below; import must not require Django setup. |
agent_tools |
{scope, binaries, environment?}; environment is module:function(endpoint, binaries) -> dict[str, str]. |
agent_skills |
Section name β relative Markdown file, selected by agent_tools.scope. |
Presentation metadata is validated when ArchiveBox loads the plugin catalog. Presentation functions are optional:
template_context(slot, context) -> dict: additional template context. Snapshot details supply plainurl,title,output_dir,output_files, and orderedprimary_preview_plugins.extra_snapshot_output_cards(outputs) -> list[dict]: output records includeoutput_filesmetadata, without model instances.serve_replay_asset_response(path, config, response_factory) -> response | None.render_full_response(filename, output_path, *, source_path=None, replay_base, fallback_url="", last_modified="", etag="", cache_control="", content_encoding="") -> (body, content_type, headers) | None. A sourceetagenables persistent replay payload caching and reuse of parsed WACZ metadata; changing it invalidates both. It must not be returned as the generated viewer HTML's ETag.rewrite_replay_document(text, *, snapshot_root, rel_path, content_type, page_url=None, replay_url=None, source_text=None) -> (text, replacement_count).replay_roots(snapshot_root, url) -> list[str] | tuple[str, ...]: relative directories inside the snapshot.
Application functions are optional. host implements
base.host.Host; it supplies configuration,
authorized records, request handling, and collection CLI command arguments.
host.capture_context(request, *, snapshot_id=None, crawl_id=None) requires
exactly one ID and checks access before returning output_dirs and tmp_dir.
Snapshot context also includes id, url, title, crawl_id, and tags.
Collection UIs can stream host.collection_records(request, after=None, limit=512)
(primary-key pages of domain, parent domain, size and archived favicon metadata) and
host.outlink_records(request, after=None, limit=32) (capture directories and saved
<plugin>/urls.jsonl paths), or read host.domain_records(request, cursor=None, limit=16),
host.snapshot_records(request, domain=..., after=None, limit=16),
host.resolve_snapshot_urls(request, urls), and
host.process_records(request, after=None, ids=(), limit=128), and
host.group_domains(request, hosts) (up to 512 names, offline public suffix list). These require a collection
administrator. Domain pages return registered names, scopes, counts, and an opaque
cursor; snapshot pages return capture IDs, URLs, domains, output directories,
parent/child domains, and a primary-key cursor. URL resolution accepts at most 256
targets. Process pages contain current-machine lifecycle rows, crawl/snapshot/plugin
relationships, recorded interface/local/public IPs, a cursor, and at most 16
capture directories. Up to 128 tracked IDs refresh completed process metadata.
The host owns database queries and domain grouping;
plugins own routes, bounded artifact reads, OS sampling, and rendering.
networkgraph registers /admin/graph/ and uses the vendored Three.js-based
3d-force-graph 1.80.2 bundle. Metadata streams in 512-row primary-key pages. The
overview reads saved outlinks from the newest 50,000 captures, in 32-capture
pages with a 64 KiB read budget per capture. Other captures are available from
domain selection and expansion. Targets
are grouped with captured sites by domain. Missing or malformed artifacts leave
discovery relationships available. Weighted PageRank, Louvain link communities,
and d3 layout run in a browser worker using vendored libraries. Unlinked sites
are omitted from the canvas when there are more than 200, but remain searchable.
W3C, Schema.org, Open Graph and WordPress metadata domains are excluded from nodes and edges.
XFN profile URLs and Creative Commons license deeds, legal code and badges are
also excluded from graph relationships. Other pages on those sites remain eligible.
The graph skips script, stylesheet, and font assets, along with shared CDN
endpoints, Bootstrap homepage references, and Disqus widget links.
Nodes use recorded favicons, logarithmic snapshot counts and PageRank. The
canvas draws up to 850 domains and 1,700 links, prioritizing the selected
neighborhood. The 3D view lays out
communities and their members in depth. Dragging a node pulls on springs along
its links. Nearby nodes sway and settle into new positions for the session.
Incoming and outgoing links use distinct colors and the same springs. Wheel
zoom follows the cursor. Hide removes a node and its links until reload.
Domain selection lazily loads capture details. Neither loading nor layout requires new backend workers,
models, indexes or hooks.
bandwidth registers /admin/bandwidth/ and samples network I/O while the
dashboard polls. It associates runner hook processes and their descendants with
socket counters from macOS nettop or Linux TCP socket diagnostics. Plugins can
also supply exact completed download bytes by implementing
completed_downloads(stderr) -> list[tuple[hostname, bytes]] in their presentation
module. The panel reads bounded tails of recent completed process logs and
uses these measurements for history in place of socket byte deltas from the
same plugin. Recorded DNS
observations label peers when they identify a single site. Ambiguous traffic remains
in an unattributed total. Site cards use archived favicons and show 24-hour
download history, rolling download totals, minimum observed RTT, and hit
estimates based on observed connections. History is retained in the browser
tab. Short connections can be missed by socket polling. Interface cards use
separate host interface counters for devices used by observed flows. Recorded
ArchiveResult sizes supply disk totals, and foreground CPU totals exclude
background hooks. Both plugins contribute cards through the generic admin slots.
Neither plugin has capture hooks,
background services, models, or migrations. Both stop polling in hidden tabs.
| Function | Return value |
|---|---|
get_urlpatterns(host) |
Native Django URL patterns. |
get_websocket_views(host) |
URL name β ASGI callable (scope, receive, send). |
get_api_routers(host) |
(prefix, ninja.Router) pairs. |
get_cli_commands(host) |
Native Click commands mounted at archivebox plugin <plugin> <command>. |
get_services(host, config) |
Service dictionaries described below. |
register_eventbus(bus, config) |
None; register handlers, services or middleware on the supplied native abxbus.EventBus. |
wrap_asgi(application, config) |
ASGI callable; wrap the complete host application, or return it unchanged when disabled. |
enter_operation(name, config, *, attributes) |
Context manager for host work outside the bus, including scheduler passes and CLI commands; receives existing Process identity. |
get_subprocess_env(config) |
Environment mapping for a child Process, captured within the active operation; disabled plugins return {}. |
read_snapshot_inventory(snapshot_dir, *, verify=False) |
None when absent, otherwise {path: {size, hash, is_dir}}; invalid inventories raise ValueError. |
app.py may export AppConfig, a native Django AppConfig subclass with a unique
label. The host installs it at startup; models, migrations, management commands,
and ready() use standard Django behavior. Register signals and logging filters
there. App registration is independent of hook enable flags.
ArchiveBox exposes its resolved process configuration through Django's
settings.CONFIG; apps can pass settings.CONFIG.model_dump(mode="json") to
load_config(global_config=...) in ready() without importing ArchiveBox.
Apps must check their own enable flag before loading optional dependencies or
registering external integrations. Declare x-scope: server on a plugin's
<NAME>_ENABLED property for machine/collection ownership: its settings appear
only in Machine settings, cannot be overridden by personas/crawls, and remain
independent of the crawl's PLUGINS selection.
The Sentry plugin uses this hook for
opt-in Django error reporting and logging; it is disabled and has no DSN by default.
An AppConfig may implement render_page_head(self, request, config) -> str.
ArchiveBox calls it in admin/public UI heads with request-scoped machine settings
(or current machine settings when request is None). Return "" when disabled,
otherwise safe Django-rendered HTML; use json_script for browser settings.
Failures are logged per app and omitted without breaking the page. Archived
content is unchanged.
An AppConfig may implement synchronous shutdown() -> None to flush or close
resources during HTTP worker shutdown. It runs off the event loop; failures are
logged without skipping other apps. Disabled apps must keep cleanup a no-op.
An app_module may export synchronous register_eventbus(bus, config) -> None
to attach native bus.on(...) handlers, services or bus.middlewares. ArchiveBox
calls it once before dispatch on each crawl, binary-resolution and install bus,
using the operation's resolved config, including applicable crawl/persona and
runner overrides. Every application plugin is offered the bus; the plugin
owns enable checks and must check before importing optional dependencies.
Use load_config(..., global_config=config, environ={}) to preserve host-resolved
settings. Registration errors fail the operation; the host owns bus teardown.
Process-wide initialization must tolerate multiple bus registrations.
An app_module may export synchronous wrap_asgi(application, config). ArchiveBox
calls it once per HTTP worker after Django setup, with resolved machine/collection
configuration. Wrappers compose in catalog order (first plugin outermost), around
HTTP and WebSocket dispatch, including request-body reads, response streaming and
disconnect cleanup. A wrapper must preserve the ASGI protocol and propagate
exceptions/cancellation, with cleanup in finally. Plugins own enable checks;
disabled plugins return the original callable before importing optional runtime
dependencies. Registration errors fail startup. This hook does not wrap individual
views or create a second Django middleware stack.
ArchiveBox's services.runner.create_bus(config=..., **bus_options) registers
apps immediately; crawl runners defer registration until their config is loaded.
Standalone abx-dl does not call these application hooks. No separate EventBus
metadata is needed beyond app_module. See the Sentry app
for an opt-in example; plugins must not import ArchiveBox or abx-dl.
Call abx_plugins.plugins.base.django.register_webhooks(model, *, events=None, status_events=None)
from AppConfig.ready() to register CRUD webhooks. events maps event names to
options (label, icon, color, section, blocking);
status_events maps saved status values to declared events. These use the model's
webhook_events and webhook_status_events attributes. Emit an explicit event with
webhook_event.send(sender=Model, instance=instance, event="READY", **metadata) from the same module.
Payloads use the existing serializer and optional model.webhook_data() method.
Services require name, label, and prepare() -> supervisor_worker_dict.
Optional fields: ready() -> bool, bind: (host, port), process_name,
identity: list[str], and contexts: list[str] (default
["server", "runner", "command"]). The prepared worker keeps the declared name.
templates/<slot>.html contributes UI through {% plugin_ui slot %};
{% plugin_ui plugin slot %} selects one plugin. Collection slots: navigation,
add, importers_actions, importer_sessions, snapshot_head,
admin_archive_results_cards, admin_environment_cards.
Output slots: icon, card, full. Static assets stay inside the plugin.
Templates and template_context receive the existing context, including Django
models and request when supplied by the view.
A search provider registers search and flush in config.json > commands.
It can also register "search_candidates": ["search.py", "search_candidates"]
to evaluate content predicates against an authorized page of snapshot IDs.
For indexed providers ArchiveBox sends snapshot IDs. A provider declaring
search_scan: true is eligible only when the collection has no enabled index.
The host uses its candidate command exclusively, including for legacy contents
URLs. Each candidate includes its authorized snapshot path under archive_root.
File, byte and wall-clock budgets are shared across the query. A scanner must
treat an incomplete read as unknown, including in a connected stream.
An indexed provider's optional app_module.search_word_hits(word, *, environ, timeout)
can return a bounded, ranked iterable of confirmed snapshot IDs for a lowercase
word. This avoids launching a command for a single cheap index lookup. It must
honor the supplied timeout, use the resolved environment, and require no archive
file reads. Missing IDs are unknown. Hosts check permissions, scope and the full
Boolean expression before displaying any hit. Providers without this adapter use
the standalone commands.
An index can additionally expose search_word_pages(word, *, environ, timeout).
Yield successive pages of ranked positive IDs and finish only at end of postings.
Raise on interruption or backend failure. Each fetch observes the socket timeout.
Exhausting this iterator establishes all index positives for the word. It does
not certify coverage of an individual document or prove a negation.
Input is one JSON object on stdin. A provider flushes at most one JSON object per candidate to stdout, in the order evidence becomes available. It may omit unresolved candidates. Each operand in a request must have a unique key.
{"candidates":[{"id":"snap-1"}],"terms":[{"key":"t0","mode":"literal","value":"Solar panel"}],"limits":{"seconds":2,"files":8,"entries":64,"bytes":131072,"per_file":65536}}{"id":"snap-1","matches":{"t0":true},"scores":{},"usage":{"entries":2,"files":1,"bytes":320}}wordrequests the provider's term search.literalrequests a contiguous substring in indexed text. Each operand determines its own case mode. An uppercase letter in its value requires matching case. Only original text can establish such a match when a provider's token index discards case.matchescontains confirmed booleans keyed by the request's opaque term keys. Omit a key or candidate when it is unsupported, unindexed, unreadable, capped or otherwise unresolved. A negative requires complete evidence. Optionalscoresrank confirmed matches, with larger finite values first.- Hosts supply candidate IDs. Each page admits up to 64 candidates
and 128 terms. Limits apply across the page. The shared command caps work at
8 seconds, 96 file attempts, 512 directory entries, 4 MiB of source bytes
and 512 KiB per file.
usagegives the increment for each emitted row so callers can charge subsequent pages against one query budget. Hosts also enforce a subprocess timeout for blocked filesystem or network reads.
Connected clients may send "streaming": true to continue beyond the preview limits. The SQLite provider keeps a cursor and matches across chunk boundaries. For this mode the file, entry and byte allowances renew in one-second windows, and per_file limits an individual read. While processing a long candidate, providers may flush {"progress":true} to renew the inactivity timeout without reporting a match. Consumers must terminate their subprocess when the client disconnects. An unavailable source still supplies no evidence for negation.
ArchiveBox renders the existing config.json properties as searchable plugin
settings on /add/ and Persona admin. No extra manifest is needed. A field can
replace its presentation through templates/config/<EXACT_CONFIG_KEY>.html:
{% extends "plugins/config_field.html" %}
{% block label %}Image size{% endblock %}
{% block widget %}{% include "plugins/config_resolution.html" %}{% endblock %}
{% block help %}Choose a preset or enter width,height in pixels.{% endblock %}The template receives plugin and field (key, input_name, value, label,
description, minimum, maximum, options). Without an override, the shared renderer
handles booleans, enums, numbers, strings, secrets, and JSON. Keep the canonical
control's name="{{ field.input_name }}", id="id_{{ field.input_name }}",
class="plugin-config-input", and data-config-key="{{ field.key }}" so existing
validation, Persona defaults, and saving continue to work. Presentation templates
do not change the schema or persisted key/value shapes.
Shared controls include plugins/config_range.html (pass unit, low, high,
and step), plugins/config_resolution.html, and plugins/config_editor.html.
The editor extends the field template with language and snippets blocks;
buttons with data-config-insert insert text at the cursor. Add
data-config-position="start" for a guard before existing code, or use
data-config-wrap with an __SCRIPT__ placeholder to wrap the existing script.
data-config-source reads a sibling field into an __VALUE__ placeholder as a
quoted string (useful for routing prompts by domain). See Puppeteer's script
and Autosummary's prompt templates for working examples. Editors submit ordinary
strings; snippets are inserted only when selected.
Command contracts:
browser-open: stdin{config, persona_dir, name?, headless?, collection_dir?}; emits a JSON readiness record withreadyandbrowser_pid.browser-export-state: stdin{config, user_data_dir?, cdp_url?, profile_dir?, browser_binary?, cookies_output_file?, auth_output_file?}; exports selected browser state.browser-profile: stdin{action: "copy" | "import", source_dir, destination_dir, profile_dir?}or{action: "prepare", persona_dir, source_dir?, name?, browser_binary?}; stdout{path}. Paths are absolute;importrequiresprofile_dirand normalizes it toDefault.configure-gallery: stdin{model, config, data_dir}; stdout{configured: bool}.recover: stdin{config, paths}; stdout{processes_orphaned: nonnegative int}. Recovery uses installed tools and preserves live owners.deduplicate: stdin{root, files: [{path, hash, size}]}; emits{type: "DeduplicateResult", schema_version: 1, supported_platform, attempted_files, extent_bytes_verified, failed_files, error?}.
Plugins need no screenshot registration. ArchiveBox captures the selectable outputs
of its default example snapshot at desktop, tablet, and mobile sizes. The marketplace
automatically uses snapshot-view-<plugin-name>-<profile>.png (underscores become
hyphens). Enabled plugins with visible output templates must appear in the gallery.
For a plugin that needs a different source, add "screenshot": "screenshot.json"
to its config.json and keep the recipe beside it:
{
"url": "https://news.ycombinator.com/item?id=41860909",
"wait_for_text": "ArchiveBox is evolving: the future of self-hosted internet archives"
}url overrides the default snapshot source. Every source runs the full capture
pipeline. config_overrides supplies plugin settings for that capture, such as a
script or agent prompt. output_plugin selects the saved output to photograph
(default: the recipe's plugin); preparation plugins can show the normal screenshot
output after their work. wait_for_text waits
inside that output's preview before taking the screenshots. Recipes sharing a URL
reuse one snapshot. An optional view selects an existing application gallery
view instead, such as "AI agent". With "config": true, view names a dedicated
screenshot of the plugin's expanded settings on Add URLs (see mobilesize).
Set "enabled": true to include an optional plugin in the default capture.
Ordinary plugins need no recipe.
The yt-dlp example uses a public HTML video demo so its gallery does not depend on YouTube allowing anonymous CI downloads. TLSNotary uses the small Example Domain response so the gallery can show a complete verified proof within its normal response-size budget. Both still require real successful captures.
Recipes travel in the plugin package. Neither website needs a plugin allowlist, and adding an example requires no workflow changes or separate screenshot job.
EXTRA_CONTEXT is an opaque JSON object used only by shared output emitters to
reflect correlation fields unchanged into JSONL records. Hooks must never read,
branch on, or extract values from it, including IDs. Required inputs belong in
explicit CLI arguments (e.g. --snapshot-id, --depth, --url) or filesystem
data. Unbounded archived content such as titles and tags belongs in files, not
environment variables or shell commands. Sonic reads snapshot metadata from
SNAP_DIR/index.jsonl; archived title text is available in title/title.txt.
SQLite and Sonic first index saved plain text/Markdown (including LiteParse/OCR),
extracted article HTML from Readability, Defuddle, Mercury and Trafilatura, and
native HTML document exports published under files/ with downloads.json.
Data URLs and long ASCII encoded blobs are stripped in bounded streaming reads
before any size thresholds are applied. Extracted text has a 5 MiB total budget.
If it supplies less than 10 KiB, raw HTML with less than 100 KiB of cleaned source
is used as a fallback, adding at most 256 KiB of text. HTML parsing itself is
bounded to 16 MiB of cleaned input per source and 64 MiB per snapshot. Sonic
snapshot metadata also has a 16 MiB cleaned-input bound before JSON decoding.
Search limits never modify the saved capture files.
LiteParse uses sharepoint-to-text for native Office, OpenDocument, CSV/TSV,
and RTF text extraction. Rendering those documents to temporary PDFs required
an entire office suite, even for plain CSV data. The small native extractor runs
under the existing per-document deadline and preserves real document units,
tables, and annotations in JSON; it does not fabricate PDF page geometry.
PDF/image parsing and ZIP-embedded image OCR continue through LiteParse.
Original files are unchanged. Legacy binary Office images are not rendered or
OCRed through this text-only path; modern ZIP-contained images retain the
existing independent OCR path.
SNAP_DIR- base snapshot directory (default:.)CRAWL_DIR- base crawl directory (default:.)TMP_DIR- local runtime storage for disposable files (defaults to the host runtime's temporary directory); live screencast frames stay here, with each snapshot isolated by itsSNAP_DIR, and only explicitly retained frames saved underSNAP_DIR/chrome_screencaston shutdownABXPKG_LIB_DIR- binaries/tools root (default:~/.config/abx/lib)PERSONAS_DIR- persona profiles root (default:~/.config/abx/personas)ACTIVE_PERSONA- persona name (default:Default)
Lifecycle:
config.json > required_binariesdeclares plugin dependencies.- Hook config helpers hydrate
*_BINARYvalues from env, known local paths, and abxpkg provider state so hooks can run as standalone CLIs. - Runners may perform an install preflight from the same declarations.
abx-dland ArchiveBox use abxpkg services/cache backends to prepare env/DB state, but hooks must not depend on those services being active.
Optional min_version and max_version are inclusive bounds on acceptable
installed binaries. Set both to the same version for an exact requirement;
provider install_args alone select what to install and do not reject a
different binary already present on the host.
config.json declaration:
[
{
"name": "{YTDLP_BINARY}",
"binproviders": "env,uv,brew,apt",
"min_version": null,
"overrides": {
"uv": {
"install_args": ["yt-dlp[default]"]
}
}
}
]Runners may project resolved binary metadata internally as BinaryEvent records shaped like:
{"type":"Binary","name":"yt-dlp","abspath":"/abs/path","version":"2025.01.01","sha256":"<optional>","binprovider":"pip","machine_id":"<recommended>","binary_id":"<recommended>"}Notes:
- Install resolution is optional runtime preflight work driven directly from
config.json > required_binaries. - Binary provider plugins are no longer part of this package; binary provider behavior lives in
abxpkg. abxpkgowns the provider cache underABXPKG_LIB_DIR; ArchiveBox may additionally project resolved binary events into DBmachine_binaryrows. Plugins andabx-dlstay unaware of both persistence layers.
State/OS:
- working dir:
CRAWL_DIR/<plugin>/ - durable install root:
ABXPKG_LIB_DIR(e.g. npm prefix, pip venv, puppeteer cache) - built-in providers include
apt(Debian/Ubuntu),brew(macOS/Linux), and language/runtime-specific installers; many hooks currently assume POSIX paths
Lifecycle:
- optional binary preflight can run before crawl setup, but hook scripts also resolve declared binaries through shared config helpers when run directly
on_CrawlSetup__*runs before snapshot extraction; background setup hooks use their first stdout line as readiness and emit no stdout JSONL records- Extension setup hooks can publish
CRAWL_DIR/chrome/extensions/<name>.extension.jsonwithname, matching installedversion, and a preparedunpacked_path. Chrome uses that copy only when the installed extension is selected and enabled; setup must leave the shared package cache unchanged. - Plugins whose snapshot hook owns the extension lifecycle may set
x-chrome-extension-load: on-demandinconfig.json. Chrome keeps the installed extension available and enables CDP extension loading, but the hook loads and unloads it around each capture. on_Snapshot__*runs once per snapshot; background hooks use their first stdout line as readiness and then may emitArchiveResult,Snapshot, andTagrecords only- Chrome owns the shared download directory for its lifetime and uses unique download GUIDs. Snapshot hooks observe their own downloads without changing that shared policy; a slow export must not block another snapshot. SingleFile separately serializes its temporary extension-profile changes.
- Papers download starts after DOM capture and overlaps article parsing.
- Offline article parsers run after live browser hooks and cleanup so parsing saved HTML does not keep a large renderer resident alongside another DOM.
- PDF parsers settle background downloads before scanning saved documents, just like hashes settle producers before building the final manifest. Live DOM outlink extraction runs before that cleanup.
- Final-file consumers may declare
wait_for_background_cleanup: trueto flush and stop snapshot monitors before reading their outputs. Place these hooks after all capture hooks. Direct callers must finish and clean up producers before invoking them.
State:
- output cwd is usually
SNAP_DIR/<plugin>/ - hooks may read sibling outputs via
../<plugin>/...
Output records:
on_Snapshot__*should finish with anArchiveResultrecord:
{"type":"ArchiveResult","status":"succeeded|noresults|skipped|failed","output_str":"path-or-message"}SnapshotandTagrecords may appear before the finalArchiveResult
Semantics:
stdout: for background hooks, the first line is the readiness boundary; hook JSONL records may followstderr: diagnostics/logging- exit
0: succeeded, noresults, or skipped - exit non-zero: failed
Rules:
on_CrawlSetup__*hooks should communicate only through side effects such as files, sockets, long-lived processes, or the background readiness stdout line, not stdout JSONL recordson_Snapshot__*hooks should not emitMachine,Process, orBinaryrecords
The base/ plugin provides shared Python and JS helpers that all other plugins import:
Python (base/utils.py):
from abx_plugins.plugins.base.utils import (
load_config,
emit_archive_result_record,
emit_snapshot_record,
)load_config()β load pluginconfig.jsonwith env var + alias + fallback resolution, merged with shared base/common runtime vars likeSNAP_DIR,CRAWL_DIR,ABXPKG_LIB_DIR,PERSONAS_DIR,EXTRA_CONTEXT,TIMEOUT, andUSER_AGENTemit_archive_result_record(status, output_str)β print{"type":"ArchiveResult",...}JSONL to stdoutemit_snapshot_record(record)β emit{"type":"Snapshot",...}JSONL to stdoutwrite_text_atomic(path, content)β write file atomically (temp + rename)find_html_source(snap_dir, ...)β locate HTML from sibling pluginshas_staticfile_output(staticfile_dir="../staticfile")/hasStaticFileOutput()β check for a successful staticfile download; pending or failed downloads do not suppress other extractorsis_non_html_document(navigation_path="../chrome/navigation.json")/isNonHtmlDocument()β let HTML-only hooks skip a known non-HTML browser document. Chrome navigation recordsdocument.contentTypebefore post-navigation hooks run; HTML and XHTML remain eligible. Missing, failed, or older navigation records leave extraction enabled. This does not depend on staticfile completion.enforce_lib_permissions()β lock downABXPKG_LIB_DIRso snapshot hooks can read/execute but not write
JS (base/utils.js):
const { loadConfig, getEnv, getEnvBool, getEnvInt, getEnvArray, emitArchiveResultRecord, emitSnapshotRecord } = require('../base/utils.js');loadConfig()β load pluginconfig.jsonmerged with shared base/common runtime vars using env var + alias + fallback resolutionemitArchiveResultRecord(status, outputStr)β emitArchiveResultJSONL to stdoutemitSnapshotRecord(record)β emitSnapshotJSONL to stdout
Test helpers (base/test_utils.py):
CI discovers every test_*.py automatically. Linux tests can use hosted or ugNAS
capacity by default. Genuine runner requirements belong in the first five lines
of the test file: # ci-runner: hosted keeps its normal OS assignment, while
# ci-runner: hosted-linux requires a hosted Linux runner (for example, Docker
integration tests). Add a comment explaining the requirement beside the header.
from abx_plugins.plugins.base.testing import (
get_hook_script,
parse_jsonl_output,
run_hook,
)parse_jsonl_output(stdout)β extract first matching JSONL record from hook stdoutrun_hook(hook_script, url, snapshot_id=None)β run a hook subprocess with explicit URL and optional snapshot ID argumentsget_hook_script(plugin_dir, pattern)β find hook script by glob pattern
Note: Use
sys.path.append()(notinsert(0, ...)) because thessl/plugin directory would shadow Python's stdlibsslmodule.
- all plugins should:
- overwrite existing files cleanly if re-run in the same dir, do not skip if files are already present (do not delete and then download, because if a process fails we want to leave previous output intact).
- the exception to always overwriting files is: chrome.pid. target_id.txt, navigation.json, etc. chrome state which gets reused if it's not stale. we should detect if any of it is stale during chrome launch and tab creation, and clear all of it together if it is stale to prevent subtle drift errors / reuse of stale values.
- status
succeededif they ran and produced output - status
noresultsif they ran but produced no meaningful output due to an expected runtime condition (e.g. git on a non-github url, ytdlp on a site with no media, paperdl on a site with no pdfs, or unavailable provider authentication/export permission) - status
skippedonly if config prevented execution (e.g.YTDLP_ENABLED=False) - status
failedif any hard dependencies are missing/invalid (e.g. chrome), if the process exited non-0 / raised an unexpected exception, or for navigation, missing-control and invalid-content errors - return a short, meaningful
output_stre.g. the page title, mimetype, return status code, or the relative path of the primary output file produced likeoutput.pdfor0 modals closedorThe Page Title Verbatimorfavicon.ioorNot a git URL - define execution order solely using lexicographic sort order of hook filenames
- use bg hooks for either short-lived tasks that can run in parallel, or long-lived tasks that run for the whole duration of the snapshot and get killed for cleanup/final output at the end
- treat
bgvsfgas the only programmatic hook distinction; words likedaemonandfinitein hook filenames are human hints only - bg hooks must emit their first stdout line only after they are ready for the next hook to launch; move non-ready startup diagnostics to stderr
- bg hooks that depend on other bg hook outputs must implement their own waiters internally + check that inputs are truly ready and not just that the files are present, because they may be spawned in parallel/before the earlier one's outputs are actually ready and race. e.g. html/artifact generation should usually be fg so that later bg parsing hooks can safely depend on it being finished and not just part of the file being present
- use rich_click for cli arg parsing with a uv file header when hooks are written in python. do not depend on archivebox or django, try to only depend on chrome or the output files of other plugins instead of importing code from them. the one exception is to always use chrome_utils.js as the interface for anything involving chrome.
Hooks emit plain JSONL records to stdout. The current hook families and records are:
on_CrawlSetup__*β background readiness line only, no stdout JSONL recordson_Snapshot__*β background readiness line when applicable, thenArchiveResult,Snapshot,Tag
abx-dl and ArchiveBox map those records into their own internal event systems. Binary request events are produced from plugin config and handled by abxpkg, not by plugin hook scripts. Plugins do not need to know or emit any bus envelope format.
Parallel Tests remains the required release/cascade gate. Live authenticated
Canva, Figma, Miro and Substack acceptance runs independently in Live Provider Tests, scheduled every eight hours or started manually on main. Missing or
expired sessions and failed exports fail that workflow normally; they do not
turn into passing tests or block deterministic release checks.
Public iWork (Keynote, Pages and Numbers) acceptance also runs in that workflow,
in a separate hosted job with no provider credentials. Other public and local
plugin tests remain in Parallel Tests. Test files declare ci-environment: provider-capture or ci-environment: provider-public in their first five lines;
the matrix verifies that every discovered test file is assigned exactly once.
Authenticated jobs retain the protected provider-capture environment and
required runner placement. Documentation checks remain their existing separate
scheduled/manual workflow.
Article/text extractors can reuse archivewebpage/archivewebpage.wacz when no
DOM, SingleFile, or Wget HTML is available. This is offline HTTP response HTML,
not a reconstructed JavaScript DOM. Selection requires the requested URL's latest
indexed GET response, follows only recorded HTTP redirects (at most four), and
never substitutes an incidental page or iframe. Original captures are unchanged.
The bounded reader currently supports indexes/index.cdx or concatenated-gzip index.cdx.gz, ZIP-stored gzip
WARC members, and SHA-256 recordDigest entries. It checks selected-record digest,
gzip CRC, WARC integrity, HTTP status and HTML MIME type. Revisit records, encoded HTTP bodies, missing matching responses and unsupported/corrupt captures yield no
input, without fetching the live site. Limits: 256 MiB archive, 1024 ZIP members,
8 MiB index, 16 MiB compressed record/individual ZIP metadata read, 32 MiB expanded
record/decoded HTML, with a cooperative 10-second processing deadline. Extractors
retain their existing overall timeouts. A consumer-local hidden input file avoids
races between extractors and does not modify the archived WACZ.
