Twig

Dreams

Agent sleeps. Memory hardens. Skills born. OS cannot kill mid-thought forever.

You not talking. Agents dream. Turn finished chats into durable memory. Clean mess. Maybe invent skill or macro for thing you ask every week.

Units. Not long loops.

Android WorkManager kills workers ~10 minutes. We plan for that:

  • Dream = queue of units. One model call each.
  • Units idempotent. Commit one by one.
  • Budget 7 minutes per run (3 minutes headroom).
  • One hung socket max 90s. Cannot eat whole budget.
  • Poison unit dies after 4 fails. Does not block forever.

Min spacing between dream runs: 6 hours. WorkManager rounds shorter up anyway.

No dreams for 3 days? Twig says so in plain words. Phone maker probably murdering background work. Not subtle.

Dream kinds

KindJob
consolidateFinished chat → durable facts
dedupeMerge double / fighting facts
summarizePlain words what workspace holds
propose-skillRepeated ask → skill or macro idea
pruneDrop stale unused notes

Consolidate beats housework (priority). Dedupe key so same work not triple-queued.

What you see

No job logs. No token counts. Dream makes report: one headline sentence in your language, short body, paths it touched.

Reports: markdown under agents/<id>/dreams/. Also in index so UI shows unread stuff.

Models

Uses models.dream if set. Else cheap default. Hate dreams? dreamsEnabled: false.

Conversations feed dreams

Conversation has consolidatedAt. New message clears it. Dream knows work waiting.

Transcripts = append-only NDJSON. One message per line. Crash tears last line only. Reader throws torn line away. Done.