Skip to main content

Reflection

WASP runs reflection at two levels: per-goal post-mortems and the dream-cycle narrative. Both produce structured artifacts the operator can review.

Per-goal post-mortem

scheduler/goal_meta_reflection.py. Runs once when a goal completes or fails.

Output (one row in execution_reflection)

FieldMeaning
intentInferred from the goal objective
skills_usedOrdered list of skills the executor ran
duration_msTotal wall-clock time
successTrue/False
efficiency_score0–1, weighted by skills used vs minimum needed, retries, replans
issuesJSON array of issues encountered (timeouts, replans, gate hits)
insightShort LLM-generated note
suggestionImprovement proposal
pattern_keyNormalized for SkillPattern detection
recurring_patternTrue if this matches a known SkillPattern

How it's used

  • Operator reads it at /goals (per-goal detail page) and /cognitive (recent reflections).
  • Context Builder injects recent reflection insights into similar future goals.
  • Skill Evolution uses pattern_key and recurring_pattern to detect candidates for composite-skill synthesis.

Maximum 3 reflection rows per goal. Older reflections are pruned by execution_reflection_pruner (daily).

Dream-cycle reflection

scheduler/dream.py. Runs during the dream cycle (idle-time, gated by inactivity + CPI).

Output (one row in dream_log)

FieldMeaning
reflectionShort LLM narrative on the day's activity
improvements_proposedCount of proposed self-improvements
improvements_jsonThe actual proposals (each is a diff)
memories_consolidatedEpisodic entries promoted to semantic
kg_nodes_addedNew entities discovered
prefetch_doneWhether crypto prices were prefetched

How it's used

  • Operator reads the narrative at /cognitive.
  • Self-Improve dashboard shows proposals from improvements_json for review at /self-improve.
  • Failure-pattern analysis updates self_model["known_failures"].

The dream cycle does NOT modify code on its own — every improvement is operator-gated.

Reading reflections

WhereWhat
/goals (per-goal page)Goal Meta-Reflection for that goal
/cognitive (Reflections tab)Recent goal reflections + dream narratives
/self-improvePending dream-cycle improvements
dream_log tableRaw history of dream cycles
execution_reflection tableRaw history of goal post-mortems

When reflection runs

TriggerWhat runs
Goal completesGoal Meta-Reflection (one-shot)
Goal failsGoal Meta-Reflection (one-shot)
Dream cycle activatesDream reflection + memory consolidation + improvement proposals

Disabling

To turn off reflection entirely:

GOAL_META_REFLECTION_ENABLED=false
DREAM_ENABLED=false

This stops the LLM-cost of reflection. Operator loses post-mortem visibility; self-model accumulates failures less precisely.

See also