Skip to content

Latest commit

 

History

History
444 lines (371 loc) · 24.7 KB

cli-reference.md

File metadata and controls

444 lines (371 loc) · 24.7 KB

CLI reference

An unofficial ZeroNoise CLI for cited research packages, source curation, agent configuration and lifecycle management. Ordinary commands use a saved-cookie session over HTTP and observed LiveView operations, without browser automation. Unverified provider controls fail explicitly; see zero capabilities --json.

Install

Node 22+ is required. Normal commands need no browser. Optional interactive login uses an existing Chrome 144+ installation on macOS; no extension is required.

npm install
npm run build
npm link
zero --help

Playwright's HTTP request client manages the cookie jar without launching a browser.

Authentication

Set ZERO_SESSION_DIR to use a separate directory for credentials, locks, and operation receipts. For example, export ZERO_SESSION_DIR=/private/tmp/zero-test-session. Use the same value for login and subsequent commands. No existing credentials are copied into a new directory. Chrome discovery still uses your regular Chrome installation.

For interactive login, start regular Chrome and enable remote debugging at chrome://inspect/#remote-debugging, then run:

zero auth login --timeout 120000 --json

Approve Chrome's connection prompt and sign in to ZeroNoise in the new tab. The command connects through Chrome's documented local discovery file, opens only the ZeroNoise login page, and requests only cookies applicable to ZeroNoise. It validates them over HTTP before replacing the saved CLI session. It then disconnects without closing Chrome or the login tab. It never enables debugging itself, launches an automated browser, reads the Chrome cookie database, or enumerates unrelated tabs. Chrome's permission is broader than these CLI actions; enable it only for a trusted local environment and disable it again after login.

Login timeout or denied access does not replace existing CLI credentials. Normal read/preview/export commands never connect to Chrome. This is a one-time import, not continuous synchronization with Chrome; provider refresh behavior remains unverified. The default discovery location currently targets macOS Chrome stable.

Protected-file import remains available:

zero auth import --file /path/to/protected-storage.json --json
zero auth status --json
zero doctor --json

Provide a Playwright storage-state JSON file containing only ZeroNoise cookies. The file must be owned by your user with permissions 0600; localStorage is not imported. Import validates the protected agent page before replacing saved state. Only an explicit auth login starts the browser-assisted sign-in flow. Status, doctor and other commands never initiate login or capture browser cookies.

State lives at ~/.local/share/zero/session/storage.json, outside the checkout and Vault. Cookie updates and deletions are saved atomically under a process lock, including on failed requests. Directory permissions are 0700, files 0600. This is a plaintext credential file protected by OS permissions, not encrypted storage. Never place it in a repository or synced folder. After a crash, remove .zero-lock only after verifying no zero process still uses this state. Expired authentication returns reauth_required; explicitly import fresh cookies. Provider long-lived session refresh is unverified; fixture rotation tests do not establish a refresh guarantee. The command network deadline defaults to 30 seconds.

Export

zero briefs export https://zeronoise.ai/posts/EXACT-SLUG --format md --out ./brief.md --json

The URL must be an exact same-origin brief URL (or its slug), without query, fragment, or credentials. Export requests only the observed /agents/my validation route and /posts/:slug/download/:format route. Redirects are not followed. No arbitrary request command exists. Export never generates a brief. Markdown, DOCX and PDF exports were verified live on September 7; MIME types and file signatures are checked before publication.

--out names a new file in an existing directory. The complete provider bytes are published atomically with owner-only permissions, without overwriting an existing file. Citations remain unchanged. Stdout contains a bounded receipt, not article contents.

Inspect and pull

zero agents list --limit 20 --json
zero agents get EXACT-AGENT-SLUG --json
zero capabilities --agent EXACT-AGENT-SLUG --json
zero sources export --agent EXACT-AGENT-SLUG --out ./sources.json --json
zero suggestions list --agent EXACT-AGENT-SLUG --json
zero briefs latest --agent EXACT-AGENT-SLUG --json
zero documents get DOCUMENT-ID --brief EXACT-BRIEF-SLUG --out ./article.md --json
zero pull EXACT-AGENT-SLUG --out ./research --limit 20 --timeout 60000 --json

