---
name: wiki-ai-actions
description: Skill substrate for the inline `/ai` slash-menu commands in the wiki editor (Stage E2 — v3.5).
title: Wiki Inline AI Actions
category: core
status: active
author: agentic
metadata:
  triggers:
  - wiki ai action
  - /summarize
  - /extend
  - /translate
  - /extract-actions
  - /rephrase
  priority: 5
---
## Purpose

This skill is **engine substrate**, not an injection-into-agent-prompt skill. It declares the available inline `/ai` actions for the wiki editor — what each one does, the exact LLM prompt template, the model tier, and the token budget.

When the user types `/summarize` (or any other action) inside a wiki article in editor mode, the frontend slash-menu fires `POST /api/wiki/article/{slug}/ai-action` with the action name + selected text + optional params. The backend reads this skill's `config/actions.yaml`, looks up the action, formats the prompt template with the user's selection, dispatches via `agent.process_task(model_tier=...)`, and returns the LLM output. The user decides whether to insert it.

## Why a skill (Rule 12)

Every action's prompt template, model tier, max_tokens, and required params live in `config/actions.yaml`. To tune behavior — change wording, add a new action, switch a model tier — edit YAML and restart. **Never** hardcode prompt strings in Python.

To add a new inline action:
1. Add an entry to `actions.yaml` with `description`, `prompt_template`, `model_tier`, `max_tokens`, optional `requires_param`.
2. Add the slash command to the frontend `SlashMenu` component's options list.
3. The endpoint resolves it via `SkillLoader.load_skill_config_file("wiki-ai-actions", "actions.yaml")` and dispatches.

No code change in either layer needed for the engine to pick up new actions.

## Default actions (shipped)

| Action | Tier | Purpose |
|---|---|---|
| `summarize` | fast | Condense selection into 2-3 sentences |
| `extend` | capable | Continue writing in the same voice |
| `translate` | fast | Translate to a target language (requires `target_lang` param) |
| `extract-actions` | fast | Pull explicit action items into a checklist |
| `rephrase` | fast | Rewrite selection in clearer prose |

## Hard rules (every action follows)

- **Never invent facts.** Only operate on what's in the selection + context. If asked to extend, the continuation must follow logically from the input, not introduce new claims.
- **Preserve markdown formatting** unless explicitly transforming it (e.g., `extract-actions` produces a checklist; that's the only allowed structural change).
- **Be concise.** Each action has a `max_tokens` cap; respect it.
- **Don't echo the input.** Output is the rewritten/added content, not "here's a summary:" preamble.
- **Match the source language** of the selection unless the user asked for translation. A Swedish article gets a Swedish summary.

## Output format

Plain text or markdown — whatever the action declares appropriate. The frontend inserts it at the cursor verbatim. No preamble, no closing remarks, no `Here's the result:` framing.