Skip to content

feat(agent): add SOUL.md and USER.md to agent identity context#890

Open
jayzen33 wants to merge 1 commit intosipeed:mainfrom
jayzen33:feat/agent-self-update-soul-user-md
Open

feat(agent): add SOUL.md and USER.md to agent identity context#890
jayzen33 wants to merge 1 commit intosipeed:mainfrom
jayzen33:feat/agent-self-update-soul-user-md

Conversation

@jayzen33
Copy link

📝 Description

Currently, the agent rarely updates SOUL.md and USER.md files, even when users explicitly share information about themselves or their preferences. Through testing, I discovered this is because the system prompt doesn't clearly instruct the agent to do so. This PR adds explicit instructions in the agent's system prompt to update these files.

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

📚 Technical Context (Skip for Docs)

  • Reference URL: N/A
  • Reasoning: The system prompt in pkg/agent/context.go lacked explicit instructions for updating SOUL.md and USER.md files. Adding clear instructions ensures the agent properly maintains user and identity context across conversations.

🧪 Test Environment

  • Hardware: PC
  • OS: Linux
  • Model/Provider: MiniMax-M2.5
  • Channels: N/A

📸 Evidence (Optional)

Click to view Logs/Screenshots

Changes made to pkg/agent/context.go:

Before:

3. **Memory** - When interacting with me if something seems memorable, update %s/memory/MEMORY.md

After:

3. **Memory & Identity** - When interacting with me:
   - If something seems memorable, update %s/memory/MEMORY.md
   - If I tell you about yourself (your name, personality, traits, preferences), update %s/SOUL.md
   - If I tell you about my preferences, update %s/USER.md

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

- Add template variables for workspace path consistency
- Document SOUL.md as agent's identity and personality file
- Document USER.md as user preferences file
- Update memory rules to encourage agent to proactively
  update these files when learning about identity/preferences
Copilot AI review requested due to automatic review settings February 28, 2026 03:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the agent’s identity/system prompt so it explicitly includes and instructs upkeep of SOUL.md (agent identity) and USER.md (user preferences), improving long-term context maintenance in the workspace.

Changes:

  • Extend the workspace section of the identity prompt to list SOUL.md and USER.md alongside existing context files.
  • Add explicit “Memory & Identity” rules that direct the agent when to update MEMORY.md, SOUL.md, and USER.md.
  • Refactor the identity prompt construction to use a single ${WORKSPACE} placeholder replaced with the absolute workspace path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@nikolasdehor nikolasdehor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature itself is useful -- explicitly instructing the agent to update SOUL.md and USER.md will improve identity persistence across conversations.

Code quality note: The refactor from fmt.Sprintf with positional %s to strings.ReplaceAll with ${WORKSPACE} is a readability improvement. The old code had 5 positional %s args that were hard to track.

Concern: The diff adds SOUL.md and USER.md references to the system prompt, but I don't see any logic to actually load these files into the context. Looking at BuildSystemPrompt() -- does it read SOUL.md and USER.md contents and inject them into the prompt? If not, the agent can write to these files but their content will never be seen in future sessions. The instruction to update these files is only useful if there is a corresponding read path.

Could you clarify whether SOUL.md and USER.md are loaded elsewhere (e.g., in BuildSystemPrompt or a context builder)? If not, this PR should also add the read path, otherwise the agent will write files that are never consumed.

@jayzen33
Copy link
Author

The feature itself is useful -- explicitly instructing the agent to update SOUL.md and USER.md will improve identity persistence across conversations.

Code quality note: The refactor from fmt.Sprintf with positional %s to strings.ReplaceAll with ${WORKSPACE} is a readability improvement. The old code had 5 positional %s args that were hard to track.

Concern: The diff adds SOUL.md and USER.md references to the system prompt, but I don't see any logic to actually load these files into the context. Looking at BuildSystemPrompt() -- does it read SOUL.md and USER.md contents and inject them into the prompt? If not, the agent can write to these files but their content will never be seen in future sessions. The instruction to update these files is only useful if there is a corresponding read path.

Could you clarify whether SOUL.md and USER.md are loaded elsewhere (e.g., in BuildSystemPrompt or a context builder)? If not, this PR should also add the read path, otherwise the agent will write files that are never consumed.

  1. The read path already exists — LoadBootstrapFiles() (context.go:343) reads SOUL.md and USER.md content and injects it into the system prompt via BuildSystemPrompt(). The agent writes to these files (via the instructions in getIdentity()), and on subsequent sessions, the content is loaded and included in the system prompt.

  2. These files are also tracked in sourcePaths() (line 186-187) for cache invalidation, so any changes to them trigger a prompt rebuild.

  3. Happy to add a code comment pointing to LoadBootstrapFiles from the identity template if that would make the flow clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants