/** * Personalities — pluggable system prompt addenda that shape how the * agent communicates and what it prioritises. * * Storage: * - **Built-in**: hardcoded below (concise, verbose, security, * senior-reviewer, junior-mentor, ship-it). * - **Project**: `/.codeep/personalities/.md` * - **Global**: `~/.codeep/personalities/.md` * * Project shadows global shadows built-in, by name. * * File format (project / global): legacy prompt-only Markdown remains valid; * structured custom bots add a small versioned frontmatter block: * ``` * --- * codeep: custom-bot/v1 * model: automatic * tools: [files, tests, git] * scope: all * projects: [] * --- * # Concise Reviewer * * ``` * The first H1 is the display name. Tools/model/scope are enforced only for * structured files; old files stay unrestricted. * * Activation: * - `config.activePersonality` holds the active name (or null/undefined * for default behaviour). * - `getActivePersonalityPrompt(workspaceRoot)` returns the prompt * addendum to inject into the agent's system prompt, or '' when no * personality is active. * - Persists across sessions until cleared with `/personality off`. */ import type { ToolCall } from './tools.js'; export type PersonalityScope = 'builtin' | 'project' | 'global'; export type PersonalityCapability = 'files' | 'terminal' | 'tests' | 'git' | 'web' | 'mcp'; export type PersonalityProjectScope = 'all' | 'selected' | 'personal' | 'unspecified'; export interface PersonalityRuntimeModel { providerId: string; model: string; protocol: 'openai' | 'anthropic'; } export interface Personality { /** Slug (filename without .md, or built-in id). Lowercase, hyphens. */ name: string; /** Human display label shown in `/personality` list. */ displayName: string; /** One-line description for the list view. */ description: string; /** Markdown body appended to the system prompt when active. */ prompt: string; scope: PersonalityScope; /** True for `custom-bot/v1` files and the previous web section format. */ structured?: boolean; /** False when a frontmatter `codeep` schema marker is present but unsupported. */ schemaValid?: boolean; /** `automatic` inherits the user's current provider/model for this run. */ modelPreference?: string; /** Normalised high-level capabilities selected in the builder. */ tools?: PersonalityCapability[]; /** Original declared tool values, retained for diagnostics/UI. */ declaredTools?: string[]; /** True when a structured file explicitly declares Tools, including `[]`. */ restrictTools?: boolean; projectScope?: PersonalityProjectScope; /** False when versioned metadata explicitly declares an unknown scope. */ scopeValid?: boolean; projects?: string[]; responsibility?: string; responseStyle?: string; always?: string[]; never?: string[]; advancedInstructions?: string; } /** Whether a structured bot's model field satisfies the portable v1 contract. */ export declare function isPersonalityModelPreferenceValid(personality: Personality): boolean; /** Parse both custom-bot/v1 and the original web builder's heading format. */ export declare function parsePersonalityMarkdown(raw: string, name: string, scope: PersonalityScope): Personality; /** * Scope is enforced against the workspace basename only. This intentionally * avoids accepting arbitrary paths from cloud-authored metadata. */ export declare function isPersonalityAvailable(personality: Personality, workspaceRoot?: string): boolean; /** Concrete tool names that may be advertised for a structured custom bot. */ export declare function getPersonalityToolAllowlist(personality: Personality, registeredMcpToolNames?: ReadonlySet): string[] | undefined; /** Runtime gate. It is deliberately stricter than the prompt/tool catalog. */ export declare function isPersonalityToolCallAllowed(personality: Personality, toolCall: ToolCall, registeredMcpToolNames?: ReadonlySet): boolean; /** Resolve an exact provider/model preference without mutating global config. */ export declare function resolvePersonalityRuntimeModel(personality: Personality, current: { providerId: string; model: string; protocol: 'openai' | 'anthropic'; }): PersonalityRuntimeModel | null; export declare function loadAllPersonalities(workspaceRoot?: string): Personality[]; export declare function findPersonality(name: string, workspaceRoot?: string): Personality | null; export declare function getActivePersonality(workspaceRoot?: string): Personality | null; /** * Returns the prompt addendum for the currently active personality, or * '' when none is set. Called from agent.ts after the base system prompt * is composed — appended last so personality overrides apply even if * project rules conflict. */ export declare function getActivePersonalityPrompt(workspaceRoot?: string): string; export declare function formatPersonalityActivation(personality: Personality): string; export declare function formatPersonalityList(workspaceRoot?: string): string;