Skip to main content
archal autoloop connects a harness repo to trace evidence. Hosted database sources are registered with Archal and processed by hosted workers. Local trace directories run a local loop and write artifacts under .archal/autoloop/.

Usage

trace-dir is required for local file-backed autoloops. Omit it when using --source postgres or --source supabase.

Required options

For hosted database sources, also set: Use exactly one of --database-url-env or --database-url-secret-ref.

Source configuration (.archal.json)

Per-source facts live in the autoloop block of .archal.json in the harness repo, not in flags. Every field is optional; unset fields fall back to the defaults shown.
  • source.name is the stable display name; source.id is the hosted source UUID (set both to re-register an existing source under its display name).
  • cursor.mode is updated_at_id or created_at_id; use created_at_id for append-only tables, and map mapping.traces.updatedAtColumn and mapping.spans.updatedAtColumn to the creation timestamp column too (the updated columns are always required).
  • cursor.watermarks is a repair escape hatch: set it only to rewind or skip the import cursor. Streams you leave unset keep their server-stored position across re-registrations. Setting a stream’s at or id to a timestamp or id moves its cursor; setting at or id to null resets that stream and re-imports from the beginning. Do not leave null placeholders in the config: { "at": null } is a deliberate reset on every registration, not an unset default.
  • filters restrict which rows import (workspaceIds, statuses, traceGroups, agentIds, and a per-poll limit).
  • metadata stores non-secret labels with the source.
The config file is discovered by walking up from --repo, so the source configuration always tracks the repo being fixed. Passing one of the retired source flags exits 2 with a message naming the config field to set instead.

Execution policy

Default: fix

Validation

Use --check to validate prerequisites without registering a hosted source or starting a local loop:

Examples

Register a hosted Supabase source (name it in .archal.json):
Register a hosted Postgres source with custom mapping:
Use a secret reference instead of a local database URL:
Watch a local directory and stop after reproduction:
Stop a local file-backed autoloop:
archal autoloop detach applies to local file-backed autoloops. Hosted database sources are managed by hosted Autoloop workers; local detach does not disable them.

Output

Hosted database source registration prints:
Local file-backed autoloops print the trace directory, repo, resolved GitHub repository, execution policy, artifact directories, loop process id, and log path.

Local artifacts

Local file-backed autoloops write:
Hosted database sources expose phase information in workspace Autoloop state and through archal autoloop status <run-id>, which prints a hosted run’s status, grade evidence, and artifacts. Without a run id, archal autoloop status reads the repo-local ledger for file-backed autoloops only. For terminal-first handoffs, pair local artifacts with:
Use autoloop status to summarize terminal trace jobs. Use autoloop reprocess after fixing the missing evidence, credential, mapping, harness, or GitHub blocker that caused a trace job to stop. With --json, the local view emits { "ok": true, "jobs": [...] } where each job row carries the trace id, status, phase, next action, and artifact summary. The shape is identical with or without --wait; a failed wait (timeout or a terminal-failed job) emits "ok": false with error and "kind": "wait_failed" and exits 1.

Exit behavior

archal autoloop exits non-zero when prerequisites fail, source options are invalid, database credentials are missing or malformed, the repo cannot be resolved to GitHub where required, or hosted registration fails.

See also