<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eugene</title>
    <description>The latest articles on DEV Community by Eugene (@gemyago).</description>
    <link>https://dev.to/gemyago</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3834858%2Fdf2ccce7-b3f7-48b0-a0e8-59a78a5a1493.png</url>
      <title>DEV Community: Eugene</title>
      <link>https://dev.to/gemyago</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gemyago"/>
    <language>en</language>
    <item>
      <title>Two AI Prompts That Fixed My Git History</title>
      <dc:creator>Eugene</dc:creator>
      <pubDate>Mon, 10 Aug 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/gemyago/two-ai-prompts-that-fixed-my-git-history-2gep</link>
      <guid>https://dev.to/gemyago/two-ai-prompts-that-fixed-my-git-history-2gep</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;I used to have pull requests with dozens, and sometimes hundreds, of commits. Most of the messages were complete garbage: &lt;code&gt;Cleanup.&lt;/code&gt;, &lt;code&gt;More tests.&lt;/code&gt;, &lt;code&gt;fix.&lt;/code&gt;, &lt;code&gt;some initial notes&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two small Markdown prompt files removed the friction:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;commit.md&lt;/code&gt; stages the requested changes, reads the staged diff, and creates a short descriptive commit message.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;create-pull-request.md&lt;/code&gt; reads the commit log, generates a PR title and description, pushes the branch, and runs &lt;code&gt;gh pr create&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The useful part is how the quality compounds. Good commit messages become good PR descriptions. Those descriptions give reviewers better context, and the commit history becomes useful to both humans and coding agents later.&lt;/p&gt;

&lt;p&gt;The prompt content is agent-agnostic. I usually package these prompts as commands, although skills can work too. For this kind of housekeeping task, I also prefer a fast, cheap model over the most expensive reasoning model available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Video Walkthrough
&lt;/h2&gt;

&lt;p&gt;If you prefer a video walkthrough, here it is:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/R9K_c9MOJ2Q"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;




&lt;h2&gt;
  
  
  A Real Pull Request With 209 Bad Commits
&lt;/h2&gt;

&lt;p&gt;This was not a hypothetical example. I had a &lt;a href="https://github.com/gemyago/oke-gateway-api/pull/3" rel="noopener noreferrer"&gt;real pull request with 209 commits&lt;/a&gt;, and many messages looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cleanup.
More tests.
Some initial notes.
More readme.
fix.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sure, you can squash before merging. But that does not make the branch history useful while the work is in progress, and a vague squashed commit is still vague.&lt;/p&gt;

&lt;p&gt;Usually nobody reads commit messages until production is on fire and you're trying to figure out what changed three months ago. At that point the history becomes a search index, and good history is way easier to search. Sure, an LLM will probably find the answer anyway, but it will take longer, explore more diffs, and likely burn more tokens as well.&lt;/p&gt;

&lt;p&gt;I can write a good commit message by hand. The problem is doing it consistently while committing often, switching between branches, or working with several agents that are producing a bunch of code that I need to review and commit. This is a good LLM task: read some text that happens to be code, summarize it, and run a few Git commands, so adding prompts to automate this was a logical next step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt One: Turn the Diff Into a Commit
&lt;/h2&gt;

&lt;p&gt;My current &lt;a href="https://github.com/gemyago/golang-backend-boilerplate/blob/main/.context/commit.md" rel="noopener noreferrer"&gt;&lt;code&gt;commit.md&lt;/code&gt;&lt;/a&gt; is intentionally small:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Follow this instruction to commit changes.&lt;/span&gt;

