Skip to main content

🧬 SoulAdapt

An adaptation & sincerity layer for AI companions. Companion to SoulMemory.

PyPI version Python License


🎯 Why SoulAdapt?

Most AI companions either invent memories or treat every user exactly the same. SoulAdapt fixes both:

  • 🎛️ Adapts how the AI talks: style, sensitive topics, interests
  • 💎 Never invents: calibrates honesty to the real memory signal
  • 🪶 Zero dependencies: pure Python standard library
  • 🤝 Compatible, not dependent: works with SoulMemory or any object with .recall()

✨ Features

Feature Description
observe() Learn something about the user
learn_from() Auto-extract observations from user text (ES/EN)
observations() What the companion learned, strongest first
forget_observation() Unlearn something
decide() How to respond: style, avoid-list, interests, honesty, tone
prompt_context() Ready-to-paste context string for LLM prompts
SincerityEngine distance → confidence → assertive / hedged / admit (EN/ES)

📦 Installation

pip install souladapt

🚀 Quick Start

Standalone (no memory connected)

from souladapt import SoulAdapt

adapt = SoulAdapt("adapt.db")

adapt.observe("Prefiere respuestas cortas", category="style")
adapt.observe("Ruptura con Ana", category="sensitive")

d = adapt.decide("hola")
# → {'style': ['Prefiere respuestas cortas'],
#    'avoid': ['Ruptura con Ana'], 'interests': [],
#    'memories': [], 'confidence': None, 'honesty': 'neutral'}

Connected to SoulMemory

from soulmemory import SoulMemory   # optional extra: pip install souladapt[soulmemory]
from souladapt import SoulAdapt

mem = SoulMemory("memory.db")
adapt = SoulAdapt("adapt.db", memory=mem)

d = adapt.decide("¿qué sabes de Ana?")
# → honesty calibrated from real recall distances

💎 The three honesty levels

confidence ≥ 0.75 → assertive   "You had coffee with Ana."
0.45 – 0.75       → hedged      "If I remember correctly: ..."
< 0.45            → admit       "I don't have a clear memory..."

The AI never invents: if the memory is weak, it admits it.

🎭 Mood-based tone

When connected to a memory with emotional_timeline(), decide() reads the user's current mood and recommends a tone:

sadness / fear -> gentle (soft, warm) anger / disgust -> careful (calm, respectful) joy / surprise -> energetic (match the energy)

🤖 Auto-learning

adapt.learn_from('Prefiero respuestas cortas')   # -> style
adapt.learn_from("Me encantan los gatos")        # → interests
adapt.learn_from("No me hables de política")     # → sensitive

🤝 The contract (duck typing)

SoulAdapt never imports SoulMemory. Any object satisfies the contract if it has:

.recall(query, limit)  → list of dicts with "content" and "distance"

SoulMemory satisfies it out of the box. So does your own memory system.

️ Observation categories

style     → how to talk to the user ("short answers", "casual tone")
sensitive → topics to handle with care ("breakup with Ana")
interests → what they like ("cats", "gym")
general   → everything else

📚 API Reference

SoulAdapt(db_path="souladapt.db", memory=None)

Create an adapter. memory is any SoulMemory-like object (optional).

observe(content, category="general")

Register something learned about the user. Repeated observations get reinforced, not duplicated.

observations(category=None)

Get learned observations, strongest first.

forget_observation(observation_id)

Delete an observation: the companion unlearns it.

decide(query, limit=3)

Decide HOW the AI should respond. Returns style hints, topics to avoid, interests, evaluated memories, confidence and honesty level.

close()

Close the database connection.

🎬 Examples

python examples/demo_adapt.py   # standalone + connected to SoulMemory

🗺️ Roadmap

  • Observations (reinforcement learning-lite)
  • decide() adaptation layer
  • SincerityEngine (3 honesty levels)
  • Auto-learning (learn_from(), ES/EN)
  • Mood-based tone adaptation
  • Bilingual sincerity phrases
  • prompt_context() for LLM integration
  • Habit & routine detection
  • Observation decay (unlearning over time)
  • Multi-user support

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments


Made with ❤️ as part of the Soul ecosystem

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

souladapt-0.2.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

souladapt-0.2.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file souladapt-0.2.0.tar.gz.

File metadata

  • Download URL: souladapt-0.2.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for souladapt-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0c332079b9abfd8c4fd980a3e5717b6c1f4eda401984f89f5780b0a4c4d74e74
MD5 da0f74a26ea73974a477a285d3a47554
BLAKE2b-256 c37a7fcdfedfd9612719d16f07bd4f2eab2f8948a8fd12e8a91b7af892c03c6f

See more details on using hashes here.

File details

Details for the file souladapt-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: souladapt-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for souladapt-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00c361fbb308f1b1268e1de9fefbf2a622c944bdcd0b8cee579ff322c7131f14
MD5 86fbca7ac62133632bc91ed52c5a6484
BLAKE2b-256 a4c4c678ea12e6a4ce9449c85227cb4a95ed0b1669f42fef0ffb245563d97f16

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page