Log in

Smart Actions

Smart Actions is a powerful feature that allows you to create custom automation workflows through JSON configuration files. By placing action definitions in the .supercode/actions/ folder, you can build sophisticated integrations that modify prompts, interact with external services, and customize AI behavior in ways that perfectly match your development workflow.

Smart Actions

An action is a universal operation that can be triggered in multiple ways: through direct user interaction by clicking buttons in various menus (as you'll read about below), through triggers like voice commands, or configured as automatic actions in specific situations. Using actions, you can modify your current request, system prompt, selected model, and chosen agent mode in countless different ways.

These modifications can range from very simple operations like adding text to your current request or appending information to the system prompt, to complex pipelines where your prompt is sent to your own server for custom processing before being returned to Cursor. Actions represent an incredibly powerful subsystem of Supercode that allows you to almost completely rewrite how the AI agent processes your requests.

With actions, you can create anything from simple conveniences like a pretty button with a predefined prompt and model that executes a specific request, to huge multi-layered workflows involving sequential execution of multiple requests by different models. The possibilities are virtually limitless.

Creating Custom Actions

Actions are defined within JSON files in the .supercode/actions/ directory. Each JSON file serves as a collection of related actions, where you can group similar or thematically connected actions together. Within each file, the structure is an object where keys represent unique action name and values define the action configuration. Actions can perform multiple types of operations, from simple prompt modifications to complex integrations with external services and dynamic model selection.

Basic Action Configuration

Here's a simple example showing the basic structure of actions:

{
  "Security Review": {
    "icon": "🔒",
    "menu": "buttons",
    "mode": "SC:Architect",
    "systemPrompt": "You are a security expert. Focus on input validation, authentication, and potential attack vectors.",
    "prompt": "$prompt \n\n Implement it with a focus on security."
  },
  "Performance Analysis": {
    "icon": "⚡",
    "menu": ["prompts", "buttons"],
    "prompt": "Analyze the code for performance bottlenecks and suggest optimizations.",
    "model": "o3",
    "run": true
  }
}

Menu Types

  • "prompts": Appears in the User Prompts menu alongside custom prompts
  • "enhancers": Available in the Custom Enhancers dropdown for prompt enhancement workflows
  • "buttons": Displays as emoji icons in the Cursor IDE toolbar for quick access

You can specify multiple menu types by using an array: ["prompts", "buttons"]

Updaters: Dynamic Value Modification

Smart Actions support powerful "updaters" that can dynamically modify prompts, system prompts, models, and modes. Updaters can use variables like $prompt, $model, and $mode to reference current values and transform them.

Updater Types

  • Simple: Replace with a static string value (default when using plain strings)
  • URL: Send current values to a web server and use the response as the new value
  • Command: Execute a shell command with current values and use stdout as the new value
  • AI: Use AI to transform the current values based on a system prompt
{
  "Add Project Context": {
    "icon": "🌐",
    "menu": "enhancers",
    "prompt": {
      "url": "https://your-server.com/api/enhance"
    }
  },
  "Security Focus": {
    "icon": "🔐",
    "menu": "enhancers", 
    "prompt": {
      "ai": "Add security considerations and best practices to this prompt: $prompt"
    }
  }
}

Using Variables in Updaters

Updaters can reference current context using dollar-signed variables. These variables allow you to build dynamic transformations that work with the current state:

Available Variables

  • $prompt - The current prompt text
  • $model - The currently selected AI model
  • $mode - The current mode (if any)
  • $systemPrompt - The current system prompt
{
  "Add Debug Logging": {
    "icon": "🐛",
    "menu": "prompts",
    "prompt": "Add comprehensive debug logging to this code. Original request: $prompt",
    "systemPrompt": "Focus on adding meaningful log statements that help with debugging. Current model: $model"
  },
  "Convert to TypeScript": {
    "icon": "🔷",
    "menu": "buttons",
    "prompt": {
      "ai": "Convert the following code to TypeScript with proper type definitions: $prompt"
    },
    "model": "claude-3-5-sonnet"
  }
}

Advanced Updater Examples

Here are more sophisticated examples using different updater types:

{
  "Context-Aware Assistant": {
    "icon": "🤖",
    "menu": "prompts",
    "systemPrompt": {
      "ai": "Create a system prompt optimized for the current model ($model) and mode ($mode)"
    },
    "prompt": "Help me with: $prompt"
  },
  "Test External": {
    "menu": "buttons",
    "icon": "🚀",
    "prompt": {
      "url": "https://api.supercode.sh/prompt-echo"
    },
    "systemPrompt": "You must start your response with 'Hello, world!'",
    "run": true
  }
}

Voice Commands and IDE Integration

Actions can also integrate with voice commands and IDE operations:

{
  "Run Tests": {
    "voiceCommand": ["run tests", "execute tests", "test project"],
    "ideCommand": {
      "name": "workbench.action.tasks.runTask", 
      "args": ["npm: test"]
    }
  },
  "Quick Fix": {
    "icon": "⚡",
    "menu": "prompts",
    "prompt": "Fix any obvious errors in the selected code",
    "run": true
  }
}

Complete Action Example

Here's a comprehensive example that demonstrates multiple Smart Actions features:

{
  "Full-Stack Code Review": {
    "icon": "🔍",
    "menu": ["prompts", "buttons"],
    "model": {
      "ai": "Select the best model for code review based on current context: $model"
    },
    "systemPrompt": {
      "ai": "Create a comprehensive system prompt for code review that considers the current project context and selected model ($model)"
    },
    "prompt": {
      "url": "https://your-company.com/api/enhance-review-prompt"
    },
    "voiceCommand": ["review code", "full stack review"],
    "actions": ["security_scan", "performance_check"]
  }
}

Workflows: Sequential Action Execution

One of the most powerful features of Smart Actions is the ability to create Workflows through sequential automatic execution. When an action includes "run": true or "instantRun": true, the current prompt (including all nested modifications) is automatically sent to the Cursor Agent for execution immediately after the action completes.

⚡ Automatic Execution

When you create a Workflow consisting of multiple Actions, each with "run": true, Supercode will automatically trigger the next request after the successful completion of the previous one. This creates incredibly powerful automated development workflows.

For example, you can use an architectural mode with a deep-thinking model in one Action to design feature implementation, then have another Action perform the implementation with a simpler model. A Workflow Action can then sequentially call the first Action to design the solution, and automatically switch to the second Action for implementation without requiring your manual intervention.

{
  "Architecture Design": {
    "icon": "🏗️",
    "mode": "SC:Architect",
    "model": "o3",
    "prompt": "Design the architecture and implementation plan for: $prompt",
    "systemPrompt": "Focus on system design, component relationships, and implementation strategy.",
    "run": true
  },
  "Implementation": {
    "icon": "⚙️",
    "model": "claude-4-sonnet",
    "prompt": "Implement the feature based on the architectural design: $prompt",
    "systemPrompt": "Focus on clean, maintainable code implementation.",
    "run": true
  },
  "Full Feature Workflow": {
    "icon": "🚀",
    "menu": ["prompts", "buttons"],
    "actions": ["Architecture Design", "Implementation"],
    "voiceCommand": ["build feature", "full workflow"]
  }
}

Nested Workflows

Using this mechanism, you can create nested Workflows that allow the Cursor Agent to perform complex sequences of operations over tens of minutes. Each step in the workflow can use different models, modes, and system prompts optimized for specific tasks, creating sophisticated automation pipelines that adapt to your development process.

{
  "Code Review & Fix": {
    "model": "claude-4-opus",
    "prompt": "Review this code for issues: $prompt",
    "systemPrompt": "Identify bugs, security issues, and improvement opportunities.",
    "run": true
  },
  "Apply Fixes": {
    "model": "claude-4-sonnet",
    "prompt": "Apply the suggested fixes from the review: $prompt",
    "run": true
  },
  "Generate Tests": {
    "model": "claude-4-sonnet",
    "prompt": "Create comprehensive tests for the fixed code: $prompt",
    "run": true
  },
  "Complete Code Pipeline": {
    "icon": "🔄",
    "menu": ["buttons"],
    "actions": ["Code Review & Fix", "Apply Fixes", "Generate Tests"],
    "voiceCommand": ["run pipeline", "complete workflow"]
  }
}

Benefits and Use Cases

Smart Actions unlock powerful automation possibilities:

  • Create domain-specific AI assistants for different parts of your application
  • Integrate with company-specific tools and knowledge bases via API calls and RAG
  • Automate complex multi-step development workflows

With Smart Actions, Supercode becomes a platform for building sophisticated AI-powered development workflows that adapt to your unique requirements and integrate seamlessly with your existing tools and processes.