Only use this instruction if the user asks for it.
&lt;span class="p"&gt;*&lt;/span&gt; All commands should be run from a repo root.
&lt;span class="p"&gt;*&lt;/span&gt; You will be given a list of files to commit.
&lt;span class="p"&gt;*&lt;/span&gt; Commit all updated files if not otherwise specified. In this case use &lt;span class="sb"&gt;`git add .`&lt;/span&gt; from a repo root as a first step to stage all updated files.
&lt;span class="p"&gt;*&lt;/span&gt; If user requested to commit specific files, use &lt;span class="sb"&gt;`git add &amp;lt;file1&amp;gt; &amp;lt;file2&amp;gt; ...`&lt;/span&gt; to stage specific files only.
&lt;span class="p"&gt;*&lt;/span&gt; When committing, make sure to provide a sensible message. Figure out the message from chat history and/or the actual code changes. Make the message short and descriptive.
&lt;span class="p"&gt;*&lt;/span&gt; Always run &lt;span class="sb"&gt;`git diff --staged`&lt;/span&gt; before composing the message so you can summarise what was changed.
&lt;span class="p"&gt;*&lt;/span&gt; If you still lack context after reviewing the diff, consult the chat history; the diff should be your primary source for message content, not just &lt;span class="sb"&gt;`git status`&lt;/span&gt;.
Do NOT do any other verification or actions unrelated to this instruction. You SHOULD just commit the changes as specified here.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The staged diff is the primary source because it is what you are actually committing. Chat history is useful as extra context, but it can be incomplete, stale, or describe changes that never made it into the worktree.&lt;/p&gt;

&lt;p&gt;The last line is also important. Without that boundary, a helpful agent may run lint, start fixing unrelated problems, or turn a five-second checkpoint into a much larger task. This prompt has one job. It does not replace the verification you run before calling the actual coding task complete.&lt;/p&gt;

&lt;p&gt;If I want the whole worktree committed, &lt;code&gt;git add .&lt;/code&gt; is convenient. If I want a specific set of changes, I give the agent the file list instead, but I think I do this less often.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt Two: Turn Commit History Into a Pull Request
&lt;/h2&gt;

&lt;p&gt;The companion &lt;a href="https://github.com/gemyago/golang-backend-boilerplate/blob/main/.context/create-pull-request.md" rel="noopener noreferrer"&gt;&lt;code&gt;create-pull-request.md&lt;/code&gt;&lt;/a&gt; uses the branch history as its input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Instruction to create pull request&lt;/span&gt;

This is an instruction to follow when user is referencing it. Only use this instruction when explicitly requested by the user.
&lt;span class="p"&gt;
1.&lt;/span&gt; Review the commit history between the base branch (use &lt;span class="gs"&gt;**main**&lt;/span&gt; unless another base is specified) and the current branch:
&lt;span class="p"&gt;```&lt;/span&gt;&lt;span class="nl"&gt;bash
&lt;/span&gt;&lt;span class="c"&gt;# Make sure remote is up to date&lt;/span&gt;
git fetch origin

&lt;span class="c"&gt;# Get the current branch; use it when pushing and creating the PR&lt;/span&gt;
git branch &lt;span class="nt"&gt;--show-current&lt;/span&gt;

&lt;span class="c"&gt;# Read commits on this branch that are not on the base branch&lt;/span&gt;
git log origin/&amp;lt;base branch&amp;gt;..HEAD &lt;span class="nt"&gt;--oneline&lt;/span&gt; | &lt;span class="nb"&gt;cat&lt;/span&gt;
&lt;span class="p"&gt;```&lt;/span&gt;
&lt;span class="p"&gt;
2.&lt;/span&gt; Review commit history and come up with a sensible PR title.
&lt;span class="p"&gt;3.&lt;/span&gt; Review commit history and come up with a sensible PR description:
   &lt;span class="p"&gt;```&lt;/span&gt;&lt;span class="nl"&gt;markdown
&lt;/span&gt;&lt;span class="p"&gt;   *&lt;/span&gt; Short change description 1
&lt;span class="p"&gt;   *&lt;/span&gt; Short change description 2
&lt;span class="p"&gt;   *&lt;/span&gt; ...
   &lt;span class="p"&gt;```&lt;/span&gt;
&lt;span class="p"&gt;4.&lt;/span&gt; Prepare the PR title and description.
&lt;span class="p"&gt;5.&lt;/span&gt; Push pending changes and create a PR. Pass the description through standard input so multiline Markdown and shell characters remain intact:
&lt;span class="p"&gt;```&lt;/span&gt;&lt;span class="nl"&gt;bash
&lt;/span&gt;git push origin &amp;lt;current branch&amp;gt; &lt;span class="nt"&gt;--set-upstream&lt;/span&gt;
gh &lt;span class="nb"&gt;pr &lt;/span&gt;create &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--title&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;PR title&amp;gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--body-file&lt;/span&gt; - &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--base&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;base branch&amp;gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--head&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;current branch&amp;gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;'
&amp;lt;PR description&amp;gt;
EOF&lt;/span&gt;
&lt;span class="p"&gt;```&lt;/span&gt;
&lt;span class="p"&gt;6.&lt;/span&gt; Show the PR URL to the user.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git fetch origin&lt;/code&gt; needs to happen before the comparison. Otherwise the agent may summarize the wrong range against stale remote state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Good Summaries Compound
&lt;/h2&gt;

