Create server/app/modules/persona-memory.js:
- PostgreSQL connection to age_os database
- Load 5-page notebook (identity, relationships, world, feelings, timeline)
- Load recent memory anchors (top 8 by importance)
- Load recent light tree leaves (last 3 for awakening context)
- Load relationship network
- Load user-specific memories for personalized responses
- Build enriched system prompt with all memory context
- Record conversation memories asynchronously after replies
- Grow light tree leaves for important conversations
- 5-minute cache for persona memory to reduce DB load
- Full graceful degradation: DB down → static persona prompt
Update chat-engine.js:
- Import and use persona-memory for enriched system prompts
- Record memory after each successful API response
- Grow tree leaves for important conversations
Update domestic-llm-gateway.js:
- Use persona-memory for enriched system prompts
- Record memory after successful CN relay and direct API responses
Update server.js:
- Load persona-memory module
- Add GET /api/memory/status endpoint
Add pg dependency to server/app/package.json
Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/2e09fb7c-c501-4223-8734-5afac689ded9
Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>