workspaces list, agents resolve, sources list, briefs list/get/details, documents list, and insights list expose smaller read operations. Collection defaults are --limit 20 --max-pages 3. Source lists/export can follow the observed channel load-more event over a browserless LiveView connection until a bound or verified termination. Insight lists also paginate and reconcile the reported total. Brief lists paginate and recognize the observed removal of the continuation control as archive exhaustion; local bounds still report truncation. Coverage is explicitly complete, truncated or unknown. Source search filters loaded rows locally and can continue loading within the page budget; unavailable URLs and canonical source IDs remain null. suggestions list expands the counted pending list without approving or rejecting anything. Suggestion references remain separate from approved attachment and canonical source references.

When a settings or instructions section denies access, agents get keeps the readable sections, marks section access explicitly and returns a partial result with exit 1. Expired authentication and malformed responses remain errors. Configuration export and previews require readable configuration and do not create files or fingerprints from an access-denied partial read.

documents list --brief EXACT-BRIEF-SLUG --source-id SOURCE-ID selects an observed source entity. Source groups are expanded within the command deadline and their document counts are reconciled; expansion is not a pagination page. Shared documents retain their source_ids. If continuation fails, reads retain collected rows with a safe error code, unknown coverage and nonzero partial completion.

pull defaults to the latest brief; --since 14d or an ISO date selects a window. It preserves the original Markdown, normalized documents, a locally linked brief, and manifest.json. Original URLs remain available. Only citations with an observed matching original URL are linked; unresolved targets remain explicit. Reachable evidence is not the complete scanned corpus; reported scanned/used counts stay separate from reachable/fetched counts. Partial packages return exit 1 with useful file receipts, not a claim of full coverage.

Reruns reuse content-hashed artifacts and retain changed revisions. Checkpoints allow reconciliation; a hard crash can leave .zero-pull-lock, which requires checking that no pull is active before removal. Do not remove a live process lock.

Configuration and source management

zero agents export EXACT-AGENT-SLUG --out ./agent.json --json
zero agents validate --file ./agent.json --json
zero agents diff EXACT-AGENT-SLUG --file ./agent.json --json
zero agents schedule EXACT-AGENT-SLUG --time 09:00 --timezone Europe/Berlin --json
zero sources plan --agent EXACT-AGENT-SLUG --file ./sources.txt --mode add-only --json
zero sources add --agent EXACT-AGENT-SLUG --url https://example.com/feed-a --url https://example.com/feed-b --json
zero sources import --agent EXACT-AGENT-SLUG --file ./sources.txt --json

Configuration uses versioned zero/agent/v1 JSON (not YAML). Exported readable fields round-trip through local validation. Partial updates preserve omitted fields; unknown fields and clearing are rejected. Fingerprints detect a stale reviewed snapshot but do not promise atomic provider concurrency. Weekdays are 1–7, Monday–Sunday. Validation is local, not provider acceptance.

