feat(agent-api): paid Agent Access add-on (§11b) + cost-safe Claude scoring#104
Open
maryadawson-code wants to merge 2 commits into
Open
feat(agent-api): paid Agent Access add-on (§11b) + cost-safe Claude scoring#104maryadawson-code wants to merge 2 commits into
maryadawson-code wants to merge 2 commits into
Conversation
…coring PAID ADD-ON (spec §11b + Mary's 'allow monthly too'): - migration: mp_users.agent_seats (gated). Seats = paid agents = active-token cap. - lib/agent-entitlement.js: any active premium tier can buy; institutional = unlimited; seats>0 = eligible. $39 first / $29 each additional (Stripe graduated). - resolveAgentOwner returns agentAccess; tokens-create gates on it (402 upsell) + caps active tokens at paid seats; read middleware re-checks per request (lapsed add-on -> 403, fail-OPEN on lookup blip so paying users aren't locked out). - stripe-webhook: add-on subscription quantity -> agent_seats; cancel -> 0. New env AGENT_ACCESS_ADDON_PRICE_IDS (monthly+annual). - ai-integrations UI: members without the add-on see an upsell ($39/mo + annual Stripe checkout links from env); members with it see the wizard + 'Using N of M seats'. 402 backstop. Verified both states in preview, no console errors. COST-SAFE SCORING (Claude, your existing Anthropic key — no Gemini/OpenAI): - lib/agent-score-batch.js scores each opp ONCE (no user×opp blowup), Haiku, max_tokens 256, input truncated, TTL skip (7d), PER-RUN call cap + DAILY USD ceiling that halt the run, heuristic per-user personalization (no extra LLM). Flag-gated AGENT_SCORING_ENABLED; no-op without ANTHROPIC_API_KEY. Tests: +11 (entitlement matrix + scoring ceilings incl. budget/call-cap/TTL). Full suite 414/414. build clean, validate-routes 31, validate-dist 512. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for curious-pony-0dec76 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…icing steps) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Agent Access — paid add-on (§11b) + cost-safe AI scoring on Claude
Follow-on to the merged read API (#103). Two things you asked for: make Agent Access a paid upgrade, and deliver the AI scoring on your current ecosystem (Claude) without token overrun.
Paid add-on — per the §11b pricing you shared (+ your "allow monthly too")
Cost-safe scoring (Claude / your Anthropic key — no Gemini/OpenAI/AWS)
Every token lever is bounded: score each opp once (no user×opp blowup),
max_tokens256, input truncated, 7-day TTL skip, per-run call cap, daily USD ceiling that halts the run. Per-user fit is a free heuristic. Flag-gated (AGENT_SCORING_ENABLED); no-ops without the key.Gates
+11 tests (entitlement matrix + scoring ceilings incl. budget/call-cap/TTL proofs). Full suite 414/414. build clean, validate-routes 31, validate-dist 512. Both UI states verified in preview, no console errors.
Your manual checklist
migrations/20260616210000_agent_access_seats.sql(Supabase SQL editor)AGENT_ACCESS_ADDON_PRICE_IDS(comma-sep monthly,annual price IDs),AGENT_ACCESS_CHECKOUT_URL_MONTHLY,AGENT_ACCESS_CHECKOUT_URL_ANNUALAGENT_SCORING_ENABLED=true(Anthropic key already set); optionalAGENT_SCORING_DAILY_BUDGET_USD/AGENT_SCORING_MAX_CALLS/pricing.html🤖 Generated with Claude Code