Skip to content

feat: DBA agent (Ask button on home, self-serve signup, MCP ask_dba, 2x cost guard) 0.3.0 - #5

Merged
ralyodio merged 1 commit into
mainfrom
feat/dba-agent
Nov 30, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/dba-agent

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

DBA as a service on dbml.db, run by an AI agent grounded in the review engine.

  • Home page: "Ask the DBA agent" button in the playground; the section below asks about the editor's schema in place, with personal-link signup and $5/$10 top-up inline.
  • Self-serve: POST /api/signup gives anyone a personal link (cookie set, 5 per IP per hour, SIGNUP_CREDIT_CENTS default 0). /ask signed-out page now has a "Get my personal link" button.
  • Agents: MCP tools ask_dba / ask_dba_result with Authorization: Bearer <token>; API documented in /docs#dba and llms.txt.
  • Cost rule: c0mpute always first. OpenAI/Claude are offered per call only when the price paid >= ASK_MIN_MARGIN (2) x (paid spend already burned on the question + worst-case cost of the next call: prompt at 3 chars/token, all 2,500 output tokens). Enforced via the router's only list. Anthropic default rate corrected to claude-haiku-5-5 ($0.10/$0.50 per MTok).
  • Shared startAsk() so page, API and MCP run the same checks.

Tests: 34/34 (new: margin guard, only list, signup + rate limit, MCP ask_dba charge).

🤖 Generated with Claude Code

… ask_dba, 2x cost guard on paid fallback (0.3.0)

- Home page: "Ask the DBA agent" in the playground asks about the editor's
  schema in place; personal link + top-up inline.
- /api/signup: anyone gets a personal link (5/IP/hour, SIGNUP_CREDIT_CENTS).
- MCP ask_dba / ask_dba_result with the personal token as Bearer.
- c0mpute first; OpenAI/Claude only when price >= ASK_MIN_MARGIN (2) x the
  worst-case paid cost (incl. failed paid attempts). Haiku 5.5 rates 0.10/0.50.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 557ddb9 into main Nov 30, 2026
1 check passed
@ralyodio
ralyodio deleted the feat/dba-agent branch November 30, 2026 21:09
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