~/.buttons/ by default. In a project initialized with buttons init, the active data directory is the closest .buttons/ folder in the current directory tree.
Each button gets its own subdirectory with a spec file, optional code file, agent context, and run history. Drawers get the same pattern for workflow specs and workflow history.
Directory layout
button.json
The spec file for a button. It describes the button type, arguments, runtime, and all other configuration. Newly created specs use"schema_version": 2.
drawer.json
The workflow spec for a drawer. It stores inputs, steps, refs, triggers, return values, and error handling.buttons.json and buttons-lock.json
buttons.json at the root of .buttons/ declares the desired project buttons and version policy.
buttons-lock.json records the exact resolved versions, sources, and content hashes. Commit it with buttons.json so teammates can recreate the same installed buttons.
history.json
history.json records local create, edit, install, update, delete, rollback, and failed resolution events. Commands write explicit events; file hooks can record manual edits to tracked button and drawer files.
In a team repo, commit buttons.json, buttons-lock.json, and authored button/drawer files. Do not commit history.json; it is a local runtime artifact.
When installed buttons are generated entirely from a registry, the repo can recreate them from the manifest and lock file. When a button is authored directly in the project, commit its folder under buttons/.
main.*
The script file for code buttons. The extension matches the runtime:main.sh for shell, main.py for Python, main.js for Node. HTTP and prompt-only buttons do not have a main.* file.
AGENT.md
Present on every button. For prompt buttons, contains the raw instruction text stored at create time via--prompt; when pressed, the contents are returned in the prompt field of the JSON output. For other button types, AGENT.md holds notes and context an agent can read to understand when and how to press the button.
pressed/
One JSON file per run, named by timestamp. Each file records the input arguments, exit code, stdout, stderr, duration, and whether the run succeeded.batteries.json
Batteries are key/value pairs injected into button presses asBUTTONS_BAT_<KEY>.
Project-local batteries live at .buttons/batteries.json. Global batteries live at ~/.buttons/batteries.json. Local values override global values on key collision.
webhook.json
Named webhook setup stores Cloudflare tunnel configuration inwebhook.json. It is machine-specific and should not be committed.
idempotency/
Successful presses with--idempotency-key are cached here until their TTL expires.
queues/
Buttons with aqueue declaration use file locks here to enforce concurrency limits.
Overriding the home directory
SetBUTTONS_HOME to use a different base directory:
The
~/.buttons/ directory and all files inside it are created with mode 0700 / 0600. Other users on the same system cannot read button specs or run history.Related
- button.json — button spec fields
- drawer.json — workflow spec fields
- History — local audit history
- JSON output — the shape of history records
- Code buttons — how
main.*is populated from scaffolded or imported scripts