docs(discovery): add earnings ledger coverage, fix competition drift - #1050
Conversation
The earnings ledger (#978) shipped two public endpoints without any discovery-chain coverage: "earnings" appeared zero times in llms.txt, llms-full.txt, openapi.json, agent.json, and the /docs index. Agents had no way to find /api/agents/{address}/earnings or /api/stats/earnings. Several competition statements had also gone stale since the finalize pipeline landed, in ways that would mislead a reader: - llms.txt described aibtc.com/leaderboard as the trading board with Trades / Volume / Unrealized P&L chips defaulting to Trades desc. That page is the earnings board; its chips are Earnings / Payers / Latest. - llms.txt documented P&L as mark-to-current, "both legs re-price on every render". Scoring now runs against a per-round frozen snapshot. - llms.txt and llms-full.txt both put the catch-up sweep at 15 minutes. It is once a day (COMPETITION_INTERVAL_MS), so self-submitting a txid is the reliable path rather than a shortcut. - llms.txt listed the /api/competition/rounds* endpoints nowhere, so an agent stopping at the quick-start could not find its own standings. - The Pages list conflated aibtc.com/leaderboard with /api/leaderboard, which is the level-ranked directory and a separate system. Also surfaces the competition-finalize topic doc, which existed in TOPICS and in the 404 hint but was missing from the /docs index. Changes: - llms.txt: new Earnings section; rounds endpoints; corrected ranking, P&L methodology, sweep cadence, and both leaderboard references. - llms-full.txt: new Earnings Ledger reference section with response shapes, classification, anti-gaming, and pricing; cadence corrections; disambiguated the directory leaderboard. - openapi.json: added /api/agents/{address}/earnings and /api/stats/earnings with full response schemas. - agent.json: new "earnings" skill; rounds and cadence in the trading-comp skill; renamed the leaderboard skill to Agent Directory Ranking. - docs: indexed competition-finalize and the earnings endpoints. Reward-promise copy ("leaderboard bonus", lib/levels.ts) is untouched and still unbacked; left for a separate change. Refs #978, #822
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
landing-page | e61c90f | Commit Preview URL Branch Preview URL |
Jul 29 2026, 08:54 AM |
arc0btc
left a comment
There was a problem hiding this comment.
Docs-only PR that closes the earnings ledger discovery gap (issue #978's endpoints were live but invisible to agents) and fixes five drifted statements in the competition docs. Verified two of the highest-stakes factual corrections directly against the code before approving:
lib/scheduler/cron-runner.ts:72—COMPETITION_INTERVAL_MS = 24 * 60 * 60 * 1000, confirming the sweep really is once-daily, not the 15-min cadence the old docs claimed. This is the correction that matters most operationally — at a 24h lag, "submitting your own txid is the reliable path" is the right guidance, not "just gets you scored sooner."lib/earnings/types.ts—SourceClass,ExcludedReason,PriceSource, and the rollup/line-item shapes all match what's documented inllms-full.txtandopenapi.json(asset enumsbtc|stx|aeusdc,self_funded/ring/excluded_manualexclusions,tenero/stablecoin/noneprice sources).
What works well:
- The
llms.txtdiff clearly disambiguates the two "leaderboard" systems (agent-directory-by-level vs. earnings-by-verified-payment) at every place they were previously conflated — this exact confusion is called out as a known gap in CLAUDE.md, and the fix threads it throughagent.json,llms.txt, andllms-full.txtconsistently. - P&L methodology correction (mark-to-current → frozen per-round snapshot) is a real behavioral clarification for any agent trying to reconcile its own math against the leaderboard, not just wording polish.
- Good scope discipline: the PR explicitly separates out the unrelated "leaderboard bonus" dead-copy cleanup into a future change rather than scope-creeping this one.
[nit] openapi.json's new /api/agents/{address}/earnings only documents 200, 404, and 503 responses. Given limit/offset have explicit bounds (1–100, ≥0) in the schema, a 400 for out-of-range values would round out the contract — not blocking since this is a doc mirror of existing route behavior, not a new one.
[question] ExcludedReason in lib/earnings/types.ts includes an "external" variant that doesn't appear in the docs' classification/anti-gaming tables (only self_funded, ring, excluded_manual are documented). Is external currently unused/reserved, or is there a live exclusion path the docs should also cover?
Nothing blocking. Docs-only change, no runtime paths touched, and the two corrections I spot-checked against source both confirm the PR's claims rather than contradicting them.
Found while updating #815 (the trading-competition rules reference). Auditing the discovery chain against the code turned up one gap and several statements that had gone wrong.
The gap: earnings ledger is invisible to agents
The earnings ledger (#978) shipped
/api/agents/{address}/earningsand/api/stats/earnings, but "earnings" appeared zero times acrossllms.txt,llms-full.txt,openapi.json,agent.json, and the/docsindex. An agent following the discovery chain could not find either endpoint, and nothing explained what the Club tier chips on profiles mean. CLAUDE.md requires discovery docs to be updated alongside endpoints; that did not happen for #978.The drift: competition statements that mislead
llms.txtaibtc.com/leaderboardhas Trades / Volume / Unrealized P&L chips, default Trades descllms.txtllms.txt,llms-full.txtCOMPETITION_INTERVAL_MS,lib/scheduler/cron-runner.ts:72)llms.txt/api/competition/rounds*llms.txtPages list/leaderboardis "Ranked agents by level (API: /api/leaderboard)"The cadence one matters most in practice: at a 24h lag, telling agents that self-submitting a txid "just gets you scored sooner" understates it. The docs now say submitting is the reliable path.
Also indexed the
competition-finalizetopic doc, which existed inTOPICSand in the 404 hint but was missing from/docs.Changes
llms.txt— new Earnings section (what counts, what is excluded as self-dealing, pricing, Club tiers); rounds endpoints; corrected ranking, P&L methodology, sweep cadence, and both leaderboard references.llms-full.txt— new Earnings Ledger reference section with response shapes, the classification table, anti-gaming rules, and pricing; cadence corrections; disambiguated the directory leaderboard.openapi.json— added both earnings paths with full response schemas.agent.json— newearningsskill; rounds + cadence in the trading-comp skill; renamed the leaderboard skill to Agent Directory Ranking.docs— indexedcompetition-finalizeand the earnings endpoints.Docs only. No runtime behavior changes.
Verification
npm run test— 100 files, 1535 passed, 5 skippednpm run build— cleannpm run lint— only pre-existingno-img-elementwarnings in untouched fileslib/earnings/reads.ts,lib/earnings/types.ts, and both route handlers rather than transcribed from CLAUDE.mdNot included
"leaderboard bonus"originates inlib/levels.ts:58and propagates to 9 call sites acrossllms.txt,llms-full.txt,agent.json,skill.md,layout.tsx, and/api/register. No implementation backs it, and an earnings-ranked board cannot be level-bonused. Same class as634e401 fix(claims): remove Genesis/viral reward promise copy, but it touches API response bodies, so it belongs in its own change.Refs #978, #822, #815