Skip to content

feat: xurl skill — cost-optimized X/Twitter via sandbox + live modes#70

Merged
bearmug merged 11 commits into
mainfrom
feat/xurl-skill
Apr 5, 2026
Merged

feat: xurl skill — cost-optimized X/Twitter via sandbox + live modes#70
bearmug merged 11 commits into
mainfrom
feat/xurl-skill

Conversation

@bearmug
Copy link
Copy Markdown
Contributor

@bearmug bearmug commented Apr 5, 2026

Summary

  • Add xurl skill to fiale-awesome-skills plugin — cost-optimized X/Twitter workflows via the official xurl CLI
  • Two modes: sandbox (local playground server on port 3080, $0) and live (real X API with spending guardrails)
  • Guided first-run interview: detects auth status, asks what user wants, guides only through missing setup
  • Add fiale-awesome-skills to root README plugin table (was missing)
  • Fix PR gate workflow permissions for user-owned repos
  • Bump plugin version 0.1.00.2.0

Cost optimization features

  • Sandbox-first via API_BASE_URL — same xurl commands, zero cost
  • Inline API_BASE_URL=http://localhost:3080 xurl ... prefix per command (no export leak across tool calls)
  • Compose + confirm gate with trust mode opt-in (per-session only, resets on new session)
  • Configurable session spending limits ($0.25 / $2.00 / $10.00 tiers)
  • Mode prefixes [SANDBOX] / [LIVE $X.XX] on every output
  • 24h UTC dedup awareness, batch confirmation for planned workflows
  • Real usage tracking via /2/usage/tweets (requires bearer token auth)

Auth model

Two auth types, both recommended:

  • OAuth2 user context — post, like, follow, DM, timeline, bookmarks, mentions
  • Bearer token (app-only) — usage tracking, public search/lookup

Workflows included

  • Post + monitor engagement
  • Search + engage
  • Timeline review
  • Bookmark processing — fetch → read → process into knowledge base → unbookmark

Known sandbox limitation

Playground validates OAuth token type. User-context shortcuts (whoami, post, like) need raw path form in sandbox. App-auth shortcuts (search, read) work directly.

Files changed

File Change
plugins/fiale-awesome-skills/skills/xurl.md New skill (~420 lines)
plugins/fiale-awesome-skills/commands/xurl.md New command entry point
plugins/fiale-awesome-skills/.claude-plugin/plugin.json Version 0.2.0 + keywords
.claude-plugin/marketplace.json Version 0.2.0 + keywords
plugins/fiale-awesome-skills/README.md xurl section added
README.md Awesome Skills section added
.github/workflows/pr-gate.yml Fix permissions + user-owned repo handling

Test plan

  • Verify xurl installed, auth working (xurl whoami)
  • Install playground, verify sandbox mode on port 3080
  • Test sandbox: app-auth shortcuts work, user-context needs raw path
  • Test live: xurl bookmarks -n 10 returns real data
  • Verify usage endpoint: xurl --auth app "/2/usage/tweets?days=1" returns consumption
  • Confirm usage matches: 10 bookmarks = 10 posts consumed
  • Verify plugin.json + marketplace.json versions match (0.2.0)
  • Verify /xurl triggers skill and first-run interview works
  • Verify root README renders Awesome Skills section correctly

bearmug added 11 commits April 5, 2026 22:30
Add xurl skill to fiale-awesome-skills plugin wrapping the official X CLI
with pay-per-use cost awareness and local playground sandbox integration.

Key features:
- Sandbox-first via API_BASE_URL → playground (zero cost, same commands)
- Batch reads (/2/tweets?ids=...) for ~75% bulk savings
- Compose + confirm gate for live writes with trust mode opt-in
- Configurable session spending limits ($0.25 / $2.00 / $10.00 tiers)
- Mode prefixes [SANDBOX] / [LIVE $X.XX] on every output
- Error recovery for playground down, auth expired, 429, limit hit
- Quick-pick menu and workflow templates (post+monitor, search+engage)

