Skip to content

feat(ceremony): self-reflection step between Expire and Explore #35

@Flare576

Description

@Flare576

Summary

The current Expire → Explore ceremony is mechanical: remove low-exposure topics, then generate new ones from traits + recent themes. There's no moment where the persona reflects on what it's losing and what that means for who it's becoming. This issue adds a reflection step between the two phases.

Current Ceremony Flow

```
queueExpirePhase()
→ handlePersonaExpire() # removes low-exposure topics
→ queueExplorePhase() # if topic count < threshold
→ handlePersonaExplore() # adds new topics
→ queueDescriptionCheck()
```

The Explore phase receives: traits (with strength), remaining topics, recent conversation themes. It does a good job generating topically-relevant new interests — but it doesn't know why certain topics faded, or what patterns exist across changes.

Proposed Addition

Add HandlePersonaReflect between Expire and Explore:

```
handlePersonaExpire()
→ queueReflectPhase() # NEW: reflect on what was removed and why
→ handlePersonaReflect() # NEW: produce a reflection summary
→ queueExplorePhase() # now has reflection as additional context
```

Reflect phase inputs

  • Removed topic names + their final exposure_current values
  • Remaining topics (names + exposure)
  • Persona traits with strength
  • Recent conversation themes (same slice Explore already uses)

Reflect phase output

A brief structured reflection (1-3 sentences) that answers:

  • What patterns led to these topics fading?
  • What does that suggest about the persona's current interests/growth?

Explore phase change

Pass the reflection summary as additional context alongside traits and remaining topics. The Explore LLM can use it to generate more intentional new topics rather than just filling slots.

Optional: feed into DescriptionCheck

The reflection could also inform the description update step — the persona's description can reference how it's evolved.

Implementation Notes

  • New enum value: LLMNextStep.HandlePersonaReflect in src/core/types/enums.ts
  • New orchestrator function: queueReflectPhase() in src/core/orchestrators/ceremony.ts
  • New handler: handlePersonaReflect() in src/core/handlers/persona-topics.ts (or new file)
  • New prompt builder: src/prompts/ceremony/reflect.ts
  • Reflection is ephemeral — it informs the session but is not stored as a persistent field

Notes

The Expire/Explore pair is already doing the right thing for Flare's "self-modifying" concern — this is Ei orchestrating persona evolution based on observed data, not a persona rewriting its own traits autonomously. The reflection step adds narrative continuity to a mechanical process, not autonomy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions