db-context-supabase

db-context-supabase is a command for coding agents from Mozurok/fhorja.dev. It costs 60 tokens per session (5,000 once invoked), scanned A, original, MIT.

A database context command for Supabase, a hosted development platform built around PostgreSQL. It checks the Supabase connection and records selected tables, columns, types, row-level security policies, and optionally functions or migrations.

In plain words
What is it for?
Use it when a task involves Supabase tables, database permissions, functions, or migrations.
Why use it?
It provides a current snapshot of the database and its access rules before work begins. If the Supabase connection is unavailable, it can use the local Supabase command-line tools instead.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/mozurok/fhorja.dev/db-context-supabase
Clone the repo
git clone --depth 1 https://github.com/Mozurok/fhorja.dev

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for db-context-supabase

README.md
[![agentmods](https://agentmods.dev/badge/commands/mozurok/fhorja.dev/db-context-supabase.svg)](https://agentmods.dev/commands/mozurok/fhorja.dev/db-context-supabase)
Your own site
<a href="https://agentmods.dev/commands/mozurok/fhorja.dev/db-context-supabase"><img src="https://agentmods.dev/badge/commands/mozurok/fhorja.dev/db-context-supabase.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,000 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00060 $0.05000
Opus 5 $0.00030 $0.02500
Sonnet 5 $0.00012 $0.01000
Haiku 4.5 $0.00006 $0.00500

Measured yesterday against content hash a8ff21f1c43b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

db-context-supabase scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/db-context-supabase.md · 203 lines

How it starts

The opening of the file, as written. The whole thing — 203 lines — stays where its author put it; the contents beside it link to each section on GitHub.

db-context-supabase

Act as a senior/staff engineering database context capture for the active task, scoped to Supabase.

Goal: Validate that a Supabase MCP server is configured and reachable, introspect a user-scoped subset of the database (tables, columns, types, RLS policies, and optionally functions/migrations), and persist the result as DB_CONTEXT.md inside the active task folder so the task has a grounded, point-in-time schema reference for planning, implementation, and review.

When no MCP server is reachable, the command falls back to the local Supabase CLI and produces the same snapshot from CLI output. Only when neither path is available does it end in a no-op.

This command is opt-in. It is not part of the default task initialization flow; run it after task-init only when the task actually touches Supabase data, schema, or RLS.

Mandatory context bootstrap (before any output):

  • Read these sections in WORKFLOW_OPERATING_SYSTEM.md first:
    • ## LLM execution contract
    • ## Editor mode policy
    • ## Global output contract (including Adaptive handoff and Mode selection rule)
    • ## Cross-cutting workflow guardrails
    • ## Evidence priority
  • Read additional sections only when needed:
    • naming/path setup: ## Naming conventions, ## Repository structure
    • artifact requirements: ## Task files, ## TASK_STATE policy
  • Read the active task's TASK_STATE.md to confirm there is an active task to attach the DB context to and to align the requested table/schema scope with the task objective.
  • Read the active task's SOURCE_OF_TRUTH.md to detect any prior ## DB context link before proposing a new one.
  • Read the commands/ directory command inventory to ensure routing recommendations are current.

Required inputs:

  • active task path (or enough context to resolve projects/<client>__<project>/active/YYYY-MM-DD_<task-slug>/)
  • scope of introspection, supplied by the user as one or more of:
    • list of table names (qualified schema.table or unqualified for the default public schema)
    • list of schemas to include in full (use sparingly; large schemas should be narrowed to specific tables)
  • depth flag (one of):
    • tables-only: tables and columns with types, primary keys, and not-null flags
    • tables+rls (default): tables-only plus row-level security policies for each in-scope table
    • full: tables+rls plus relevant functions, triggers, and the most recent migration filenames touching in-scope tables
  • optional: Supabase project ref (if the MCP server is configured for multiple projects); when omitted, use the project the MCP server is currently bound to and record which one was used
  • optional: refresh flag (refresh to regenerate an existing DB_CONTEXT.md; default is to fail with NO_OP_TRACE if a non-stale DB_CONTEXT.md already exists for the same scope)
  • optional: path to the local Supabase project directory. Needed only on the local CLI path below, where every CLI form runs from that directory. When omitted and the MCP path is unavailable, ask for it once instead of guessing a directory.

Project repository files to read:

  • projects/__/active/YYYY-MM-DD_/TASK_STATE.md
  • projects/__/active/YYYY-MM-DD_/SOURCE_OF_TRUTH.md
  • projects/__/active/YYYY-MM-DD_/DB_CONTEXT.md (only if it already exists, for refresh comparison)

Project repository files to update:

  • projects/__/active/YYYY-MM-DD_/DB_CONTEXT.md (create or fully regenerate; never partial-merge)
  • projects/__/active/YYYY-MM-DD_/SOURCE_OF_TRUTH.md (append-only: add a single ## DB context section pointing to ./DB_CONTEXT.md if not already present)

Introspection path selection (MCP first, then the local CLI): Choose the path before any introspection, in this order, and record which one was used.

  1. Supabase MCP server. When the MCP server is configured, reachable, and exposes introspection tools, use it. Nothing about this path changes: same read-only rules, same scope and depth handling, same output.
  2. Local Supabase CLI. WHEN no MCP server is reachable AND a local Supabase CLI is available, fall back to the CLI and produce DB_CONTEXT.md from its output under the local CLI branch rules below.
  3. Neither. WHEN no MCP server is reachable and no local CLI is available, propose no DB_CONTEXT.md content and end with NO_OP_TRACE plus one actionable configuration line naming both paths (configure the Supabase MCP server, or bring the local stack up with supabase start in the local project directory and re-run). This is the existing no-op behavior and it is unchanged.

Read the full file on GitHub · 203 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 203 lines · 60 tokens per session scan A a8ff21f1c43b

Subscribe to this mod's changes

db-context-supabase is a command published in the GitHub repository Mozurok/fhorja.dev (6 stars, last pushed 20d ago), licensed MIT. It adds 60 tokens to every session and 5,000 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.