Skip to content
Releases

Use Flint with an AI agent

A coding agent (Claude Code, Codex, or any tool that can run a command) can use the same vault you use in the app. It reaches a server by its alias with flint exec, Flint logs in, and the agent gets the output and the exit code. Passwords, keys and passphrases stay inside Flint: no command prints them, so they never reach the agent’s prompt, transcript or context.

Terminal window
flint --json exec web-01 -- 'systemctl is-active nginx'
{"host":"web-01","exit_code":0,"signal":"","stdout":"active\n","stderr":"","duration_ms":187}

The agent runs flint as you, on your machine. It never opens the vault itself: every command goes through the Flint app, which holds the vault unlocked (how).

  1. Open Flint and unlock the vault. Keep it open while the agent works.

  2. Check that a command runs without a prompt:

    Terminal window
    flint vault status
    flint --json host list
  3. Trust each server’s host key yourself before the agent uses it, with flint host test <alias> or a first flint connect. An agent has no terminal to answer the host key question, so an unknown key stops it with host_key.

The first time the agent runs flint, Flint asks you in its own window (Approve a program). The command waits while you decide, for as long as the approval wait (2 minutes by default).

When the vault locks (idle time, screen lock, sleep) or Flint is closed, the agent’s next command waits: Flint’s window, started if needed, asks you for the master password and names the command that asked. Unlock within the approval wait (with Allow … for 1 hour ticked, the agent is approved in the same step) and the command goes on and runs. Only if nobody unlocks in time does it fail with locked. Settings → Vault → Lock after sets the idle time (1 hour by default).

Closing Flint’s window does not stop the agent: Flint stays in the menu bar or system tray and keeps serving what you approved, with its window locked until Touch ID, polkit or the master password opens it (the window’s own lock). A new request waits for you to open the window and answer.

Flint answers no flint command until you approve the program behind it. The window names it after the program that started flint, skipping shells: “flint, started by Claude Code”, “flint, started by tmux”. It shows the chain of processes and the exact command, and lets you choose:

Hosts The host the command runs on, its group, or the whole vault
Actions Read (list and show; never a secret), Run commands (exec, connect, host test and cp on the hosts chosen), Change the vault (add, edit, remove; needs the whole vault)
Duration 15 minutes, 1 hour, 4 hours, or until the vault locks

Allow asks you to prove you are at the machine: Touch ID or your Mac’s password on macOS, your login password through polkit on Linux, or the vault’s master password where neither is available. Deny refuses the command, and so does no answer within the approval wait.

The grant covers every flint that program starts until it expires, the vault locks or Flint quits; it is tied to that process, so another program, or the same one started again, asks again. Settings → Access lists the grants, and Revoke ends one now. The status bar counts them (Agents: N), and shows N waiting while a request waits behind another app.

Settings → Notifications → Approval wait sets how long a command waits for you: 2 (the default), 5, 10 or 30 minutes. It is one value for every approval window (a grant, a root command, a token, a copy, a tunnel) and for a command waiting for you to unlock the vault. A command that waits through an unlock and then needs an approval waits again for it, so the longest a command can wait is twice the setting. Away from the desk for a meeting, a longer wait lets the agent’s command still be there when you come back.

The command says it is waiting on stderr (Waiting for approval in Flint (…), up to 10 min…) and keeps waiting while Flint does, so flint itself never gives up first. The agent’s own tool may: many agent tools stop a command after a few minutes. An agent that needs to wait longer than its tool allows runs flint in the background and checks on it:

Terminal window
flint --json exec web-01 -- 'systemctl restart app' >/tmp/flint-out.json 2>/tmp/flint-err.json &
echo $! >/tmp/flint.pid
# later, as often as needed:
kill -0 "$(cat /tmp/flint.pid)" 2>/dev/null && echo waiting || cat /tmp/flint-out.json /tmp/flint-err.json

With 30 minutes, Settings reminds you of this: the program must be able to wait that long.

Away from the desk, Flint can tell your phone that a command waits, with a content-free alert through ntfy: Alerts on your phone.

While a grant lasts, each command it allows shows in a notice in Flint’s window, one per grant, updated in place: Claude Code ran 10 commands on db1, nas. The notice names the program and the hosts, never the command, so nothing secret in a command shows on a shared screen. It stays while a command runs and hides about 10 seconds after the last one ends (pointing at it keeps it), then comes back with the next.

  • View lists that grant’s commands, newest first, and keeps filling while it is open: the time, the host, the command, how long it took and how it ended: running…, exit 0, exit 1, or refused with sudo’s reason (not a sudoer, sudo password refused). Open a row for the exact command and Copy.
  • Stop asks once, in the notice (Stop this grant? Claude Code can’t run more on db1.), then revokes the grant. A command already running finishes; the next one asks again.

A root period’s notice says as root and its time left, and stays until the period ends. Notices are on for every new grant by default. Untick Notify me of each command in the approval window for one grant, turn the default off with Notify me of commands run under a grant in Settings → Access, or use a grant’s bell there to turn its notices off or on at any time. Notices are cleared when the vault locks, which also ends every grant.

