Skip to content

Commit dd818a7

Browse files
GeneAIclaude
authored andcommitted
chore: Repository cleanup - add build artifacts to .gitignore
- Add htmlcov_logging/ to .gitignore - Add dump.rdb (Redis) to .gitignore - Remove 10_9_2025_ai_nurse_florence folder - Remove book-indesign alias files Reduces root directory clutter from 110 to 84 items. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 32d3adc commit dd818a7

File tree

4 files changed

+232
-219
lines changed

4 files changed

+232
-219
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ wheels/
3636
.pytest_cache/
3737
.coverage
3838
htmlcov/
39+
htmlcov_logging/
3940

4041
# Healthcare Wizards (top-level only - keep plugin wizards)
4142
/wizards/
@@ -95,6 +96,9 @@ convert_pitch_deck.sh
9596
# Logs
9697
logs/
9798

99+
# Redis dump
100+
dump.rdb
101+
98102
# MCP Registry tokens (credentials)
99103
.mcpregistry_*
100104

Lines changed: 76 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
---
2-
title: Give Claude Persistent Memory in 10 Lines of Python (Now with 80% Cost Savings)
2+
title: Give Your AI Persistent Memory (and Cut Costs 80%)
33
published: false
4-
description: How to make Claude remember your preferences across sessions using the Empathy Framework v3.0.1
5-
tags: python, ai, claude, anthropic, openai
4+
description: How to make Claude/GPT remember your preferences across sessions using the Empathy Framework v3.2.5
5+
tags: python, ai, claude, openai, llm
66
cover_image:
77
---
88

9-
# Give Claude Persistent Memory in 10 Lines of Python
9+
# Give Your AI Persistent Memory (and Cut Costs 80%)
1010

11-
Every conversation with Claude starts from scratch. Tell it you prefer concise code examples, and next session? It's forgotten.
11+
Every conversation with Claude starts from scratch. Tell it you prefer concise code examples, and next session? Forgotten.
1212

13-
Here's how to fix that—plus save 80% on API costs with v3.0.0's multi-provider system.
13+
Here's how to fix that—and save 80% on API costs while you're at it.
1414

1515
## The Problem
1616

17-
Claude's API is stateless. Each request is independent. For simple Q&A, that's fine. But for:
17+
LLM APIs are stateless. Each request is independent. For simple Q&A, that's fine. But for:
1818

1919
- Development assistants that learn your coding style
20-
- Customer support that remembers history
20+
- Support bots that remember customer history
2121
- Personal tools that adapt to preferences
2222

2323
...you need memory that persists.
2424

25-
## The Solution
25+
## The Solution: 10 Lines of Python
2626

2727
```python
2828
from empathy_llm_toolkit import EmpathyLLM
2929

3030
llm = EmpathyLLM(
3131
provider="anthropic", # or "openai", "ollama", "hybrid"
32-
api_key="your-key",
3332
memory_enabled=True
3433
)
3534

@@ -40,158 +39,115 @@ response = await llm.interact(
4039
)
4140
```
4241

43-
That's it. Next time this user connects—even days later—Claude remembers.
42+
That's it. Next time this user connects—even days later—the AI remembers.
4443

45-
## New in v3.0.1: Multi-Provider Support + XML-Enhanced Prompts
44+
## Why This Actually Matters
4645

47-
Choose your provider—or mix them:
46+
### 1. Cost Savings (80%)
4847

49-
```bash
50-
# Check available providers (auto-detects API keys)
51-
python -m empathy_os.models.cli provider status
48+
Smart routing automatically picks the right model for each task:
5249

53-
# Switch providers
54-
python -m empathy_os.models.cli provider set openai
50+
| Task | Model | Cost |
51+
|------|-------|------|
52+
| Summarize text | Haiku/GPT-4o-mini | $0.25/M tokens |
53+
| Fix bugs | Sonnet/GPT-4o | $3/M tokens |
54+
| Design architecture | Opus/o1 | $15/M tokens |
5555

56-
# Enable hybrid mode (best model from each provider)
57-
python -m empathy_os.models.cli provider set hybrid
58-
```
56+
**Real numbers:**
57+
- Without routing (all Opus): $4.05/complex task
58+
- With routing (tiered): $0.83/complex task
59+
- **Savings: 80%**
5960

