Metadata-Version: 2.5
Name: songe
Version: 0.1.0a12
Summary: Local hindsight distillation for a model that sleeps.
Project-URL: Homepage, https://github.com/sous-labs/songe
Project-URL: Repository, https://github.com/sous-labs/songe
Project-URL: Issues, https://github.com/sous-labs/songe/issues
Author: Sous Labs
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Requires-Dist: gguf<1,>=0.19
Requires-Dist: httpx<1,>=0.28
Requires-Dist: jsonschema<5,>=4.26
Requires-Dist: lmstudio<2,>=1.5
Requires-Dist: mlx-lm<0.33,>=0.32; sys_platform == 'darwin' and platform_machine == 'arm64'
Requires-Dist: mlx<0.33,>=0.32.4; sys_platform == 'darwin' and platform_machine == 'arm64'
Requires-Dist: packaging<27,>=24.2
Requires-Dist: psutil<8,>=5.9
Requires-Dist: rich<16,>=15
Requires-Dist: starlette<2,>=0.49
Requires-Dist: textual<7,>=6.12
Requires-Dist: uvicorn<1,>=0.38
Provides-Extra: cuda
Requires-Dist: accelerate<2,>=1; extra == 'cuda'
Requires-Dist: bitsandbytes<1,>=0.45; (sys_platform == 'linux' or sys_platform == 'win32') and extra == 'cuda'
Requires-Dist: nvidia-ml-py>=12; (sys_platform == 'linux' or sys_platform == 'win32') and extra == 'cuda'
Requires-Dist: peft<1,>=0.21; extra == 'cuda'
Requires-Dist: protobuf<8,>=5; extra == 'cuda'
Requires-Dist: safetensors<1,>=0.5; extra == 'cuda'
Requires-Dist: sentencepiece<1,>=0.2; extra == 'cuda'
Requires-Dist: torch<3,>=2.11; extra == 'cuda'
Requires-Dist: transformers<6,>=5.22.2; extra == 'cuda'
Provides-Extra: mlx
Requires-Dist: mlx-lm<0.33,>=0.32; (sys_platform == 'darwin' and platform_machine == 'arm64') and extra == 'mlx'
Requires-Dist: mlx<0.33,>=0.32.4; (sys_platform == 'darwin' and platform_machine == 'arm64') and extra == 'mlx'
Provides-Extra: rocm
Requires-Dist: accelerate<2,>=1; extra == 'rocm'
Requires-Dist: peft<1,>=0.21; extra == 'rocm'
Requires-Dist: protobuf<8,>=5; extra == 'rocm'
Requires-Dist: safetensors<1,>=0.5; extra == 'rocm'
Requires-Dist: sentencepiece<1,>=0.2; extra == 'rocm'
Requires-Dist: torch<3,>=2.11; extra == 'rocm'
Requires-Dist: transformers<6,>=5.22.2; extra == 'rocm'
Provides-Extra: torch
Requires-Dist: accelerate<2,>=1; extra == 'torch'
Requires-Dist: peft<1,>=0.21; extra == 'torch'
Requires-Dist: protobuf<8,>=5; extra == 'torch'
Requires-Dist: safetensors<1,>=0.5; extra == 'torch'
Requires-Dist: sentencepiece<1,>=0.2; extra == 'torch'
Requires-Dist: torch<3,>=2.11; extra == 'torch'
Requires-Dist: transformers<6,>=5.22.2; extra == 'torch'
Description-Content-Type: text/markdown

# Songe

A local model that learns from how you use it.

Use your model as usual through opencode, pi or any OpenAI-compatible tool. When your agent is quiet, Songe looks at what happened after each of the model's actions — the tool result, the error, your next message — and teaches the model to see it coming. A new version is used only if it passes checks. Nothing leaves your machine.

## Install

macOS with Homebrew:

```sh
brew install sous-labs/tap/songe
songe init
```

Or with pip (Python 3.11 or later; with Homebrew's Python use `pipx install songe`):

```sh
pip install songe
songe init
```

`songe init` finds your model server and your agents, shows what it will change, and asks once. Then pick a `songe/…` model in your agent. In opencode, a local default model switches over automatically.

Needs a model served locally by LM Studio, Ollama, llama.cpp, mlx-lm or vLLM. Learning runs on Apple Silicon (MLX); Linux and Windows with NVIDIA or AMD are supported but less tested. Machines without a GPU still serve and record.

## Use

There is nothing to do. To look:

```sh
songe          # what it is doing
songe open     # dashboard in your browser
songe models   # each model and its learning level
```

To change things:

```sh
songe models MODEL off|new|all   # learning level for one model
songe undo MODEL                 # go back one version
songe pause
songe resume
songe sleep                      # learn now instead of waiting
songe doctor                     # check the setup
songe forget                     # delete recorded conversations (learned versions stay)
```

Learning levels: **off** only records; **new** (default) learns from conversations from now on; **all** also learns from earlier ones.

In the dashboard each model has a **Dream** button: it reads your new replies now, however few, and trains too if there are enough conversations, memory and power. It says what it started and what is still missing.

## How it learns

- The model as it was, shown the conversation *and* what happened next, is the teacher.
- The same model with a small adapter, shown only the conversation, is the student. It answers in its own words and the teacher scores each token (on-policy distillation).
- Each round trains on new conversations once, mixed with earlier ones so old skills stay.
- The update is used only if it does better on conversations it never trained on and no worse on general tasks. Otherwise nothing changes.

Songe never runs your tools. It only reads what already happened.

## When it runs

Only when your agent is quiet, there is enough free memory, the battery is not low, the machine is cool, and there are new conversations to learn from. Memory needs are measured once on your machine. When you come back it stops at once, saves its place and continues later.

## What it changes

- Its data folder: `~/Library/Application Support/songe` on macOS, `$XDG_DATA_HOME/songe` on Linux, `%LOCALAPPDATA%\songe` on Windows.
- A `songe/` folder in LM Studio's models folder with the current learned version. Older versions are rebuilt when you return to them. Your own models are never touched.
- One provider entry in opencode and pi, with a backup.
- A background service that starts at login.

No account, no notifications.

## Upgrade and remove

`brew upgrade songe` or `pip install -U songe`: the service moves to the new version by itself in a quiet moment.

`songe uninstall` stops the service and restores your agent settings; add `--purge` to also delete its data and learned versions. Run it before `brew uninstall songe`.

---

Details and development: [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md). Design: [DESIGN.md](DESIGN.md).
