Add AI persona profiles for prompt injection
Profiles allow users to inject system instructions into prompts, customizing the AI's behavior and persona for tool execution. Features: - Profile dataclass with name, description, system_prompt - 8 built-in profiles: None, Comedian, Technical Writer, Teacher, Concise, Creative, Code Reviewer, Analyst - Custom profile creation and storage in ~/.cmdforge/profiles/ - Profile selector in Prompt Step dialog - Profile injection during tool execution - Profiles page in GUI (Ctrl+4) for viewing and managing profiles Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
@@ -9,6 +9,7 @@ from .tool import Tool, PromptStep, CodeStep, ToolStep
|
||||
from .providers import call_provider, mock_provider
|
||||
from .resolver import resolve_tool, ToolNotFoundError, ToolSpec
|
||||
from .manifest import load_manifest
|
||||
from .profiles import load_profile
|
||||
|
||||
# Maximum recursion depth for nested tool calls
|
||||
MAX_TOOL_DEPTH = 10
|
||||
@@ -114,6 +115,13 @@ def execute_prompt_step(step: PromptStep, variables: dict, provider_override: st
|
||||
# Build prompt with variable substitution
|
||||
prompt = substitute_variables(step.prompt, variables)
|
||||
|
||||
# Inject profile system prompt if specified
|
||||
if step.profile:
|
||||
profile = load_profile(step.profile)
|
||||
if profile and profile.system_prompt:
|
||||
# Prepend system prompt to user prompt
|
||||
prompt = f"{profile.system_prompt}\n\n---\n\n{prompt}"
|
||||
|
||||
# Call provider
|
||||
provider = provider_override or step.provider
|
||||
|
||||
|
||||
Reference in New Issue
Block a user