Persistent Context¶
Extends SimpleContextManager with persistent file loading for cross-session memory.
Module ID¶
context-persistent
Installation¶
contexts:
- module: context-persistent
source: git+https://github.com/microsoft/amplifier-module-context-persistent@main
config:
memory_files:
- ./AGENTS.md
- ./PROJECT.md
- ~/.amplifier/AGENTS.md
max_tokens: 200000
compact_threshold: 0.92
Configuration¶
| Option | Type | Default | Description |
|---|---|---|---|
memory_files | list | [] | Context files to load at session start |
max_tokens | int | 200000 | Maximum token limit |
compact_threshold | float | 0.92 | Compaction threshold (0-1) |
Features¶
- Inherits from SimpleContextManager: All base functionality
- File loading at session start: Automatically loads configured files
- Graceful error handling: Skips missing files with warnings
- Clear context labeling: Each loaded file is labeled
- Home directory expansion: Supports
~/paths
How It Works¶
- Session Start: Loads all configured files
- File Processing: Each file added as system message
- Context Labeling: Files labeled (e.g.,
[Context from AGENTS.md]) - Error Handling: Missing files skipped with warnings
- Normal Operation: Behaves like SimpleContextManager
Usage¶
[session]
context = "context-persistent"
[context]
memory_files = [
"./TEAM_STYLE_GUIDE.md",
"./PROJECT_ARCHITECTURE.md"
]
Perfect for:
- Team context files
- Project-specific knowledge
- Personal AI preferences
Repository¶
→ GitHub