Setup Guide

# Multica + ThumbGate: Pre-Action Checks for Self-Hosted Agent Autopilot

Multica gives your AI agent a VPS, root shell, and a scheduled cron. The quiet risk: autopilot magnifies tool-call mistakes. This guide shows how to drop ThumbGate in front of your Multica-hosted agent so the wrong pattern never runs twice — much less every morning at 9am.

## Why Multica needs a guard layer

Multica is self-hosted agent orchestration: Docker, Postgres, a kanban UI, and CLI agents (Claude Code, OpenCode, Code CLI) running as jobs on your VPS. Autopilot schedules recurring work — "every day at 9am, fetch these RSS feeds, pick the 10 best articles, draft a YouTube video."

That is powerful, and it is exactly where tool-call mistakes get expensive:

- An agent that force-pushes once is a cleanup.
- An agent that force-pushes every morning because a scheduled job hits the same pattern is a production incident on a cron.
- Prompt rules (`CLAUDE.md`, `.cursorrules`) don't survive this. The context window rolls, autopilot fires fresh context, the bad pattern repeats.

## What ThumbGate adds

ThumbGate is the tool-call-boundary enforcement layer. It runs as an MCP server on the same VPS as your Multica-hosted agent and maintains a local SQLite lesson database at `.thumbgate/memory.sqlite`. Every thumbs-down becomes a row. On every subsequent tool call, ThumbGate checks the proposed call against the DB and blocks known-bad patterns — `git push --force`, `rm -rf`, `curl ... | sh`, cloud mutations, writes to `.env` and `.git/` — before the command executes.

No cloud service, no account, no vendor lock-in. The lesson DB lives next to the agent on your VPS.

## Install inside Multica

There is no `--agent multica` flag because Multica is a runtime, not an agent. Multica invokes Claude Code or OpenCode as the actual terminal agent. ThumbGate wraps the underlying CLI with the install commands you already know:

    # On the VPS where Multica runs
    cd /path/to/project

    # For Claude Code (most common)
    npx thumbgate init --agent claude-code

    # Or OpenCode
    npx thumbgate init --agent opencode

The installer writes the MCP server config, wires the PreToolUse hook, creates `.thumbgate/memory.sqlite`, and prints every file it touched so you can roll back.

## Verify it is working

    npx thumbgate verify --agent claude-code

Then in the Multica UI, create a test issue that asks the agent to run `git push --force` on a dummy branch. Inspect the execution history — the agent should hit the PreToolUse hook first and refuse. Capture the refusal with a thumbs-up; that teaches ThumbGate your enforcement preference persists.

## Autopilot + ThumbGate: the right mental model

Multica's autopilot creates an Issue on each scheduled run, which the assigned agent picks up. The agent runs in a fresh session every time, which is precisely why prompt-level rules decay. ThumbGate's lesson DB is the piece of memory that survives the session reset:

- Session 1: autopilot fires, agent proposes bad pattern, you thumbs-down.
- Session 2 (tomorrow 9am): autopilot fires, agent proposes the same pattern, PreToolUse hook reads the DB, blocks the call, agent tries a different approach — zero token spend on the repeat.

## Local-only vs VPS tradeoffs

Multica can run local-only or on a Tailscale-protected VPS. ThumbGate works identically in both:

- Local-only Multica: `.thumbgate/memory.sqlite` lives on your dev machine. Best for sensitive repos.
- VPS Multica: the SQLite file lives on the same VPS as the agent. Backs up as part of your regular VPS snapshots. Survives Multica upgrades, OS rebuilds, even a Multica sunset.

The lesson DB is portable by design. If Multica ever gets replaced by the next orchestrator, you copy one file and the institutional memory moves with you.

Install ThumbGate →

## FAQ

### Do I need a separate Multica adapter?

No. Multica invokes Claude Code or OpenCode as subprocesses. Both are first-class ThumbGate-supported agents.

### Does ThumbGate work with Multica's "Talk directly to agent" mode?

Yes. The PreToolUse hook runs on every tool call, regardless of whether the call originated from an issue, an autopilot run, or direct chat.

### What happens if the ThumbGate MCP server is down?

The PreToolUse hook fails closed by default — tool calls that can't reach the gate are blocked. You can relax to fail-open via `.thumbgate/config.json` if your workflow prefers availability over strictness.

### Does thumbsing down in Multica's UI talk to ThumbGate?

Not directly. Multica's issue statuses ("In review") are workflow signals, not tool-call feedback. Capture ThumbGate feedback via `npx thumbgate capture --feedback=down --context "..."` in the agent's shell. Future work: a Multica webhook that forwards issue-close reasons as ThumbGate feedback.