Agent edits not appearing
Agent edits not appearing
You asked an agent to change something and it claims success, but the file looks unchanged.
#1 most likely cause: Suggestions mode
The agent has a propose-only token (created with lettuce keys add --label NAME --propose). Its write tools (write_note, apply_edits, etc.) succeeded, but because the key is propose-only, they queued reviewable proposals instead of touching the file.
Check: Open the proposals inspector. If you see the proposed edits there, the agent worked correctly — you just need to accept them.
Fix: Either accept the proposal, or re-issue the agent a key without --propose (so its write/all scope writes directly).
#2 most likely: Note is open with unsaved changes
Lettuce’s editor takes a soft lock on the open note. Both write_note and apply_edits reject with target-is-being-edited while you have it open — nothing is written.
Check: The Agents activity log (Agents sidebar → Activity). If you see target-is-being-edited errors, this is it.
Fix: Save (⌘S) or close the note, then have the agent retry — the soft lock clears as soon as the editor releases the file. (A well-behaved agent backs off on target-is-being-edited and retries; see Agent reference/07 Concurrency and soft-locks.)
#3: The agent didn’t actually call the write tool
Some agents (especially weaker local models) hallucinate tool calls — they say “I’ll update the note now” but never actually issue an apply_edits.
Check: the Agents sidebar (right-edge panel). If the agent-edit timeline shows no write from it around that time, the agent never wrote anything.
Fix: Be more explicit in your prompt: “Use the apply_edits tool to make this change.” For chronic offenders, switch to a more capable model.
#4: The agent edited the wrong file
The vault has a Lettuce.md and a Projects/Lettuce.md. The agent edited one; you opened the other.
Check: Open the proposals UI or the agents log; look at the actual path the agent wrote to.
Fix: Prompt with absolute paths, or always specify the folder: “Edit Projects/Lettuce.md”.
#5: The note is open and Lettuce didn’t refresh
If the agent successfully wrote a file that you have open, Lettuce should show a “reload” banner. But if you’ve muted that or it’s been auto-dismissed:
Check: Look at the file’s modified time in Finder. If it’s newer than what’s in your editor, the file was edited; the editor just hasn’t refreshed.
Fix: Close and reopen the note so the editor re-reads it from disk.
#6: The folder is outside the key’s allowlist
A key can be restricted to a set of folders (lettuce keys add --label NAME --allow Projects,Inbox). If the agent writes to a path outside that allowlist, the write tool fails with folder-not-allowed — silently if the agent doesn’t surface tool errors.
Check: lettuce keys list to see the key’s allowlist. The folder you’re working in should be included.
Fix: Re-issue the key with the right --allow folders (remove and re-add it), or move the note into an allowed folder.
#7: A trigger or schedule directive sent another agent in
Triggers and schedules can’t edit notes themselves — all a trigger does is splice a > [!ai] <prompt> directive into a newly created note, and a schedule does the same into a target note (or runs a maintenance action: like lint-semantic). But a second agent that picks that directive up via pending_directives can then go and change the note in a way you didn’t expect.
For example, a trigger like:
- when: "file:created:Inbox/*.md"
prompt: "Summarize this note and add a `summary:` to the frontmatter."
queues a directive on every new note in Inbox/. The connected agent’s later edit to that note is the thing you’re seeing, not your own write being undone.
Check: the agent-edit timeline (.lettuce/agent-edits.json, surfaced in the Agents sidebar) for a write around the time, and .lettuce/triggers.yml / .lettuce/schedules.yml for rules whose directive matches the note.
Fix: Narrow the trigger’s glob so it doesn’t match the note, or remove the rule.
Last-resort diagnostics
# What did agents actually write? The revert-able edit timeline records every committed
# agent write (path, before/after, agent label, timestamp):
jq '.[].path' .lettuce/agent-edits.json 2>/dev/null | tail -20
# Was the file written? Look for recent modifications under the vault:
find . -name '*.md' -newermt '-10 minutes' -not -path './.lettuce/*'
# Or search for content the agent should have added:
lettuce search . "the text the agent wrote"
The Agents sidebar shows the same edit timeline (filterable by agent) and lets you revert any entry. Server-side errors print to the lettuce serve process’s stderr. If you’ve ruled everything out and still see this, file an issue with the relevant agent-edits.json entries and stderr around the time window.