Flint’s CLI carries its own manual for agents. flint --help names it, and flint agent-guide prints it in Markdown: how to work with Flint (status first, wait for your approval and never retry in a loop, never ask you for a password), then every command, flag and exit code, generated from the CLI’s own command table. It always matches the installed flint, so it never goes stale. Read it as The agent guide.

To have an agent read it from the start, paste this into your project’s CLAUDE.md, AGENTS.md or the agent’s instructions:

## Servers
This machine reaches servers through Flint. Run `flint agent-guide` before the first
`flint` command and follow it. Never ask for, read or use SSH passwords, keys or `ssh`
directly.

The guide ends by asking the agent to offer you a skill made from it. If you agree, the agent writes the skill in its own format, with a short summary and a pointer back to flint agent-guide, so the skill survives Flint’s updates. Flint itself writes nothing in your agents’ folders.

Command What it gives the agent
flint --json host list Every host: alias, hostname, user, group, tags. No secret
flint --json host show <alias> One host, with has_password instead of the password
flint --json exec <alias> -- '<cmd>' {host, exit_code, signal, stdout, stderr, duration_ms}
flint --json exec <alias> --sudo -- <cmd> [args] The same, run as root once you allow that exact command in Flint, or inside a root period you gave
flint --json cp [-r] <src> <dst> Copies a file or folder to or from a host, or between two: {host, to_host, direction, files, folders, bytes, skipped, duration_ms}
flint --json tunnel ls / tunnel status The saved tunnels, or the running ones, with listen (127.0.0.1:<port>) and state
flint --json tunnel up|down <host>:<name> Starts or stops a saved tunnel in Flint; it keeps running after the command returns
flint --json known-host list The server keys Flint has recorded

Everything after -- is joined with spaces and parsed by the remote shell, like ssh. Quote the remote command as one word, or the local shell splits it first:

Terminal window
flint exec web-01 -- 'cd /var/log && tail -n 50 syslog' # one remote command
flint exec web-01 -- sh -c 'echo $HOME' # the remote shell sees: sh -c echo $HOME

The second line is a common trap: the quotes are gone by the time the remote shell reads the line, so sh -c gets only echo. Quote the whole thing instead: flint exec web-01 -- 'sh -c "echo \$HOME"', or just flint exec web-01 -- 'echo $HOME'.

flint exec closes the command’s stdin and gives it no terminal, so a program that waits for input (a password prompt, a “continue? [y/N]”) gets none. Prefer non-interactive flags (apt-get -y, --no-pager).

With --json, a Flint error is one JSON object on stderr and nothing on stdout; a remote command’s own failure comes as the usual object on stdout with its exit_code.

Exit Code What the agent should do
5 locked Nobody unlocked the vault within the approval wait, or Flint could not start. flint vault unlock waits for it; then retry once. flint vault status says why it is locked
11 host_key Stop. The key is unknown, or it changed, which Flint always refuses
12 auth Report it: the server refused every login method in the vault
13 network The host is unreachable: VPN, address, firewall
14 timeout The command ran past --exec-timeout
15 denied You denied it in Flint, or the grant does not cover it. Ask before retrying
16 approval_timeout Nobody answered Flint’s window within the approval wait. One retry is fair, then ask
17 not_sudoer The host’s login user may not use sudo
18 sudo_password sudo refused the password Flint typed, or Flint has none for that host
19 permission_denied cp: the host’s user may not read or write there
20 exists cp: the file is already there. Ask before --force
21 not_a_directory cp: a path that must be a folder is a file
22 port_in_use tunnel up: another program holds that local port

The full list is in the CLI reference.

A plain flint exec cannot answer a sudo password prompt: there is no terminal for it, and Flint never hands a password to the caller. flint exec --sudo runs one command as root instead:

Terminal window
flint exec web-01 --sudo -- systemctl restart nginx
  1. Flint’s window shows the program that asks, the host, the login user and the exact arguments, one per chip. No grant or token covers it: every --sudo command is asked for, and confirmed with Touch ID, polkit or the master password, unless you gave that program a few minutes of root on that host.
  2. Flint runs sudo -S -k -p <random prompt> -- <arguments> on the host, each argument quoted as one word: the arguments are never parsed by a shell. For pipes or redirections the agent passes them on purpose, and you see them: --sudo -- sh -c 'journalctl -u nginx | tail -n 50'.
  3. Flint types the sudo password only when sudo prints that random prompt, so a command that prints a fake password: gets nothing. The prompt and the password never reach the agent’s output. -k leaves no cached sudo session behind for later commands.

The password is the host’s sudo password if you set one (flint host edit <alias> --sudo-password, or the host editor), else its login password. When Flint has neither, the window asks for it, for that command, with Save it for this host.

