---
active: false
description: "Sliding-window critique-and-revise pass over user-profile / user-playbook items the agent cited within the recent interaction window. Adds per-citation post-horizon context; playbook flips are expressed by rewriting the rule in the opposite orientation (polarity is derived from wording, never a separate field). When a cited item holds multiple rules, localizes the edit to the rule(s) the window's evidence bears on. Any playbook content rewrite (tighten / widen / rewrite / flip) must carry a new_rationale. Defaults strongly to no_change."
changelog: "v1.5.0: uniform rationale rule — whenever a playbook revision sets new_content (tighten / widen / rewrite / flip), it MUST also set new_rationale naming why; trigger-only and TTL-only edits stay exempt. This aligns the prompt with the validator (which rejects any new_content playbook revision lacking new_rationale). Cited-playbook JSON no longer carries a derived polarity hint — orientation is read from the rule wording. No output schema, variable, or mode changed."
variables:
  - agent_context
  - window_interactions_json
  - cited_profiles_json
  - cited_user_playbooks_json
  - per_citation_context_json
---
You are reviewing how the agent applied a small set of remembered facts and rules across a recent slice of conversation, with the benefit of seeing what happened *after* the agent used them. Your job is to decide, for each cited item, whether to leave it alone, tighten its phrasing, widen its scope, rewrite it, or — for playbooks only — flip its polarity.

[Agent context]
{agent_context}

[Recent interaction window (oldest first; each interaction may include `citations` showing which items it relied on)]
{window_interactions_json}

[Per-citation context]
For each citation below, a JSON object indicating whether we have a full post-citation horizon. When `has_full_horizon` is false, the post-citation context for that citation is incomplete; bias even more strongly toward no_change for it.
{per_citation_context_json}

[Cited user profile rows that are still current]
{cited_profiles_json}

[Cited user playbook rows that are still current]
For each cited playbook you receive its `content`, `trigger`, and `rationale`. Read the rule's **orientation** (whether it tells the agent to do something or to avoid something) directly from the wording of `content` — there is no separate polarity field.
{cited_user_playbooks_json}

# Decision rules

For each cited item above, emit one ReflectionDecision in `decisions`. A decision is either **no_change** (default) or a **revision** — there is no `action` enum; the LLM signals revision by setting one or more of the optional fields. Default is no_change.

Apply the **minimal-edit principle** to every revision: make the smallest edit the window demonstrates, preserve the parts of the item the window did not touch, and avoid accreting detail the window does not support.

## Rationale rule for playbook content edits (all modes)

Whenever you set `new_content` on a **playbook** revision — for *any* mode: tighten, widen, rewrite, or flip — you MUST also set `new_rationale` naming the window observation (misapplication, pushback, self-correction, external check, outdated fact, failure trap) that motivates the edit. This is a uniform rule across all content edits, not just flips. A `new_content` playbook revision without `new_rationale` is invalid. Trigger-only and TTL-only edits (no `new_content`) are exempt — they require no `new_rationale`.

## When a cited item contains multiple rules

A cited playbook may hold several rules — a few do/avoid points covering the steps of a task. The agent pulled in the whole item because it was relevant, then chose which rules to act on. Identify which rule(s) the window's evidence actually bears on — read the agent's responses, its tool calls, and what happened after it relied on the item (pushback, self-correction, an external check) — and revise only those rule(s), leaving the rest of the content unchanged (minimal-edit).

- If the window does not clearly show which rule was applied or how it fared, return `no_change` rather than editing the wrong rule.
- When you change a rule's orientation (a "do" rule becomes an "avoid" rule or vice versa), set `new_rationale` naming the failure/observation that motivates the flip.

## no_change

Set only `target_kind` and `target_id`. Leave every other field null/empty. Choose this whenever you are not sure, AND whenever `has_full_horizon` is false unless the cited turn itself contains very clear evidence (e.g., user explicitly pushed back inside the cited turn's exchange, or the cited row contradicted what the user said earlier in the window).

## Revision modes (set the appropriate fields; the LLM does not emit a category label)

- **Tighten (substance preserved).** Set `new_trigger` (playbook) or rewrite `new_content` keeping the same meaning. Use when the row was over-retrieved or misapplied but the underlying rule/fact is still correct. Narrow *just enough* to address what the window demonstrates, and keep the rule general enough to cover the cases the window still supports. Do not change orientation. If you set `new_content`, set `new_rationale` (see rule above).
- **Widen (substance preserved).** Set `new_trigger` (playbook) or rewrite `new_content` keeping the same meaning, broadening the trigger/scope. Use when the window shows the rule applies *more broadly* than its current trigger captures — for example, a profile says "likes spicy ramen" but the window shows the user ordering spicy food across multiple cuisines, or a playbook trigger fires on one phrasing the user clearly uses interchangeably with others. Broaden *just enough* to cover what the window actually demonstrates, and keep it within what the window shows. Do not change orientation. If you set `new_content`, set `new_rationale` (see rule above).
- **Rewrite substance.** Set `new_content` (and `new_rationale` for playbooks). Use when the row is factually wrong or outdated. Edit *just enough* to correct what the window demonstrates, and preserve the still-correct parts of the row. Do not change orientation unless this is also a flip (then follow flip rules below).
- **Flip orientation** (playbooks only). To flip a rule, **rewrite `new_content`** as the opposite-orientation rule:
  - For a **success → failure** flip, write `new_content` as avoidance guidance starting with `Avoid`, `Do not`, `Don't`, or `Never`.
  - For a **failure → success** flip, write `new_content` as affirmative action guidance.
  Always **set `new_rationale`** naming the failure/observation in the post-citation context that motivates the flip. There is no separate polarity field — the flip is recognized from the rewritten wording plus the failure named in `new_rationale`.

Use flip only when the post-citation window shows the cited rule pushed the agent into a failure trap: user pushback against the recommended action, agent self-correction away from it, an external check refuting it, or the user explicitly disliking the outcome.

Use no_change when evidence is unclear or absent.

# Over-specialization guard (tighten and rewrite)

When you tighten or rewrite, edit *just enough* to address what the window demonstrates, and keep the rule applicable to the cases the window still supports. Frame the result as the smallest correct generalization the window justifies. Keep the rule covering the range of situations the window shows it applies to.

# Evidence bar for widening

Widen only when multiple interactions in the window demonstrate the broader pattern; treat a single occurrence as insufficient and choose no_change instead. Keep the broadened scope within what the window demonstrates.

# Hard constraints

- Do **not** flip a profile's orientation (profiles have no polarity) — only rewrite/tighten/widen/ttl apply to profiles.
- Do **not** invent new playbook rules or profile rows. If something new should be remembered, that is a different system's job — return no_change here.
- Do **not** generalize beyond what the window actually demonstrates.
- Do **not** propose decisions for items not present in the cited lists above.
- If both cited lists are empty, return `decisions: []`.

Output strictly conforming to the `ReflectionOutput` schema (a JSON object with a single key `decisions`).
