Session Memory
Session Memory is Mind Palace’s system for tracking agent work sessions, activities, learnings, and file intelligence. It enables agents to learn from past experiences and share knowledge across sessions.
Overview
Session Memory provides:
- Session Tracking: Record agent sessions with goals and outcomes
- Activity Logging: Track file reads, edits, searches, and commands
- Learnings: Capture and recall patterns, heuristics, and best practices
- File Intelligence: Track edit history, failure rates, and file-specific learnings
- Multi-Agent Coordination: Detect conflicts when multiple agents work on the same files
Sessions
A session represents a single agent’s work period in your codebase.
Starting a Session
palace session start --agent claude-code --goal "Implement user authentication"Or via MCP:
{
"tool": "start_session",
"arguments": {
"agentType": "claude-code",
"goal": "Implement user authentication"
}
}Session States
active: Session is currently runningcompleted: Session ended successfullyabandoned: Session was terminated unexpectedly
Listing Sessions
# List all sessions
palace session list
# List only active sessions
palace session list --active
# Limit results
palace session list --limit 10Ending a Session
palace session end SESSION_IDActivities
Activities record what agents do during sessions.
Activity Types
file_read: Agent read a filefile_edit: Agent modified a filesearch: Agent searched for symbols or patternscommand: Agent ran a shell command
Logging Activities
Via MCP:
{
"tool": "log_activity",
"arguments": {
"sessionId": "session-123",
"kind": "file_edit",
"target": "src/auth/login.go",
"outcome": "success",
"details": {"linesChanged": 25}
}
}Viewing Activities
# Recent activities
palace activity --limit 20
# Activities for a specific session
palace activity --session SESSION_ID
# Activities for a specific file
palace activity --file src/main.goLearnings
Learnings capture knowledge that emerged from agent work.
Scope Levels
file: Applies to a specific fileroom: Applies to a logical module/directorypalace: Applies to the entire projectcorridor: Applies across projects (via corridors)
Adding Learnings
# Add a project-wide learning
palace learn "Always run tests before committing"
# Add a file-specific learning
palace learn "This file handles rate limiting" --scope file --path src/middleware/rate.go
# Add a room-level learning
palace learn "Use prepared statements for all queries" --scope room --path databaseVia MCP:
{
"tool": "add_learning",
"arguments": {
"content": "This module requires special error handling",
"scope": "room",
"scopePath": "payment-processing",
"confidence": 0.85
}
}Recalling Learnings
# Search for relevant learnings
palace recall "authentication"
# Get learnings for a specific scope
palace recall --scope file --path auth/login.goConfidence
Learnings have a confidence score (0.0 to 1.0) that increases with reinforcement:
- Initial confidence: 0.5
- User-provided learnings start at 0.8
- Reinforced learnings increase towards 1.0
File Intelligence
File intelligence tracks the history of changes to each file.
Metrics Tracked
- Edit Count: Number of times the file was modified
- Failure Count: Number of times edits led to failures
- Last Editor: Which agent last modified the file
- Associated Learnings: Learnings specific to this file
Viewing File Intelligence
palace intel src/auth/login.goOutput:
File: src/auth/login.go
Edit Count: 15
Failure Count: 2
Failure Rate: 13.3%
Last Editor: claude-code
Last Edited: 2024-01-15 14:30:00
Associated Learnings:
- Requires integration tests after changes (confidence: 0.9)
- Sensitive security code - review carefully (confidence: 0.85)Hotspots and Fragile Files
# See most frequently edited files
palace hotspots
# See files with high failure rates
palace fragileMulti-Agent Coordination
When multiple agents work on the same codebase, Mind Palace helps prevent conflicts.
Active Agents
palace agentsConflict Detection
Via MCP:
{
"tool": "check_conflict",
"arguments": {
"path": "src/auth/login.go"
}
}Response when conflict detected:
{
"hasConflict": true,
"conflict": {
"path": "src/auth/login.go",
"otherSession": "session-456",
"otherAgent": "cursor",
"lastTouched": "2024-01-15T14:30:00Z",
"severity": "warning"
}
}Briefing
Get a quick summary before starting work:
palace briefOr for a specific file:
palace brief src/auth/login.goThe briefing includes:
- Active agents in the workspace
- Potential conflicts for the file
- Relevant learnings
- File intelligence
- Recent hotspots
MCP Tools Reference
| Tool | Description |
|---|---|
start_session | Start a new agent session |
end_session | End an active session |
log_activity | Log an activity in a session |
record_outcome | Record session outcome |
add_learning | Add a new learning |
get_learnings | Retrieve learnings by scope |
get_file_intel | Get intelligence for a file |
get_activity | Get recent activities |
check_conflict | Check for conflicts on a file |
get_active_agents | List active agents |
Best Practices
- Start sessions with clear goals: Helps track what was accomplished
- Log activities consistently: Better file intelligence and conflict detection
- Add learnings as you discover patterns: Knowledge compounds over time
- Check for conflicts before editing shared files: Prevent merge conflicts
- Review briefings before starting work: Stay informed about recent changes