fix: system prompt never reaches LLM — agent identity now works - #173
Merged
Conversation
SerializedPayload.system_text was built by the serializer but never
placed into payload.messages. AgentLoop::build_context() only returned
payload.messages (conversation history), so the system prompt — including
agent identity from merak_core.md — was silently dropped before reaching
the LLM. DeepSeek then defaulted to its training identity ("Claude").
- Add system_text field to SerializedPayload
- Set it in ContextSerializer::serialize()
- Prepend system message in AgentLoop::build_context()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build_context()was only returning conversation messages, silently dropping the entire system prompt (identity, constraints, world context). The LLM never received "You are Merak" instructions, so DeepSeek defaulted to its training identity "Claude".config/prompts/merak_core.mdvia the industrialPromptCompositorpipeline, not a truncated hardcoded string.Root Cause
ContextPipeline::planned_assemble()assembled the full system text and placed it inSerializedPayload.openai_json/anthropic_json, butAgentLoop::build_context()only returnedpayload.messages(conversation history). The system prompt was computed but never sent to the LLM.Fix (3 files)
context_serializer.hpp— addsystem_textfield toSerializedPayloadcontext_serializer.cpp— expose system text viapayload.system_textagent_loop.cpp— prepend system message inbuild_context(), load identity fromPromptCompositor::build_core_sections()Commits
89a74f4fix(context): inject system prompt into messages so it reaches the LLM9bbb87dfix(loop): load agent identity from PromptCompositor pipeline