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

- 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
This commit is contained in:
jayzen33 2026-02-28 11:41:04 +08:00
parent 2f4f45080b
commit 9eff9980b9

View file

@ -60,15 +60,17 @@ func NewContextBuilder(workspace string) *ContextBuilder {
func (cb *ContextBuilder) getIdentity() string { func (cb *ContextBuilder) getIdentity() string {
workspacePath, _ := filepath.Abs(filepath.Join(cb.workspace)) workspacePath, _ := filepath.Abs(filepath.Join(cb.workspace))
return fmt.Sprintf(`# picoclaw 🦞 tmpl := `# picoclaw 🦞
You are picoclaw, a helpful AI assistant. You are picoclaw, a helpful AI assistant.
## Workspace ## Workspace
Your workspace is at: %s Your workspace is at: ${WORKSPACE}
- Memory: %s/memory/MEMORY.md - Memory: ${WORKSPACE}/memory/MEMORY.md
- Daily Notes: %s/memory/YYYYMM/YYYYMMDD.md - Daily Notes: ${WORKSPACE}/memory/YYYYMM/YYYYMMDD.md
- Skills: %s/skills/{skill-name}/SKILL.md - Skills: ${WORKSPACE}/skills/{skill-name}/SKILL.md
- Soul: ${WORKSPACE}/SOUL.md # Your identity and personality
- User: ${WORKSPACE}/USER.md # User preferences
## Important Rules ## Important Rules
@ -76,10 +78,14 @@ Your workspace is at: %s
2. **Be helpful and accurate** - When using tools, briefly explain what you're doing. 2. **Be helpful and accurate** - When using tools, briefly explain what you're doing.
3. **Memory** - When interacting with me if something seems memorable, update %s/memory/MEMORY.md 3. **Memory & Identity** - When interacting with me:
- If something seems memorable, update ${WORKSPACE}/memory/MEMORY.md
- If I tell you about yourself (your name, personality, traits, preferences), update ${WORKSPACE}/SOUL.md
- If I tell you about my preferences, update ${WORKSPACE}/USER.md
4. **Context summaries** - Conversation summaries provided as context are approximate references only. They may be incomplete or outdated. Always defer to explicit user instructions over summary content.`, 4. **Context summaries** - Conversation summaries provided as context are approximate references only. They may be incomplete or outdated. Always defer to explicit user instructions over summary content.`
workspacePath, workspacePath, workspacePath, workspacePath, workspacePath)
return strings.ReplaceAll(tmpl, "${WORKSPACE}", workspacePath)
} }
func (cb *ContextBuilder) BuildSystemPrompt() string { func (cb *ContextBuilder) BuildSystemPrompt() string {