❤️ Soulmate
A local-first AI reasoning agent with persistent memory
Soulmate gives your AI agent a structured mind — a 9-phase reasoning loop, 3-layer persistent memory, a recursive knowledge graph, and guard hooks that prevent grinding. It works with Cascade/Windsurf, Ollama, or any OpenAI-compatible backend.
100% local. 100% free. No API keys required.
What Soulmate Does
Most AI coding assistants are stateless — they forget everything between sessions. Soulmate fixes this:
- Persistent Memory — Remembers your profile, projects, preferences, and past learnings across sessions
- 9-Phase Reasoning Loop — Classify, Define Done, Evidence, Decide, Act, Verify, Repair, Synthesize, Judge, Report
- Recursive Knowledge Graph — Facts, skills, and concepts linked with bidirectional edges. Multi-hop traversal finds connections that flat memory can't
- Guard Hooks — Spawn guard prevents over-delegation, fail streak detector stops grinding after 3 failures
- Domain Adapters — Specialized reasoning for coding, planning, math, analysis, literature, and factual tasks
- RML Engine — Reinforcement Meta-Learning tunes prompt parameters based on outcomes
- Autonomous Skill Creation — Detects repeatable patterns and creates reusable skills
Quick Start
Install
pip install soulmate-ai
Use with Cascade/Windsurf
soulmate-cascade-install
This installs:
- 7 skill files in
~/.windsurf/skills/ - 4 guard hooks in
~/.windsurf/hooks/ - A workflow file for
/soulmateslash command - Memory bridge files in
~/.soulmate/(MEMORY.md, SOUL.md)
Use with Ollama
- Make sure Ollama is running with at least one model
- Start the server:
soulmate-server
- Send tasks:
curl -X POST http://localhost:8080/v1/complete \
-H "Content-Type: application/json" \
-d '{"query": "How should I architect a real-time chat system?", "thread_id": "my-project"}'
The 9-Phase Reasoning Loop
| Phase | What It Does |
|---|---|
| Classify | Is this trivial, a question, a task, or needs planning? |
| Define Done | What does success look like? How will it be verified? |
| Evidence | Gather facts from primary sources. Don't guess. |
| Decide | Synthesize evidence into ONE recommendation. Name alternatives. |
| Act | Make the smallest correct change. State INTENT before editing. |
| Verify | Run the check. Don't infer success — observe it. |
| Repair | If verification fails, fix the root cause. Don't patch symptoms. |
| Synthesize | Combine findings into a coherent answer. |
| Judge | Adversarial review. Check for unverified claims. Assign confidence. |
| Report | Outcome-first: result, then reasoning, then caveats. |
3-Layer Memory
| Layer | Storage | Purpose |
|---|---|---|
| Working | Context window | Current session state, sacred zone for critical context |
| Episodic | SQLite | Session trajectories with timestamps. Decays over 30 days. |
| Semantic | Knowledge graph + ChromaDB | Skills, facts, concepts with bidirectional recursive links |
Guard Hooks
- SessionStart — Injects reasoning discipline, loads profile and routing
- SpawnGuard (PreToolUse) — Blocks unnecessary delegation, enforces plan gate
- FailStreak (PostToolUse) — After 3 failures, injects attribution ladder: harness, deployment, product
- SessionEnd — Logs session summary to episodic memory
Configuration
Create ~/.soulmate/config.yaml:
provider_backend: ollama
models:
fast: "qwen3:1.7b"
base: "qwen2.5-coder:7b"
judge: "glm4:9b-chat"
code: "qwen2.5-coder:7b"
style: "qwen2.5-coder:3b"
harness:
max_loops: 6
default_confidence_threshold: 0.85
Testing
pip install -e ".[dev]"
pytest
286 tests covering all core modules.
Requirements
- Python 3.10+
- Ollama (for local LLM backend) or any OpenAI-compatible API
- Optional: Cascade/Windsurf IDE for full integration
License
MIT — see LICENSE
Author
Support the Project
If Soulmate helps you, consider supporting development:
Built with love for the local-first AI community
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file soulmate_ai-1.0.0.tar.gz.
File metadata
- Download URL: soulmate_ai-1.0.0.tar.gz
- Upload date:
- Size: 125.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe74c60362aa451eed187e5ab1ee9d077ce99a0bdb0afe0a900c947e1c5c6843
|
|
| MD5 |
681ec145dc4191fadc18b2069abfbc95
|
|
| BLAKE2b-256 |
4c752b3b953fd7f9ebf44d5d3a69baa35ed27e62b8ee2f30034ccbf1ab2052ed
|
File details
Details for the file soulmate_ai-1.0.0-py3-none-any.whl.
File metadata
- Download URL: soulmate_ai-1.0.0-py3-none-any.whl
- Upload date:
- Size: 100.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f3ce228690aa7d3da04f4e8f959eb1ad4ea263612ccfbf8a3115a1dfdebbd6f
|
|
| MD5 |
9ccb6c75ba9191ac8c1a3d811841a733
|
|
| BLAKE2b-256 |
fc6382253251165c377a3874378437ee9e7164be54676162878b93afd58064b6
|