# Agent instructions Source: https://docs.buttons.sh/ai/agent-instructions How buttons init writes managed instruction blocks into CLAUDE.md, AGENTS.md, and other coding-agent files — and how the project button list stays current. Buttons keeps two kinds of **managed markdown blocks** in your project's coding-agent files so any agent that opens the repo knows Buttons exists and what buttons are available. Both are written in place, wrapped in HTML-comment markers, and refreshed by the CLI — hand-edits *between* the markers are overwritten. This is distinct from the hosted [skill.md](/ai/skill-md) (`npx skills add`): that installs a capability summary fetched from a URL; the blocks below are written **locally into your repo** by `buttons init` and by button mutations. ## 1. The instruction block — `buttons init --agent` `buttons init --agent ` writes a Buttons instruction section into the file each coding agent reads, wrapped in `` / `` markers. Re-running `init` finds those markers and replaces the section in place, so your other content is never clobbered. ```bash theme={null} buttons init --agent claude,agents-md # non-interactive selection buttons init --agent none # skip the picker buttons init # interactive picker on a TTY ``` Each target maps to the file that tool actually reads: | Target (`--agent`) | File written | How | | ------------------ | --------------------------------- | ------------------------------------------------------------ | | `cursor` | `.cursor/rules/buttons.mdc` | Standalone MDC rule file (frontmatter + body), written whole | | `claude` | `CLAUDE.md` | `BUTTONS:START/END` section appended/updated in place | | `cline` | `.clinerules` | `BUTTONS:START/END` section | | `copilot` | `.github/copilot-instructions.md` | `BUTTONS:START/END` section | | `agents-md` | `AGENTS.md` | `BUTTONS:START/END` section (cross-agent convention) | | `openclaw` | `AGENTS.md` | `BUTTONS:START/END` section | | `hermes` | `AGENTS.md` | `BUTTONS:START/END` section | Cursor is the exception: its `.mdc` file is standalone and rewritten whole. Every other target shares the `BUTTONS:START/END` contract, so the block is idempotent — safe to re-run and safe to sit next to your own instructions in the same file. `buttons init` also always writes a `.buttons/AGENTS.md` reference guide (Buttons' own onboarding doc for the folder) and a `.buttons/.gitignore`. That reference file belongs to Buttons and is overwritten on every `init`. ## 2. The button list — `## Buttons in this project` Inside a project-local git repo, Buttons keeps a live list of the project's buttons in the repo-root `AGENTS.md`, wrapped in `` / `` markers. It's refreshed automatically after every button mutation — `buttons create`, `buttons delete`, `buttons add`, and `buttons import` — so an agent reading `AGENTS.md` always sees the current set without running a command first. ```markdown theme={null} ## Buttons in this project - `buttons press deploy` — Deploy a tagged release - `buttons press summarize-pr` — Summarize an open PR ``` Two behaviors worth knowing: * **Press-ranked.** Buttons are ordered most-pressed-first (ties broken alphabetically for stable diffs), so the buttons an agent actually uses float to the top. * **Capped at 20.** The 20 most-pressed buttons render with their descriptions; any beyond that collapse to a single comma-separated line pointing at `buttons list` for the full set. This keeps `AGENTS.md` scannable in workspaces with hundreds of buttons. The refresh is best-effort and only runs for **project-local** buttons inside a **git repo** — it never fails the command that triggered it. As with the instruction block, don't hand-edit between the `BUTTONS:LIST` markers: the next mutation regenerates the block. ## Related * [buttons init](/cli/buttons_init) — create the `.buttons/` dir and install instruction blocks * [skill.md](/ai/skill-md) — the hosted `npx skills add` capability summary (a different mechanism) * [Folder structure](/concepts/folder-structure) — where `.buttons/AGENTS.md` and per-button `AGENTS.md` live # llms.txt Source: https://docs.buttons.sh/ai/llms-txt Auto-generated documentation index for LLMs and AI agents. Mintlify automatically generates and hosts two files that help AI tools index your documentation: * **`llms.txt`** — a structured index listing every page with its title, URL, and description * **`llms-full.txt`** — your entire documentation site combined into a single file Both are always up to date and require zero maintenance. They update every time you deploy. ## Where to find them | File | URL | Purpose | | --------------- | -------------------------------------------- | -------------------------------------- | | `llms.txt` | `https://buttons.mintlify.app/llms.txt` | Page index with links and descriptions | | `llms-full.txt` | `https://buttons.mintlify.app/llms-full.txt` | Full content of every page in one file | Both are also available at `/.well-known/llms.txt` and `/.well-known/llms-full.txt` for tools that follow the `.well-known` convention. Mintlify adds HTTP headers to every page response so AI tools can discover these files automatically: ``` Link: ; rel="llms-txt", ; rel="llms-full-txt" X-Llms-Txt: /llms.txt ``` ## What llms.txt looks like A plain Markdown file with your site title, description, and a link to every page: ```markdown theme={null} # Buttons > Deterministic workflow engine for AI agents. ## Docs - [Installation](https://buttons.mintlify.app/installation.md): Install Buttons via curl, Docker, Go, or Homebrew. - [Quick start](https://buttons.mintlify.app/quickstart.md): Create and press your first button in 30 seconds. - [Code buttons](https://buttons.mintlify.app/buttons/code.md): Run inline shell, Python, or Node scripts as buttons. ... ``` Page links include a `.md` extension so AI tools can fetch the Markdown version of each page directly. Descriptions come from each page's `description` frontmatter field. ## When agents use llms.txt * **RAG pipelines** — fetch `llms.txt`, extract URLs, embed each page for vector search * **Agent discovery** — check `llms.txt` to learn what documentation exists before deciding what to read in full * **Generative search engines** — Perplexity, ChatGPT, Claude, and similar tools use `llms.txt` to index docs * **`llms-full.txt` for full context** — agents with large context windows can load the entire docs site in one fetch ## llms.txt vs MCP vs SKILL.md | | llms.txt | [MCP server](/ai/mcp-server) | [SKILL.md](https://github.com/autonoco/buttons/blob/main/.agents/skills/buttons/SKILL.md) | | --------------------- | --------------------------------------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------- | | **Format** | Text index with page URLs | Real-time search API | Full CLI reference in one file | | **How agents use it** | Fetch once, discover pages, then fetch individually | Search on demand during conversation | Load into context at session start | | **Best for** | RAG, embedding pipelines, generative search | Interactive sessions (Claude Code, Cursor) | Offline agents, CI pipelines | | **Stays current** | Updated on every deploy | Updated on every deploy | Regenerated by the docs-sync workflow (`go run ./internal/tools/skillgen`) | | **Network** | One-time fetch + per-page | Per-query | None (file is in the repo) | ## Custom override To replace the auto-generated `llms.txt` with a custom version, add an `llms.txt` file to the root of your docs project. Mintlify uses your custom file instead. Delete it to restore the auto-generated version. # Connect via MCP Source: https://docs.buttons.sh/ai/mcp-server Search Buttons documentation from Claude, Cursor, VS Code, and other AI tools. Mintlify generates a hosted MCP server from these docs. Connect it to your AI tools so they can search Buttons documentation and retrieve full page content directly — no browser, no copy-paste. The MCP server exposes two tools: * **Search** — find relevant docs pages by query * **Get page** — retrieve the full content of a specific page by path Your AI tool decides when to use these tools based on the conversation context. If you ask about creating an HTTP button, it searches the docs and pulls the relevant page automatically. This is the **docs-search** MCP server — it lets an agent read these documentation pages. It is **not** the same as running Buttons *as* an MCP server. To expose your own buttons to an agent as deterministic, pressable tools, run [`buttons mcp`](/buttons/mcp) (only buttons marked `"mcp_enabled": true` are listed/pressable). ## Connect to your AI tool Add the Buttons docs MCP server to Claude Code: ```bash theme={null} claude mcp add --transport http buttons-docs https://buttons.mintlify.app/mcp ``` Verify: ```bash theme={null} claude mcp list ``` Now ask Claude Code about Buttons and it can search these docs during response generation. Go to [Connectors](https://claude.ai/settings/connectors) in your Claude settings. Select **Add custom connector** and enter: * **Name:** `Buttons` * **URL:** `https://buttons.mintlify.app/mcp` Select the attachments button (plus icon) in any conversation, then select the Buttons connector. Claude searches these docs to answer your questions. Press `Cmd+Shift+P` (Mac) or `Ctrl+Shift+P` (Windows/Linux), search for "Open MCP settings", and select **Add custom MCP**. In `mcp.json`: ```json theme={null} { "mcpServers": { "buttons-docs": { "url": "https://buttons.mintlify.app/mcp" } } } ``` In Cursor's chat, ask "How do I create an HTTP button with Buttons CLI?" — Cursor should search these docs and return an accurate answer. Create `.vscode/mcp.json` in your project: ```json theme={null} { "servers": { "buttons-docs": { "type": "http", "url": "https://buttons.mintlify.app/mcp" } } } ``` ## Quick install from any docs page Select any text on this docs site and use the contextual menu to: * **Copy MCP server URL** — paste into your tool's MCP configuration * **Connect to Cursor** — one-click install into Cursor * **Connect to VS Code** — one-click install into VS Code ## MCP + skill.md MCP and the [skill.md](/ai/skill-md) capability file serve complementary roles: | | MCP server | skill.md | | ------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------- | | **What it provides** | Real-time search across all docs pages | Full CLI reference in one file | | **How the agent uses it** | Searches on demand during conversation | Loaded into context at session start | | **Stays current** | Auto-indexed on every docs deployment | Auto-generated from the Cobra command tree (`go run ./internal/tools/skillgen`) | | **Best for** | Deep questions, discovering pages, getting full page content | Quick reference, offline use, CI agents without network | Use both: load `skill.md` for baseline context, connect the MCP server for deep dives. The MCP server URL above uses `buttons.mintlify.app`. If you're self-hosting or using a custom domain, replace with your actual docs URL followed by `/mcp`. # skill.md Source: https://docs.buttons.sh/ai/skill-md Install the Buttons agent skill into Claude Code, Cursor, and other AI tools. `skill.md` is a machine-readable file that tells AI agents what your product can do, what inputs it needs, and what constraints apply. While [llms.txt](/ai/llms-txt) is a documentation index and [MCP](/ai/mcp-server) is a search API, `skill.md` is a **capability summary** — the agent loads it once and knows how to use Buttons. ## Install the Buttons skill ```bash theme={null} npx skills add https://buttons.mintlify.app ``` This fetches the Buttons skill from the hosted discovery endpoint and installs it into your agent's skill directory. The skill includes every command, flag, the JSON output contract, argument types, and common usage patterns — all auto-generated from the Cobra command tree. ## Discovery endpoints Mintlify hosts the skill at two standard endpoints: | Endpoint | URL | | ------------------------------------ | ------------------------------------------------------------------------ | | **Agent-skills 0.2.0** (recommended) | `https://buttons.mintlify.app/.well-known/agent-skills/index.json` | | **Individual skill** | `https://buttons.mintlify.app/.well-known/agent-skills/buttons/SKILL.md` | | **Legacy format** | `https://buttons.mintlify.app/.well-known/skills/index.json` | The agent-skills endpoint includes SHA256 integrity verification so tools can verify the skill hasn't been tampered with. ## Manual installation If you prefer to install the skill manually instead of using `npx skills add`: The Buttons skill is already in the repo at `.agents/skills/buttons/SKILL.md`. Claude Code picks it up automatically when working in the Buttons repo. For other repos, copy the skill: ```bash theme={null} mkdir -p .agents/skills/buttons curl -fsSL https://buttons.mintlify.app/.well-known/agent-skills/buttons/SKILL.md \ -o .agents/skills/buttons/SKILL.md ``` Download the skill file and place it where your agent reads skills: ```bash theme={null} curl -fsSL https://buttons.mintlify.app/.well-known/agent-skills/buttons/SKILL.md \ -o SKILL.md ``` Then reference it in your agent's configuration. ## What the skill contains The Buttons skill is auto-generated from the Cobra command tree via `go run ./internal/tools/skillgen`. It follows the [AgentSkills specification](https://agentskills.io/specification) and includes: * **YAML frontmatter** — name, description, license, compatibility, metadata * **Quick reference** — copy-paste examples for create, press, list, history, delete * **Full command reference** — every command and subcommand with flags table * **JSON output contract** — success/error shapes and all error codes * **Argument types** — string, int, bool with env var and template injection rules * **Button sources** — code, HTTP, file, and prompt buttons with runtime details * **Common patterns** — lifecycle, prompt context, local dev server examples * **Storage layout** — `~/.buttons/` directory structure ## Keeping the skill current The skill auto-updates through two mechanisms: 1. **In the repo** — the [docs-sync workflow](https://github.com/autonoco/buttons/blob/main/.github/workflows/docs-sync.yml) regenerates `SKILL.md` whenever CLI code changes on main and opens a PR with updates 2. **On Mintlify** — the hosted skill file updates whenever the docs deploy You never have to manually maintain the skill content. Change a command or flag in `cmd/*.go`, and the skill updates automatically. ## skill.md vs llms.txt vs MCP | | skill.md | [llms.txt](/ai/llms-txt) | [MCP server](/ai/mcp-server) | | ------------------ | ------------------------------------ | ------------------------ | ---------------------------- | | **What it is** | Capability summary | Documentation index | Real-time search API | | **Agent loads it** | Once at session start | Once for discovery | On demand per query | | **Best for** | Teaching an agent how to use Buttons | RAG pipelines, embedding | Deep questions, page lookup | | **Size** | \~300 lines | \~50 lines (links only) | N/A (API) | | **Install** | `npx skills add ` | Fetch the URL | `claude mcp add` | # CLI buttons Source: https://docs.buttons.sh/buttons/cli Wrap a shell command as a button — one line, no separate script file. A "CLI button" is just a shell-runtime button whose body is the command you want to run. There's no special flag for it: `buttons create` scaffolds a shell button by default, and `--code` lets you pass the command inline so you never open an editor. ```bash theme={null} buttons create tail-logs --code 'openclaw tail --service api --env production' buttons create git-status --code 'git status --short' ``` `--code` writes the command straight into the button's `main.sh` and skips the placeholder scaffold. `--runtime` defaults to `shell`, so you don't pass it for a portable CLI command; use `bash`, `python`, or `node` when the body requires that interpreter. Press it like any other button: ```bash theme={null} buttons press git-status ``` ## Without `--code` Run `buttons create ` with no shortcut flags and it scaffolds a shell button with a placeholder `main.sh` you then edit: ```bash theme={null} buttons create deploy-check # edit .buttons/buttons/deploy-check/main.sh ``` To start from an existing script file instead of inline code, use `-f, --file`: ```bash theme={null} buttons create deploy-check --file ./scripts/deploy-check.sh ``` ## Adding args Declare typed args with `--arg name:type:required|optional` (repeatable). Each is injected into the press as `$BUTTONS_ARG_`: ```bash theme={null} buttons create tail-logs \ --code 'openclaw tail --service "$BUTTONS_ARG_SERVICE" --env "$BUTTONS_ARG_ENV"' \ --arg service:string:required \ --arg env:enum:required:staging|production buttons press tail-logs --arg service=api --arg env=production ``` Add `-d, --description` for what shows in `buttons list`, and `--timeout ` to override the default press timeout. See [Code buttons](/buttons/code) for the full `buttons create` flag set (runtimes, HTTP buttons, batteries, and more). # Code buttons Source: https://docs.buttons.sh/buttons/code Wrap a shell, Python, or Node script as a pressable, typed action. A code button is a script the runtime executes every time you press it. The script lives as a file inside the button folder, so you can edit it the same way you edit any other file. ## The default flow: scaffold, edit, press The simplest way to create a button is to let Buttons scaffold a placeholder script you can fill in. Declare the args you'll need up front — they're part of the button spec and can't be added later without recreating the button: ```bash theme={null} buttons create greet --arg name:string:required # Created button: greet # Edit: /Users/you/.buttons/buttons/greet/main.sh # Press: buttons press greet ``` Open the scaffolded `main.sh` — it has a shebang, a TODO comment, and a hint about where args arrive: ```bash theme={null} #!/bin/sh set -eu # TODO: add your command here # Args arrive as $BUTTONS_ARG_ ``` Edit it to whatever you want: ```bash theme={null} #!/bin/sh echo "Hello, $BUTTONS_ARG_NAME" ``` Press: ```bash theme={null} buttons press greet --arg name=Ada # → Hello, Ada ``` Args are declared at create time and stored in `button.json`. If you need to change them, delete and recreate the button — your `main.sh` is at the same path each time, so you can copy your edits over. ## Scaffold in Bash, Python, or Node Pass `--runtime` to scaffold with the right shebang and extension: ```bash theme={null} buttons create deploy --runtime bash --arg env:string:required # → scaffolds main.sh with: # #!/usr/bin/env bash # set -euo pipefail ``` ```bash theme={null} buttons create parse-json --runtime python --arg input:string:required # → scaffolds main.py with: # #!/usr/bin/env python3 # # TODO: add your code here # # Args arrive as os.environ["BUTTONS_ARG_"] ``` ```bash theme={null} buttons create transform --runtime node --arg payload:string:required # → scaffolds main.js ``` | Flag value | Interpreter used | File written | | ----------------- | ------------------ | ------------ | | `shell` (default) | `/bin/sh` | `main.sh` | | `bash` | `bash` from `PATH` | `main.sh` | | `python` | `python3` | `main.py` | | `node` | `node` | `main.js` | The `bash` runtime requires Bash to be installed. If it is unavailable, `buttons press` returns `RUNTIME_MISSING`; Buttons does not install it automatically. ## Shortcuts for when you already know the code Three shortcuts let you skip the edit step when the script is trivial or already on disk. ### `--code 'one-liner'` Pass a one-line script inline. Useful when the body is a single command and quoting isn't painful: ```bash theme={null} buttons create hostname --code 'hostname -f' buttons create ls-home --code 'ls -la ~' --runtime shell ``` Inline code is capped at **64 KB**. Beyond that, write it to a file and use `--file`. ### `--file ./path/to/script.sh` Copy an existing script into the button folder. The file is copied (not symlinked) so the button is self-contained: ```bash theme={null} buttons create deploy \ --file ./scripts/deploy.sh \ --arg env:string:required \ --arg version:string:required \ -d "Deploy a tagged release" ``` When importing code, Buttons infers the runtime from the file extension or shebang. Without a recognized extension or shebang, Buttons defaults to `/bin/sh`. ## Argument injection Arguments are never interpolated into the script body. They arrive as environment variables named `BUTTONS_ARG_` (uppercased): ```bash theme={null} # Declared: --arg bucket:string:required # Available: echo "$BUTTONS_ARG_BUCKET" # shell os.environ["BUTTONS_ARG_BUCKET"] # python process.env.BUTTONS_ARG_BUCKET # node ``` This prevents shell injection regardless of what the caller passes at press time. ## Reporting progress Long-running buttons can stream progress while they run. Before executing your script, the engine sets `$BUTTONS_PROGRESS_PATH` to a per-press file. Append one JSON object per line (JSONL) to it, and `buttons tail -f` follows those events live in another terminal. ```bash theme={null} #!/bin/sh set -eu # $BUTTONS_PROGRESS_PATH is set by the engine on every press. say() { printf '{"message":"%s"}\n' "$1" >> "$BUTTONS_PROGRESS_PATH"; } say "cloning repo" git clone "$BUTTONS_ARG_REPO" work say "installing deps" ( cd work && npm install ) say "done" ``` Follow it while it runs: ```bash theme={null} buttons tail deploy -f ``` Progress events are advisory and separate from the result — the final structured output still goes to stdout when the press finishes. A script that never writes to `$BUTTONS_PROGRESS_PATH` simply produces no progress to follow. See the [tail CLI reference](/cli/buttons_tail). ## Where the code lives After `buttons create`, the button folder contains: ``` ~/.buttons/buttons// button.json # spec: args, runtime, timeout main.sh # your code (or main.py / main.js) AGENTS.md # notes for agents pressing this button pressed/ # run history, one JSON file per press ``` Edit `main.sh` any time. Changes take effect on the next press — no recreate needed. ## Example: wrap a deploy script ```bash theme={null} # scripts/deploy.sh #!/bin/bash set -euo pipefail ENV=$BUTTONS_ARG_ENV VERSION=$BUTTONS_ARG_VERSION echo "Deploying $VERSION to $ENV..." kubectl set image deployment/app app=registry.example.com/app:$VERSION -n $ENV kubectl rollout status deployment/app -n $ENV ``` Import it: ```bash theme={null} buttons create k8s-deploy \ --file ./scripts/deploy.sh \ --arg env:string:required \ --arg version:string:required \ -d "Roll out a new image version to a Kubernetes namespace" ``` ## Related * [Prompt buttons](/buttons/prompt) — attach an instruction to any button for the consuming agent * [Arguments](/concepts/arguments) — declare and pass typed args * [JSON output](/concepts/json-output) — capture results programmatically * [Folder structure](/concepts/folder-structure) — what lives inside a button folder # Cron triggers Source: https://docs.buttons.sh/buttons/cron Run a button on a recurring schedule. A cron trigger fires a **button** press on a recurring schedule. It lives on the button's spec and runs under the `buttons serve` trigger engine. ```bash theme={null} buttons trigger add daily-snapshot --cron --schedule "0 3 * * *" buttons trigger add slack-sync --cron --schedule "0 */2 * * *" ``` Schedules are standard **5-field** cron expressions (parsed with `cron.ParseStandard`). Cron attaches to a button only — drawers support webhook triggers, not cron (the `cron` drawer kind is reserved but not implemented). ## Passing args Pass `--arg KEY=VALUE` (repeatable) to set the args the press runs with each tick: ```bash theme={null} buttons trigger add report --cron --schedule "0 9 * * 1" --arg window=weekly ``` `buttons trigger add` requires exactly one kind flag: `--cron`, `--watch`, or `--webhook`. The trigger id is generated automatically (a short hex id) — there is no `--name`, `--timezone`, or `--overlap` flag. ## Management ```bash theme={null} buttons trigger list # every trigger, across all buttons buttons trigger list