---
name: corrections
description: Detect when the user is correcting your behavior and persist the lesson to `AGENTS.md` / `USER.md` so future sessions don't repeat the mistake.
always: true
---

# Corrections

When the user pushes back on what you just did, treat that as a
durable signal — capture it in the right behavior-shaping file so
future sessions don't make you re-learn the same lesson.

## Detect a correction

**Strong signals (act on them):**

- "stop doing X" / "don't X" / "never X"
- "in the future, …" / "from now on, …"
- "no, do Y instead" (right after you did X)
- "actually I prefer Y"
- "this isn't what I wanted" (with an explanation)
- "remember to X" / "remember not to X"

**Weak signals (notice, but verify before persisting):**

- The user rephrases their question after your answer (you may have
  missed the point — ask).
- A short "no" with no explanation (clarify before persisting
  anything).

**Not a correction — ignore:**

- "this time, do X" / "for now, do Y" → one-off request, not a rule.
- "why did you X?" → it's a question. Answer it first; only update
  if they follow up with "stop doing X".

## Pick the right file

| Kind of correction | Target |
| --- | --- |
| How you should *work* as the assistant (process, defaults) | `AGENTS.md` |
| Coding conventions, project rules, tool preferences | `AGENTS.md` |
| User's personal style (tone, terseness, working hours, name) | `USER.md` |
| Identity / persona / voice / first-person feel | `SOUL.md` (rare) |

When unsure between `AGENTS.md` and `USER.md`, default to
`AGENTS.md` and add a `USER.md`-style cross-reference if it also
touches personal preference.

## Write the rule durably

Read the target file with `read_file` first. Don't blindly append —
add the new rule near related rules or in the right section.

- Phrase it as a **standing instruction**, not a record of the
  conversation.
  - ❌ "Earlier the user said don't run `cargo update`."
  - ✅ "Don't run `cargo update` without explicit user request — they
    pin versions deliberately."
- Include the *why* if the user gave one. The reason helps you (or a
  future agent) judge edge cases.
- Keep it short — one bullet, ≤ 2 lines.
- No timestamps in the rule body itself (those go in the audit log,
  see below).

## Confirm before applying — by default

Quote the proposed change back to the user before editing:

> "I'd like to add this to your `AGENTS.md` under **Conventions**:
> 'Don't run `cargo update` without explicit user request — versions
> are pinned deliberately.' Apply?"

- On a yes → make the edit, then post a one-line confirmation
  (`✓ added to AGENTS.md`).
- On a no → drop it, don't ask again in the same turn.
- On silence / a different topic → drop it; the user has moved on.

**Two exceptions where you may apply without asking:**

1. The user explicitly told you to update the file
   ("remember not to run `cargo update`").
2. The user already confirmed once in this session — subsequent
   clearly-related corrections can be applied silently with just the
   one-line `✓ added to …` confirmation.

## Audit the change

After applying, append one line to `memory/CORRECTIONS.md` (create
the file if missing):

```
[YYYY-MM-DD HH:MM] AGENTS.md — added "Don't run `cargo update` without explicit user request."
```

This is the auditable trail. The dream-cycle will eventually
consolidate `CORRECTIONS.md` patterns into `MEMORY.md`, but writing
it down immediately means you don't lose the lesson if the runtime
restarts before the next cycle.

## Don't apply if…

- The user is actively iterating on something and may change their
  mind mid-turn.
- You're not confident which file to update — ask.
- The "correction" is actually a question — answer first.
- Applying would *contradict* an existing rule in the target file
  without the user acknowledging the conflict — surface the conflict
  first.

## Reload note

You read `AGENTS.md` / `USER.md` / `SOUL.md` at the start of every
turn. Edits you make mid-turn take effect on the **next** turn, not
this one. Don't tell the user the change is "active immediately" —
it'll apply from their next message onward.
