# VibeRaven Agent Rules

VibeRaven is agent context and a pre-launch repo check for AI-built apps on Vercel + Supabase. It is advice, not a gate: the user decides when to ship. It is a repository check, not a live database or security test.

You can add these rules to `AGENTS.md`, `CLAUDE.md`, or `.cursorrules` yourself, or let `init` write them:

```bash
npx -y viberaven init
```

Preview first; `init` with no `--agents` writes the same default set as `--agents all`:

```bash
npx -y viberaven init --dry-run
```

## Files init writes

In the unpublished local 1.7.0-rc.5 candidate, `init --agents all` writes the default set: `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.github/copilot-instructions.md`, `.cursor/rules/viberaven-core.mdc`, `.cursor/rules/viberaven-supabase-rls.mdc`, `.cursor/rules/viberaven-deploy.mdc`, `.cursor/rules/viberaven-payments.mdc`, `.viberaven/agent-context.md`, `.viberaven/mission-map.md`, `.viberaven/agent-rules.md` and `.claude/skills/viberaven/SKILL.md`.

Other targets are written only when you name them with `--agents <name>`: `.cursorrules` (cursor-legacy), `.devin/rules/viberaven.md` (devin), `.windsurf/rules/viberaven.md` (windsurf), `.clinerules/viberaven.md` (cline), `.roo/rules/viberaven.md` (roo), `.junie/guidelines.md` (junie) and `.rules` (zed).

What `init --agents all` installs, from a local 1.7.0-rc.5 candidate run (not published):

- AGENTS.md, CLAUDE.md, GEMINI.md and `.github/copilot-instructions.md` get a short VibeRaven block for Vercel + Supabase apps. It runs `npx -y viberaven check` for relevant changes, fixes permitted repo-code blockers first, then has the agent ask the user before a repo change that needs their yes, such as enabling RLS without policies. It says "This is advice, not a gate: the user decides when to ship." A clean check is not proof of live database state or security. CLAUDE.md also gets an `@AGENTS.md` line.
- `.cursor/rules/viberaven-core.mdc` always applies and carries a short version of the same advice. Three more Cursor rule files apply only when editing `supabase/**`, `vercel.json` or `.github/workflows/**`, or payment webhook files. They point the agent at the `.viberaven/agent-context.md` and `.viberaven/mission-map.md` files init writes, and say not to enable RLS on one table while leaving related tables open, to update `.env.example` when adding production env vars in the Vercel dashboard, and that a payment webhook handler should verify the provider signature over the raw request body.
- init also writes `.viberaven/agent-context.md`, `.viberaven/mission-map.md`, the full loop in `.viberaven/agent-rules.md`, and the project Skill in `.claude/skills/viberaven/SKILL.md`. A differing existing Skill is preserved for manual review. Selecting one short-rule target also installs its linked guide.
- `package.json` gets `viberaven:check` (`npx -y viberaven check`). Existing scripts and their values are preserved, including legacy scripts from an earlier init.

You can edit or skip any of these rules. The dry run does not show the `package.json` scripts. Your own notes outside the VibeRaven markers stay. If an earlier version wrote gate rules into these files, running `init --agents all` again replaces the VibeRaven block, and `npx -y viberaven doctor --agents` names any file that still has them.

## Rules to write by hand

A shorter set, matching what 1.6.3 checks, if you would rather write the rules yourself:

- On an AI-built app that deploys on Vercel and uses Supabase, before a launch or client handoff, or after changes to Supabase migrations, env vars, the service role key or Stripe webhook handlers, suggest one pass with `npx -y viberaven --agent-mode`.
- The local check needs no login, no API key and no scan quota.
- Read `.viberaven/agent-tasklist.md` first, `.viberaven/gate-result.json` for the machine verdict, and `.viberaven/context-map.json` for compact agent context.
- Read `.viberaven/agent-summary.md` second for scan context.
- Read `.viberaven/launch-playbook.md` third for the full checklist.
- Use `npx -y viberaven next --json` or `npx -y viberaven prompt --gap <id>` for the next focused fix.
- After a batch of fixes, run `npx -y viberaven --verify`.
- For the Supabase checks one by one, run `npx -y viberaven audit --vercel-supabase`. It covers RLS in migrations, `using (true)` policies, Data API grants, security definer functions, service role key exposure and serverless connections on port 5432 instead of the 6543 pooler.
- Do not claim provider dashboard checks are fixed by repo-code edits.
- A `clear` status is the repo half of launch readiness; the user decides when to ship.
