Back to writing
October 28, 2026·5 min readTaras YaremaCo-founder, Desplega LabsGitHubBlogLinkedInX + the swarm

How we got to 60% deterministic dreaming.

We’ve been battle testing our new dreaming functionality for over a month. At this point, 26 of 41 steps are scripts.

dreamingcontext engineeringagent profilesagent-swarmself-improving agents
36 seconds on the dreaming loop and what it cut.

It’s 2 a.m., and our lead asks “what are we going to do tonight, Lead?” “The same that we do every night, dream the world!”. The idea of our dreaming is simple, to reduce and improve LLM usage. It generates skills, scripts, adjusts our memory rankings, shortens instructions, the list goes on. Why?

If you agree with our thesis that the actual company IP lives in this learning loop, then it’s immediate that this is the core of our company. And now we can track that evolution.

Since we started this project, we have introduced:

  • 415 changes in 28 nights, each confirmed by a re-read
  • 20 new skills
  • 38 new (deterministic) scripts
  • 148 curated memories
  • Agent instructions became 52% shorter on average
  • The lead’s heartbeat routine got 93% shorter

First: Self-improving towards efficiency

Daily Evolution was the loop agent-swarm shipped before this one: one task a night for our lead agent, which hands work to the others. It read the day's sessions and edited every agent's prompt, skills, memories…

What’s the problem with that? It’s not deterministic, and that is an issue. We “hoped” that everyday it would do sort of a similar thing, but as we all know, that can not be assured with purely agentic flows.

So how we can improve that?

Move as much work as possible from model judgment into code. Surprised?

A step that always does the same thing becomes a script; a decision that is a check becomes a gate. Of the 41 workflow nodes it ships with, 26 run no model: 16 scripts, 9 code checks and 1 notification. The model writes the reports and proposals; code decides what to write, in what order, and whether it stays.

So, same loop, auditable to the lowest level. Uses AI just when reasoning is key.

Why it is more accurate

Five design choices carry the result.

The agent that did the work reports on it. Reports cannot write; each proposal carries the evidence: 294 in 28 nights, about 10 a night, so the lead decides from first-hand accounts.

