Orchardcore ai personas

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore ai personas is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for AI Personas in Orchard Core with the CrestApps AI module. Covers the CrestApps.OrchardCore.AI.Personas feature, reusable linked characters with instructions, assistant name, language, voice and avatar, the Personas catalog and ManageAIPersonas permission, linking a persona from AI profiles

How to use this skill

Skill file

Orchard Core AI Personas - Prompt Templates

Configure AI Personas

You are an Orchard Core expert. Generate recipes and code that give AI profiles, profile templates, chat interactions and workflow tasks a reusable persona with the CrestApps AI module.

Guidelines

What the Feature Adds

| Item | Detail |

|---|---|

| Admin catalog | Artificial Intelligence → Personas (ai/personas, ai/persona/create, ai/persona/edit/{id}), guarded by ManageAIPersonas |

| Admin list | Orchard Core AdminList named AIPersonas (columns Name, Details, Actions); see orchardcore-admin-lists |

| Pickers | AI persona on the profile and Profile template Instructions tab, the chat interaction Settings panel, and the AI completion with configuration workflow task (needs CrestApps.OrchardCore.AI.Chat.Interactions and OrchardCore.Workflows) |

| Chat UI | Assistant name and avatar on assistant messages and the typing indicator in AI Chat, both widgets and Chat Interactions |

| Recipe step | AIPersonas (needs OrchardCore.Recipes.Core) |

| Deployment step | AI Personas (AIPersonaDeploymentStep with IncludeAll and PersonaIds, needs OrchardCore.Deployment) |

| Session record | AIChatSession.PersonaId records the persona a session started with |

Create Personas and Link a Profile by Recipe

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.AI.Personas"
      ],
      "disable": []
    },
    {
      "name": "AIPersonas",
      "personas": [
        {
          "Name": "front-desk",
          "DisplayText": "Front desk",
          "Description": "Gracious and efficient.",
          "Instructions": "You are {{ assistant_name }}, a gracious, efficient front-desk assistant.",
          "AssistantName": "Ava",
          "Language": "en-US",
          "VoiceName": "alloy",
          "VoiceDeploymentName": "gpt-realtime",
          "AvatarUrl": "/media/avatars/ava.png"
        }
      ]
    },
    {
      "name": "AIProfile",
      "Profiles": [
        {
          "Name": "support",
          "DisplayText": "Support",
          "Type": "Chat",
          "PersonaId": "front-desk"
        }
      ]
    }
  ]
}

What the Model Receives

On every request the persona block goes first in the system message:

  1. "Your name is ..." when the persona has an assistant name
  2. the persona's instructions (Liquid; assistant_name holds the assistant name)
  3. the selected prompt templates
  4. the profile's or interaction's own system instructions

Business rules come last, so they win any conflict with the persona's personality.

Voice Resolution

| Surface | Order |

|---|---|

| Chat sessions and realtime calls | Voice chosen for the call or session, then the profile or interaction voice, then the persona voice, then the deployment default |

| Turn-based automated calls | Activity voice, then subject flow voice, then the persona voice (only when chosen on a deployment of the same provider as the call's text-to-speech deployment), then the telephony provider default |

See orchardcore-ai-realtime-voice and orchardcore-telephony for the call side.

Seed Saved Personas in a Migration

Saved personas are ordinary catalog records: editors can change or delete them and they export.

public sealed class PersonaMigrations : DataMigration
{
    private readonly IAIPersonaManager _personaManager;

    public PersonaMigrations(IAIPersonaManager personaManager)
    {
        _personaManager = personaManager;
    }

    public async Task<int> CreateAsync()
    {
        var persona = await _personaManager.NewAsync("front-desk", new JsonObject
        {
            ["DisplayText"] = "Front desk",
            ["Instructions"] = "You are {{ assistant_name }}, a gracious, efficient front-desk assistant.",
            ["AssistantName"] = "Ava",
        });

        var result = await _personaManager.ValidateAsync(persona);

        if (result.Succeeded)
        {
            await _personaManager.CreateAsync(persona);
        }

        return 1;
    }
}

[RequireFeatures("CrestApps.OrchardCore.AI.Personas")]
public sealed class PersonasStartup : StartupBase
{
    public override void ConfigureServices(IServiceCollection services)
    {
        services.AddDataMigration<PersonaMigrations>();
    }
}

Ship Provided Personas as Files

A provided persona is read from code every time: every tenant that enables the module gets it, editors cannot delete it, it is marked From file, and it is not exported. Saving one in the editor creates a saved persona with the same name that replaces it; deleting that saved copy falls back to the file.

Put Markdown files in the module's Templates/Personas folder and register the assembly:

[RequireFeatures("CrestApps.OrchardCore.AI.Personas")]
public sealed class PersonasStartup : StartupBase
{
    public override void ConfigureServices(IServiceCollection services)
    {
        services.AddCoreAIPersonasFromAssembly(typeof(PersonasStartup).Assembly);
    }
}

Templates/Personas/front-desk.md (the file name is the technical name):

---
Title: Front desk
Description: Gracious and efficient.
AssistantName: Ava
Language: en-US
---

You are {{ assistant_name }}, a gracious, efficient front-desk assistant.

A site can also drop such files into Templates/Personas under its content root. For any other source, implement IAIPersonaProvider and register it with services.AddSingleton<IAIPersonaProvider, MyPersonaProvider>().

Deleting

Profiles that use a deleted persona keep working without one. Deleting a persona that AI profiles still use shows how many were affected.

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.