mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-28 14:07:55 +00:00
SystemPromptBuilder (which loads the SOUL/MEMORY/USER persona files) was wired only into the one-shot `jarvis ask` path, so persistent agents run through AgentExecutor ignored persona entirely. The naive "pass prompt_builder" fix is insufficient: `prompt_builder` was dropped at every __init__ hop (ToolUsingAgent never accepted/forwarded it), and monitor_operative/operative assemble their own system prompt and never consult `_prompt_builder` — so they would silently ignore it even if it arrived. Fix: - `SystemPromptBuilder.persona_sections()` returns just the SOUL/MEMORY/USER sections (no agent template), for agents that build their own prompt and want to *append* persona rather than have it replace their instructions. - `BaseAgent._apply_persona()` appends persona to a self-assembled prompt (no-op without a builder or persona files). - Thread `prompt_builder` through the __init__ chain: ToolUsingAgent now accepts and forwards it to BaseAgent; monitor_operative and operative forward it and call `_apply_persona()` on their assembled system prompt. - AgentExecutor constructs a SystemPromptBuilder from config and passes it to any agent whose __init__ accepts it (same gating as session_store / memory_backend). Agents that override __init__ without forwarding (e.g. orchestrator) opt out automatically and keep their own machinery. Specialized prompts are preserved — persona is appended, not substituted. The one-shot path is unchanged. Verified: persona_sections() excludes the template but build() still includes both; monitor_operative/operative receive the builder through the chain and their assembled prompt includes the SOUL content. New tests in tests/agents/test_persona_persistent.py (11 passed; ruff clean). Closes #376 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>