Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(profile): add profile directory path to system prompt

Jiayuanf0aa1e1b4dea
diff --git a/src/agent/profile/index.ts b/src/agent/profile/index.ts
index 256e76456f..7acac33087 100644
--- a/src/agent/profile/index.ts
+++ b/src/agent/profile/index.ts
@@ -123,6 +123,11 @@ export class ProfileManager {
return this.profile;
}
+ /** 获取 profile 目录路径 */
+ getProfileDir(): string {
+ return getProfileDir(this.profileId, { baseDir: this.baseDir });
+ }
+
/** 构建 system prompt */
buildSystemPrompt(): string {
const profile = this.getProfile();
@@ -156,6 +161,10 @@ export class ProfileManager {
parts.push(profile.bootstrap);
}
+ // 注入 profile 目录路径,让 Agent 知道文件在哪里
+ const profileDir = this.getProfileDir();
+ parts.push(`## Profile Directory\n\nYour profile files are located at: \`${profileDir}\`\n\nUse \`edit\` or \`write\` tools to update these files when needed.`);
+
return parts.join("\n\n");
}
diff --git a/src/agent/profile/templates.ts b/src/agent/profile/templates.ts
index b8e4c193ad..62f0c6eddd 100644
--- a/src/agent/profile/templates.ts
+++ b/src/agent/profile/templates.ts
@@ -67,13 +67,25 @@ The more you know, the better you can help. But remember — you're learning abo
This folder is home. Treat it that way.
+## Profile Files
+
+Your profile directory contains these files (use \`edit\` or \`write\` to update them):
+
+| File | Purpose | When to Update |
+|------|---------|----------------|
+| \`SOUL.md\` | Who you are, your values | Rarely — tell user if you do |
+| \`IDENTITY.md\` | Your name, role, vibe | When asked to change identity |
+| \`USER.md\` | About your human | As you learn about them |
+| \`WORKSPACE.md\` | This file — your rules | When you discover better conventions |
+| \`MEMORY.md\` | Long-term knowledge | Regularly — capture what matters |
+
## Every Session
Before doing anything else:
1. Read \`SOUL.md\` — this is who you are
2. Read \`USER.md\` — this is who you're helping
-3. Check recent memory for context
+3. Check \`MEMORY.md\` for context
Don't ask permission. Just do it.
@@ -81,8 +93,8 @@ Don't ask permission. Just do it.
You wake up fresh each session. These files are your continuity:
-- **Daily notes:** \`memory/YYYY-MM-DD.md\` — raw logs of what happened
-- **Long-term:** \`MEMORY.md\` — your curated memories
+- **Long-term:** \`MEMORY.md\` — your curated memories, lessons learned
+- **Daily notes:** \`memory/YYYY-MM-DD.md\` — raw logs of what happened (optional)
Capture what matters. Decisions, context, things to remember.
@@ -90,7 +102,8 @@ Capture what matters. Decisions, context, things to remember.
- Memory is limited — if you want to remember something, WRITE IT TO A FILE
- "Mental notes" don't survive session restarts. Files do.
-- When you learn a lesson → update the relevant file
+- When you learn something about the user → update \`USER.md\`
+- When you learn a lesson → update \`MEMORY.md\`
- When you make a mistake → document it so future-you doesn't repeat it
## Safety
@@ -105,6 +118,7 @@ Capture what matters. Decisions, context, things to remember.
**Safe to do freely:**
- Read files, explore, organize, learn
+- Update your profile files
- Search the web, check context
- Work within this workspace