Skip to content

feat: persisted tx mode + flatten ERC-8004 commands (agent agent → top-level) - #134

Merged
JamesLawton merged 10 commits into
mainfrom
feat/tx-mode-and-flatten-agent-commands
Jul 24, 2026
Merged

feat: persisted tx mode + flatten ERC-8004 commands (agent agent → top-level)#134
JamesLawton merged 10 commits into
mainfrom
feat/tx-mode-and-flatten-agent-commands

Conversation

@JamesLawton

Copy link
Copy Markdown
Collaborator

Summary

Two agent-facing DX changes from the Fable DX audit, plus the doc/skill cleanup that fell out of it.

1. Persisted transaction mode (agent mode)
Instead of remembering --broadcast on every write, the mode is chosen once and saved to ~/.polygon-agent/config.json:

  • agent mode auto — write commands broadcast immediately.
  • agent mode dry-run (default) — write commands preview first.
  • --dry-run on any command forces a preview regardless of mode; --broadcast forces execution. Precedence: --dry-run > --broadcast/--no-broadcast > persisted mode.
  • wallet login asks once: an interactive [y/N] prompt on a TTY, or a modePrompt field in the JSON output telling the driving agent to ask its user (no hanging on stdin). Auto mode is never enabled without an explicit answer.

Wired through every write command in operations.ts, polymarket.ts, and the ERC-8004 commands.

2. Flattened the agent agent * group
agent agent register is gone. The ERC-8004 commands are now top-level:

  • register, reputation, reviews, feedback
  • identity (merges the old agent agent wallet + agent agent metadata; --key decodes metadata)

The nested group, the six hidden legacy aliases, and agent-legacy.ts are removed. This is a breaking change (changeset included, minor).

Fixes made along the way

  • reputation and reviews were completely broken (Cannot assign to read only property '0' — a frozen ethers v6 Result reused in a contract call). Fixed by spreading. reputation also failed to serialize a BigInt decimals field.
  • Removed documented-but-nonexistent flags from the skill (reviews --revoked--include-revoked, dropped fund --token) and documented the real x402-pay --chain.

Docs / skill hygiene

  • Deleted the duplicate root skills/SKILL.md so npx skills add stops offering two near-identical "Polygon agent" skills; skills/polygon-agent-cli/SKILL.md is now canonical (the better lines from the deleted copy were ported first).
  • Deleted the stale in-package polygon-defi skill fork.
  • Renamed the DeFi sub-skill framing to Swap, Bridge & Deposit (use cases in titles/routing labels; Trails stays in body prose). Slug and agentconnect URL unchanged.
  • Fixed the broken README SKILL.md links and the CLAUDE.md claim that skills ship via npm (they ship via npx skills add / agentconnect; package.json files is dist + contracts).

Testing

  • pnpm --filter @polygonlabs/agent-cli test — 29 passing (7 new for mode persistence + precedence).
  • typecheck, lint (0 errors), and full pnpm run build clean.
  • Live read-only smoke against Polygon mainnet: reputation --agent-id 1 and identity --agent-id 1 return ok:true (previously crashed); --help shows the flattened surface with no agent group; agent register correctly fails.
  • Not verified live: the interactive wallet login mode prompt (skipped to avoid triggering a real browser auth). The non-TTY modePrompt path and mode persistence are covered by inspection + mode.test.ts.

Live interactive-login verification skipped to avoid triggering a real
browser auth; non-TTY guard and mode persistence covered by inspection
and mode.test.ts.
- register/identity/reputation/reviews/feedback are now top-level commands;
  the nested 'agent agent *' group and hidden legacy aliases are removed
  (agent-legacy.ts deleted). identity merges the old agent wallet + metadata.
- fix: reputation/reviews no longer crash with 'Cannot assign to read only
  property 0' (frozen ethers Result spread before reuse).
- fix: reputation no longer fails to serialize a BigInt decimals field.
Deletes the duplicate root skills/SKILL.md (npx skills add was offering two
near-identical 'Polygon agent' skills) and the stale in-package polygon-defi
fork; keeps skills/polygon-agent-cli/SKILL.md as canonical. Fixes the broken
README SKILL.md links and the CLAUDE.md claim that skills ship via npm.
…sit framing

- SKILL.md + README: top-level register/identity/reputation/reviews/feedback,
  the agent mode command and mode-aware write behavior, onboarding mode prompt.
- Fix documented-but-missing flags (--include-revoked, drop fund --token,
  document x402-pay --chain).
- Rename the DeFi sub-skill framing to 'Swap, Bridge & Deposit' (use cases,
  not infra) in titles and routing labels; slug/URL unchanged.
@claude

claude Bot commented Jul 24, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@JamesLawton
JamesLawton merged commit 5377af6 into main Jul 24, 2026
6 checks passed
@JamesLawton
JamesLawton deleted the feat/tx-mode-and-flatten-agent-commands branch July 24, 2026 10:46
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.

1 participant