&lt;p&gt;The first prompt is useful on its own, but the second prompt is where the workflow starts paying back.&lt;/p&gt;

&lt;p&gt;Instead of this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cleanup
fix
more changes
update tests
final tweaks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I get history closer to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Add AccountsStore load/validate/query and tests
Add cmd/bbmd Cobra scaffold and DI smoke tests
Implement bbmd auth sub-commands
Implement bbmd pr sub-commands
bbmd: unify auth/PR execution via exec helpers and tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the PR description is a summary of already-good summaries. A &lt;a href="https://github.com/gemyago/atlacp/pull/38" rel="noopener noreferrer"&gt;real PR created with this workflow&lt;/a&gt; has a specific title, a short explanation of the change, and a useful high-level list for reviewers.&lt;/p&gt;

&lt;p&gt;The same history helps later when a teammate reviews the PR, an agent needs to understand why something changed, or you need to generate release notes. The compound effect works in the other direction too: vague commits give the PR prompt vague input.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Do I Run This?
&lt;/h2&gt;

&lt;p&gt;For the &lt;code&gt;commit.md&lt;/code&gt; one, I usually do it like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run it manually when I want to checkpoint my work, for example with &lt;code&gt;/commit&lt;/code&gt; or &lt;code&gt;follow @commit.md&lt;/code&gt;. I do this less often these days.&lt;/li&gt;
&lt;li&gt;Have my agent run it during a long-running orchestration loop, usually as part of a verification step handled by a dedicated sub-agent.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;create-pull-request.md&lt;/code&gt; prompt works the same way: I run it myself or let my agent run it when it's time to submit the PR.&lt;/p&gt;

&lt;h2&gt;
  
  
  If Something Goes Wrong
&lt;/h2&gt;

&lt;p&gt;If you notice a model misbehaving with these prompts, &lt;a href="https://craftedbytes.dev/posts/agent-diagnostics-mode/" rel="noopener noreferrer"&gt;Agent Diagnostics Mode&lt;/a&gt; can help you understand why. I use it for prompt problems in general, not just commit and pull request automation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is This Lazy?
&lt;/h2&gt;

&lt;p&gt;Maybe. But it is the good kind of lazy.&lt;/p&gt;

&lt;p&gt;The output is better, the friction is lower, and the history is more useful. I will take that trade-off.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>git</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>Your AI Coding Agent Is LYING When It Says "Done"</title>
      <dc:creator>Eugene</dc:creator>
      <pubDate>Fri, 31 Jul 2026 08:10:07 +0000</pubDate>
      <link>https://dev.to/gemyago/your-ai-coding-agent-is-lying-when-it-says-done-2a85</link>
      <guid>https://dev.to/gemyago/your-ai-coding-agent-is-lying-when-it-says-done-2a85</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;When an AI agent changes few files, runs few tests, and says "Done", is it really done? Not always. Things may still break in unexpected places.&lt;/p&gt;

&lt;p&gt;I prefer to define a strict definition of "Done", which I call the &lt;strong&gt;Task Completion Protocol&lt;/strong&gt;. It usually lives in &lt;code&gt;AGENTS.md&lt;/code&gt; and, in its simplest form, looks like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run the repository's real lint and test commands.&lt;/li&gt;
&lt;li&gt;Fix failures and rerun the checks.&lt;/li&gt;
&lt;li&gt;Report the exact evidence before claiming completion.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This does not replace CI or code review. It moves a basic verification gate earlier, before a broken state reaches the next agent session, the pull request, or you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Video Walkthrough
&lt;/h2&gt;

&lt;p&gt;If you prefer a visual walkthrough, this video shows the concept in action. I run the same task twice: without a completion protocol and with it - this demonstrates how explicit definition of "done" helps. I also show few tricks and techniques for making agents follow the protocol.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/UxwJj6wo8J8"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;