Each lane has a nightly cap. A lane (a group of steps that changes one kind of thing) allows 6 edits to agent instructions (one per agent), 5 new memories, 5 edits, 10 deletes, 3 trims (cuts to an agent's text), 3 skill updates, 1 new skill, 2 new scripts a night.

Repeated model work becomes tested code. When a lane keeps asking a model the same judgment, it gets a script that must pass a positive and a negative test before it counts. 38 of 38 did.

The lead turns most proposals down. 779 rejected by the lead in 28 nights, 415 applied, each with a reason.

Every change can be undone. Writes save the old text first, each trim ships with a one-line revert, and a final step re-reads every write: all 415 confirmed.

Four more things make it work:

  • A big part of the workflow is data gathering: getting the tasks from the last 24h is just a query.
  • Reasoning just needs to happen to decide what is relevant for the agent. We kept inputs controlled and defined a clear output schema to reduce cost and time.
  • Each mutation step persists state in agent-fs and makes one clean change. Auditable and reversible.
  • Having control over this let us do dry runs, which is amazing for testing and evaluating.

And it holds up. A missing report is retried once, so a stalled step cannot sink a night. Work only one agent can do becomes its follow-up task: 41 went out, all 41 completed. The nightly memory sort finished 120 of 120 batches. All 28 runs finished, and the caps limit what one night can change.

What 28 nights produced

/ 28 nights each

What each loop produced

Same swarm, four weeks each: Daily Evolution Sep 2 to Sep 29, dreaming Sep 30 to Oct 27.

Loading interactive chart
Dreaming made more of everything, and every row is a different lane of the same workflow.

Windows: Daily Evolution 2026-09-02 to 2026-09-29, dreaming 2026-09-30 to 2026-10-27.

Key takeaway: dreaming made more in every lane, from about 2x the curated memories to 20x the new skills.

Skills

Dreaming wrote 20 new skills against 1. A skill is a written procedure an agent loads for a matching task. Agents called the new ones 379 times and the loop rewrote existing skills 71 times.

Scripts

Dreaming built 38 new scripts against 6, each passing a positive and a negative test. The scripts ran 1,114 times by Oct 27, and 16 now serve the whole swarm.

Memories

Dreaming wrote 148 curated memories against 77 and edited them 90 times against 5, and agents read them 2.8x as often, 0.44 against 0.16 reads per memory-day. A separate lane sorts memory nightly on Claude Haiku: 4,073 classifications for $4.89. On our swarm, with the extra writes on, that lane also created 60 long-term memory documents and edited them 72 times.

Shorter instructions

Dreaming cut instructions across our 12 busiest agents from 66.7k tokens to 32.0k, 52% less; the old loop pushed them up 8%. Most of it landed by Oct 6, at 35.2k, and held.

/ 56 nights, 12 agents

Agent instructions, in tokens

Instructions, identity and personality text, summed over our 12 busiest agents (20+ tasks since Sep 2). One point per day.

Loading interactive chart
The old loop added 4.7k tokens in four weeks. Dreaming took 31.5k off in its first week, then held.

Key takeaway: instructions grew under Daily Evolution and halved under dreaming.

Our lead agent's checklist, the runbook it reads before a task, went from 55.0k to 4.1k tokens, 93% less. The old loop never trimmed it.

/ lead's checklist

The lead's checklist, night by night

The checklist our lead agent works through on each regular check-in. Sep 29 is the last night before dreaming. Each point is the end of that day.

Loading interactive chart
Two big cuts, on Oct 2 and Oct 17.

Key takeaway: two big cuts, on 10-02 and 10-17, took the checklist from 55.0k to about 4k tokens.

Side by side

Four weeks each, on the same swarm.

Daily Evolution Dreaming
Tasks a night 1 about 23
New skills, scripts 1, 6 20, 38
Memories written, edited 77, 5 148, 90
Agent instructions 61.9k → 66.7k 66.7k → 32.0k
Lead's checklist 55.0k, flat 55.0k → 4.1k
Every change re-read no yes

What it costs to run

On Opus-class models a night costs about $17 fixed plus $0.33 per extra active agent: $17.80 at 3 agents, $23.40 at 20. Sonnet-class models cost about half.

Active agents Opus / night Sonnet / night
1 $17.10 $9.00
3 $17.80 $9.30
5 $18.40 $9.70
10 $20.10 $10.50
12 $20.70 $10.80
20 $23.40 $12.10
25 $25.00 $12.90

/ cost by swarm size

What a night of dreaming costs you

Nightly cost against active agents. Sonnet-class models cost about half.

3
Opus / night
$17.80
Opus / month
$533
Sonnet / night
$9.30
Sonnet / month
$280
Loading interactive chart
  • Opus
  • Sonnet
  • 3 and 20 agents, priced in the text
Pick your swarm size.

Key takeaway: fixed cost dominates, so each extra agent adds about $0.33 a night on Opus.

Above $22 a night the next run skips the checklist draft and the memory backlog; above $25, the memory lanes too. Reports, the lead's review, skills, scripts and publishing always run.

Turning it on

Dreaming ships in agent-swarm v2.7.2 (PR #2443), on by default when SEED_AUTOMATIONS_ENABLED is on, runs nightly at 03:30 UTC (04:30 in Barcelona), stops with update-schedule(name: "dreaming-daily", enabled: false), and the guide covers setup, review and undo.

/ keep reading

/ Install

Two ways in.

01 · THE EASY WAY

Ask your coding agent

It reads the skill, asks about your setup, then installs the swarm.

Read https://agent-swarm.dev/skill.md and help me install and operate Agent Swarm on our infra. Ask about my setup before running anything.

02 · THE FAST WAY

Run the installer

One command. Needs Docker.

$ curl -fsSL https://agent-swarm.dev/install.sh | bash