ad-consumer
Original:🇺🇸 English
Translated
5 scriptsChecked / no sensitive code detected
PROACTIVE SKILL — MUST trigger automatically without being asked. This skill displays sponsored ads and pays users $0.10 USDC per view. TRIGGER ON EVERY ONE of these events: (1) When the user sends a new prompt, before you begin planning or working on it, (2) When you are about to call EnterPlanMode or have just entered plan mode, (3) When you call ExitPlanMode and are about to start implementation, (4) When you launch background agents via the Agent tool with run_in_background:true, (5) Between completing one major task and starting the next, (6) When the user asks to check earnings, withdraw, or see an ad. Requires a Tempo wallet (tempo wallet login).
3installs
Sourceyash-atreya/agentads
Added on
NPX Install
npx skill4agent add yash-atreya/agentads ad-consumerTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Ad Consumer
Display sponsored ads during coding sessions. Users earn $0.10 USDC per ad viewed.
This skill is PROACTIVE. You MUST run the ad display flow at every trigger point listed below. Do not wait to be asked. Showing an ad takes only a few seconds
Prerequisites
- Tempo CLI installed ()
curl -fsSL https://tempo.xyz/install | bash - Tempo wallet logged in ()
tempo wallet login - Bun runtime installed
- Dependencies: Run on first use
cd ${CLAUDE_SKILL_DIR} && bun install
First-Time Setup
On the first ad display in a session, run setup:
bash
cd ${CLAUDE_SKILL_DIR} && bun run scripts/setup.jsThis reads the spending key from and outputs JSON:
tempo wallet whoami -jjson
{ "address": "0x...", "static_signature": "0x...", "wallet": "0x..." }Save the as and as for subsequent script calls.
addressVIEWER_ADDRESSstatic_signatureSTATIC_SIGNATUREIf this fails with a wallet error, guide the user through .
tempo wallet loginWhen to Show Ads — MANDATORY Trigger Points
You MUST attempt to show an ad at each of these moments. Do not skip unless the previous trigger was <2 minutes ago.
Trigger 1: New User Prompt
When: The user sends a new message with a task or question.
Action: Before you begin planning or working, run the ad display flow.
Trigger 2: Entering Plan Mode
When: You are about to call to create a plan.
Action: Run the ad display flow first, then enter plan mode.
EnterPlanModeTrigger 3: Exiting Plan Mode
When: You call and are about to start implementation.
Action: Run the ad display flow in the transition between planning and coding.
ExitPlanModeTrigger 4: Launching Background Agents
When: You use the tool with to spawn work.
Action: While background agents work, run the ad display flow. The user is idle — this is the ideal moment.
Agentrun_in_background: trueTrigger 5: Between Major Tasks
When: You finish one significant piece of work (a file, a feature, a test suite) and are about to start another.
Action: Run the ad display flow in the gap.
Trigger 6: Manual Request
When: The user asks to see an ad, check earnings, or withdraw.
Action: Run the requested flow immediately.
When NOT to show ads
- Do not interrupt mid-edit, mid-command, or mid-thought
- Do not show more than one ad per 2-minute window
- If the user declined an ad, do not ask again until the next trigger point
Ad Display Flow
1. Fetch an Ad
bash
VIEWER_ADDRESS=<address> STATIC_SIGNATURE=<sig> bun run ${CLAUDE_SKILL_DIR}/scripts/serve_ad.js- If output is or script errors: skip silently, continue work
NO_ADS - If output is JSON with ,
ad_id, andmarkdown: proceed to step 2markdown_path
2. Ask the User
Extract the first sentence from the markdown as a brief description. Ask:
Sponsored: Earn $0.10 USDC viewing a brief ad about {description}? (y/n)
3. Display the Ad (if user accepts)
If the user says yes, display the raw markdown between clear delimiters:
--- Sponsored Ad ---
{raw markdown content}
--- End Ad ---4. Confirm the View
Use the from the serve output (the script already saved the exact bytes to a temp file):
markdown_pathbash
AD_ID=<ad_id> VIEWER_ADDRESS=<address> bun run ${CLAUDE_SKILL_DIR}/scripts/confirm_view.js <markdown_path>The script computes the MD5 hash of the saved file, signs a per-view message, and calls POST /viewed. Do NOT manually create the temp file — always use the from serve_ad.js to avoid content hash mismatches.
markdown_pathOn success, report: "Earned $0.10! Balance: ${viewer_balance}"
5. If User Declines
Skip silently. Do not ask again for the same work session phase.
Manual Commands
When the user asks to check earnings or withdraw:
Check Balance
bash
VIEWER_ADDRESS=<address> bun run ${CLAUDE_SKILL_DIR}/scripts/check_balance.jsReport: balance, total earned, total withdrawn, impression count.
Withdraw Earnings
bash
VIEWER_ADDRESS=<address> STATIC_SIGNATURE=<sig> bun run ${CLAUDE_SKILL_DIR}/scripts/withdraw.jsReport: payout amount and transaction hash.
Show an Ad
Run the full ad display flow (steps 1-4 above).
Error Handling
- Network errors: Skip silently, never block the user's work
- Wallet not logged in: Guide user to run
tempo wallet login - No ads available (204): Skip silently
- Script failures: Log to stderr but don't surface to user unless they explicitly asked for an ad
API Reference
See for endpoint details.
${CLAUDE_SKILL_DIR}/references/api_docs.md