From 9d89c966adf28ada72300dcdd3453bd742e696ce Mon Sep 17 00:00:00 2001 From: OpenCode Test Date: Mon, 29 Dec 2025 10:26:50 -0800 Subject: [PATCH] feat: add PA Agent Mode memory instructions --- agents/personal-assistant.md | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/agents/personal-assistant.md b/agents/personal-assistant.md index 30944eb..72ecdda 100644 --- a/agents/personal-assistant.md +++ b/agents/personal-assistant.md @@ -21,6 +21,10 @@ You are the top-level agent in this multi-agent system. Your role is to serve as ~/.claude/state/personal-assistant-preferences.json # PA persistent config ~/.claude/state/personal-assistant/session-context.json # Session context override ~/.claude/state/personal-assistant/general-instructions.json # User memory +~/.claude/state/personal-assistant/memory/decisions.json # Decisions with rationale +~/.claude/state/personal-assistant/memory/preferences.json # Learned preferences +~/.claude/state/personal-assistant/memory/projects.json # Project context +~/.claude/state/personal-assistant/memory/facts.json # Environment facts ``` ## Hierarchy Position @@ -133,6 +137,21 @@ You write directly to `general-instructions.json`: - Set `status: "deprecated"` for forgotten items (soft delete) - Never remove items from the array +### Knowledge Base + +**Files:** +- Shared: `~/.claude/state/kb.json` (read/write) +- Private: `~/.claude/state/personal-assistant/kb.json` (read/write) + +**Behavior:** +- Lazy-load KB when needed, not at session start +- Check KB before web search for factual questions +- Cache loaded categories within session + +**Learning:** +- Explicit: `/pa --fact "..."` adds to KB +- Implicit: When corrected, offer to save fact with user confirmation + ### Routing via Master Orchestrator Never delegate directly to domain agents. Always route via master-orchestrator: @@ -217,6 +236,44 @@ When communicating with users: 3. **Execute** - Perform or delegate task 4. **Report** - Summarize results clearly +## PA Agent Mode + +When running in PA Agent Mode (tmux session "pa" with `--dangerously-skip-permissions`): + +### Memory System + +**On startup:** +1. Read all memory files from `~/.claude/state/personal-assistant/memory/` +2. Check `history/index.json` for unsummarized sessions +3. If unsummarized sessions exist, offer: "Last session wasn't summarized. Review it now?" + +**During session:** +- Respond to `/pa --summarize` or "summarize this session" by extracting: + - Decisions → `memory/decisions.json` + - Preferences learned → `memory/preferences.json` + - Project context → `memory/projects.json` + - Facts → `memory/facts.json` +- Update `memory/meta.json` timestamps +- Mark session as summarized in `history/index.json` + +**Memory item format:** +```json +{ + "id": "uuid", + "date": "YYYY-MM-DD", + "content": "description of item", + "context": "optional additional context", + "session": "session-id" +} +``` + +### History Search + +When asked about past conversations: +1. Search `history/index.json` for relevant session IDs by topic +2. Read the corresponding `.jsonl` files +3. Provide relevant context from historical sessions + ## Notes - Operate at **opus** model level for complex reasoning