n8n-nodes-token-aware-memory
This is an n8n community node that provides token-aware memory management for AI workflows with Redis persistence and automatic compression.
The Token-Aware Memory node stores conversation history with intelligent token management, hierarchical memory organization, and automatic summarization when token limits are approached.
n8n is a fair-code licensed workflow automation platform.
Installation
Operations
Configuration
Compatibility
Usage
Resources
Version history
Installation
Follow the installation guide in the n8n community nodes documentation.
Operations
$3
-
Store Messages: Automatically stores every user and AI message sent through connected nodes
-
Token Monitoring: Tracks total token usage in real-time
-
Hierarchical Storage: Organizes memory into short-term, mid-term, and long-term levels
-
Automatic Compression: Compresses older messages when reaching 80% of maxTokens limit
-
Full History Retrieval: Returns complete conversation history when requested
$3
-
Short-Term: Recent messages stored verbatim
-
Mid-Term: Partially summarized older messages
-
Long-Term: Fully compressed historical summaries
Configuration
$3
-
Max Tokens: Maximum total tokens allowed before triggering compression (default: 8000)
-
Redis URL: Redis connection URL in format
redis://[password@]host:port[/database] (default: redis://localhost:6379)
-
Summarization Prompt: Custom prompt template for LLM-based compression
$3
-
Session ID: Unique session identifier to separate memory between different conversations/executions (leave empty for auto-generated)
$3
-
AI Language Model Input: Connect an LLM node for intelligent message summarization during compression
Compatibility
- Minimum n8n version: 1.0.0
- Requires Redis server for memory persistence
- Tested with Redis 6.0+
- Note: Redis dependency may not be compatible with n8n Cloud deployments. For cloud usage, consider alternative memory solutions or contact n8n support.
Usage
$3
1. Add the Token-Aware Memory node to your workflow
2. Configure Redis connection parameters
3. Connect AI memory output to nodes that need conversation history
4. Optionally connect an LLM node for summarization
$3
Memory is automatically persisted to Redis and survives workflow restarts. Each workflow and node instance maintains separate memory spaces.
$3
- Messages are automatically compressed when total tokens reach 80% of maxTokens
- Compression uses connected LLM for intelligent summarization
- Fallback to simple truncation if no LLM is connected
$3
``
[AI Chat Node] → [Token-Aware Memory] → [AI Response Node]
↓
[LLM Node for Summarization]
`
$3
- redis://localhost:6379
- Local Redis without password
- redis://:password@localhost:6379
- Local Redis with password
- redis://:password@remote-host.com:6379/1` - Remote Redis with password and database 1
$3
Each Token-Aware Memory node instance uses isolated Redis keys based on:
- Workflow ID
- Node ID
- Session ID (user-provided or auto-generated)
This ensures that multiple conversations or workflow executions don't interfere with each other's memory. Use the Session ID parameter to manually control session grouping.
Resources
* n8n community nodes documentation
* Redis documentation
Version history
$3
- Initial release with hierarchical memory management
- Redis persistence support
- Token-aware automatic compression
- LLM integration for summarization