60-
Supported providers:
61-
- **Anthropic** — Claude (Haiku/Sonnet/Opus)
62-
- **OpenAI** — GPT (GPT-4o-mini/GPT-4o/o1)
63-
- **Ollama** — Local models (Llama 3.2)
64-
- **Hybrid** — Best of each provider per tier
61+
```python
62+
llm = EmpathyLLM(provider="anthropic", enable_model_routing=True)
6563

66-
## Real-World Example: Debugging Wizard
64+
# Automatically routes to Haiku
65+
await llm.interact(user_id="dev", user_input="Summarize this", task_type="summarize")
6766

68-
Here's what persistent memory enables. I built a debugging wizard that correlates current bugs with historical patterns:
67+
# Automatically routes to Opus
68+
await llm.interact(user_id="dev", user_input="Design the system", task_type="coordinate")
69+
```
6970

70-
```python
71-
from empathy_software_plugin.wizards import MemoryEnhancedDebuggingWizard
71+
### 2. Bug Memory
7272

73-
wizard = MemoryEnhancedDebuggingWizard()
73+
My debugging wizard remembers every fix:
7474

75+
```python
7576
result = await wizard.analyze({
7677
"error_message": "TypeError: Cannot read property 'map' of undefined",
7778
"file_path": "src/components/UserList.tsx"
7879
})
7980

8081
print(result["historical_matches"])
81-
# Shows: "This looks like bug #247 from 3 months ago"
82-
# Suggests: "Add null check: data?.items ?? []"
83-
# Time saved: ~12 minutes
82+
# "This looks like bug #247 from 3 months ago"
83+
# "Suggested fix: data?.items ?? []"
8484
```
8585

86-
Without persistent memory, every bug starts from zero. With it, your AI assistant **remembers every fix** and suggests proven solutions.
86+
Without memory, every bug starts from zero. With it, your AI assistant **remembers every fix** and suggests proven solutions.
8787

88-
## How It Works
88+
### 3. Provider Freedom
8989

90-
The [Empathy Framework](https://github.com/Smart-AI-Memory/empathy-framework) stores user context in a memory layer that:
90+
Not locked into one provider. Switch anytime:
9191

92-
1. **Persists across sessions** - Preferences survive restarts
93-
2. **Scopes by user** - Each user has isolated memory
94-
3. **Supports projects** - Different contexts for different work
95-
4. **Includes privacy controls** - Clear memory, forget specific info
92+
```bash
93+
empathy provider set anthropic # Use Claude
94+
empathy provider set openai # Use GPT
95+
empathy provider set ollama # Use local models
96+
empathy provider set hybrid # Best of each
97+
```
9698

97-
## Five Levels of Empathy
99+
Use Ollama for sensitive code, Claude for complex reasoning, GPT for specific tasks.
98100

99-
The framework implements five collaboration levels:
101+
## Smart Router
100102

101-
| Level | Behavior | Example |
102-
|-------|----------|---------|
103-
| 1 - Reactive | Standard request-response | Basic Q&A |
104-
| 2 - Informed | Uses stored preferences | Remembers coding style |
105-
| 3 - Proactive | Offers help when stuck | Detects struggle patterns |
106-
| 4 - Anticipatory | Predicts needs | "This will break in 3 days" |
107-
| 5 - Collaborative | Full partnership | Cross-domain learning |
103+
Natural language routing—no need to know which tool to use:
108104

109105
```python
110-
# Level 4: Claude predicts and warns
111-
response = await llm.interact(
112-
user_id="dev_123",
113-
user_input="Starting a new FastAPI project",
114-
empathy_level=4
115-
)
116-
# Might warn: "You had async issues last time—here's a pattern that worked"
117-
```
118-
119-
## Privacy Built In
106+
from empathy_os.routing import SmartRouter
120107

121-
```python
122-
# Clear all memory
123-
await llm.clear_memory(user_id="dev_123")
108+
router = SmartRouter()
124109

