Agent Memory Skill
This skill provides a persistent, searchable memory bank that automatically syncs with project documentation. It runs as an MCP server to allow reading/writing/searching of long-term memories.
Prerequisites
- Node.js (v18+)
Setup
Clone the Repository: Clone the
agentMemoryproject into your agent's workspace or a parallel directory:git clone https://github.com/webzler/agentMemory.git .agent/skills/agent-memoryInstall Dependencies:
cd .agent/skills/agent-memory npm install npm run compileStart the MCP Server: Use the helper script to activate the memory bank for your current project:
npm run start-server <project_id> <absolute_path_to_target_workspace>Example for current directory:
npm run start-server my-project $(pwd)
Capabilities (MCP Tools)
memory_search
Search for memories by query, type, or tags.
- Args:
query(string),type?(string),tags?(string[]) - Usage: "Find all authentication patterns" ->
memory_search({ query: "authentication", type: "pattern" })
memory_write
Record new knowledge or decisions.
- Args:
key(string),type(string),content(string),tags?(string[]) - Usage: "Save this architecture decision" ->
memory_write({ key: "auth-v1", type: "decision", content: "..." })
memory_read
Retrieve specific memory content by key.
- Args:
key(string) - Usage: "Get the auth design" ->
memory_read({ key: "auth-v1" })
memory_stats
View analytics on memory usage.
- Usage: "Show memory statistics" ->
memory_stats({})
Dashboard
This skill includes a standalone dashboard to visualize memory usage.
npm run start-dashboard <absolute_path_to_target_workspace>
Access at: http://localhost:3333
Guidelines
Operational Guidelines
The following operational guidelines ensure consistent memory management and agent behavior:
Memory Synchronization: Regularly sync memory content with project documentation to maintain data consistency.
Query Optimization: Implement efficient search strategies to retrieve relevant information quickly.
Knowledge Preservation: Archive historical decisions and patterns for future reference and analysis.
Performance Monitoring: Track memory usage metrics to identify optimization opportunities.
Examples
Example 1: Memory Search
{
"query": "authentication",
"type": "pattern",
"tags": ["security", "identity"]
}
Example 2: Memory Write
{
"key": "auth-v1",
"type": "decision",
"content": "Authentication patterns implemented for secure access control.",
"tags": ["security", "v1"]
}
Example 3: Memory Read
{
"key": "auth-v1",
"result": {
"status": "active",
"lastUpdated": "2024-01-15T10:30:00Z",
"metrics": {
"accessCount": 150,
"responseTime": "120ms"
}
}
}
Example 4: Memory Statistics
{
"totalMemories": 45,
"activePatterns": 12,
"recentDecisions": 8,
"performanceScore": 92
}