Skip to main content

Module profiles

Module profiles 

Source
Expand description

Profile system for reusable MCP prompts and personas.

Profiles are named personas that combine a system prompt, scoped tools, and optional dynamic context injection. They enable “assume a role” workflows in Cursor, Claude Desktop, and other MCP clients.

§Architecture

┌──────────────────────────────────────────┐
│            ProfileRegistry                 │
│  ┌─────────┐ ┌─────────┐ ┌────────────┐ │
│  │  TOML   │ │  Lua    │ │  Custom    │ │
│  │ Inline  │ │ Script  │ │ (Rust)     │ │
│  └─────────┘ └─────────┘ └────────────┘ │
└──────────────┬───────────────────────────┘
               ▼
  GET /profiles/list  ·  POST /profiles/{name}/prompt

§Profile Sources

SourceConfig KeyStruct
Inline TOML[profiles.inline.<name>]TomlProfile
Lua script[profiles.script.<name>]LuaProfileAdapter (in crate::profile_script)
Custom Rustregistry.register(...)User-defined Profile impl

§Usage

use context_harness::profiles::{ProfileRegistry, TomlProfile};

let mut profiles = ProfileRegistry::new();
profiles.register(Box::new(TomlProfile::new(
    "reviewer".to_string(),
    "Reviews code against conventions".to_string(),
    vec!["search".to_string(), "get".to_string()],
    "You are a senior code reviewer.".to_string(),
)));

See the profiles documentation for the full specification.

Structs§

ProfileArgument
An argument that an profile accepts.
ProfileInfo
Serializable profile info for the /profiles/list endpoint.
ProfilePrompt
A resolved profile prompt ready for the LLM.
ProfileRegistry
Registry for profiles (TOML, Lua, and custom Rust).
PromptMessage
A message to inject into the conversation.
TomlProfile
An profile defined inline in TOML configuration.

Traits§

Profile
A reusable persona that provides a system prompt and tool scoping.