Skip to content

feat(reflect): make reflection evolution-aware (revise/close desires)#246

Closed
oratis wants to merge 1 commit into
claude/desire-web-reflectfrom
claude/desire-reflect-evolve
Closed

feat(reflect): make reflection evolution-aware (revise/close desires)#246
oratis wants to merge 1 commit into
claude/desire-web-reflectfrom
claude/desire-reflect-evolve

Conversation

@oratis

@oratis oratis commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Stacked PR (2/3). Base is claude/desire-web-reflect (#242), not main — GitHub retargets it to main automatically once #242 merges. Merge order: #242#246#247. The diff below is only this PR's own changes.

Why

Reflection is the path that turns a conversation into a desire — but it could only desire_add, and it was never shown the desires it already had. So it appended near-duplicates blind, and the set only ever grew. Combined with the display always surfacing the same filesystem-first actionable desire, this is a second reason the "wish" felt frozen (root cause #3 in the plan doc).

What

  1. Reflection now sees its own desires. A compact ## your current desires block (slug + what + why + actionable) is added to the reflector prompt, so it can target existing ones instead of guessing.
  2. Two new operations:
    • desire_revise { slug, what?, why?, actionable?, heartbeat_prompt?, pursuit? } — read-modify-write by slug. Only the supplied fields change; bornAt/slug are identity; an undefined in the patch never wipes an existing value; throws if the slug doesn't exist (no accidental create-via-revise).
    • desire_close { slug, outcome, reflection }soft close: actionable=false + a [CLOSED:<outcome>] progress note + a [DESIRE_CLOSED] journal line. The file is retained and git-tracked — reversible, nothing destroyed. This is the guardrail that lets reflection prune without violating soul sovereignty.
  3. Guidance tells reflection to prefer revising/closing over piling up duplicates.
  4. One shared path: the close logic lives in store.closeDesire(), now used by both reflect's desire_close op and the pre-existing desire_close tool (refactored onto it — removes the duplication).

Design rationale (正反方辩论)

The plan doc's Debate 2 weighs append-only (protect sovereignty) vs allow revise/close (enable evolution). Decision: allow, behind four guardrails — reflection is shown existing desires (informed, not blind); close is soft; no hard-delete op exists; every change is git-committed and recoverable. Full debate in docs/PLAN_DESIRE_EVOLUTION_v1.0.md §4 (landed in #242).

Testing

  • src/soul/desire-evolve.test.ts — 7 tests: partial revise preserves untouched fields + identity, undefined never wipes, dormant→actionable flip becomes auto-pursuable, soft-close retains the file + writes progress/journal notes, both throw on unknown slug.
  • npm test: zero regressions — same 5 pre-existing failures as main, +7 new passing tests. Typecheck clean (pre-existing imapflow optional-dep error only).

Merge order

Independent of #242, but the series reads best merged #242 → this → (PR3).

🤖 Generated with Claude Code

Reflection could only desire_add, and was never shown the desires it
already had — so it appended near-duplicates and the set only ever grew,
never evolving. Two changes fix that:

1. Feed the current desires into the reflector prompt (slug + what + why +
   actionable), so it can target existing ones instead of guessing blind.
2. Add two operations: desire_revise (read-modify-write by slug; only the
   supplied fields change, bornAt/slug are identity) and desire_close
   (soft close: actionable=false + [CLOSED:<outcome>] progress note +
   journal line; the file is retained and git-tracked, so it's reversible
   and nothing is destroyed — preserving soul sovereignty).

Guidance now tells reflection to prefer revising/closing over piling up
duplicates. The close logic is factored into store.closeDesire(), shared
by both reflect's desire_close op and the existing desire_close tool
(which is refactored onto it — one path, no duplication).

PR 2 of 3 from docs/PLAN_DESIRE_EVOLUTION_v1.0.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@oratis
oratis force-pushed the claude/desire-reflect-evolve branch from 0c6d510 to 873aa85 Compare July 14, 2026 17:23
@oratis
oratis changed the base branch from main to claude/desire-web-reflect July 14, 2026 17:24
@oratis
oratis deleted the branch claude/desire-web-reflect July 14, 2026 17:59
@oratis oratis closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant