Skip to content

docs(predictions): push prediction events into Claude Code routines - #210

Merged
ericjuta merged 3 commits into
mainfrom
docs/claude-routine-push
Oct 23, 2026
Merged

ericjuta merged 3 commits into
mainfrom
docs/claude-routine-push

Conversation

@ericjuta

@ericjuta ericjuta commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Tracks t-y-b-b/nextjs-ai-chatbot#2690

DRAFT. These docs match shipped D46 behavior from t-y-b-b/nextjs-ai-chatbot#2691 and #2693, production revision 1150273e4. The owner runs the live fire manually. No live fire was performed for this documentation correction.

What changes

  • docs/connect/claude.mdx: corrects routine registration controls, optional kind, test-fire cooldown and token replacement instructions.
  • docs/predictions-mcp/events.mdx: corrects immediate rejection/oversize pauses, shared destination backoff, routine tests, receiver selection and token replacement. Replaces unnecessary hardcoded inventory/quota counts with schema/error fields and Anthropic's current limits documentation.
  • tools/docs/venue-tools.json and generated docs/predictions-mcp/tools.mdx: mention optional destination kind in the registration description.

Shipped behavior documented

  • events.mdx:239: 200 delivers.
  • events.mdx:240: 429 is not a failure; honor Retry-After, never sooner than 150 seconds; persist the wait on the destination across its subscriptions.
  • events.mdx:241,245: 400, 401, 403, 404 immediately pause with one paused health event and routine_rejected; fix the cause and resume with updatePredictionEventSubscription, patch.enabled: true.
  • events.mdx:242,245: 413 or an envelope too large to fit alone pauses with routine_too_large.
  • events.mdx:243: other statuses, including 500/503, and network failures use normal failed-delivery backoff; retrying a 500 can duplicate a session.
  • claude.mdx:106, events.mdx:125,222-224, tools.mdx:107: optional kind, URL inference, rejection of other Anthropic URLs or contradictory kind, Receiver type choices, exact URL/token labels and Claude routine badge.
  • claude.mdx:116, events.mdx:252-254: Replace token, Save token and resume after a rejection pause.
  • claude.mdx:108, events.mdx:139,303: a short unsigned test message starts a real session, uses fire quota and occupies the destination's 150-second slot. During cooldown nothing is sent; MCP returns WEBHOOK_ROUTINE_NOT_READY with details.retryAfterSeconds, and settings tells the user to wait N seconds.
  • events.mdx:228-229: one fire per destination every 150 seconds, oldest first, text under 65,536 characters, envelopes never split.

Local checks

At head 56382687f23801ba92636ab2cde9c28e41918dc3:

  • bun install --frozen-lockfile: passed.
  • Targeted bunx vp fmt, bun run fmt:check: passed.
  • bun run docs:test: 41 passed, 0 failed.
  • bun run docs:check: passed; 73 pages and 27 images validated.
  • node tools/docs/venue-tools.mjs --check: passed.
  • bun run lint: exit 0, including package builds.
  • git diff --check: passed.
  • Frozen-rubric rejudge covered all three changed pages with full contents. The first comparison flagged events drift risk; after removing redundant counts, the final compare.mjs reported "No regression against the baseline", with 0 pages newly at drift_risk >= 0.7. Final drift estimates: Claude 0.41, events 0.44, tools 0.29. Unchanged pages retain committed baseline verdicts; this was not a fresh whole-site sweep.
  • bun audit: FAILED, 1 high-severity advisory in unchanged Zod dependencies (4.1.8, 4.4.3): GHSA-mrhx-c7xc-m3w5. No dependency or lockfile changes were made.

Fetched origin/main and ran git rebase origin/main before editing; Git reported already up to date (0 behind, 2 ahead). Added one signed correction commit and pushed using the lease pinned to f7c8b7aff2c13a1778a3e582ee7cd31ab20da2b2.

No merge, deployment, environment change or nextjs-ai-chatbot edits.

Replaces the claim that a webhook cannot start a Claude turn. Adds the routine push recipe, delivery semantics, token rotation, limits, safety, and a scheduled-routine pull alternative. Describes behavior from the implementation brief for t-y-b-b/nextjs-ai-chatbot#2690 and is not proven in production yet.
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
plugins-evals Ready Ready Preview Oct 23, 2026 9:53pm UTC

Request Review

@github-actions

Copy link
Copy Markdown

Docs Preview

Changed docs pages: 3

  • connect/claude
  • predictions-mcp/events
  • predictions-mcp/tools

Navigation updated: no

Impacted nav groups:

  • Start here
  • Trading MCP (Degen Mode)

@ericjuta

Copy link
Copy Markdown
Contributor Author

Statements not verified (PR stays draft until #2690 proof):

  1. Everything about Ask Gina delivery is taken from the implementation brief, not from running code: 150 s batching, text as a note plus a JSON array of envelopes, the note's wording, bearer-only auth with no Standard Webhooks headers, 429 waiting on Retry-After without counting as a failure, 400/401/403/404 counting as failures, secret required with an sk-ant-oat01- token, refusal of other api.anthropic.com URLs, no 24 h overlap on rotate, the test event starting a real session, and no charge per delivery. No real fire against Anthropic has been made.
  2. Whether health events (such as paused) reach a routine destination is undecided in the brief, so the docs do not promise it. They point to listPredictionEventSubscriptions for why a subscription paused.
  3. Upstream facts are from Anthropic's pages as read on 2026-10-23 (code.claude.com/docs/en/routines and the routines fire API reference), not tested: routines use the connectors on the claude.ai account, cron more often than hourly is rejected, 30 fires per hour per routine and 100 per account, fire text wrapped as untrusted data, regenerating a token revokes the old one at once, sessions start in auto mode.
  4. Not tested: a routine calling the Ask Gina Predictions connector (OAuth in an unattended run). The docs say so and tell the reader to check the first run.
  5. The scheduled pull recipe is untested. Where the routine keeps its cursor is left to the reader.
  6. Anthropic's current docs call routines "scheduled tasks"; the new text notes both names.

Checks: fmt, docs:test, docs:check, venue-tools --check, lint, audit all pass locally; rejudge + compare.mjs: no regression.

@ericjuta
ericjuta marked this pull request as ready for review October 23, 2026 21:55
@ericjuta
ericjuta merged commit be9ae35 into main Oct 23, 2026
12 of 14 checks passed

This branch was successfully deployed

1 active deployment
Preview — 56382687 Deployed Oct 23, 2026 by vercel[bot]
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