Get started
An evening for the server and the rules, half an hour per phone. The full procedure, with every detail, is in docs/PROVISIONING.md; every server setting is in the README.
What you need
- An Android phone you can factory reset, Android 13 or newer. Android only lets an app become device owner on a phone with no account yet, so the setup starts from a reset. Back up whatever is on it first.
- A small server that the phone can reach over HTTPS: a home server with Docker, a VPS, or a Kubernetes cluster. The server is one Rust binary with a SQLite file; it needs very little. Put it behind a reverse proxy that terminates HTTPS and sets
X-Forwarded-For(or Cloudflare'sCF-Connecting-IP): the abuse protection counts per client address. - A git repository for the rules, on any host. Private is a good idea: it holds your children's schedules. If you want Claude to change rules, the server needs to push to it over ssh with a deploy key, so a dedicated repo for the rules is the tidiest.
- A computer with a USB cable and
adb(Android platform tools), the Rust toolchain (for thekidctlcommand), and JDK 21 with the Android SDK to build the agent. - A signing key for the agent, kept forever (see below).
- Optional: a Claude account (claude.ai or Claude Code), and an Android developer verification registration for the agent (why).
The agent's signing key
Android only updates a device-owner app with an APK signed by the same key. Lose it and the only way to update the agent is a factory reset. Create it once, back it up with its password:
mkdir -p ~/.config/kidctl && chmod 700 ~/.config/kidctl
keytool -genkeypair -keystore ~/.config/kidctl/kidctl-release.jks -storetype PKCS12 \
-alias kidctl -keyalg RSA -keysize 4096 -validity 10000 -dname CN=kidctl
and tell the build where it is, in ~/.config/kidctl/signing.properties (mode 600; storeFile is an absolute path, and with PKCS12 both passwords are the same):
storeFile=<your home directory>/.config/kidctl/kidctl-release.jks
storePassword=<the password>
keyAlias=kidctl
keyPassword=<the password>
Without this file the agent is signed with your computer's debug key, which then has to stay the same forever.
1. Write the rules
One directory, one file per child, plus the list of phones:
policies/
├── alex.yaml # Alex's rules
├── alex.overrides.yaml # temporary exceptions (overrides: [] when there are none)
└── devices.yaml # phones allowed to sync, and whose they are
Start small, you can tighten later:
child: alex
timezone: Europe/Paris
downtime:
- {start: "21:00", end: "07:00"}
always_allowed: [com.google.android.dialer]
limits:
- name: everything
apps: ["*"]
daily: {weekdays: 1h30m, weekend: 3h}
notify: {} # heads-up at 50/80/95 % and 5 min before downtime, in French; locale: en for English
Create the overrides file even if it is empty: Claude adds exceptions to it but never creates files.
overrides: []
Create a token for the phone. The raw token goes to the phone only; git gets its hash:
kidctl token
# token: <64 hex characters, keep it for the phone>
# token_sha256: <64 hex characters, goes into devices.yaml>
devices:
- {id: alex-phone, child: alex, token_sha256: <token_sha256>}
Check before every push:
kidctl validate policies/
# ok: 1 children (alex), 1 devices
2. Run the server
The image is built from the repository and runs as the unprivileged user 65532. It reads the rules from /etc/kidctl and keeps its state in /data: the usage database, agent releases, OAuth clients and tokens (hashed), and its clone of your repo for Claude's changes.
With Docker
git clone https://github.com/kidctl/kidctl && cd kidctl
docker build -t kidctl .
sudo install -d -o 65532 -g 65532 -m 0750 /srv/kidctl/data
docker run -d --name kidctl --restart unless-stopped -p 127.0.0.1:8080:8080 \
-v /srv/kidctl/policies:/etc/kidctl:ro \
-v /srv/kidctl/data:/data \
kidctl
curl -s http://127.0.0.1:8080/healthz # ok
Point your HTTPS reverse proxy at port 8080, for example as https://kidctl.example.net. Keep /srv/kidctl/policies a clone of your repo's rules directory, with a git pull every minute from a timer.
With Kubernetes
Let Argo CD or Flux generate a ConfigMap from the rules directory, with a stable name so that an edit updates the mounted files instead of restarting the pod:
# kustomization.yaml, next to policies/
configMapGenerator:
- name: kidctl-policies
files:
- policies/alex.yaml
- policies/alex.overrides.yaml
- policies/devices.yaml
options: {disableNameSuffixHash: true}
Run one replica with the Recreate strategy (one SQLite writer), mount the ConfigMap as a directory at /etc/kidctl (no subPath, or updates don't propagate) and a persistent volume at /data, with runAsUser/fsGroup 65532, a read-only root filesystem, and /healthz for the probes. A 128 MiB memory limit is plenty. The repository has all of it ready to copy into your GitOps repo: deploy/k8s (kustomization, Deployment, Service, volume and example rules), and deploy.sh builds the image, pushes it to your registry and bumps its tag there.
Either way, the server reloads the rules directory within seconds of a change. An invalid push never reaches the phones: the server logs the errors and keeps the last valid rules.
KIDCTL_ | rules directory (default /etc/kidctl) |
|---|---|
KIDCTL_ | usage database (default /data/kidctl.db) |
KIDCTL_ | address and port (default 0.0.0.0:8080) |
KIDCTL_ | agent releases offered for self-update (default /data/agent) |
KIDCTL_ | optional: Host headers accepted on the MCP, e.g. kidctl.example.net |
3. Set up the phone
- Factory reset. In the setup wizard, join Wi-Fi but skip the Google account. Finish setup.
- Settings › About phone › tap Build number seven times, then Developer options › USB debugging on. Plug the phone in and accept the prompt.
- From the kidctl repository:
It builds the agent signed with your key, installs it, makes it device owner, grants it usage access, gives it the server address and token, then deletes the token file from the phone. After its second sync the phone shows up asscripts/provision.sh alex-phone https://kidctl.example.net alex-phone.tokenpolicy up to date(Claude'slist_children). - Now add the child's Google account and install their apps. Ask Claude (or the server) for the package names of what's installed, and list them in the rules. With
approval: true, anything not listed stays paused. - For DNS filtering, install and sign in to your VPN app, then add
always_on_vpn,private_dns, and the VPN app inuninstall_blockedanduser_control_disabled(so it can't be stopped from Quick Settings), plus its managed configuration inapp_configif it has one. - Tighten last. Add the restrictions you want (
no_factory_reset,no_safe_boot,no_config_date_time,no_modify_accounts…), andno_debugging_featuresat the very end: it turns USB debugging off for good. From then on the agent updates itself from your server.
Play Protect checks every install on a phone with Google Play, the agent's own updates included. On a real phone with scanning on, the agent's updates installed silently, with its package and key registered for Android developer verification. If an update ever stops at an “App blocked” dialog, see the FAQ.
4. Connect Claude
The MCP endpoint, /mcp, is protected by OAuth: the server is its own authorization server, and you sign in with an owner password that only you know. Hash it (at least 12 characters, read from the terminal so it stays out of your shell history):
read -rs P && printf '%s' "$P" | kidctl hash-password > kidctl.hash; unset P
Give the server three settings and restart it:
KIDCTL_ | the content of kidctl.hash; environment only (a Kubernetes Secret, or a Docker --env-file with mode 600), never in git |
|---|---|
KIDCTL_ | the server's public origin, https://kidctl.example.net |
KIDCTL_ | where OAuth clients and tokens are kept (hashed), on the persistent volume: /data/oauth |
Check: curl -si -X POST https://kidctl.example.net/mcp | grep -i www-authenticate answers with a resource_metadata URL. Then add the server:
- claude.ai: Settings › Connectors › Add custom connector, URL
https://kidctl.example.net/mcp, sign in with the owner password, Allow. - Claude Code:
claude mcp add --transport http kidctl https://kidctl.example.net/mcp, then/mcp› kidctl › Authenticate.
Ask: “What's Alex's status right now?” The read tools are list_children, status, usage, apps, policy, events and validate. To log every client out, delete oauth-tokens.json in the state directory and restart. KIDCTL_CIMD_ALLOWLIST and KIDCTL_REDIRECT_PATTERNS restrict which clients may connect (see the README).
5. Let Claude change the rules (optional)
With a few more settings, Claude connected over OAuth can also change the rules, and every change is a commit pushed to your repo. The server needs an ssh deploy key with write access to the rules repo:
ssh-keygen -t ed25519 -N '' -C kidctl-mcp -f kidctl-gitops
gh repo deploy-key add kidctl-gitops.pub --repo you/family-rules --title "kidctl MCP" --allow-write
ssh-keyscan -t ed25519,ecdsa,rsa github.com > known_hosts
ssh-keygen -lf known_hosts # compare with the fingerprints your git host publishes
A deploy key opens one repo, but all of it, not one directory: if the repo holds more than the rules (say, your whole cluster's configuration), the key can push to all of it. Hence a dedicated repo for the rules. Branch protection that requires pull requests refuses the server's pushes.
KIDCTL_ | git@github.com:you/family-rules.git (ssh only) |
|---|---|
KIDCTL_ | the branch to commit to (default main) |
KIDCTL_ | the rules directory inside the repo, e.g. policies |
KIDCTL_ | the private key file, mounted read-only (on Kubernetes: a Secret, defaultMode: 0440 with fsGroup: 65532) |
KIDCTL_ | the pinned host keys (no trust on first use) |
KIDCTL_ | commit author, e.g. kidctl MCP <kidctl-mcp@example.org> |
Restart, check the log for gitops: … branch main at <sha>, reconnect the connector so the new tools are listed, and ask for a dry run: “Block com.example.test for Alex, dry run.” The answer shows the diff and dry run, valid, nothing committed. A real change appears as a kidctl-mcp: … commit with a Requested-By: line, and reaches the phone the same way as your own pushes. The write tools are listed in the rule summary.
6. Update the agent
Over the air, no cable, with USB debugging off. From the kidctl repository, with your signing key in place:
scripts/release-agent.sh you@server:/srv/kidctl/data/agent # over ssh (with sudo), or a local directory
git commit -m "agent: release versionCode N" agent/version.properties
The script builds the next version, checks that it is signed with your key, and publishes it in the server's agent directory. Each phone downloads it at its next sync, checks its SHA-256, and installs it itself. Claude's list_children shows the release offered and each phone's version; events shows the download and the update, or why it failed. Delete agent.json in that directory to withdraw a release.