&lt;h2&gt;
  
  
  The Agent Says "Done." The Repository Disagrees.
&lt;/h2&gt;

&lt;p&gt;You have probably seen some version of this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Agent:
Done. Implemented the fix and updated the tests.

Terminal:
$ make test
... FAIL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The implementation might even look correct. Perhaps the agent ran one focused test, inspected the diff, and produced a tidy summary. Then you run the repository's normal checks and find a lint error, a failing test in a different place, or any other error that was not caught by the agent.&lt;/p&gt;

&lt;p&gt;This gets worse as AI-assisted workflows grow to involve multiple agents. In an interactive session, you may spot the failure and fix it yourself. In a multi-step workflow, one worker reports success and the next starts from a broken state. These problems accumulate quickly, and the final state may be badly broken.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Repository Needs to Define What "Done" Means
&lt;/h2&gt;

&lt;p&gt;Yes, this is obvious for humans: make some changes, run tests and lint, fix issues, maybe check few other things, and only then say "Done". Agents need it written down, and &lt;code&gt;AGENTS.md&lt;/code&gt; is the perfect place for it. I call this section the &lt;strong&gt;Task Completion Protocol&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here is a compact version you can adapt to your repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Task Completion Protocol&lt;/span&gt;

Before reporting completion, classify the task as coding or non-coding.

For coding tasks:
&lt;span class="p"&gt;1.&lt;/span&gt; Run lint: &lt;span class="sb"&gt;`your command to run lint`&lt;/span&gt;.
&lt;span class="p"&gt;2.&lt;/span&gt; Run tests: &lt;span class="sb"&gt;`your command to run tests`&lt;/span&gt;.
&lt;span class="p"&gt;3.&lt;/span&gt; Check whether commands, workflows, or architecture changed. If so, update AGENTS.md.
&lt;span class="p"&gt;4.&lt;/span&gt; Report the commands run, their results, test coverage, and whether AGENTS.md changed.
&lt;span class="p"&gt;5.&lt;/span&gt; Do not report the task as complete while a required check is failing.

For non-coding tasks:
&lt;span class="p"&gt;1.&lt;/span&gt; Summarize the findings or actions taken.
&lt;span class="p"&gt;2.&lt;/span&gt; Confirm that the requested deliverable was produced.
&lt;span class="p"&gt;3.&lt;/span&gt; Do not run unrelated lint or test commands unless requested.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My &lt;a href="https://github.com/gemyago/golang-backend-boilerplate/blob/main/AGENTS.md#task-completion-protocol" rel="noopener noreferrer"&gt;Go backend template has a real version of this protocol&lt;/a&gt;. It uses &lt;code&gt;make lint&lt;/code&gt; and &lt;code&gt;make test&lt;/code&gt;. Your protocol should name the exact commands and any specific checks that matter.&lt;/p&gt;

&lt;p&gt;Don't just say "Run the tests". This still leaves the agent guessing. It is best to name the exact commands the agent must run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Classification and Hierarchy Are Important
&lt;/h2&gt;

&lt;p&gt;"Always run everything" may work in a small repository. In a monorepo, it quickly becomes expensive and sometimes absurd.&lt;/p&gt;

&lt;p&gt;A documentation change does not need the entire test suite. A CSS change may need visual verification, not a set of backend tests. The same applies to Terraform, Helm, and similar tools.&lt;/p&gt;

&lt;p&gt;At minimum, I classify tasks as coding or non-coding. We don't want to run tests if we only changed some docs, skills, or similar files.&lt;/p&gt;

&lt;p&gt;The hierarchy makes sense as well. Each area can have its own &lt;code&gt;AGENTS.md&lt;/code&gt; file with its own completion protocol. Each type of change may require different checks and commands.&lt;/p&gt;

&lt;p&gt;The root &lt;code&gt;AGENTS.md&lt;/code&gt; can define project-wide behavior if relevant. More specific files can define what completion means there. Typically I have something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AGENTS.md
├── apps/web/AGENTS.md
├── apps/backend/AGENTS.md
└── deploy/terraform/AGENTS.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And I make sure to keep the root &lt;code&gt;AGENTS.md&lt;/code&gt; minimal.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Reporting Part Also Matters
&lt;/h2&gt;

