Files
Frank WuandClaude Opus 5.5 61cdb487ba Cloud judge on Claude Code / Codex: many answers per call; Codex cut down and honest about cost (#369)
* Cloud judge on Claude Code / Codex: many answers per call; Codex cut down and honest about cost

On an agent CLI provider the Deep Dream's gate now asks the cloud judge
about up to 12 answers in one call (sleep/judged.asked_up_front): numbered
items, each judged on its own, a JSON list back. Items are ordered so a
moment's two answers are never side by side (in separate calls once there
are 12 moments) and position says nothing about which version wrote it.
A missing or garbled item falls back like an unreadable single verdict
(local judge decides, reason kept); the batch result is journalled, so a
stopped Dream doesn't pay twice. API providers keep one answer per call.

Codex runs with config overrides that drop its optional tools, shell, web
search, skills list and own instructions, and turns off the MCP servers in
the user's Codex config (live: a configured node_repl server read a canary
file; with the servers off it could not). Live: 22.4k -> 4.6k tokens for a
one-word question. Default nightly calls 20 (was 50); the Codex disclaimer
lines say each call uses roughly 5,000 to 15,000 tokens of the plan.

Live, 10 moments x good/bad answers: Claude Code 20/20 in 2 judge calls,
3.6k prompt tokens (was 20 calls, ~18k); Codex 20/20 in 2 calls, 10.7k
(was 20 calls, ~496k with the probe).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Codex wording: up to about 17,000 tokens a call, as measured for 12 of the longest items

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-30 18:14:21 -05:00

8.6 KiB

FAQ

Short answers, from the code on main. Paths are under src/songe/.

What is the difference between a note and a change in the weights?

A Quick Dream writes notes. A note is a line of text that the proxy adds to the end of the system message of every request to that model (proxy.with_lessons), under "Lessons from earlier sessions with this user. Follow them:". At most 10 notes are in the prompt (prompt_lessons). Notes only come from what you wrote: rules you stated, preferences about yourself, a standing wish, or a change you asked for once that came up again in a second conversation (quick.suitable). Removing a note undoes it.

A Deep Dream changes weights. It trains a LoRA adapter on practice scenes written from your lessons; the original weights stay as they were.

