Skip to content

docs: fail loud on unknown flags (principle 6)#63

Draft
themightychris wants to merge 1 commit into
kunchenguid:mainfrom
themightychris:docs/fail-loud-unknown-flags
Draft

docs: fail loud on unknown flags (principle 6)#63
themightychris wants to merge 1 commit into
kunchenguid:mainfrom
themightychris:docs/fail-loud-unknown-flags

Conversation

@themightychris

Copy link
Copy Markdown
Contributor

Why

Closes #62.

Agents routinely invent flags. When a CLI silently ignores an unknown flag, the agent never learns it did nothing — it trusts output it believes is scoped/filtered and proceeds on wrong data. (Concrete instance: an agent nearly created a duplicate record because list <thing> --project <slug> dropped the unsupported flag and returned an unfiltered list that looked scoped.)

The SDK already fails loud on an unknown command. This codifies the same guarantee for flags as part of principle 6.

What

Adds a "Fail loud on unrecognized input" sub-principle under §6 Structured errors & exit codes:

  • Unknown flags/args are rejected with exit 2, never silently ignored — validated before any dependency call.
  • Globals (--json, --help, …) always pass.
  • Removed/renamed flags get a targeted migration hint, not the generic list.
  • Per-subcommand flag sets for grouped nouns (commitment list vs commitment create).
  • Self-correcting errors: fold the --help lookup into the error (list valid flags inline / print the concise help) so the agent fixes it in one turn rather than a guaranteed follow-up call.

Synced across all three surfaces: the spec (SKILL.md), the README principle table, and the docs site (docs/index.html).

Open question (from #62)

Should the error print the command's full --help inline, or just the valid-flag list + a pointer? The draft recommends inlining (per §4 the follow-up call is the expensive cost; per §10 per-command help is already concise) but leaves the exact rendering to the tool. Happy to tighten the wording either way.

Follow-up (not in this PR)

The implementation half #62 also asks for: have axi-sdk-js export a shared parseArgs/validateFlags primitive so tools get this without copy-paste (non-breaking), with central enforcement as a later breaking change. Can do that in a separate PR.

@themightychris themightychris force-pushed the docs/fail-loud-unknown-flags branch 3 times, most recently from 1ffe28a to 0d3e04f Compare June 25, 2026 03:29
Add a "Fail loud on unrecognized input" sub-principle to principle 6
(Structured errors & exit codes): unknown flags and arguments must be
rejected with exit 2, never silently ignored — the same guarantee a CLI
already gives for an unknown command. Silently dropping a flag is worse
than an error: the agent gets plausible-looking output it believes is
scoped/filtered and proceeds on wrong data.

Covers: validate-before-dependency-call, globals always allowed, targeted
migration hints for removed/renamed flags, per-subcommand flag sets for
grouped nouns, and folding the --help lookup into the error so the agent
self-corrects in one turn.

Synced across the spec (SKILL.md), the README principle table, and the
docs site.

Refs kunchenguid#62

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@themightychris themightychris force-pushed the docs/fail-loud-unknown-flags branch from 0d3e04f to 5f28580 Compare June 25, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggested new principle (or just SDK behavior): fail loudly on invalid flags

1 participant