&lt;p&gt;Do not let the agent "guess" what to report. Require an explicit format. I typically use something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Lint: pass - make lint
Tests: pass - make test
Coverage: 87.42% - this one is very important
AGENTS.md: no changes needed
Status: complete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And it is not really for you to read (though I do sometimes). It is more for the agent. A strict reporting format gives the agent more "motivation" to actually run your checks. Otherwise it may just "guess" the outcome.&lt;/p&gt;

&lt;p&gt;The dynamic part matters too. I typically require coverage reporting. If you don't collect it (I hope you do), ask for test duration or something else the agent can't guess. I haven't seen a model report this reliably without running the checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  This Does Not Replace CI or Review
&lt;/h2&gt;

&lt;p&gt;The completion protocol is a local behavioral contract. CI remains the hard and deterministic gate.&lt;/p&gt;

&lt;p&gt;You still want deterministic checks in the pipeline, and you still need to review and validate the change. Passing tests do not prove the requested behavior is correct, the architecture is sensible, or the security model survived the refactor. But it gives you a solid baseline:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The repository is "green".&lt;/li&gt;
&lt;li&gt;The agent used the team's canonical checks.&lt;/li&gt;
&lt;li&gt;Failures were caught sooner instead of passed forward.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Harness May Make It Harder
&lt;/h2&gt;

&lt;p&gt;One frustrating caveat: repository instructions are not always the highest-priority instructions an agent receives. The harness may add constraints that shape command execution, testing behavior, and final reporting.&lt;/p&gt;

&lt;p&gt;If an agent repeatedly ignores a clear completion protocol, the wording in &lt;code&gt;AGENTS.md&lt;/code&gt; may not be the problem. Ask your model which instruction is shaping the verification behavior and where it came from. I use &lt;a href="https://craftedbytes.dev/posts/agent-diagnostics-mode/" rel="noopener noreferrer"&gt;Agent Diagnostics Mode&lt;/a&gt; for this kind of investigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start Small
&lt;/h2&gt;

&lt;p&gt;You do not need a giant governance document. Start with the checks you already expect a responsible human contributor to run. Extend your completion protocol as the project grows.&lt;/p&gt;

&lt;p&gt;This helps me a lot and I hope it will help you too!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>automation</category>
    </item>
    <item>
      <title>Agent Diagnostics Mode — A Structured Technique for Iterative Prompt Tuning</title>
      <dc:creator>Eugene</dc:creator>
      <pubDate>Sat, 21 Mar 2026 09:24:12 +0000</pubDate>
      <link>https://dev.to/gemyago/agent-diagnostics-mode-a-structured-technique-for-iterative-prompt-tuning-hg8</link>
      <guid>https://dev.to/gemyago/agent-diagnostics-mode-a-structured-technique-for-iterative-prompt-tuning-hg8</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuzxauy6gifry1m5kvkc2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuzxauy6gifry1m5kvkc2.png" alt="A conceptual illustration of a technical diagnostic interface for an AI agent"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem with Prompt Tuning Today
&lt;/h2&gt;

&lt;p&gt;Prompts are not static configuration. If you have been running LLM-powered agents on real projects for more than a few months, you already know this. A prompt that worked perfectly last quarter drifts after a model update. A system instruction that produced reliable behavior on one agent — say, Cursor — behaves differently when you port it to Gemini or Claude. And the same prompt file can produce subtly inconsistent results across projects as the surrounding context changes.&lt;/p&gt;

&lt;p&gt;The usual response to this is ad-hoc: you notice something is off, exit the working conversation, edit the prompt file, re-run the agent, and try to reconstruct the context you had before. That friction compounds. You lose the conversational thread. You lose the intermediate reasoning the model had built up. And you are basically doing print-statement debugging on a system that has no stack trace.&lt;/p&gt;

&lt;p&gt;The problem is not that prompt tuning is hard. The problem is that there is no structured diagnostic loop for doing it &lt;em&gt;inside&lt;/em&gt; the working context. As for me, this lack of structure has been a recurring pain point.&lt;/p&gt;




&lt;h2&gt;
  
  
  Video Walkthrough: The Diagnostics In Action
&lt;/h2&gt;

