fix(cli): strip line numbers from agent memory in system prompt #341
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.
When loading agent memory from
/memories/agent.md, thebackend.read()method formats content with line numbers (cat -n style), which were being injected directly into the system prompt. You can see here:https://smith.langchain.com/public/3e4c03f0-34c0-46fd-92bc-78869bea5861/r
This change adds the
_strip_line_numbers()function to remove line numbers before injecting memory content into the prompt, ensuring clean memory content without formatting artifacts. (The fix was previously implemented in PR #246 but was reverted along with other changes in PR #248.)Confirm fixed:
https://smith.langchain.com/public/3e4c03f0-34c0-46fd-92bc-78869bea5861/r