Agent Code Buddy

Agent Code Buddy is a mobile Human-in-the-Loop companion for AI coding agents. A Python HTTP server runs on your PC and intercepts tool-use requests from Claude agents via a pre-tool-use hook. The native Android app receives those requests in real time and lets you approve or deny directly from the notification shade — without unlocking the phone. Agent Code Buddy é um companion mobile de Human-in-the-Loop para agentes de IA. Um servidor Python HTTP roda no seu PC e intercepta requests de tool use de agentes Claude via hook de pre-tool-use. O app Android nativo recebe esses requests em tempo real e permite aprovar ou negar direto da aba de notificações — sem desbloquear o phone.

Claude agent (Claude Code, etc.)
        │ pre-tool-use hook
        ▼
  buddy server (PC)   ← Python HTTP, long-poll, ThreadingHTTPServer
        │ BroadcastReceiver
        ▼
  Android app (phone) ← native Java, notification shade, accelerometer
        │ POST /api/decide/:id
        ▼
  agent unblocked     ← allow_once | always_allow | reject

The agent blocks on long-poll until you decide. No push notifications required — the app polls the server and posts a local Android notification. Works over local network or any reachable IP. Source on GitHub. O agente bloqueia em long-poll até você decidir. Sem push notifications externas — o app consulta o servidor e posta uma notificação Android local. Funciona em rede local ou qualquer IP acessível. Código no GitHub.

Setup Instalação

Start the server on your PC: Inicie o servidor no seu PC:

cd server
python3 server.py --port 8765

Build and install the APK on your phone (requires Termux with SSH): Build e instale o APK no seu phone (requer Termux com SSH):

cd android && ./build.sh
scp -P 8022 build/agent-code-buddy-signed.apk u0_a186@<phone-ip>:~/
ssh -p 8022 u0_a186@<phone-ip> 'su -c "pm install -r ~/agent-code-buddy-signed.apk"'

Wire it to Claude Code as a pre-tool-use hook in .claude/settings.json: Conecte ao Claude Code como hook de pre-tool-use em .claude/settings.json:

{
  "hooks": {
    "PreToolUse": [
      { "matcher": "", "hooks": [{ "type": "command", "command": "python3 /path/to/server/bin/claude-pretooluse-hook" }] }
    ]
  }
}

Decisions Decisões

allow_once Approve this specific request Aprova este request específico
always_allow Trust this tool for the session Confia nesta ferramenta na sessão
reject Block — agent receives a deny Bloqueia — agente recebe deny

Robot pet states Estados do pet robô

The companion app has a living ASCII robot pet that reacts to what's happening. O app companion tem um pet robô ASCII vivo que reage ao que está acontecendo.

idle Waiting. Animated robot pet, random easter eggs (hiccup, sneeze, yawn, peekaboo, dance). Aguardando. Pet robô animado com easter eggs aleatórios (hiccup, sneeze, yawn, peekaboo, dance).
attention Pending approval request. Robot raises alert, flashing [!] frames. Request de aprovação pendente. Robô aciona alerta com frames [!].
busy Decision being sent to server. Decisão sendo enviada ao servidor.
celebrate After clearing the queue — confetti frames for 3 seconds. Após zerar a fila — frames de confete por 3 segundos.
sleep Phone face-down (accelerometer). Robot sleeps, z Z frames. Phone virado para baixo (acelerômetro). Robô dorme, frames z Z.
dizzy Phone shaken (accelerometer). Robot spins @ @ frames. Phone sacudido (acelerômetro). Robô gira com frames @ @.
heart Fast approval (< 5s). Robot shows <3 for 8 seconds. Aprovação rápida (< 5s). Robô mostra <3 por 8 segundos.

Server API API do servidor

GET /api/stateCurrent requests and statsRequests e stats atuais
POST /api/requestSubmit an approval requestSubmete um request de aprovação
POST /api/decide/:idApprove or reject a requestAprova ou rejeita um request
POST /api/wait/:idLong-poll until decided (default 300s)Long-poll até decidido (padrão 300s)
GET /healthHealth checkHealth check