&lt;p&gt;If you prefer a visual deep dive, I have a video for this post. I walk through the "Westworld" analysis vibe in real-time, showing exactly how the model pivots from "doing" to "reporting" in a live project. &lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/aH-_6NvKCB8"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Start: Entering and Exiting Diagnostics Mode
&lt;/h2&gt;

&lt;p&gt;The mechanic is simple. I keep a small file at &lt;code&gt;.context/agent-diagnostics-mode.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Agent Diagnostics Mode&lt;/span&gt;

If user is referencing this prompt, you are in self-diagnostics mode. The goal of this mode is typically to understand your reasoning process, decision making, actions or results. Typically the user is trying to optimise your performance or behavior and tune their instructions to you.

The user may typically ask you something along with this prompt. You should analyse the user enquiry and report your findings based on the user enquiry.

&lt;span class="gs"&gt;**IMPORTANT:**&lt;/span&gt; You MUST NOT do any actions or modifications - just analyse and report your findings based on the user enquiry.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To enter diagnostics mode on any agent that supports referenced prompt files (are there any that do not?), I include this file in my message. The effect is immediate and significant: the model pivots from &lt;em&gt;doing&lt;/em&gt; to &lt;em&gt;reporting&lt;/em&gt;. It stops planning tasks and starts articulating its reasoning.&lt;/p&gt;

&lt;p&gt;Here is a real example from one of my Go projects. My &lt;code&gt;AGENTS.md&lt;/code&gt; defines two distinct task completion protocols &lt;a href="https://github.com/gemyago/golang-backend-boilerplate/blob/main/AGENTS.md#task-completion-protocol" rel="noopener noreferrer"&gt;for example&lt;/a&gt;: a &lt;strong&gt;Coding Task Completion Protocol&lt;/strong&gt; (run &lt;code&gt;make lint&lt;/code&gt;, run &lt;code&gt;make test&lt;/code&gt;, confirm coverage, report status) and a &lt;strong&gt;Non-Coding Task Completion Protocol&lt;/strong&gt; (summarize findings, confirm deliverables, no lint/test required). The intent is obvious: code changes require verification, everything else does not.&lt;/p&gt;

&lt;p&gt;The model started skipping lint and tests after refactoring a package. It classified the task as non-coding — I suspect because the instruction I gave was phrased around reorganizing files, which pattern-matched to "documentation/investigation" rather than "code change." The refactor changed Go files. Lint and tests were mandatory. But the agent declared completion with just a summary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enter diagnostics:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;@agent-diagnostics-mode.md&lt;/code&gt;&lt;br&gt;&lt;br&gt;
I just asked you to move a package and update its imports across the codebase. You reported completion without running &lt;code&gt;make lint&lt;/code&gt; or &lt;code&gt;make test&lt;/code&gt;. Which task completion protocol did you apply, and what in my instructions led you to that classification?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The agent responds with a behavioral report — not an action. It identifies that it applied the Non-Coding protocol, cites the exact section it matched against ("investigation, documentation review, committing"), and notes that the ambiguity came from my use of the word "reorganize" — a word it associated with structural/documentation work rather than code modification. No files are changed. No commands are run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exit diagnostics:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Exit diagnostics mode. Now update &lt;code&gt;AGENTS.md&lt;/code&gt; so that the Coding Task Completion Protocol explicitly lists package moves and import updates as coding tasks, regardless of how the instruction is phrased.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The model carries the diagnostic conclusion forward and applies the fix in one step. The conversation context &lt;em&gt;is&lt;/em&gt; the working memory — no reconstruction needed.&lt;/p&gt;

&lt;p&gt;No special tooling is required here. This is a pure prompt technique.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Side note: every time I type &lt;code&gt;@agent-diagnostics-mode.md&lt;/code&gt; I think of &lt;a href="https://www.imdb.com/title/tt0475784/" rel="noopener noreferrer"&gt;Westworld&lt;/a&gt; — where the hosts switched to "Analysis" mode on a simple voice command. Same vibe, but instead of uncovering suppressed memories, you are uncovering why your agent skipped &lt;code&gt;make test&lt;/code&gt;. Feels like the future we're living in — there were no flying cars in that movie, so I guess we're almost there. :)&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Works: The Architecture Behind the Mode
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why LLMs Respond to Mode Declarations
&lt;/h3&gt;

