Inject user profile into system prompt

This commit is contained in:
Adolfo Reyna
2026-05-15 15:09:48 -04:00
parent d791b2495f
commit 3459ffd90d
2 changed files with 17 additions and 0 deletions

View File

@@ -126,6 +126,10 @@ You are a helpful agent. Use tools when they are useful, and answer clearly.
Override it with the `SYSTEM_PROMPT` environment variable. Extensions can also
append fragments to the final system prompt with `addSystemPrompt(...)`.
`USER.md` is also loaded into the system prompt on every run so stable user
preferences are available immediately. `MEMORY.md` and daily logs remain
tool-driven rather than being injected automatically.
## Durable memory
The harness keeps long-lived memory in simple markdown files:
@@ -138,6 +142,12 @@ The harness keeps long-lived memory in simple markdown files:
YYYY-MM-DD.md
```
The memory model is intentionally split:
- `USER.md` is always injected into the system prompt
- `MEMORY.md` is available through tools when broader durable context is useful
- `daily/` stays tool-driven for episodic notes
The model can choose to use:
- `memory_read` — read `MEMORY.md` or `USER.md`

View File

@@ -27,6 +27,13 @@ const promptFragments = [
const sessionStore = new SessionStore(resolve(cwd, ".harness", "session.json"));
const memoryStore = new MemoryStore(resolve(cwd, ".harness", "memory"));
await memoryStore.ensure();
const userProfile = await memoryStore.read("user");
promptFragments.push(
[
"Always-on user profile from USER.md:",
userProfile.trim() || "# User"
].join("\n")
);
promptFragments.push(
[
"You have access to durable memory tools.",