Command line
Drive the running Bandicot app from Terminal with `bandicot rpc`, list every method, search past chats, apply setup files and read the exit codes.
Available now. A current user-facing path exists within the stated scope.
Where the command is
The bandicot command is inside the app, at /Applications/Bandicot.app/Contents/MacOS/bandicot.
Call it by that full path, or make an alias for it. A bandicot already on your PATH may be an older build without rpc. bandicot version prints the build, and bandicot --help prints every command.
| Command | What it does |
|---|---|
bandicot rpc <method> [json] | Calls one method on the running app and prints the result as JSON. |
bandicot methods [--pretty] | Lists every method with its params and its effect. Needs no running app. |
bandicot history search|read|sessions | Searches and reads this folder's past chats, even with the app closed. |
bandicot setup check|plan|apply|undo|export|receipts | Checks, previews, applies and undoes a setup file. |
bandicot brain context|recall|remember|forget | Reads and writes memory notes for the current folder; --global for every project. |
bandicot version | Prints the build version. |
Call the app with bandicot rpc
bandicot rpc <method> '<json params>' sends one call to the running Bandicot and prints its answer as JSON.
Bandicot must be open. Every method is listed by bandicot methods, with an effect: read looks, write changes Bandicot's state, spends starts model work, and outside reaches the network, a browser, the Mac or Team members. Anything but a read needs --yes, and so does reading a path outside the project.
A result that grants access prints its tokens redacted unless you pass --reveal. --events <s> keeps printing that connection's events for that many seconds after the answer.
--timeout and --events take seconds, and a decimal such as 2.5 is accepted. A number outside the range in the table, or a word, is a usage error (exit 2). If Bandicot is not up yet, rpc retries the connection for up to ten seconds before it gives up with exit 3.
- Open Bandicot.
- List what you can call:
bandicot methods --pretty. - Read something:
bandicot rpc session_list --pretty. - Change something only with
--yes, for examplebandicot rpc session_rename '{"session_id":"…","title":"Draft"}' --yes. - Read the state back with a read method to confirm the change.
| Option | Meaning |
|---|---|
--yes | Allows a call that is not a read, or a read outside the project. |
--pretty | Indents the JSON. |
--timeout <s> | Seconds to wait for the answer, from 0 to 86400; 30 by default. |
--events <s> | Keeps printing event frames for that many seconds, from 0 to 86400. |
--beta | Talks to Bandicot Beta instead of Bandicot. |
--channel <name> | Talks to another channel's app, such as production or beta. |
--socket <path> | Talks to one engine exactly. |
--reveal | Prints access tokens instead of redacting them. |
Exit codes
bandicot rpc exits 0 when the app answered, 1 when it refused, and 2 to 7 for problems before or around the call.
After exit 4 to 7, a call that is not a read may already have run. The message names a read method to check with: read the state before you call it again.
| Exit | Meaning | What to do |
|---|---|---|
0 | Answered. | Read the JSON on stdout. |
1 | The engine refused; {"error_code","error_message"} is on stderr. | Look the code up in Troubleshooting. |
2 | Usage error, or refused before sending (for example a write without --yes). | Fix the command. |
3 | Bandicot is not running. | Open Bandicot and try again. |
4 | No answer within --timeout. | Check with the read the message names before retrying. |
5 | The connection was lost before the answer. | Check with a read, then retry. |
6 | The answer was over 64 MiB. | Ask for less, for example a smaller page. |
7 | Failed on this side. | Read the message; retry once. |
If it goes wrong
Bandicot is not running; open it first- Open the app.
rpcwaits up to ten seconds for an app that is starting. … changes Bandicot's state; pass --yes to call it- Add
--yesif you meant to change it. no production app answers; these other engines do- Pick one with
--channelor--socket, as the message lists. Bandicot stayed busy until the timeout- The app was finishing a step. Raise
--timeoutor try again.
Search past chats with bandicot history
bandicot history search <query> searches this folder's conversations for the active profile and prints JSON; it works with the app closed.
bandicot history read <session-id> reads one conversation and bandicot history sessions [query] lists them. The project is the folder you run it in. It never asks the running app, so it cannot change which chat is open.
Errors are one JSON line on stderr with a code: exit 1 means refused and exit 2 means a usage problem, including invalid_args.
| Option | Used with | Meaning |
|---|---|---|
--session <id> | search | Search one conversation instead of the whole project. |
--tools | search | Also search tool calls and their output; secrets are masked. |
--regex | search | Treat the query as a regular expression without groups. |
--limit <n> | search, read | Results per page: 1 to 50 for search, 1 to 20 for read. |
--cursor <c> | search, read | Continue from the cursor the previous page printed. |
--around <message-id> | read | Centre the page on one message. |
--pretty | all | Indent the JSON. |
--profile <id> | all | Read another of your profiles instead of the active one. |
If it goes wrong
signed_out- Sign in to the app on this Mac, then run it again.
secrets_unavailable- Unlock the Keychain; past tool output cannot be masked without the saved keys.
no_such_session- Run it from the project folder the chat belongs to, with the right profile.
no_homeHOMEis unset or not an absolute path, so the conversations cannot be found. Run it from a normal shell.no_such_profile- No profile of yours has that id on this Mac. Check the id given to
--profile. invalid_cursor- The cursor is not from this search. Use the one the last page printed, or start again without
--cursor. invalid_args- Check
--limitis in range and the query is a valid expression without groups when you use--regex. This one exits 2. read_failed- Something could not be read; the message names the cause. Try again.
Apply a setup file from Terminal
bandicot setup plan FILE shows what a setup file would change, and bandicot setup apply FILE applies it after you consent.
In a terminal, apply asks for each key the file needs; pass --credential PROVIDER=stdin or env:NAME to supply one without typing it. Sensitive changes need --allow ID or --allow-sensitive after reviewing the plan. bandicot setup undo reverses the last apply, and bandicot setup export --out DIR writes your setup to a folder.
| Exit | Meaning |
|---|---|
0 | Done, or nothing to do. |
1 | Failed. |
2 | Invalid file or usage. |
3 | Consent missing for a sensitive change. |
4 | The machine changed since the plan, or the undo was refused. |
5 | The running app could not be reached. |
6 | A required key is missing. |
Options for bandicot setup
check validates a file, plan previews it, apply writes it, undo reverses an apply, export writes your setup out and receipts lists past applies.
check FILE validates the file alone and reads none of your settings. plan FILE prints each change with a mark (+ to create, ~ to change, - to remove) and flags the sensitive ones. apply FILE writes after consent. undo [RECEIPT] restores what an apply changed, the last one by default. export --out DIR writes a setup folder. receipts lists every apply on this Mac.
Every command takes --json for one JSON result instead of text. Keys are never read from arguments: a value for --credential must be stdin or env:NAME, so it never shows in a process list.
| Option | Used with | Meaning |
|---|---|---|
--json | all | Print JSON. |
--all | plan | Also list items that are already set. |
--yes, -y | apply | Do not ask; apply without the review questions. |
--allow <id> | apply | Consent to one sensitive change by its id. Repeat for more. |
--allow-sensitive | apply | Consent to every sensitive change, after you read the plan. |
--credential PROVIDER=stdin|env:NAME | apply | Supply a key from standard input or an environment variable. Repeat for more. |
--overwrite | plan, apply, undo | Change items you edited by hand since the last apply, or restore files that changed since the apply being undone. |
--prune | plan, apply | Remove items an earlier apply installed that the file no longer names; items you edited are kept. |
--out <dir> | export | The folder to write the setup file into. |
If it goes wrong
nothing applied; these sensitive changes need consent- Review the plan, then pass
--allow <id>for each listed change, or--allow-sensitivefor all. This exits 3. nothing undone; changed since the apply- Files changed after the apply. Pass
--overwriteto restore them anyway. This exits 4. --credential takes PROVIDER=stdin or PROVIDER=env:NAME- Give the source of the key, never the key itself.
Read and write memory with bandicot brain
bandicot brain runs the agent's memory tool from Terminal on the folder you are in, or on notes kept everywhere with --global.
context <query> finds the few notes that fit a question, recall [query] lists or searches notes, remember <name> <text> saves one and forget <name> deletes one. Put --global last to use the notes kept everywhere; for recall it may come right after the command. A name or query must not start with a dash.
It exits 0 when it worked, 1 when the memory tool refused (the message says why, for example a note that is too large or no note by that name), and 2 for a usage mistake such as a missing name or an unknown option. See Memory for where the notes live.
Questions
Can I script Bandicot?
Yes. bandicot rpc calls any of the app's methods from Terminal or another program and prints JSON.
Why does bandicot rpc ask for --yes?
Anything that changes state, spends model time or reaches outside Bandicot needs it, so a script cannot change things by accident.