ReAct reasons and acts but does not learn the environment. Reflection after a task extracts what to learn. That stage belongs in harness design. The reflection prompt is only the tunable knob.
1. Overview
- Most agent loops still look like ReAct: reason, then act, then repeat until the task ends.
- That loop can finish a task. It does not, by itself, learn how the environment works.
- The missing stage is reflection after the task: look at the episode, extract what to learn, and write durable notes for later work.
- Reflection is not the same as a memory product. Memory systems store and retrieve. Reflection decides what is worth learning about the environment.
- The reflection prompt is a tunable parameter, like a system prompt. It is not the whole idea.
- What to reflect on depends on the environment. That choice is harness design.
2. Prior research
- Yao et al.'s ReAct paired reasoning traces with actions. It improved tool use and transparency. It did not add an explicit learn-the-environment stage after the task.
- Lilian Weng's Harness Engineering for Self-Improvement (Jul 2026) maps harness work: workflows, files as memory, context engineering, and harness search. Continual learning is named, then left open.
- Memory products such as Mem0, Cognee, and vector stores focus on write, index, and retrieve.
- Anthropic's Dreams (managed agents, research preview) run after sessions. They read a memory store plus transcripts and produce a cleaned, reorganized store with new insights. Dreams are one concrete form of reflection, not a replacement for the idea.
3. ReAct stops too early
-
ReAct answers: what should I think, and what should I do next?
-
It does not answer: what did this environment teach me that I should keep?
-
Without a post-task stage, the agent either:
-
drops the episode when the chat ends, or
-
dumps the transcript into memory and hopes retrieval will sort it later
-
-
Dumping is not learning. Learning needs a deliberate extract step aimed at environment behavior.
-
Coding agents, analytics agents, and game agents all show the same gap: strong within-task loops, weak across-task learning.
4. Reason, act, then reflect
-
Keep the ReAct core for the task itself.
-
Add one stage after the task completes (or after a clear unit of work):
-
Reason
-
Act
-
Reflect
-
-
During the task, the agent solves. After the task, the agent learns.
-
Reflection reads the episode plus prior durable notes.
-
Reflection writes an updated model of the environment for the next actor.
-
The next task starts with that model in trusted context, not with a raw history dump.
-
Fail closed if reflection produces noise. Prefer no new notes over wrong notes.
5. Reflection is not a memory system
-
Memory systems answer how to store and retrieve:
-
vector databases
-
graph memories such as Cognee
-
agent memory layers such as Mem0
-
file notebooks, card stores, or Anthropic memory stores
-
-
Reflection answers what to learn from this episode about the environment.
-
You still need a store. The store is the sink. Reflection is the filter and the teacher.
-
Mixing the two causes familiar failure modes:
-
retrieve fluent junk
-
store strategy slogans instead of environment facts
-
treat "we have memory" as "we learn"
-
-
Design them apart. Wire them together.
6. What to reflect depends on the environment
- The variable is the learning target, not the presence of a reflect call.
- Coding agent: system architecture, module boundaries, external dependencies, build and test quirks, ownership maps.
- Analytics agent: database schema, encodings, join keys, traps, drift after migrations.
- Poker or other game agent: opponent tells, play style, stack tendencies, bluff patterns.
- Ops agent: fleet topology, runbook exceptions, alert causes that recur.
- Support or sales agent: account facts, constraints, prior commitments.
- Same harness stage. Different learning object. That is why reflection must be designed per environment class.
7. The reflection prompt is a tunable parameter
-
People already tune system prompts for role, tools, and style.
-
The reflection prompt is the same kind of knob for the post-task stage.
-
It should name:
-
what environment object to extract
-
what to forbid (transcript dumps, slogans, one-off recipes)
-
how to merge with prior notes
-
how to write for the next actor
-
-
Tuning the reflection prompt is useful. Calling the prompt "the harness" is wrong.
-
The harness owns the stage, the timing, the inputs, the outputs, and the store boundary.
-
The prompt only steers what that stage extracts.
8. Dreams as one form of reflection
- Anthropic Dreams take an existing memory store and past session transcripts.
- They produce a new memory store: merge duplicates, replace stale or contradicted entries, surface new insights.
- The input store is not mutated. You can review and discard the output.
- Dreams also take
instructions, for example "focus on coding-style preferences; ignore one-off debugging notes." - That
instructionsfield is a reflection prompt in practice: it names what to learn and what to ignore. - Dreams sit after work, over many sessions. Per-task reflection sits after one unit of work.
- Both are reflection. They differ in scope and schedule. Neither is "just retrieval."
9. Why this belongs in harness design
-
If reflection is optional glue, teams bolt on a memory product and hope.
-
If reflection is a harness stage, the environment class decides the learning target up front.
-
Harness design then includes:
-
when reflection runs
-
what episode artifacts it sees
-
what durable store it writes
-
what reflection prompt steers extraction
-
how later tasks read the result
-
-
ReAct stays the within-task engine.
-
Reflection becomes the across-task learner.
-
Memory remains the store and retrieve layer.
-
Without that split, "agent memory" work keeps optimizing the wrong surface.
10. What stays open
- How often should reflection run: after every task, after a batch, or on a dream schedule?
- How do we score reflection quality without trusting fluency?
- How much should the reflection prompt be domain-specific vs shared?
- How do we stop reflection from writing confident false environment models?
- When should harness search edit the reflection stage versus the actor stage?
- How do Dreams-style offline cleanup and per-task reflection share one store without fighting?
Sources used for this draft
- Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models.
- Lilian Weng, Harness Engineering for Self-Improvement, Lil'Log, Jul 2026 (prior research overview).
- Anthropic, Dreams (Claude managed agents docs): https://platform.claude.com/docs/en/managed-agents/dreams
- Memory systems named as store/retrieve examples: Mem0, Cognee, vector databases, Anthropic memory stores.