Skip to content

reachweb/statamic-ai-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Statamic AI Agent

An AI-powered interface for Statamic CMS that lets you manage your site using natural language commands.

This addon is in an early alpha stage and is being developed mainly using AI. Please use in care and never on production sites.

Features

  • Natural Language Commands: Type instructions like "Create 10 blog posts" or "Update all entries in collection X"
  • Claude-Powered: Uses Anthropic's Claude API with tool use for intelligent operations
  • Real-time Streaming: See responses and tool executions in real-time via SSE
  • Budget Control: Set daily, monthly, and per-session spending limits
  • Permission Modes: Choose between "Content Only" (safe) or "Full Access" (power mode)
  • Bulk Operations: Efficiently create or update multiple entries in a single operation

Requirements

Installation

composer require reachweb/statamic-ai-agent

Publish the configuration (optional):

php artisan vendor:publish --tag=statamic-ai-agent-config

Configuration

Add your Claude API key to .env:

ANTHROPIC_API_KEY=your-api-key-here

And configure via the Control Panel at Settings > AI Agent.

Usage

  1. Open the Statamic Control Panel
  2. Press Cmd+I (Mac) or Ctrl+I (Windows) to open the AI Agent terminal or use the icon in the header
  3. Type your command in natural language
  4. The agent will execute the appropriate tools and show results

Example Commands

  • "List all collections"
  • "Show me the fields in the blog blueprint"
  • "Get entry with slug 'hello-world' from the posts collection"
  • "Update the title of entry X to 'New Title'"
  • "Create 5 sample blog posts with different topics"
  • "Update all entries in the news collection to set featured = true"
  • "Translate the home page to French" (multisite)

Available Tools

Entry Management

Tool Description Mode
list_entries List entries from a collection with pagination Content
get_entry Get a single entry by ID or slug Content
create_entry Create a new entry Content
update_entry Update an existing entry Content
delete_entry Delete an entry (requires confirmation) Content
bulk_create_entries Create multiple entries at once (up to 50) Content
bulk_update_entries Update multiple entries with the same data Content

Collection Management

Tool Description Mode
list_collections List all collections Content
get_collection Get collection details Content
create_collection Create a new collection Full
update_collection Update collection settings Full

Blueprint Management

Tool Description Mode
list_blueprints List all blueprints Content
get_blueprint Get blueprint field definitions Content
update_blueprint Update a blueprint Full
add_field Add a field to a blueprint Full
edit_field Edit an existing field Full
remove_field Remove a field from a blueprint Full
rename_field Rename a field Full
reorder_fields Reorder fields in a blueprint Full

Taxonomy Management

Tool Description Mode
list_taxonomies List all taxonomies Content
get_taxonomy Get taxonomy details Content
create_taxonomy Create a new taxonomy Content
list_terms List terms in a taxonomy Content
get_term Get a single term Content
create_term Create a new term Content
update_term Update an existing term Content

Global Sets

Tool Description Mode
list_globals List all global sets Content
get_global Get global set data Content
update_global Update global set values Content
update_global_blueprint Update a global set's blueprint Full

Navigation

Tool Description Mode
list_navs List all navigation structures Content
get_nav Get navigation tree Content
update_nav Update navigation structure Full
add_nav_item Add an item to navigation Full
remove_nav_item Remove an item from navigation Full

Assets

Tool Description Mode
list_asset_containers List asset containers Content
list_assets List assets in a container Content
get_asset Get asset metadata Content
update_asset Update asset metadata Content

Translation (Multisite)

Tool Description Mode
list_sites List configured sites/locales Content
translate_entry Create a localized version of an entry Content
bulk_translate_entries Translate multiple entries at once Content

Views/Templates

Tool Description Mode
find_views Search for view files Full
get_view Read a view file's contents Full
update_view Modify a view file Full
preview_view_changes Preview changes before applying Full

Git/Safety

Tool Description Mode
git_status Show git working directory status Content
git_diff Show changes in files Content
git_commit Commit changes Full
git_revert Revert changes Full

Interaction

Tool Description Mode
request_confirmation Request user confirmation before actions Content

Permission Modes

Content Only (Default)

  • Read collections, blueprints, entries
  • Create and modify entry content
  • Bulk create/update entries
  • Manage taxonomy terms
  • Translate entries (multisite)

Full Access

Everything above, plus:

  • Modify blueprints (add/edit/remove fields)
  • Modify collection settings
  • Update views/templates
  • Modify navigation structures
  • Modify global set blueprints
  • Git operations (commit, revert)

Bulk Operations

The agent supports efficient bulk operations with a single confirmation:

"Create 10 sample products in the products collection"
"Update all blog posts to set status = published"
"Translate all entries from the news collection to French"

Bulk tools are limited to prevent accidental mass operations:

  • bulk_create_entries: Up to 50 entries per call
  • bulk_update_entries: Default limit of 100 entries per call
  • bulk_translate_entries: Processes entries with configurable limits

Budget Management

The addon tracks API spending and allows you to set limits:

  • Daily Limit: Maximum spend per day
  • Monthly Limit: Maximum spend per month
  • Per-Session Limit: Maximum spend per conversation
  • Warning Threshold: Percentage at which to show warnings

Usage is stored in JSON files at storage/statamic-ai-agent/usage/.

Cleanup Old Usage Files

php artisan ai-agent:prune-usage --days=90

Development

Build frontend assets:

cd vendor/reachweb/statamic-ai-agent
npm install
npm run build

Run tests:

vendor/bin/pest

License

MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published