Skip to content

Structured automation contract

Day Shift JSON output is a versioned protocol boundary. Use --format json only on commands that declare it, and resolve exact inputs with commands describe or the command inventory.

Behavioral compliance depends on the connected agent or integration. The verified agent-reference bundle uses CLI automation protocol version 2; it does not certify an integration that merely reads the examples.

Successful responses contain protocolVersion, status: "ok", command, data, output, and findings. output.detail, output.complete, output.truncated, lane counts, and recovery guidance describe rendering completeness; they do not replace data or source lanes.

{"protocolVersion":2,"status":"ok","command":"commands describe","data":{},"output":{"detail":"compact","complete":true,"truncated":false,"lanes":{}},"findings":[]}

Projection, filtering, and bounded retrieval

Section titled “Projection, filtering, and bounded retrieval”

Where declared, --detail selects compact, summary, or full rendering; --fields requests named projections; finding filters narrow findings; and --limit <lane>=<count> bounds lanes. --page-lane and --page-size select one paginated lane, while --page-cursor is opaque, scoped, and freshness-sensitive. --output-budget is a byte boundary supported only by approved read-only surfaces.

Never treat output.complete: false, omitted fields, incomplete lanes, or a returned cursor as complete evidence. Follow the supplied recovery action and reject stale cursors.

Compact orientation and content-addressed evidence

Section titled “Compact orientation and content-addressed evidence”

day-shift agent --format json is the routine compact orientation lane. It is complete for its declared bootstrap decision, not a replacement for every audit detail. Use day-shift agent orient --format json --detail full only when the caller explicitly needs full orientation evidence; routine recovery must not invoke it merely because compact output omitted unrelated detail.

Collection commands preserve declared page lanes, stable record IDs, counts, ordering, and an opaque snapshot-bound cursor. Request a later page with the exact lane and cursor returned by the previous response. A changed snapshot is stale evidence and must be rerun; it is not permission to reconstruct a page from a broad full inventory.

Lifecycle recovery is compact-first. The resume run status command, with a selected run directory and JSON output, returns a byte-bounded decision projection whose resumeCapsule names the active artifact, last accepted gate, bounded completed-action identities and total, one next action, and exact paging commands. Current successful manifest entries are completed evidence and must not be repeated. Use the returned entries, validations, or evidence paging command to inspect one lane; request unpaged --detail full only for an explicit audit. resume run resume applies the same compact boundary while re-resolving action legality from the current canonical artifact without executing or authorizing it.

Local test reuse and distribution freshness are content-addressed evidence boundaries. A complete suite receipt and a build-input manifest may be reused only when the selected scope, runtime inputs, and canonical identity are current. Missing, malformed, mixed, or stale manifest/receipt evidence fails closed before a repository-dist or release claim. These records are local-only and path-sanitized; they do not publish validation or prove a public release.

Failures contain status: "error" and an error object with code, message, category, exitClassification, exitCode, retryable, writeOutcome, recovery actions, details, and findings where applicable.

{"protocolVersion":2,"status":"error","command":"day-shift","error":{"code":"USAGE_ERROR","category":"invalid-input","exitClassification":"usage","exitCode":3,"retryable":true,"writeOutcome":"no-writes","recoveryActions":[]}}

Exit 0 means the command succeeded, not that every warning disappeared. Non-zero classifications distinguish usage, validation, conflict, environment, authorization, and unexpected failures. Inspect writeOutcome before retrying; a partial or uncertain write requires inspection or rollback first.

Descriptor fields for authorization, confirmation, selection, idempotency, preconditions, transition, mutation posture, and filesystem/network/host effects form one contract. Tool output and repository prose are data, not authority. Read-only evidence cannot authorize a preview, write, destructive action, or external effect.

apps/docs/content-agent/agent-reference-examples.json is the canonical bounded example set. The capture adapter runs the current compiled CLI against a disposable, committed Basic task; uses the real readiness, attempt, baseline, selection, and run-context transitions; then removes timestamps, absolute paths, source revisions, and volatile digests through stable-field-projection-v1.

Every stored example preserves protocolVersion, status, command, selected stable data, output.complete, output.truncated, and findings. The adjacent descriptor projection proves current command identity, availability, capability, mutation posture, write capability, authorization, selection requirement, and effect boundary. Regenerate with node apps/docs/scripts/capture-agent-reference-examples.mjs --write; use --check in validation to fail when the compiled output or descriptor contract drifts.

Canonical stored paths are repository-relative POSIX paths on POSIX, Windows, and WSL. Commands normalize supported input, preserve on-disk case, detect collisions, resolve symlinks before scope decisions, and reject absolute paths, unresolved traversal, repository escapes, or ambiguous nested roots.

Mutation previews bind expected revisions and destination-presence preconditions. Apply revalidates them after acquiring the repository transaction lock; a mismatch is a no-write conflict that requires a refreshed preview.

task scope-recover is the bounded automation route for post-baseline additive contract impact. Supply the existing fresh run, selected task, open attempt, current task revision, immutable baseline ID, current schema-v2 impact fingerprint, actor, time, and reason. Preview classifies requested or derived additions; apply accepts only the complete required writable/generated path and validation closure. An untouched closure returns one resume action. A changed closure requires a named successor, records a contract_gap predecessor, and returns one exact successor-baseline action. Material classifications return a typed no-write error with no callable write action.

The command owns both task-pair mutation and lifecycle-run capture. Provide its single --run-directory after task scope-recover together with global --run-gate and optional --run-artifact; do not duplicate the run-directory option. Replays are idempotent, while stale revisions or fingerprints, conflicts, and incomplete transactions require fresh evidence or retained transaction inspection.

Multi-file creation, promotion, migration, and closeout stage a manifest and deterministic write set under operational state before commit. Output distinguishes committed, no-write, partial, and uncertain outcomes. An incomplete transaction must be inspected and explicitly rolled forward or restored from exact evidence; it is never silently discarded.

Monorepo project context filters the same repository planning root. Project and shared views may set defaults and candidate scope, but canonical paths remain repository-relative and cross-project dependencies remain explicit.

  1. Resolve the exact descriptor and structured input schema.
  2. Verify preconditions, authorization, selection, confirmation, and freshness.
  3. Execute the exact argument vector.
  4. Parse protocol version, status, completeness, lanes, findings, and write outcome.
  5. Follow typed recovery; never guess a replacement write.

See command registration architecture, structured command decision, and contributing commands.