&lt;p&gt;LLMs are sensitive to framing. This is not a bug — it is how the attention mechanism distributes probability mass across the context window. When you explicitly declare a behavioral mode by referencing a named instruction file, you are shifting the model's prior distribution over likely next tokens. The behavioral envelope changes without any retraining.&lt;/p&gt;

&lt;p&gt;The critical constraint in the diagnostics prompt is &lt;code&gt;MUST NOT do any actions or modifications&lt;/code&gt;. This is not politeness. It is load-bearing. Without it, many models — especially those optimized heavily for task completion — will collapse the investigation phase into an implementation. They will diagnose the issue and then helpfully fix it before you have had a chance to evaluate whether the diagnosis was correct. That is exactly the failure mode you are trying to avoid.&lt;/p&gt;

&lt;p&gt;By separating the diagnostic phase from the implementation phase, you get something closer to a red team exercise than a development sprint. The model is not trying to be useful in the conventional sense. It is trying to be &lt;em&gt;accurate&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Probing for Behavior vs. Triggering It
&lt;/h3&gt;

&lt;p&gt;There is a meaningful distinction between asking an LLM &lt;em&gt;to do something&lt;/em&gt; and asking it &lt;em&gt;to explain what it would do and why&lt;/em&gt;. Diagnostics mode exploits that gap. You can surface hidden assumptions, expose conflicting instructions, and simulate edge cases — all without mutating any project state.&lt;/p&gt;

&lt;p&gt;As for me, the most valuable use has been catching prompt assumptions I wrote months ago and forgot about. The model cites them back and precisely explains why it chose them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prompt Tuning as a Feedback Loop
&lt;/h3&gt;

&lt;p&gt;The full workflow is a tight loop: enter diagnostics → interrogate → identify the misalignment → exit → apply change. Engineers will recognize the shape — it is the REPL, or unit test isolation. The difference is that the conversation context itself is the working memory, your prompts are like code files, and you're using the model as a debugger of its own behavior.&lt;/p&gt;




&lt;h2&gt;
  
  
  Edge Cases and Failure Modes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Mode bleed.&lt;/strong&gt; Some models ignore the declaration and keep taking actions. Add an explicit confirmation step — "Confirm you are in diagnostics mode before proceeding" — which forces the model to process the constraint before it does anything else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context window exhaustion.&lt;/strong&gt; Long diagnostic threads are expensive. If responses start sounding vague or recycled, the effective context is likely saturated. Keep sessions focused on one prompt file at a time; open a fresh context for distinct concerns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model-specific variance.&lt;/strong&gt; Instruction-following models — Claude Sonnet, GPTs — respect the &lt;code&gt;MUST NOT&lt;/code&gt; constraint more or less reliably. Some other models I've used may not. Also, some models tend to produce quite verbose diagnostics output which may be hard to analyze. I've seen this behavior with grok-code-fast.&lt;/p&gt;




&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prompt Engineering and Instruction Design
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview" rel="noopener noreferrer"&gt;Anthropic: Prompt Engineering Overview&lt;/a&gt;&lt;/strong&gt; — A practical reference for constructing reliable system prompts; directly relevant to writing the kind of mode-declaration instructions used in this technique.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://platform.openai.com/docs/guides/prompt-engineering" rel="noopener noreferrer"&gt;OpenAI: Prompt Engineering Guide&lt;/a&gt;&lt;/strong&gt; — Covers the mechanics of how instruction phrasing affects model behavior, which explains why word choice like "reorganize" causes protocol misclassification.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  LLM Attention and Context Behavior
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://arxiv.org/abs/1706.03762" rel="noopener noreferrer"&gt;Attention Is All You Need (Vaswani et al., 2017)&lt;/a&gt;&lt;/strong&gt; — The original transformer paper; reading this gives you precise intuition for why framing and token ordering influence how models weight instructions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Agent Instruction Patterns
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/gemyago/golang-backend-boilerplate/blob/main/AGENTS.md" rel="noopener noreferrer"&gt;golang-backend-boilerplate AGENTS.md&lt;/a&gt;&lt;/strong&gt; — A real-world example of the task completion instruction file referenced in this post; useful as a template for structuring your own agent rules.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>debugging</category>
      <category>agents</category>
      <category>promptengineering</category>
    </item>
  </channel>
</rss>