Also adds fiale-awesome-skills to root README plugin table.
Bumps plugin version to 0.2.0.
…timate

- Fix session summary referencing non-existent /tmp/xurl-session-costs.json
  (correct: /tmp/xurl-session-config.json)
- Use conservative full-rate estimate for batch reads in guardrail tracking
  (actual batch cost may be lower, but overestimating is safer)
- Add explicit issues:write + pull-requests:write permissions
  (pull_request_target doesn't grant these by default)
- Short-circuit if PR author is repo owner (no org check needed)
- Fall back to collaborator check when owner is a user account,
  not a GitHub org (orgs API returns 404 for user accounts)
1. Remove broken `xurl --auth app /2/usage/tweets` from session summary
   (requires bearer token auth, separate from OAuth2 setup user follows).
   Session summary now uses local spend tracker only.

2. Remove incorrect batch read 75% savings claim. X bills each post in a
   batch separately — batching saves rate limit quota, not credits.

3. Remove hardcoded playground account 0 from cost queries. Account ID is
   derived from auth token; use account-independent /api/credits/pricing.

4. Change playground default port to 3080 to avoid conflict with xurl
   OAuth callback on port 8080.

5. Soften README — "local session spend tracking" instead of
   "real usage tracking via /2/usage/tweets".
…e install

1. Replace `playground status` with `curl localhost:3080/health` for sandbox
   detection — upstream playground status only checks default ports (8080,
   3000, 8081), not our configured 3080.

2. Add `-p 3080` to error recovery playground start command — was missing,
   would start on wrong port.

3. Make trust mode per-session only — reset trusted_actions to [] at session
   start. Previously trusted_actions persisted in /tmp across sessions,
   allowing a later session to skip write confirmations unexpectedly.

4. Integrate playground installation into first-use flow — offer to install
   when not found, check for Go, link to pre-built binaries as fallback.
1. Use inline API_BASE_URL=... prefix on every sandbox command instead
   of export. Export doesn't persist between separate Bash tool calls,
   so later commands could silently hit the real API.

2. Reset spent/operations/trusted_actions at session start — only
   spending_limit carries over. Prevents false warnings from stale
   spend data inherited from prior sessions.
xurl needs OAuth credentials to construct requests even against the
local playground (which accepts any token without billing). A user
with playground running but no auth configured would hit 401s.

Now clearly states auth is required for both modes and guides users
to set up auth first when playground-only state is detected.
playground start is a foreground server — running it directly would
hang the agent session. Now uses &>/dev/null & to detach, followed
by a health check to verify it started.
OAuth2 flow fails unless the app is set as default first.
Add xurl auth default <app> before xurl auth oauth2.
…ndpoints

Playground validates OAuth token type. xurl shortcut commands that require
user-context auth (whoami, post, like, follow, dm) fail with 403 because
playground sees the token as app-only. App-auth shortcuts (search, read)
work fine.

Document raw path workaround for user-context endpoints in sandbox mode.
…workflow

1. Replace dump-all-setup with guided first-run interview: detect what's
   configured, show status checkmarks, ask what user wants to do, guide
   through only the missing pieces.

2. Document both auth types clearly:
   - OAuth2 for user-context ops (post, like, timeline, bookmarks)
   - Bearer token for usage tracking (/2/usage/tweets)
   Both recommended, each with setup instructions.

3. Add bookmark processing workflow: fetch → read → process into
   knowledge base → optionally unbookmark. Cost estimate included.

4. Restore usage API in session summary now that bearer token setup
   is documented. Notes it only tracks post reads, not all operations.
@bearmug bearmug marked this pull request as ready for review April 5, 2026 22:29
@bearmug bearmug merged commit 0d10212 into main Apr 5, 2026
@bearmug bearmug deleted the feat/xurl-skill branch April 5, 2026 22:29
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