Skip to content

amp

The amp module manages Amp settings and project instructions from Lua. Use it for ~/.config/amp/settings.json, MCP servers, permissions, update behavior, and AGENTS.md content.

lua
local amp = require("rootbeer.amp")

Configure Amp

lua
amp.config({
    thinking = true,
    updates_mode = "warn",
    mcp_servers = {
        playwright = {
            command = "npx",
            args = { "-y", "@playwright/mcp@latest", "--headless" },
        },
    },
    permissions = {
        { tool = "Bash(npm run *)", mode = "allow" },
        { tool = "Bash(rm *)", mode = "ask" },
    },
})

Write Instructions

Use amp.prompt() for the instructions you want Amp to follow in this config:

lua
amp.prompt([[
## Conventions

- Use TypeScript with strict mode
- Prefer functional patterns over classes
- Always run tests before committing
- Use conventional commit messages
]])

API Reference

amp.config(cfg)

Writes Amp settings to cfg.path as JSON.

Parameterscfg: amp.Config

always_include_pathsstring[]optional
Glob patterns always included in fuzzy search (amp.fuzzy.alwaysIncludePaths).
mcp_serverstable<string, amp.McpServer>optional
MCP server configurations (amp.mcpServers).
pathstringoptional
Where to write settings. Defaults to "~/.config/amp/settings.json".
permissionsamp.Permission[]optional
Permission rules (amp.permissions).
thinkingbooleanoptional
Enable Claude's extended thinking (amp.anthropic.thinking.enabled).
updates_mode"auto"|"disabled"|"warn"optional
Update checking behavior (amp.updates.mode).

amp.prompt(content, path)

Writes the global AGENTS.md instructions file. This file is loaded by Amp at the start of every session and applies across all projects. Use it for personal coding conventions, preferred tools, and project-agnostic guidance.

Parameters

contentstring
The markdown content for the instructions file.
pathstringoptional
Where to write the file. Defaults to "~/.config/amp/AGENTS.md".

amp.McpServer

argsstring[]optional
Command arguments.
commandstringoptional
Command to run (for local servers).
envtable<string, string>optional
Environment variables.
headerstable<string, string>optional
HTTP headers.
include_toolsstring[]optional
Tool name filters.
urlstringoptional
Server endpoint (for remote servers).

amp.Permission

mode"allow"|"ask"|"delegate"|"deny"
Permission mode.
toolstring
Tool pattern to match.