Skip to content

Ship an agent skill for the CLI - #12

Merged
MastaP merged 4 commits into
mainfrom
feat/agent-skill
Oct 16, 2026
Merged

MastaP merged 4 commits into
mainfrom
feat/agent-skill

Conversation

@MastaP

@MastaP MastaP commented Oct 16, 2026

Copy link
Copy Markdown
Member

Closes #11.

An agent driving unicity-proof cannot learn from --help the parts of the interface that actually matter. The costly one: verify <token> on its own prints Status OK for a valid timestamp that was never tied to a document. Without --file or --hash that verdict says nothing about the file the caller is holding, and an agent that skips the flag reports success on a proof that establishes nothing.

skills/unicity-proof/SKILL.md covers that and the rest of the non-obvious behaviour:

  • verify must be given --file or --hash to bind a proof to a document
  • exit 3 leaves the request possibly certified; re-running stamp spends quota again
  • a token printed to stderr as hex after a failed write is recoverable, so do not re-stamp
  • the token file is the only receipt
  • UNICITY_TRUST_BASE from a discovered ./.env is ignored, and why
  • --sign / --anonymous for automation that must not produce the wrong kind of stamp
  • a stamp is evidence only if it precedes the outcome it commits to

Keeping it honest

The skill asserts exit codes, so it would rot silently as the CLI changes. tests/unit/SkillTest.ts parses the documented codes out of SKILL.md and compares them against the constants in src/errors.ts, following the pattern TrustBasesTest.ts already uses for trust-base digests. It also asserts the skill is listed in package.json files, so it reaches installs. Both guards were confirmed to fail when the thing they check is broken.

No MCP server

A tool schema costs thousands of context tokens before any work happens; this costs a few hundred and is read only when relevant. For any agent with a shell the CLI is already the better interface. The two cases a skill cannot serve — agents with no shell, and holding the gateway API key so the agent never sees it — are not addressed here and would need their own issue.

Verification

  • npm run lint, npm run build:check clean
  • 144 tests pass across 16 suites (unit plus the offline e2e suite)
  • npm pack --dry-run confirms the skill ships at skills/unicity-proof/SKILL.md
  • the README install sequence was run verbatim against a staged package tree
  • codex exec review --base main clean; it caught a real defect in the first commit, where the documented mkdir created .claude/skills but cp needed .claude/skills/unicity-proof to exist, so the install failed. Fixed in the second commit and reproduced both ways.

Network e2e tests were not run; they need a gateway API key and this change touches no network path.

An agent driving unicity-proof has no way to learn the parts of the
interface that are not discoverable from --help. The costly one is that
`verify <token>` alone reports Status OK for a valid timestamp that was
never tied to a document: without --file or --hash the verdict says
nothing about the file the caller is holding.

Add skills/unicity-proof/SKILL.md covering that trap and the rest of the
non-obvious behaviour: that exit 3 leaves the request possibly certified,
that a token dumped to stderr as hex is recoverable without re-stamping,
that the token file is the only receipt, why UNICITY_TRUST_BASE from a
discovered .env is ignored, and that a stamp is evidence only if it
precedes the outcome it commits to.

The skill asserts exit codes, so it would rot silently as the CLI
changes. SkillTest parses the documented codes and compares them against
the constants in src/errors.ts, and checks the skill is listed in the
package files so it reaches installs.

No MCP server: a tool schema costs thousands of context tokens before
any work happens, where this costs a few hundred and loads only when
relevant. The CLI is already the better interface for any agent with a
shell.
The documented install ran mkdir against .claude/skills and then copied
into .claude/skills/unicity-proof/, which cp refuses when that directory
does not exist: 'cannot create regular file ... Not a directory'. The
documented sequence therefore failed on a fresh checkout and the skill
never reached the agent.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T13:37:02.044947Z f024a65 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f024a65f40

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread skills/unicity-proof/SKILL.md Outdated
Comment on lines +35 to +37
- **Exit 3 does not mean nothing happened.** The timeout fired and nothing was
written locally, but the network may still have certified the request.
Re-running `stamp` spends quota again.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit the exit-3 warning to actual timeouts

When exit 3 results from an HTTP/network failure or an aggregator rejection, no timeout necessarily fired and retrying may not spend another quota unit; toExitCode deliberately maps all of those cases to the same code. An agent following this unconditional guidance will misdiagnose authentication, rate-limit, and rejected-request failures, so make the possible-certification warning conditional on the error being a timeout after successful submission.

Useful? React with 👍 / 👎.

The skill stated that exit 3 means the timeout fired and the request may
still have been certified. That holds only for SleepError. toExitCode
also maps StampError, JsonRpcNetworkError, JsonRpcResponseError,
JsonRpcDataError and a failed fetch to the same code, and none of those
certify anything: a 429, a refused API key or an aggregator rejection
leaves nothing on the network. An agent following the old text would
treat an auth or rate-limit failure as possibly-certified and hesitate
to retry, when the correct action is to fix the cause.

Name the timeout as the only ambiguous case and quote the five gateway
messages that distinguish the others, since describeError already prints
which one happened.

Those quoted strings can drift like the exit codes, so SkillTest now
extracts them from the skill and asserts each appears in src/errors.ts
or src/lib/errors.ts.
certifyMintTransaction submits the certification request before it calls
waitInclusionProof, and the polling path reaches the same gateway. A
dropped connection or an HTTP error can therefore surface after the
network has already accepted the request, and a lost submission response
is ambiguous for the same reason. The previous text listed those
messages as certifying nothing, which is the opposite error to the one
it replaced.

Only an explicit aggregator rejection is unambiguous. Say that, and say
that the CLI does not track the request so it cannot resolve the rest.
@MastaP

MastaP commented Oct 16, 2026

Copy link
Copy Markdown
Member Author

Both review findings on the exit-3 bullet are addressed, in two steps because my first correction was wrong in the opposite direction.

The original text asserted that exit 3 meant a timeout and the request might still be certified. That holds only for SleepError; toExitCode maps five other conditions to the same code.

My first fix listed the gateway messages as certifying nothing. That was also wrong: certifyMintTransaction submits before calling waitInclusionProof, and the polling path hits the same gateway, so a dropped connection or HTTP error can arrive after the network already accepted the request.

Final text: exit 3 generally cannot tell you whether anything was certified, and the CLI does not track the request so it cannot resolve that. The only unambiguous message is an explicit aggregator rejection. A refused API key should be fixed before retrying regardless.

SkillTest now also extracts the error strings the skill quotes and asserts each appears in src/errors.ts or src/lib/errors.ts, so the quotes rot loudly rather than silently. Confirmed failing when a quote is altered.

@MastaP
MastaP merged commit 4c09650 into main Oct 16, 2026
2 checks passed
@MastaP
MastaP deleted the feat/agent-skill branch October 16, 2026 13:44
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.

Ship an agent skill for the CLI (not an MCP server)

1 participant