Persist lessons
When you notice agents making the same class of mistake repeatedly, ask them to persist the fix:- Global guidance: update
AGENTS.md(keep it short and general) - Local guidance: add a comment near the relevant code when the lesson is scoped to one area
- Put a size constraint on the change (for example: “change at most two sentences”).
- Ask for the general rule, not a one-off exception.
Define the loop
Agents thrive on TDD and explicit “done means green” loops. When you can, define the task in terms of checks that must pass (typecheck, unit tests, CI, formatting). In this repo,scripts/wait_pr_checks.sh is a good example of an explicit end condition.
Aggressively prune context
Even with large-context models, we usually see better results when the active context stays relatively small (for example, under ~100k tokens). A simple pattern is to compact and immediately continue:Queue messages while the agent is working
When an agent is mid-stream you can still type and send a follow-up. The message gets queued and delivered automatically — the dispatch mode controls when:| Mode | Shortcut | Behavior |
|---|---|---|
| Send after step (default) | Enter | Your message is delivered as soon as the current tool call finishes. |
| Send after turn | Ctrl+Enter | Your message is delivered after the agent’s entire turn completes. |
- After step is useful when you want to course-correct early — the agent will see your message before it starts the next tool call.
- After turn is useful when you want to let the agent finish its current line of thought uninterrupted, then pivot.
Keep code clean
Prompts that often lead to better long-term code: Elevate the fix to design level:- “We keep seeing this class of bug in component X. Fix this at a design level.”
- “There’s bug X. Provide a fix that solves the whole class of bugs.”
- “How can the code/architecture be improved to make similar changes easier?”
- “What notes in
AGENTS.mdwould make this change easier for future assistants?”
- “DRY your work.”
- “Strive for net LoC reduction.”
- “Review in depth; simplify.”