> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/pfrankov/obsidian-local-gpt/llms.txt
> Use this file to discover all available pages before exploring further.

# Actions Interface

> TypeScript interface for custom AI actions and community actions

## LocalGPTAction

Defines a custom AI action that can be triggered from the editor.

```typescript src/interfaces.ts theme={null}
export interface LocalGPTAction {
  name: string;
  prompt: string;
  temperature?: number;
  system?: string;
  replace?: boolean;
  separator?: boolean;
  community?: CommunityActionRef;
}
```

### Properties

<ParamField path="name" type="string" required>
  Display name of the action shown in menus and command palette

  **Example:** `"🪄 General help"` or `"✍️ Continue writing"`
</ParamField>

<ParamField path="prompt" type="string" required>
  The user prompt sent to the AI model. Can be empty for freeform actions.

  **Special keywords:**

  * `{{=SELECTION=}}` - Replaced with selected text
  * `{{=CONTEXT=}}` - Replaced with context from linked files
  * `{{=CONTEXT_START=}}` / `{{=CONTEXT_END=}}` - Conditional context blocks

  **Example:**

  ```
  "Make a concise summary of the key points of the following text."
  ```
</ParamField>

<ParamField path="temperature" type="number">
  Override temperature for this action. If not specified, uses the default creativity setting.

  **Range:** 0.0 to 1.0

  * `0.0` - Deterministic, focused
  * `1.0` - Creative, varied
</ParamField>

<ParamField path="system" type="string">
  System prompt that defines the AI's behavior and role

  **Example:**

  ```
  "You are an AI assistant that follows instruction extremely well. Help as much as you can."
  ```
</ParamField>

<ParamField path="replace" type="boolean" default="false">
  If `true`, replaces the selected text with the AI output instead of appending below

  **Use case:** Grammar correction, text transformation
</ParamField>

<ParamField path="separator" type="boolean" default="false">
  If `true`, adds a visual separator in action menus
</ParamField>

<ParamField path="community" type="CommunityActionRef">
  Metadata for community-shared actions. See [CommunityActionRef](#communityactionref).
</ParamField>

## CommunityActionRef

Metadata for actions imported from the community repository.

```typescript src/interfaces.ts theme={null}
export interface CommunityActionRef {
  id: string;
  language: string;
  name: string;
  hash: string;
  updatedAt?: string;
  description?: string;
}
```

### Properties

<ParamField path="id" type="string" required>
  Unique identifier for the community action
</ParamField>

<ParamField path="language" type="string" required>
  Language code (e.g., `"en"`, `"es"`, `"fr"`)
</ParamField>

<ParamField path="name" type="string" required>
  Display name of the community action
</ParamField>

<ParamField path="hash" type="string" required>
  Content hash for version tracking and updates
</ParamField>

<ParamField path="updatedAt" type="string">
  ISO timestamp of last update
</ParamField>

<ParamField path="description" type="string">
  Description of what the action does
</ParamField>

## Action Examples

### Basic Action

Simple summarization action:

```typescript theme={null}
{
  name: "🍭 Summarize",
  prompt: "Make a concise summary of the key points of the following text.",
  system: "You are an AI assistant that follows instruction extremely well. Help as much as you can."
}
```

### Replace Action

Grammar correction that replaces selected text:

```typescript theme={null}
{
  name: "📖 Fix spelling and grammar",
  prompt: "Proofread the below for spelling and grammar.",
  system: "You are an AI assistant that follows instruction extremely well. Help as much as you can.",
  replace: true
}
```

### Freeform Action

General help action with empty prompt (user provides prompt at runtime):

```typescript theme={null}
{
  name: "🪄 General help",
  prompt: "",
  system: "You are an assistant helping a user write more content in a document based on a prompt. Output in markdown format. Do not use links. Do not include literal content from the original document."
}
```

### High Creativity Action

Creative writing with custom temperature:

```typescript theme={null}
{
  name: "✨ Creative expansion",
  prompt: "Expand on this idea with creative details and examples.",
  system: "You are a creative writer with a vivid imagination.",
  temperature: 0.9
}
```

### Community Action

Action imported from community repository:

```typescript theme={null}
{
  name: "📊 Data Analysis",
  prompt: "Analyze the following data and provide insights.",
  system: "You are a data analyst expert.",
  community: {
    id: "data-analysis-v1",
    language: "en",
    name: "Data Analysis",
    hash: "abc123def456",
    updatedAt: "2026-03-01T00:00:00Z",
    description: "Analyzes data and provides insights"
  }
}
```

## Usage in Code

Actions are executed in `src/main.ts:349`:

```typescript theme={null}
async runAction(action: LocalGPTAction, editor: Editor) {
  return this.executeAction(
    {
      prompt: action.prompt,
      system: action.system,
      replace: !!action.replace,
      temperature:
        action.temperature ||
        CREATIVITY[this.settings.defaults.creativity].temperature,
    },
    editor,
  );
}
```

<Tip>
  Actions can use context from linked files automatically. The RAG system processes `[[wikilinks]]` in the selection and includes relevant content based on the context limit setting.
</Tip>