--sudo runs only through Flint: with Flint closed or the vault locked it fails with locked, even for a person who could type the master password. The command gets no terminal and its stdin is closed once sudo has the password, as with flint exec. Every decision is in the activity log, with the full command.

If a host lets its login user run sudo with no password (NOPASSWD), or logs in as root, a plain flint exec gets root there with no window. Keep agents away from such hosts, or remove that rule.

Setting up a server, an agent may run ten commands as root you already agreed to, and approving each one with Touch ID gets in the way. Turn on Allow sudo for a while in Settings → Access (it is off by default). The root approval window then offers Allow for: Each command · 2 min · 5 min · 15 min.

Picking a period shows a warning every time, Claude Code and everything it starts can run commands as root on db1 for 5 min without asking you, and the button becomes Allow root for 5 min. You confirm once, with Touch ID, polkit or the master password. Then, until the period ends:

  • flint exec db1 --sudo -- … from that program (and everything it starts) runs with no window, on that one host only. A period never covers a group or the whole vault.
  • Each command shows in the period’s notice, Claude Code ran 3 commands as root on db1, with its time left. The notice stays while the period lasts; View lists the commands, Stop ends the period. Notices are always on for root.
  • Everything else still asks: a plain flint exec, --sudo on another host, and any other program. An exec grant never covers root and a period covers nothing but root.
  • Flint still types the sudo password per command and keeps sudo -k, so the server never holds a sudo session: the period is Flint’s alone. When Flint has no saved password for the host, the one you type in the window is kept in memory for the period only, unless you tick Save it for this host.

The period counts from your approval, and covers commands that start inside it: one already running is never cut, which is why the shortest is 2 minutes, not 1. It is listed in Settings → Access → Active grants with a Root badge and its time left, and Revoke ends it. Turning Allow sudo for a while off ends every period at once; locking the vault or quitting Flint ends them too.

An approved program can run any command on the hosts you allowed, as each host’s login user. It cannot take a password or key away, but a command can, for example, add a key to ~/.ssh/authorized_keys. Ways to narrow it:

  • Allow one host or one group, not the whole vault, and only Run commands when the agent does not need to change the vault.
  • A short grant: 15 minutes, or until the vault locks, with a short Settings → Vault → Lock after.
  • A vault for agents. Put only the hosts an agent may use in a vault of its own, keep that vault open in Flint while the agent works, and have the agent pass --vault. Flint holds one vault at a time, so your main vault stays locked meanwhile.
  • Limit the server side. Agents log in as a user without NOPASSWD sudo and not as root, with access only to what they need.
  • Watch the transcript. Every remote command an agent runs is in its own flint exec line.
  • Keep the notices on (See what a grant runs): every command a grant allows shows in Flint’s window while it runs, with Stop at hand.
  • Read the activity log in Settings → Access: every command a program ran or changed through Flint, and every request refused or left to time out, newest first, with how each one ended (its exit status and how long it took). Commands run as root carry a root badge. Click an entry, or press Enter on it, for the whole command (up to 16 KB) with the exact time and the full caller chain. Entries are kept 90 days unless you choose 30 days, 1 year or no limit there. Each computer keeps its own log, encrypted and outside the vault, so it never syncs; Back up activity… copies it as it is.
  • Read the whole command before you allow it. A long flint exec shows its first line in the approval window with Show full command; what it shows is read from the arguments Flint will run.

A cron job, a launchd agent or a CI runner on this machine has nobody at a terminal and no Flint window to wait on: every run is a new process, so a grant would be asked for each time. Give it a token instead:

Terminal window
flint token create --name nightly-backup --allow exec --hosts nas,@homelab --ttl 30d

Flint shows the request in its window, the token’s name, what it allows, which hosts and for how long, and creates it only once you allow it, with Touch ID or your password. It asks every time: no grant covers token create, so an agent you approved for an hour cannot mint itself a token that lasts a month. The token is printed once, alone on stdout:

Terminal window
FLINT_TOKEN=$(flint token create --name ci --allow read) # keep it in the job's secret store

The job passes it in the FLINT_TOKEN environment variable, never as an argument (it would show in ps):

Terminal window
FLINT_TOKEN=flint_… flint exec nas -- /usr/local/bin/backup.sh

With a token, Flint decides on the token alone and never opens a window: a request it covers runs; anything else fails at once with denied (15), saying why (outside its hosts, revoked, expired). A token never unlocks the vault, so Flint must be running with it unlocked, and it never creates another token.

Flag Meaning
--name What token list, token revoke and the activity log call it
--allow read, exec, write, comma-separated. write needs --all
--hosts Host aliases and @group paths (with their subgroups). Not needed for read alone
--all The whole vault
--ttl 15m, 1h, 4h, 1d (the default), 7d, 30d, 90d. There is no “never”

flint token list shows every token with its status; flint token revoke <name|id>, or Revoke in Settings → Access, ends one at once. Flint keeps only a hash of the token’s secret, inside the encrypted vault. See the CLI reference.