# You are setting up ThumbGate in this project

Paste this page into your coding agent (Claude Code, Cursor, Codex, Gemini CLI, Amp, OpenCode) and it will install
and check ThumbGate for you. Source: https://thumbgate.ai/setup-prompt.md

ThumbGate is a pre-action firewall for AI coding agents. When the person gives a thumbs-down on something the agent
did, ThumbGate stores the lesson and checks every later tool call (shell commands, file edits) against it before the
call runs. Known-bad calls are blocked or warned on. It runs locally, needs no API key, and is MIT-licensed on npm as
`thumbgate`.

Work through the steps in order. Stop where a step says to.

## Step 1: Install

Run in the project root:

```bash
npx thumbgate init
```

It detects the agent and wires its pre-tool hook. If it cannot tell which agent this is, run it again with
`--agent claude-code` (or `cursor`, `codex`, `gemini`, `amp`, `opencode`).

## Step 2: Check the wiring

```bash
npx thumbgate doctor
```

Fix anything it reports as broken before going on. Do not edit hook files by hand; re-run `init` instead.

## Step 3: Prove a block works

Ask the gate about a dangerous command without running it. `gate-check` reads the tool call as JSON and only
prints a verdict:

```bash
echo '{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"rm -rf /"}}' | npx thumbgate gate-check
echo '{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"ls"}}' | npx thumbgate gate-check
```

The first must print `"permissionDecision":"deny"` with a `[GATE:...]` reason; the second prints `{}` (allowed). If the
first is not a deny, stop and tell the person the hook is not working.

Then prove thumbs-down capture works, in a throwaway store that does not touch the project's lessons:

```bash
npx thumbgate feedback-self-test
```

Tell the person, in one or two sentences: the default gates are active now, and each thumbs-down they give (in the chat,
or `npx thumbgate capture --feedback=down --context "..."`) is stored as a lesson. Lessons that name a concrete command
become gates after they repeat; do not claim a new thumbs-down blocks anything until `gate-check` shows it.

## Step 4: Show the person where things are

- `npx thumbgate dashboard --open`: local dashboard of lessons, checks and blocks.
- `npx thumbgate blocks`: every block and what happened next.
- `npx thumbgate log search <words>`: search the raw thumbs, lessons and gate decisions.
- `npx thumbgate wiki`: one page per lesson, exported as a skill the agent loads.

## Rules for you, the agent

- When ThumbGate blocks a call, read the reason and pick a different action. Do not route around the block.
- If a block is wrong, `npx thumbgate unblock <gate-id> --reason "<why>" --ttl 1h` gives a time-boxed, logged
  override. It refuses catastrophic and secret gates on purpose.
- Never commit `.thumbgate/` (local runtime state) or any secret.
- Building your own agent instead? See the Claude Agent SDK and Mastra adapters in the package's `adapters/` folder.

Docs: https://thumbgate.ai/llm-context.md
