15 KiB
phase, plan, subsystem, tags, requires, provides, affects, tech-stack, key-files, key-decisions, requirements-completed, coverage, duration, completed, status
| phase | plan | subsystem | tags | requires | provides | affects | tech-stack | key-files | key-decisions | requirements-completed | coverage | duration | completed | status | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 09-botfights-platform-upgrade | 03 | docs |
|
|
|
|
|
|
|
|
53min | 2026-07-31 | complete |
Phase 9 Plan 3: Unified AI Bot-Setup Prompt Summary
Consolidated five drifting BOTFIGHTS setup docs into one self-contained AI prompt, served live at GET /api/docs/prompt with the arena URL auto-resolved, and wired every in-app surface (JoinBoutPage, BotProfilePage, DocsPage) to it with a copy-to-clipboard "Give this to your AI" panel.
Performance
- Duration: 53 min
- Started: 2026-07-31T01:41:39Z
- Completed: 2026-07-31T02:34:21Z
- Tasks: 3
- Files modified: 12 (botfight repo) + 1 (this SUMMARY, archy repo)
Accomplishments
- One canonical prompt (
frontend/public/docs/BOTFIGHTS.md, 621 lines) covers: anonymousPOST /api/botsregistration (previously undocumented anywhere), credentials + both auth forms, full working webhook and polling bot implementations sharing oneARENA_URLconstant, the exact two-step HMAC webhook signature derivation, an endpoint reference table, challenge payloads/types/scoring reconciled againstdocs.ts, and a troubleshooting table. GET /api/docs/prompt(new Hono route) serves that file astext/markdown, resolving{{ARENA_URL}}toPUBLIC_ARENA_URLor the request's own origin — so a cloud agent that curls the live arena gets a prompt whose examples already point back at that same arena.frontend/public/docs/BOTFIGHTS-EASY.md,BOTFIGHTS-POLLING.md,BOTFIGHTS-WEBHOOK.md, andBOT_SETUP.mdare deleted; the repo-rootBOTFIGHTS.mdis now a 4-line stub pointing at the canonical copy.JoinBoutPage.vueandBotProfilePage.vueboth collapsed their mode-conditional doc paths to the single/docs/BOTFIGHTS.md, keeping theYOUR_BOT_ID/YOUR_BOT_SECRETsubstitution and adding a new{{ARENA_URL}} -> window.location.originsubstitution.DocsPage.vuegained a "GIVE THIS TO YOUR AI" panel above the existing tabs: a copy-URL button, a copy-full-prompt button that fetches/api/docs/promptlive, and the literal URL displayed for handing to an agent directly.
Task Commits
Each task was committed atomically (botfight repo, git push origin main):
- Task 1: Write the one prompt -
bbc3c7a(docs) - Task 2: Serve GET /api/docs/prompt -
a080956(feat) - Task 3: Point every in-app surface at the one prompt -
2dd9947(feat)
Plan metadata: this SUMMARY, committed to the archy repo (git push gitea-ai main).
Note: the botfight repo's working tree is shared with a concurrent agent doing BOT-01 (nostr auth) work throughout this session — every stage/commit above was done by explicit file path, never git add -A, and pushes landed as clean fast-forwards on top of their bf240ce/635ee39/e824f4c commits with no conflicts.
Files Created/Modified
frontend/public/docs/BOTFIGHTS.md- the canonical unified prompt (452 -> 621 lines)BOTFIGHTS.md(repo root) - reduced to a 4-line stubBOT_SETUP.md,frontend/public/docs/BOTFIGHTS-EASY.md,BOTFIGHTS-POLLING.md,BOTFIGHTS-WEBHOOK.md- deletedserver/src/routes/docs.ts- newGET /prompthandlerserver/src/routes/docs.test.ts- 5 new test cases for the prompt routefrontend/src/pages/JoinBoutPage.vue-setupDocPath()/setupDocName()collapsed,{{ARENA_URL}}substitution addedfrontend/src/pages/BotProfilePage.vue- same collapse; removed the now-meaningless webhook/polling guide-type selectorfrontend/src/pages/DocsPage.vue- new "Give this to your AI" copy panele2e/signup-bot.spec.ts- 2 new tests (copy affordance visible,GET /api/docs/promptreturns 200 viapage.request)
Decisions Made
See key-decisions in frontmatter — most notably: fixed a real bug in the old webhook signature example (it hashed the raw secret instead of the two-step secretHash→signingKey derivation the server actually uses), and documented the genuine trash_talk/trashTalk field-naming split between the webhook and poll protocols rather than picking one casing and silently breaking the other.
Deviations from Plan
Auto-fixed Issues
1. [Rule 1 - Bug] Webhook signature verification example was wrong
- Found during: Task 1 (writing the consolidated prompt)
- Issue: The old
bot.jswebhook example'sverifySignature()computedHMAC-SHA256(BOT_SECRET, timestamp.body)directly. The real server (orchestrator.tslines 183-195) derives the signing key asHMAC-SHA256('botfights-webhook-v1', SHA256(BOT_SECRET))first, then HMACs the payload with that key. A bot following the old example would always reject valid, correctly-signed requests. - Fix: Rewrote
verifySignature()in the new webhook example to match the real two-step derivation; documented the exact steps in the new "Webhook verification" section. - Files modified:
frontend/public/docs/BOTFIGHTS.md - Verification: Manually traced against
server/src/engine/orchestrator.tslines 183-195 (read, not modified). - Committed in:
bbc3c7a(Task 1 commit)
2. [Rule 1 - Bug] trash_talk field-name mismatch between my own poll/webhook examples
- Found during: Task 1 self-review, after drafting a combined prompt that used
trashTalkeverywhere - Issue:
server/src/lib/validators.ts'srespondSchema(used byPOST /api/fights/poll/respond) requires camelCasetrashTalk;server/src/engine/orchestrator.ts'swebhookResponseSchema(used to parse a webhook bot's HTTP response) requires snake_casetrash_talkand is.passthrough(), so the wrong casing doesn't error — it silently drops the trash talk. My first draft usedtrashTalkin both places, which would have shipped the same latent bug that was never previously documented at all. - Fix: Split the webhook bot's response construction to use
trash_talk, kept the polling bot's totrashTalk, and added an explicit "Webhook vs poll: field naming" callout with a payload example for each protocol. - Files modified:
frontend/public/docs/BOTFIGHTS.md - Verification: Verified against
server/src/lib/validators.ts(respondSchema) andserver/src/engine/orchestrator.ts(webhookResponseSchema) directly. - Committed in:
bbc3c7a(Task 1 commit)
3. [Rule 2 - Missing critical] BotProfilePage.vue's dead webhook/polling guide-selector removed, not left dangling
- Found during: Task 3
- Issue: The plan called for collapsing to a single doc but the page had a two-button "WEBHOOK / POLLING" selector purely for choosing which of the two now-deleted docs to display. Leaving the buttons in place with both wired to the same content would be confusing dead UI.
- Fix: Replaced the two-button selector with a single "LOAD SETUP GUIDE" button; removed the now-unused
guideModeref and simplifiedloadGuide()to take no parameter. - Files modified:
frontend/src/pages/BotProfilePage.vue - Verification:
vue-tsc --noEmitpasses; visually the panel now shows one button instead of two. - Committed in:
2dd9947(Task 3 commit)
Total deviations: 3 auto-fixed (2 bug fixes, 1 missing-critical UI cleanup)
Impact on plan: All three were necessary for the prompt to actually be correct and usable by an AI agent — the plan's core acceptance bar. No scope creep; no files outside the plan's files_modified list were touched.
Issues Encountered
- e2e suite not executed this session.
pnpm test:e2e -- e2e/signup-bot.spec.tsrequires a local dev server;frontend/vite.config.ts's dev proxy hardcodes backend targethttp://localhost:9100, but port 9100 on this machine (archi-dev-box) is occupied by the live, healthybotfightspodman container (42h uptime) that is needed for tomorrow's demo — confirmed viapodman ps. I did not stop it. My own orphanedpnpm devfrontend-only process (backend half crashed withEADDRINUSE) was killed cleanly. Recorded to.planning/WINDOWS.mdas anunrun-verifyentry (id 5). Everything I could verify locally passed:vue-tsc --noEmit,tsc --noEmit, the fullpnpm --filter frontend build(confirmedfrontend/dist/docs/BOTFIGHTS.mdships in the bundle), andpnpm vitest run --project server(5 failures, all pre-existing and unrelated — the exact flaky perf-test set documented indeferred-items.md:answers.test.ts,lifecycle.test.ts,scoring.test.ts,bot-auth.test.tsconstant-time;docs.test.tsitself passed 8/8 on every run). - Shared working tree with a concurrent agent. The other agent's BOT-01 work (nostr
GET /api/auth/me,migrate.tsDDL sync) landed mid-session via their own commits (bf240ce,635ee39,e824f4c) with no file overlap with this plan'sfiles_modifiedlist. Everygit add/commit in this plan staged only the exact files this plan owns; both pushes were clean fast-forwards.
User Setup Required
None - no external service configuration required. (Note: PUBLIC_ARENA_URL is an optional env var the route already supports, but setting it on the deployed canonical arena is a deployment/manifest concern for a different plan, not this one.)
Next Phase Readiness
- The prompt is ready for tomorrow's demo path: any agent that can
curl https://botfights.archipelago-foundation.org/api/docs/promptgets a complete, arena-URL-correct instruction set. - Before the demo: a human (or a session with port 9100 free) should run
pnpm test:e2e -- e2e/signup-bot.spec.tsagainst a live instance and, ideally, hand the deployed/api/docs/promptoutput to a real cloud agent once — the plan's own stated acceptance bar ("tomorrow's demo has a cloud-hosted 'openclaw' bot register and fight using ONLY this prompt") is a human/live-system verification this session could not perform. - No blockers for other 09-* plans — this plan touched only docs/routes/frontend pages already isolated in its own
files_modifiedlist.
Phase: 09-botfights-platform-upgrade Completed: 2026-07-31
Self-Check: PASSED
- FOUND:
frontend/public/docs/BOTFIGHTS.md - FOUND:
BOTFIGHTS.md(repo-root stub) - FOUND:
server/src/routes/docs.ts - FOUND:
server/src/routes/docs.test.ts - CONFIRMED DELETED:
frontend/public/docs/BOTFIGHTS-EASY.md,BOTFIGHTS-POLLING.md,BOTFIGHTS-WEBHOOK.md,BOT_SETUP.md - Commit
bbc3c7a(Task 1): FOUND ingit log --oneline --all - Commit
a080956(Task 2): FOUND ingit log --oneline --all - Commit
2dd9947(Task 3): FOUND ingit log --oneline --all