Skip to main content

Dusha

Dusha (Russian: душа, [dʊˈʂa], "soul") is a small HTTP API and a proxy that stores messages, identity, memories, affect state—anything makes your agent yours— outside your harness. Any client that can add a custom provider are able to use it, so you can hop between harnesses (or even use multiple at once!) and still get the same soul on the other side.

Almost everything is configurable through JSON. For things that aren't, dusha is also built on everything-is-a-plugin architecture, so you can easily wire an external memory provider, or do crazy things like writing your own emotion system!

Quickstart

uv tool install dusha
dusha serve <name>

This starts a companion named <name>. On the first run it makes the folder ~/.config/dusha/<name>/ and writes a config.json. Then on the same or another device, run:

$ dusha proxy <name>

<name> isn't connected to a server yet.
? Connect to: (Use arrow keys)
   The server on this machine (http://127.0.0.1:8765)
 » Another server

? Server URL http://100.145.95.87:8765
? Server token, empty for none **********

Connected to http://100.145.95.87:8765.
Saved ~/.config/dusha/<name>/config.json.

Add a custom provider:

$ dusha proxy <name> auth login # Add a provider profile from the models.dev catalog

? Provider (Use arrow keys, type to filter)
 » 302.AI (302ai)
   Abacus (abacus)
   abliteration.ai (abliteration-ai)
   above.dev (above)
   AgentRouter (agentrouter)
   Agnes AI (agnes)
   ...

Success!
New provider 302ai added to <name> at http://127.0.0.1:8766/302ai.
Restart dusha proxy <name> to use it.

$ dusha proxy <name>

INFO:     Started server process [3970524]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8766 (Press CTRL+C to quit)

Now in your harness or app, point your endpoint at the URL auth login gave you: in this case, http://127.0.0.1:8766/302ai and you're good to go.

Optionally (but recommended), add MCP.

How it works

user message → dusha proxy → injects context → routed to upstream model → reply → (harness, dusha).

Dusha adds context "after" each message so cache can hit.

How do messages, memory, affect, and identity work in Dusha by default?
  • Messages: Basic SQLite FTS5 plus optional embedding search. An plugin can do everything you can imagine if that's not enough.
  • Evergreen: Long-term facts that you edit from the CLI and your companion edits through integration tools. No automatic extraction.
    • Think of it as a USER.md but with proper lifecycle management and duplication prevention.
  • Affect: A deterministic emotion engine that uses values like {"anger": 0.35} and shifts over time, including when the user goes unresponsive. Of course, you can make your own!
    • Side note is that Message intent analysis can also be an external plugin. drop system_one plugin in examples/ or any other classifier plugin into the plugins directory, and its decide listener picks which emotion each user message moves.
  • Identity: identity.md, or name your own.

Plugin

Everything is a plugin in dusha. Identity, memory, evergreen, memo, affect, and proactive are built in that you can alter/disable. You can also create a plugin under the plugins directory holding pyproject.toml with a [tool.dusha] table.

[tool.dusha]
entry = "my_plugin"
inject = ["messages", "cli", "mcp"]

The module defines apply(ctx, config), which runs at startup with the plugin's options from config.json. inject lists the services the plugin calls, and a plugin whose service is missing stays inactive. External plugins share the gateway's Python environment, so install their dependencies there.

Call Effect
ctx.on("message", fn) fn(message) runs for every stored message, in id order.
ctx.on("context", fn) fn(request) runs for every context build. Return a Block from dusha.hooks or None.
ctx.on("decide", fn) fn(request) runs for every new user message while affect is on. Return {"emotion": "<dimension>"}, {"deltas": {"<dimension>": <number>}}, both, or None.
ctx.on("<event>", fn) fn(*args) runs when a plugin emits <event>.
ctx.interval(seconds, fn) fn() runs on that interval.
ctx.on_dispose(fn) fn() runs on shutdown.
ctx.data_dir The plugin's private directory.
ctx.name The plugin's name.
ctx.error A non-empty string marks the plugin failed in /state/v1/plugins.
ctx.provide(name, value) Publishes a service other plugins can inject.
ctx.emit(event, ...) Calls every listener of event.
ctx.collect(event, ...) Calls every listener and returns {"<plugin>": <result>}.
ctx.api The gateway's FastAPI router.
ctx.cli The command registry, see Commands.
ctx.mcp The MCP tool registry, see Tools.
ctx.<service>.<method>(...) Calls an injected service: messages, companion, affect, evergreen, memo, proactive.

The first emotion in plugins order wins, and deltas from every plugin merge. See the Plugin API for hook fields and service methods.

Commands

You can add CLI commands to your plugin. The dusha CLI is just another client to access dusha, so for example you can do things like:

from dusha.commands import arg, option


def apply(ctx, config):
    notes = ctx.cli.group("notes", "Manage notes")
    notes.command(
        "add",
        lambda text, pinned, tags: {"note": save(text, pinned, tags)},
        help="Add a note",
        args=[arg("text"), option("pinned", bool), option("tags", repeated=True)],
    )

dusha notes add "Buy tea" --pinned --tags home --tags errand sends the values to the server as JSON and prints the handler's return value as JSON. As you can see, dusha builds --help list dynamically from registered commands. But it also caches the last command list, so --help works while the server is down.

Helper Makes
arg(name, type=str, help="", choices=(), optional=False, repeated=False) A positional argument.
option(name, type=str, help="", default=None, choices=(), required=False, repeated=False) --name, with each underscore as a dash. A bool option is a flag.

Tools & MCP

Dusha exposes a HTTP MCP per each companion. It takes the same arg and option specs as a CLI command, so it's pretty easy to add tools for dusha MCP in your own plugin:

from dusha.commands import arg


def apply(ctx, config):
    ctx.mcp.tool(
        "notes_add",
        lambda text: {"note": save(text)},
        help="Add a note the companion keeps.",
        args=[arg("text", help="Note text.")],
    )

For clients that you'd like to receive proactive messages from, use integration for each platform under integrations/, or build your own there.

Documentation

Verisioning

With version 1.0.21, dusha entered 5:Stable/Production on PyPI. I will avoid breaking changes in minor and patch releases and deprecate features before removing them.

Note that dusha's version always ends in .21. Every release bumps only the numbers in front of it (0.0.21 → 0.1.21 → 1.0.21).

Why?

The weight of soul is said to be 21 grams. Dusha is a software with a soul, and I hope it stays that way forever.

Acknowledgement

Sincere gratitude to:

  • Drivesoid for their 16-emotion system and base/mood cycle.
  • Omemo for their gateway-as-memory-layer idea.

Metadata

Release files for dusha 1.0.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dusha 1.0.21
File Size Uploaded Provenance Actions
dusha-1.0.21.tar.gz 88.7 kB With provenance Details for dusha-1.0.21.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dusha 1.0.21
File Interpreter ABI Platform Actions
dusha-1.0.21-py3-none-any.whl Python 3 none any Details for dusha-1.0.21-py3-none-any.whl

Total release size: 179.0 kB

Release files / dusha-1.0.21.tar.gz

Download URL dusha-1.0.21.tar.gz
Size 88.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f67dd8d6294a9a2b67939e5292bb65c28425a383b00407ec4fc1e8cbe21397d0
BLAKE2b-256 checksum
How to use checksums
8c24c95578a3c4e2688ed0271c049df63f42d277b1e062e6dd9070b0f2f499ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / dusha-1.0.21-py3-none-any.whl

Download URL dusha-1.0.21-py3-none-any.whl
Size 90.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75e05f4d19096a0bfe3c4c3ba19170be16e6dd98bf772c0fd7ed3ace54966cd8
BLAKE2b-256 checksum
How to use checksums
89459a779ff73c67065a5f6cf6e2e93f6386bebd28f63f07108a10710fcc0ca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for dusha 1.0.21

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dusha-1.0.21.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page