Source input is a URL per line (blank lines and # comments ignored), or an exported zero/sources/v1 JSON inventory. Outer whitespace is trimmed; URLs are otherwise compared exactly. Missing URLs or incomplete source lists produce unknown outcomes, never inferred additions or deletions.

agents update/schedule preview by default. Add --apply to submit supported General settings, individual instructions, style, or language and read them back independently. Goal, extraction and style updates have been verified through the installed CLI. Language accepts an observed option label or code. Separate field saves are not atomic; processing stops after a failed or uncertain save. Daily-to-weekly changes first reveal the provider's weekday control through form validation. Hidden daily weekday values are reported as not applicable, not erased.

Apply compares the reviewed fingerprint, joined form values and a fresh configuration immediately before saving. Results report submission, acknowledgement, per-field verification and unexpected differences separately. Missing acknowledgement or readback returns outcome_unknown with a useful receipt and exit 1; no automatic retry occurs. Reconcile current state first.

sources add/import preview by default; --apply --allow-usage submits up to 100 URLs. Repeat --url for an inline batch, or put one URL per line in a file for sources import. The CLI sends one provider form submission per command and reconciles each URL independently. sources apply is explicit write intent and also requires --allow-usage. Only exact attachment readback establishes per-URL success; aggregate import counts do not resolve unknown URLs. Omission never removes a source. ZeroNoise can normalize imported URLs into channel rows that do not expose the original URL. Reconciliation reports this explicitly and keeps those inputs unknown instead of attributing an aggregate count increase to a particular URL. Imports require complete preflight coverage within the selected bounds; increase --limit and --max-pages when the portfolio is larger. Each submitted batch has an owner-only local operation receipt. An unresolved earlier import blocks replay of its still-unobserved URLs. sources reconcile checks those URLs without submitting again and updates the local receipt; it does not infer failure from absence or attribute an observed attachment to a particular request.

zero sources import --agent EXACT-AGENT-SLUG --file ./sources.txt --apply --allow-usage --json
zero suggestions approve SUGGESTION-ID --agent EXACT-AGENT-SLUG --apply --allow-usage --json
zero suggestions reject SUGGESTION-ID --agent EXACT-AGENT-SLUG --apply --json
zero sources reconcile local:RETURNED-UUID --agent EXACT-AGENT-SLUG --json
zero sources remove ATTACHMENT-ID --agent EXACT-AGENT-SLUG --kind web_monitor --expected-url https://example.com/blog --apply --json

Removal requires a fresh matching namespace, attachment ID and URL. Unknown URLs cannot authorize removal. Rejection verifies disappearance from the current pending review list. Responsive duplicate buttons must agree on the exact suggestion ID. Monitoring-scope writes return unsupported_capability: no scope editor has been observed on the inspected channel or web-monitor cards.

Lifecycle and research operations

zero agents create --workspace WORKSPACE-ID --file ./new-agent.json --json
zero agents duplicate EXACT-AGENT-SLUG --name "Research copy" --json
zero agents activate EXACT-AGENT-SLUG --apply --allow-usage --json
zero agents pause EXACT-AGENT-SLUG --apply --json
zero sources discover --agent EXACT-AGENT-SLUG --apply --allow-usage --json
zero sources sync --agent EXACT-AGENT-SLUG --apply --allow-usage --json
zero operations get local:RETURNED-UUID --json
zero operations inspect --agent EXACT-AGENT-SLUG --json

Creation requires identity.name and instructions.goal, without an existing identity ID or slug. Only the current personal workspace is supported. Apply starts AI draft preparation and initial source discovery, then reconciles the requested configuration. Creation and duplication need --apply --allow-usage. Returned identities, saved configuration and lifecycle are read back separately. Lifecycle previews verify the current target/workspace through reads. Duplication accepts --limit and --max-pages for its source-copy comparison and returns the inspected attachment references. Partial setup remains partial when its saved receipt is subsequently read through operations wait.

Discovery uses the agent's saved discovery instructions. Discovery/sync receipts mean submitted, not completed; their --wait option is rejected before submission because reliable provider polling is unavailable. operations get reads an owner-only local receipt, never a synthetic provider job. operations inspect reads current discovery IDs, lifecycle, stage and considered sources, plus research operation IDs, reported stages and source-sync counters, from fresh provider connections. It does not infer completion when a progress card disappears or correlate unrelated agent work with a local receipt. Source imports can outlast the command deadline: reconcile the exact URL with sources list --query before retrying. A timeout does not cancel queued work.

briefs generate uses the conditional Get today's brief control, which creates a provider-labelled preview brief. If that control is absent, it refuses without changing schedules or lifecycle. It never substitutes existing-post recreation.

zero briefs generate --agent EXACT-AGENT-SLUG --json
zero briefs generate --agent EXACT-AGENT-SLUG --apply --allow-usage --wait --timeout 60000 --json
zero operations inspect --agent EXACT-AGENT-SLUG --json

Without --wait, a successful command means acknowledged submission; completion_verified remains false until an actual result is observed. With --wait, the same connection requires both the provider success message and exactly one new post. The receipt retains the observed provider operation ID, result reference and last progress snapshot. Timeout/connection loss never resubmits. operations wait can read a completed receipt but does not reconnect to an absent durable provider job API. Dates are provider-reported: a generated preview may belong to the preceding coverage period rather than today. See current status for verification and provider limits.

Output contract

--json returns one zero/v1 envelope. Success has ok, command, data, and meta; failure includes error. Partial pulls retain data alongside the error. Progress is on stderr. Without --json, success is concise formatted JSON data, except zero usage and zero status, which print human-readable summaries. Errors retain the JSON envelope.

{"schema":"zero/v1","ok":true,"command":"briefs export","data":{"path":"/absolute/brief.md","bytes":123,"sha256":"...","format":"md","brief":"slug","source_url":"https://zeronoise.ai/posts/slug/download/md"},"meta":{}}
{"schema":"zero/v1","ok":false,"command":"auth status","error":{"code":"reauth_required","message":"Saved authentication is required.","retryable":false,"next_action":"Use zero auth import --file <protected-file>."},"meta":{}}

Exit 0 means success; exit 1 means failure. Stable codes in this slice include invalid_argument, unsupported_capability, reauth_required, permission_denied, profile_locked, conflict, not_found, rate_limited, incomplete_result, and provider_contract_changed. Unexpected library/provider failures are sanitized rather than echoing response bodies or arguments.

capabilities --json distinguishes implemented code from live verification. Without a target it is offline. --agent accepts an exact slug or same-origin URL and verifies that target's read access; it does not establish write permission or trigger a settings change. An export receipt describes only that artifact, not all research evidence.

Status snapshots

zero status
zero status --all --limit 20
zero status --agent EXACT-AGENT-SLUG
zero status --agent EXACT-AGENT-SLUG --usage --json
zero status --out ./status.json --json

status reads the initial agent inventory and the first provider-listed brief for each selected agent. It excludes observed paused and inactive agents by default. Unknown lifecycle values remain visible and mark completion partial. Names do not determine whether an agent is a test or production agent. --all includes all observed lifecycle values.

--limit bounds selected overview agents, defaults to 10, and accepts 1–100. Filtering precedes this limit. The provider's initial inventory may omit agents; raising the limit does not add agent pagination. Output distinguishes observed inventory size, provider-reported total, hidden inactive/paused records and records omitted by the local limit. These are not account-wide active counts.

--agent accepts an exact slug or same-origin agent URL. It adds the selected agent's schedule, reported source and pending-suggestion counts, visible research progress and discovery/import progress. It cannot be combined with --all. If the target is absent from the initial inventory, the exact agent page is resolved directly. Its lifecycle remains unknown unless observed in the inventory. Schedule days use 1–7 for Monday–Sunday; daily schedules have no applicable day.

Source and suggestion sections collect counts, not complete inventories. Each retains the coverage and observed row count of its bounded read. A verified reported count can be available even when the underlying list is truncated. Similarly, a latest-brief observation does not require fetching its full archive. No brief observed with unknown archive coverage is partial, not verified empty. Research and discovery describe visible provider snapshots only. A missing panel does not establish inactivity, success, or completion.

--usage adds this month's usage for the selected agent, or for the personal account when no agent is selected. It includes the existing usage reader's coverage, reported totals, current account billing and supported schedule estimate. Unknown accounting coverage or an optional billing failure marks that section partial. It never converts observed row subtotals into a complete account bill.

--json returns the standard zero/v1 envelope with zero/status/v1 data:

  • started_at and completed_at bound collection. Reads are sequential, not an atomic provider snapshot. Authentication is validated at the start.
  • selection records the exact slug, inactive inclusion and agent limit.
  • inventory, each agent's detail sections, and usage use state values available, partial, unavailable, or not_checked.
  • Available and partial sections contain observed_at and data. Unavailable sections contain a safe error.code; unchecked sections explain how to select them.
  • agents contains identity/lifecycle metadata and latest_brief, schedule, sources, suggestions, research, and discovery sections.
  • completion is partial if a requested read is incomplete or unavailable, selection was truncated, or selected lifecycle is unknown. Otherwise it is complete. Complete means the requested snapshot was collected, not that provider research is healthy or finished.

For an exact-agent request, incomplete global inventory alone does not make the target's snapshot partial when its identity and lifecycle were observed. The global inventory coverage remains visible. A paused agent is not an error. Missing authentication fails before the snapshot and never starts login.

Partial snapshots retain useful data and return exit 1. Human output still prints the readable snapshot. JSON output includes ok: false, error.code set to incomplete_result, and the snapshot in data. Unrequested detail and usage sections do not make completion partial.

--out writes the same zero/status/v1 data as an atomic owner-only JSON file without overwriting existing files. It requires an existing parent directory. Stdout returns a zero/status-receipt/v1 receipt with path, bytes, SHA-256 and completion. A partial snapshot is still saved and returns exit 1.

All collection uses one saved-cookie session and the global --timeout, including nested reads. Ordinary status does not contact Chrome, submit paid work, download article bodies, or advance Catch Me Up checkpoints. There is no background polling or local status cache. Fields are observations, not unread flags or health scores.

Billed usage reads

zero usage
zero usage --agent EXACT-AGENT-SLUG --since 7d
zero usage --from 2026-09-01 --to 2026-09-14 --details --json
zero usage --since 7d --details --out ./usage.json --json
zero usage list --agent EXACT-AGENT-SLUG --limit 20 --json

usage defaults to the current UTC month through today and at most 100 rows. Without --agent, it reads the personal account's billing history, including test and paused agents represented there. --agent takes an exact slug or same-origin agent URL. Resolve display names first with agents resolve.

usage list retains its last-30-calendar-days, 20-row defaults and JSON-data output. It also supports account scope, --since, and --out. It always includes rows and avoids the extra billing and schedule reads used by usage.

--since 7d includes today and the six preceding UTC calendar dates, ending at --to when supplied. ISO dates/timestamps are also accepted. --since and --from are mutually exclusive. ISO timestamps require an explicit offset and are narrowed to UTC dates. The provider's timezone is unknown; requested dates and the provider-reported range are separate fields.

The zero/v1 response envelope contains a zero/usage/v1 data object:

  • provider_totals: agent page totals for the verified selected range. These are independent of row bounds; missing account totals stay null.
  • summary and by_agent: rounded row subtotals, brief generation versus setup and other events, unknown amounts and newest observed runs. Names come from the accounting rows; two agents sharing a display name cannot be distinguished.
  • billing: current personal-account plan, supported trial allowance/remaining balance, trial end and paid-billing start. These are not date-window totals. Other billing layouts retain their summary text; unsupported fields stay null.
  • monthly_projection: agent-only 30-day estimate, calculated as selected-window scheduled spend divided by run count, multiplied by 30 daily or 30/7 weekly runs. Requires an observed active schedule. It excludes subscription fees, setup costs and future changes in source volume. It is not a tariff or forecast of remaining credit. The sample size and calculation are included.
  • items: omitted by default on usage, included with --details or usage list. Numeric and workflow-UUID billing identities remain opaque strings. Free, zero-dollar and unpriced pending rows are distinct. Unknown amounts are never silently treated as zero, and currency symbols are never combined across buckets.
  • warnings: failed optional billing/schedule reads, without discarding usage.

--out writes a zero/usage/v1 JSON file with owner-only permissions, an atomic publication and no overwrite. Stdout returns only its path, byte count, hash, coverage and warnings. Use --details to include raw accounting rows in the file.

Coverage applies to the accounting rows, not separately reported agent totals. --limit bounds both summary inputs and detail rows. Nonempty initial-page coverage remains unknown or truncated; a verified empty state is complete. The account endpoint currently exposes up to 50 initial rows. Increasing --max-pages does not enable pagination; continuation is not yet verified. Row sums may differ from provider totals due to rounding or incomplete history. Unzoned date text is preserved; ISO currency codes and operation references stay null. A billing status is not independent proof of research completion.

The observed read routes are /users/settings?tab=usage&from=...&to=..., /users/settings?tab=billing, and /agents/:slug/usage?from=...&to=.... September 14, 2026 browser inspection and saved-session HTTP reads verified these routes and the numeric/workflow row identities. No public JSON billing API is assumed. Browser inspection is development evidence, not a runtime dependency.

Tests and evidence

npm test packs and installs the CLI in a temporary prefix and invokes its binary from outside the checkout. These tests cover public command boundaries only. Provider proof is tracked separately: tests do not imply authenticated access. Live proof: a private Markdown export was 5,925 bytes with SHA-256 48bcd3200f1ebbbacda99c9d286165f6c5d467a6ab00870481890d0707a02972, matching the user's independent export. The protected page was recognized using its user-actions and personal-workspace markers; no logout link is assumed.