Safety

App Army runs agents that can edit code, run shell commands, push to git and talk to store consoles. Most of the time that is the point. This page is about the times it should not.

There are four layers. None of them is perfect alone.

  1. The guard hook stops dangerous tool calls before they run.
  2. Confirmation rules in the workspace CLAUDE.md make the agent ask you first, with the target spelled back.
  3. Agents that never act on their own for the risky steps (the release agent writes the confirmation, it does not publish).
  4. You. Read what changed before you publish, spend money or push to main.

The guard hook

kappmaker-army init wires army-guard as a PreToolUse hook in ~/.claude/settings.json. The army-core plugin carries the same hook. It reads every shell command, file write, file edit and file read before it happens. When a call breaks a rule, the hook exits with code 2 and Claude Code drops the call. That still works with --dangerously-skip-permissions.

What it blocks, by rule id:

Rule Stops
git-force-push git push --force, -f, --force-with-lease, +branch refspecs
git-push-main any push to main or master
git-reset-hard git reset --hard
git-clean git clean -f (a dry run with -n is fine)
git-branch-delete-main git branch -D main
rm-rf rm -rf on /, your home, the projects folder, a whole project, anything outside the current project and temp folders
db-drop dropping databases, FLUSHALL, firestore:delete --all-collections
curl-pipe-sh curl ... | sh and the like
nested-claude claude -p, claude mcp ..., a bare claude inside a worker (it kills the live Telegram bot)
production-publish kappmaker publish or fastlane going to Play production or App Store review
secret-print printing .env, *.p8, *.p12, *.pem, keystore files, service-account JSON, API key files, SSH keys, bare env
gh-repo-danger gh repo delete, making a repo public
protected-file edits to ~/.claude/settings.json, project .claude/settings*.json, your workspace MEMORY.md
secret-content writing a token or private key into a normal file
secret-read the Read tool on a secret file
guard-self the agent changing the guard's own config

The one sanctioned way to push main is kappmaker-army push <app> --confirmed. It runs only after you typed yes push <repo>, needs a green full build gate for that exact commit, scans every commit for secret files and only fast-forwards. It never force-pushes.

In an interactive session, production-publish asks you instead of blocking. In bypass mode there is nobody to ask, so it blocks.

Override once, from your own terminal (not through the bot):

echo git-reset-hard >> ~/.army/guard-allow-once

The next matching call goes through and the line is removed. The agent cannot write that file.

Try it in warn mode first if you like: set "mode": "warn" in ~/.army/guard.json. It logs what it would have blocked to ~/.army/logs/guard.log and blocks nothing.

Full reference: docs/SAFETY-guard.md.

What the guard is not

It is a seat belt, not a sandbox. It reads the command text. A Python script that deletes files, or a Makefile target, gets past it. If the guard itself crashes, it lets the call through and logs an error, so a guard bug never freezes your workers. Keep backups and keep your repos on GitHub.

Skip-permissions: the real risk

Always-on workers run claude --dangerously-skip-permissions, because nobody is at the keyboard to click "allow". In that mode Claude Code ignores every allow list. Only hooks still run.

App Army handles that in three ways:

  1. kappmaker-army init wires the guard before any worker exists.
  2. The worker runner checks for the guard on every start. If it is missing, the worker starts without skip-permissions and logs why.
  3. kappmaker-army doctor fails when the guard is missing.

You can turn skip-permissions off completely with ARMY_SKIP_PERMISSIONS=no in army.conf. Workers then stop and wait at each permission prompt, which is safer and much slower.

On a laptop, you do not need skip-permissions at all. Run claude normally and approve calls as they come.

Confirmations the agent must ask for

The workspace CLAUDE.md tells every session to ask first, with the target name spelled back, before:

  • a production publish (Play production track, App Store release);
  • a push to main or master;
  • any force push;
  • deleting files, folders, branches, repos or store listings;
  • rm -rf, git reset --hard, git clean -fd, dropping a database;
  • anything that costs real money: paid AI generations, store fees, infra changes.

The confirmation looks like: "About to publish sprout to App Store production. Confirm with 'yes publish sprout'?" A vague "yeah ok" is not enough for these.

Before the first production publish of an app, release-manager walks AiGuidelines/loop/STORE_COMPLIANCE.md and puts the result in that message.

If you want milestone merges to main without being asked, write that as a rule in MEMORY.md, with conditions (full gate green, secret scan clean, fast-forward only). The agent follows it. The guard still blocks a plain git push to main; the merge goes through kappmaker-army push.

Secrets

  • Bot tokens live in ~/.claude/channels/telegram-<worker>/.env (mode 600). kappmaker-army worker add reads the token with hidden input. Never paste a token into a chat with Claude.
  • API keys live in their own files: Stitch in ~/.config/stitch/api_key, Google Play in the file GOOGLE_SA_JSON points at, store credentials in kappmaker config. Never in army.conf.
  • The agents are told never to echo a key, token or password. If you paste one, they confirm they got it without quoting it.
  • App repos never get .env, service-account*.json, .p8 files, secrets/ or credentials/.
  • The Android keystore stays out of git unless you set KEEP_KEYSTORE_IN_REPO=true, and then only in a private repo. Back it up somewhere else as well. Losing it means you cannot update your app on Play.
  • kappmaker-army push refuses a push range that holds a secret-like file.
  • If a secret lands in a commit, rotate it. Removing the commit is not enough.

What the AI may never do

These are hard rules in the workspace CLAUDE.md, the agents and the guard:

  • publish to production, or submit for App Store review, without your typed confirmation;
  • force-push, or push to main outside kappmaker-army push and your confirmation;
  • delete repos, branches or store listings without your confirmation;
  • print, commit or send a secret;
  • run a nested claude inside a worker;
  • edit ~/.claude/settings.json, the guard config, or the Safety section of CLAUDE.md;
  • change your MEMORY.md except on your "remember X" or "forget X";
  • change its own rules. systems-retro may only write numbered proposals to learnings/PROPOSALS.md. You approve them with "approve N";
  • spend money on paid AI calls without telling you the rough cost first;
  • invent device state or credentials. When a step needs you (a console click, a device test), it stops and asks;
  • use dark patterns. The conversion agents refuse fake countdowns, hidden cancel flows, pre-checked upsells and misleading "free" labels.

Your part

  • Keep kappmaker-army doctor green, especially guard-hook.
  • Read diffs before you say "yes push". Read the release-manager message before "yes publish".
  • Use a separate Google Play service account and App Store API key with only the roles they need.
  • Watch your Claude usage. Always-on workers can use a lot.

Docs for the App Army kit. The Claude Code plugin has its own page.