Creating Custom Chat Modes/Agents

The Chat view in AI Positron has a drop-down menu where you can choose between custom chat modes (e.g. Chat/Ask/DITA Agent). Each of these chat modes define an initial prompt and a set of tools that are used when the chat is started. Extra chat modes can be added by creating custom AI actions with a specific output-action, as exemplified below:
{
    "id": "my.custom.chat.mode",
    "title": "S1000D",
    "description": "Chat with the AI about your S1000D project.",
    "categoryId": "Chat modes",
    "output-action": "agentic",
    "prompt_ref": "prompts/s100d-detailed-prompt.md",
    "expand-params": [
      {
        "name": "applicationContext",
        "value": "${applicationContext}"
      }
    ],
    "parameters": {
      "function_refs": [
        {"ref": "get_current_document_location"},
        {"ref": "get_document_content"},
        {"ref": "search_project_resources"},
        {"ref": "search_webhelp_content"},
        {"ref": "grep_project"},
        {"ref": "list_dir"},
        {"ref": "copy_move_rename_path"},
        {"ref": "run_command_line"},
        {"ref": "edit_document"},
        {"ref": "invoke_ai_action"},
        {"ref": "retrieve_ai_actions"},
        {"ref": "get_xml_refactoring_operations"},
        {"ref": "get_xml_refactoring_operation_params"},
        {"ref": "refactor_xml_with_operation"},
        {"ref": "refactor_xml_with_xslt"},
        {"ref": "store_to_memory"},
        {"ref": "update_memory"},
        {"ref": "validate_content"}
      ]
    }
  }
Tools contributed by other plugins and add-ons, as well as tools provided by configured MCP servers, do not need to be listed in function_refs. They are automatically added to every chat mode. In the Oxygen XML desktop application, tools contributed by the application itself, such as compare_documents and get_profiling_conditions, are also automatically added to every chat mode. The following exceptions apply to tools contributed by the application, plugins, and add-ons:
  • A chat mode whose ID ends in .ask, such as the built-in Ask chat mode, is offered only contributed tools that declare that they do not make changes.
  • A chat mode that runs from a transformation through the AI XPath functions receives only the tools listed in its function_refs.
  • A contributed tool that replaces a built-in tool is offered only to chat modes that list the built-in tool.

Defining a Chat Mode or Sub-Agent in a Markdown File

Instead of using an action JSON file and a separate prompt file, you can define a chat mode, a sub-agent that other AI agents delegate work to, or even an AI action in a single Markdown file. For details and examples, see Defining Sub-Agents, Chat Modes, and AI Actions in Markdown.