Skip to main content

Agent workflows

The CLI is designed to be discoverable by an agent without relying on a stale prompt or parsing decorative terminal output.

The default loop

Then choose the smallest safe workflow:
  1. inspect current state;
  2. validate the desired document offline;
  3. calculate a diff or impact report;
  4. produce an integrity-checked plan;
  5. run the plan with --dry-run;
  6. apply the same plan with a version precondition; and
  7. read state or the change journal to verify the result.
The plan binds immutable target identity and the exact current config version; do not copy a version number from an example. Apply uses that atomic compare-and-swap precondition and a plan-derived idempotency key. Dry-run never sends a mutation. Verify the changed resource directly; when a workflow plan records source: "agent", its stable change ID can also be inspected through the change journal.

Stable JSON

Successful commands emit one document to stdout:
Failures emit one document to stderr with stable codes and remediation; stdout remains empty:
Agents must check both the envelope and process exit status. Success is 0; usage/validation is 2; authentication 3; forbidden 4; not found 5; conflict/precondition 6; network/timeout/rate limit 7; unsupported capability or not-ready/stale result 8; and invalid experiment analysis 9. Exit 1 is reserved for an internal failure or an unhealthy completed doctor result.

Ask feature and experiment questions directly

Use the bounded read contract instead of scraping the dashboard or rebuilding statistics from event rows:
Preserve schema/engine versions, freshness, query cost, readiness, and health reason codes in downstream decisions. A structured success response is not a winner claim. Stream large redacted reads with exposures export, persist its typed checkpoint records, and resume with the latest non-null cursor.

Keep evaluation context out of arguments

Read-only inspection uses a context file or stdin and requires an explicit instant:
Inline context is intentionally unsupported so identifiers do not enter shell history or process arguments. Inspection does not emit a feature exposure.
Pass --file exported.superflag.json to run the same evaluator offline.

One-time secrets

Key and app creation reveal plaintext secrets only with explicit --show-secrets. Supply a stable idempotency key so an interrupted response can recover the same secret during the delivery window:
Do not place returned secrets in the agent transcript. Send them directly to a secret manager or a secure user-owned file.

Install the Superflag skill

The CLI package includes a portable skill matched to that exact package version. Install it into the standard workspace location, verify it in CI, and update it only after intentionally changing the pinned CLI version:
The default destination is .agents/skills/superflag/; pass --target <directory> for a different canonical location. The CLI records its package version, public source URL, and content digest in .superflag-skill.json. check is entirely local and exits with conflict code 6 when the vendored files drift from the installed package. JSON formatting is ignored for the provenance manifest, but its exact fields and values must match. install refuses to overwrite different existing instructions; review them and use update for an explicit staged replacement with rollback on failure. The public skill contains only installed-CLI guidance. Repository-specific paths, development commands, and allowed app/environment scope belong in the consuming repository’s own agent guidance. superflag contract --json remains the installed version’s source of truth for command arguments, capabilities, and exits. The same skill source is visible in the CLI repository.