memory_insights
Analyze stored memories to generate activity summaries, identify open items, suggest consolidations, and detect patterns for better context management.
Instructions
Analyze stored memories and produce actionable insights.
Returns activity summary, open items, consolidation suggestions, and optional LLM-powered pattern detection.
Args: period: Time period to analyze (e.g., "7d", "1m", "1y") include_llm_analysis: If True, use LLM to detect patterns and themes
Returns: Dictionary with: - activity_summary: Created counts by type and tag - open_items: Open TODOs and issues with stale detection - consolidation_candidates: Similar memory pairs that could be merged - llm_analysis: Themes, focus areas, gaps, and summary (or null) Rate limited: 120s cooldown.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | 7d | |
| include_llm_analysis | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- memora/server.py:1023-1050 (handler)The handler function `memory_insights` implements the MCP tool, invoking `_generate_insights` which wraps the core logic.
async def memory_insights( period: str = "7d", include_llm_analysis: bool = True, ) -> Dict[str, Any]: """Analyze stored memories and produce actionable insights. Returns activity summary, open items, consolidation suggestions, and optional LLM-powered pattern detection. Args: period: Time period to analyze (e.g., "7d", "1m", "1y") include_llm_analysis: If True, use LLM to detect patterns and themes Returns: Dictionary with: - activity_summary: Created counts by type and tag - open_items: Open TODOs and issues with stale detection - consolidation_candidates: Similar memory pairs that could be merged - llm_analysis: Themes, focus areas, gaps, and summary (or null) Rate limited: 120s cooldown. """ if msg := _check_tool_cooldown("memory_insights"): return {"error": "rate_limited", "message": msg} try: stale_days = int(os.getenv("MEMORA_STALE_DAYS", "14")) return _generate_insights(period, stale_days, include_llm_analysis) finally: _finish_tool("memory_insights")