125-
# Forget specific information
126-
await llm.forget(user_id="dev_123", pattern="email")
110+
# Natural language → right wizard
111+
decision = router.route_sync("Fix the security vulnerability in auth.py")
112+
print(f"Primary: {decision.primary_wizard}") # → security-audit
113+
print(f"Confidence: {decision.confidence}") # → 0.92
127114
```
128115

129-
## Results
130-
131-
On a real codebase (364 debt items, 81 security findings):
132-
133-
- **Bug correlation**: 100% similarity matching with proven fixes
134-
- **Security noise reduction**: 84% (81 → 13 findings after learning)
135-
- **Tech debt tracking**: Trajectory predicts 2x growth in 170 days
116+
Examples:
117+
- "Fix security in auth.py" → SecurityWizard
118+
- "Review this PR" → CodeReviewWizard
119+
- "Why is this slow?" → PerformanceWizard
136120

137-
## v3.0.1: Smart Model Routing (80% Cost Savings)
121+
## Quick Start
138122

139-
Why pay Opus prices for simple tasks? The ModelRouter automatically picks the right model across any provider.
140-
141-
*API users save money. Subscription users (Max/Pro) preserve their premium model quota for complex tasks.*
142-
143-
```python
144-
llm = EmpathyLLM(
145-
provider="anthropic", # or "openai", "ollama", "hybrid"
146-
enable_model_routing=True
147-
)
123+
```bash
124+
# Install
125+
pip install empathy-framework
148126

149-
# Summarization → Haiku/GPT-4o-mini ($0.25/M tokens)
150-
await llm.interact(user_id="dev", user_input="Summarize this", task_type="summarize")
127+
# Check available providers (auto-detects API keys)
128+
empathy provider status
151129

152-
# Code generation → Sonnet/GPT-4o ($3/M tokens)
153-
await llm.interact(user_id="dev", user_input="Write a function", task_type="generate_code")
130+
# Set your provider
131+
empathy provider set anthropic
154132

155-
# Architecture → Opus/o1 ($15/M tokens)
156-
await llm.interact(user_id="dev", user_input="Design the system", task_type="architectural_decision")
133+
# See all commands
134+
empathy cheatsheet
157135
```
158136

159-
**Cost comparison on real workload:**
160-
- Without routing (all Opus): $4.05/complex task
161-
- With routing (tiered): $0.83/complex task
162-
- **Savings: 80%**
163-
164-
## v3.0.1: VSCode Dashboard + XML-Enhanced Prompts
165-
166-
The biggest additions in v3.0.1 include a complete VSCode Dashboard with **10 integrated workflows** and **XML-Enhanced Prompts** for structured, parseable LLM responses:
167-
168-
1. **Research Synthesis** — Deep dive research with citations
169-
2. **Code Review** — Comprehensive PR analysis
170-
3. **Debug Assistant** — Smart error diagnosis
171-
4. **Refactor Advisor** — Code improvement suggestions
172-
5. **Test Generator** — Automated test creation
173-
6. **Documentation Writer** — Auto-generate docs
174-
7. **Security Scanner** — Vulnerability detection
175-
8. **Performance Analyzer** — Bottleneck identification
176-
9. **Explain Code** — Code explanation for onboarding
177-
10. **Morning Briefing** — Daily project status report
137+
## What's in v3.2.5
178138

179-
Plus **6 Quick Action commands** for common tasks.
139+
- **Unified CLI** — One `empathy` command with Rich output
140+
- **Dev Container** — Clone → Open in VS Code → Start coding
141+
- **Python 3.10-3.13** — Full test matrix across all versions
142+
- **Smart Router** — Natural language wizard dispatch
143+
- **Memory Graph** — Cross-wizard knowledge sharing
180144

181-
All with real-time cost tracking showing your savings.
182-
183-
## Get Started
184-
185-
```bash
186-
pip install empathy-framework
187-
```
145+
## Resources
188146

189-
**Resources:**
190-
- **PyPI:** 3,400+ monthly downloads
191147
- [GitHub](https://github.com/Smart-AI-Memory/empathy-framework)
192-
- [Documentation](https://www.smartaimemory.com/docs)
193-
- [Live Demo](https://www.smartaimemory.com/tools/debug-wizard)
148+
- [Documentation](https://smartaimemory.com/framework-docs/)
149+
- [PyPI](https://pypi.org/project/empathy-framework/)
194150

195151
---
196152

197-
*What would you build with an AI that remembers—and costs 80% less? Drop a comment below.*
153+
*What would you build with an AI that remembers—and costs 80% less?*

0 commit comments

Comments
 (0)