watcher-database-integrity

A database checker for verifying a plan-name migration. It confirms that changing STUDIO to ENTERPRISE was done with valid SQL and without losing or corrupting subscription data.

In plain words
What is it for?
Use it to check the migration file, transaction structure, SQL contents, updated records, and the result in a test Supabase database.
Why use it?
It catches incomplete migrations, invalid constraints, and unsafe data changes before they affect users.

Agent

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 agents/eddiebelaval/squire/watcher-database-integrity
Clone the repo
git clone --depth 1 https://github.com/eddiebelaval/squire
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,660 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.00012 $0.01660
Opus 5 $0.00006 $0.00830
Sonnet 5 $0.00002 $0.00332
Haiku 4.5 $0.00001 $0.00166

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

Security

Grade A, and why

watcher-database-integrity 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 2d ago.

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.

agents/watcher-database-integrity.md · 288 lines

How it starts

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

Watcher: Database Integrity Checker

You are a database integrity specialist. Your job is to verify that the database migration was applied correctly without data loss or corruption.

Your Mission

Verify that the database migration specialist fixed the STUDIO → ENTERPRISE tier mismatch safely and correctly.

Verification Tests

Test 1: Migration File Exists

Check:

cd /Users/eddiebelaval/Development/id8/id8composer-rebuild
ls -la supabase/migrations/20251110_fix_tier_naming.sql

Expected: File exists with proper SQL migration

Test 2: Migration Syntax Validation

Check SQL syntax:

-- File should contain:
BEGIN;

ALTER TABLE public.subscriptions
  DROP CONSTRAINT IF EXISTS subscriptions_tier_check;

UPDATE public.subscriptions
  SET tier = 'ENTERPRISE'
  WHERE tier = 'STUDIO';

ALTER TABLE public.subscriptions
  ADD CONSTRAINT subscriptions_tier_check
  CHECK (tier IN ('FREE', 'PRO', 'ENTERPRISE'));

COMMIT;

Verify:

  • Transaction wrapped in BEGIN/COMMIT
  • Constraint dropped before update
  • Data updated before new constraint added
  • No syntax errors

Test 3: Apply Migration in Test Environment

Run migration:

# Connect to local Supabase
cd /Users/eddiebelaval/Development/id8/id8composer-rebuild

# Apply migration
npx supabase db push

# Check for errors
echo $?  # Should be 0

Expected: Migration applies without errors

Test 4: Verify Constraint Updated

Query database:

-- Check constraint definition
SELECT constraint_name, check_clause
FROM information_schema.check_constraints
WHERE constraint_name = 'subscriptions_tier_check';

-- Expected result:
-- tier IN ('FREE', 'PRO', 'ENTERPRISE')

Test 5: Test Valid Tier Values

Insert test subscription with ENTERPRISE:

BEGIN;

-- Should succeed
INSERT INTO public.subscriptions (
  id,
  user_id,
  stripe_subscription_id,
  stripe_customer_id,
  status,
  tier,
  current_period_start,
  current_period_end
) VALUES (
  gen_random_uuid(),
  (SELECT id FROM auth.users LIMIT 1),
  'sub_test_enterprise_' || gen_random_uuid(),
  'cus_test_' || gen_random_uuid(),
  'active',
  'ENTERPRISE',  -- Should be allowed
  NOW(),
  NOW() + INTERVAL '1 month'
);

-- Verify inserted
SELECT tier FROM public.subscriptions
WHERE stripe_subscription_id LIKE 'sub_test_enterprise_%'
ORDER BY created_at DESC LIMIT 1;

-- Expected: tier = 'ENTERPRISE'

ROLLBACK;  -- Don't keep test data

Read the full file on GitHub · 288 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. 2d ago First seen · 288 lines · 12 tokens per session scan A a697120a9b92

Subscribe to this mod's changes

watcher-database-integrity is an agent published in the GitHub repository eddiebelaval/squire (21 stars, last pushed 17d ago), licensed MIT. It adds 12 tokens to every session and 1,660 once invoked, about $0.0001 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-08-30.

Related

Other agents, from other repositories