What weights can learn that a note cannot:

  • Lessons that never become notes: what the work itself showed (a tool's error, a failed step) and lessons too narrow for every request (one kind of task). Deep Dream practises these; the prompt never carries them.
  • More than 10 lessons, without adding text to every request.

What happens in practice: a Deep Dream is used only if it passes the check (see below). When it is refused, nothing changes: the notes stay and keep carrying the habit, and its practice scenes are trained again, with new ones, by later Dreams, until three Dreams have tried them (practice/pool.py, keep_for_retry). When one is adopted, a note leaves the prompt only if the new version follows that lesson without it, on practice it was never trained on (sleep/judged.py, learned). Otherwise the note stays beside the adapter.

How is this different from MEMORY.md, skills files or an agent's memory?

Memory files, skills files and an agent's memory or "dreaming" features keep text and put it back into the context. Songe's Quick Dream is that kind of thing, kept by the proxy, so it works with any agent that talks to Songe.

The Deep Dream is different: it changes the model's weights, so the habit does not depend on text in the context. It also checks itself before it is used: the new version must do better than the one in use on moments from your own conversations.

Isn't this just fine-tuning?

Yes. It is LoRA fine-tuning. What is specific to Songe:

  • Data. Your recorded conversations are read for lessons (your corrections and rules, retries, tool errors). Your model writes short practice scenes for each lesson, in your agent's own tools. Under the default learning = "dreams", your real conversations are never trained on; only the practice scenes are.
  • Teacher. The model as it was at the start of the Dream, shown the lesson. The student is the same model with the adapter, shown only the scene. The student writes its own answer and is trained towards the teacher's token distribution on that answer (on-policy self-distillation, forward KL). See DESIGN.md, section 3.
  • The check. At moments from your conversations, the version in use and the new one each answer; your original weights, with no adapter, judge each answer on its own against your feedback. The new version is used only if it wins more of these moments than it loses, does not drift far from the original model, and its answers stay healthy (sleep/judged.py, sleep/gate.py).

The settings it trains with: songe status --training.

Does it work with Claude or other cloud models?

Not as the model it trains. Songe trains open weights on your machine, and the model your agent talks to through Songe must be served by a local model server: LM Studio, vLLM, Ollama, llama.cpp or mlx-lm. Songe refuses an upstream that is not plain HTTP on localhost, 127.0.0.1 or ::1 (config.py, validate). Your agent can be any client that speaks the OpenAI Chat Completions or Responses API.

Frontier distillation (songe distill on) is separate, optional and off by default (cloud/). It lets the nightly Dream ask a cloud model you choose (OpenRouter, or another provider at an https:// URL); your agent's own requests never go there. Turning it on needs you to accept what is sent, and a test: the model must answer two clear judge questions correctly. Everything sent is redacted first: keys, tokens and private keys are removed, the values of secret KEY=VALUE lines are removed, email addresses, phone numbers and IP addresses become [EMAIL], [PHONE] and [IP], and your home folder becomes ~ (cloud/redact.py). Nothing else is anonymised: the check's moments are excerpts of your real conversations, so their code, file contents and names are sent as they are. Every call is logged with its purpose, size, preview and cost; a call that would pass the nightly budget (default $1) is not sent. When a provider reports no cost (a custom endpoint), Songe counts the model's list price, or for a model it doesn't know a cautious estimate, and marks those costs as estimated. With it on, a Deep Dream sends each kept practice scene (a made-up situation built from your agent's system prompt, its tools and the lesson) to get a reference answer; your own model rewrites it in its own words, and the teacher sees that rewrite next to the lesson (practice/sfd.py). Reading and training stay on your own model.

Instead of an API you can use the coding-agent CLI you are already logged in to: Claude Code or Codex (songe distill on --provider claude-code, or pick it under Configure; no key). Songe runs it once per question, with the question on stdin, in an empty temporary folder that is removed afterwards. It uses your login and your plan: that plan's terms on automated use and on training another model with its answers apply, and the calls count against its limits. The budget is calls per night (default 200 for Claude Code, 20 for Codex, which sends roughly 5,000 to 17,000 tokens with every call) instead of dollars; the check asks such a CLI about up to 12 answers in one call; when the plan's usage limit is reached, Songe stops asking until the next night. Claude Code runs with no tools and none of your Claude Code settings or CLAUDE.md instructions, so it can't read files and your instructions stay out. Codex can: its read-only sandbox blocks writing and network access, not reading, and anything it reads goes to OpenAI without Songe's redaction, so choosing it needs a separate acceptance (--accept-codex-file-access).

How is the learned version served on each model server?

Model server How the new version is served
LM Studio merged: a merged GGUF, at the base's GGUF type when that is 8-bit or higher, else at Q8_0 (rounding to 4-6 bits would bury the learned change); with MLX training on Apple Silicon, a fused MLX model. Loaded from a songe/ folder in LM Studio's models folder.
vLLM adapter: loaded at runtime with vLLM's /v1/load_lora_adapter; the base stays loaded.
Ollama merged: a merged GGUF, imported as a new Ollama model.
llama.cpp adapter: a GGUF LoRA, switched on in a llama-server that Songe runs (/lora-adapters); a llama-server you run yourself cannot be switched.
mlx-lm adapter: passed with each request to an mlx_lm.server that Songe runs.

Defaults from sleep/fuse.py (candidate_kind) and upstream/*.py; the artifact_kind setting can choose another. Where a merged copy is served, it is checked again before it is used.

What happens to what it learned when I switch base model?

Each model is its own learner (models/registry.py). Notes, lessons, practice scenes, adapters, versions and undo history belong to one model; recorded conversations are shared. A model you switch to starts from its own original weights, with no notes. By default it learns from conversations recorded after you first used it through Songe; it reads them and writes its own practice. Nothing learned by the old model is moved to it, and the old model keeps what it learned.

The level all also lets a model learn from earlier recorded conversations, whichever model they were with. It is set in songe tui, not on the learning page or the CLI.

If the weights of the same model change on disk, Songe rebuilds: it trains a new adapter from the new weights on all kept practice scenes instead of continuing the old one (schedule.rebuild_reason, "base changed").

How does this compare with trained adapters for agent harnesses?

Songe does not train for a harness or a benchmark. Each adapter is trained for one person and one model, on practice written from that person's own conversations, and it is used only if it does better than the version in use at moments from those conversations, judged by that model's original weights. Songe makes no claim about how its adapters compare with adapters trained on other data.