<?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: Yuan</title>
    <description>The latest articles on DEV Community by Yuan (@baskduf).</description>
    <link>https://dev.to/baskduf</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3951772%2F7a4b25e8-20f7-41a0-b645-7bd63c4f6fd9.jpeg</url>
      <title>DEV Community: Yuan</title>
      <link>https://dev.to/baskduf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/baskduf"/>
    <language>en</language>
    <item>
      <title>Harness Engineering: Stop Re-Prompting Your Coding Agent Every Session</title>
      <dc:creator>Yuan</dc:creator>
      <pubDate>Tue, 26 May 2026 05:10:05 +0000</pubDate>
      <link>https://dev.to/baskduf/harness-engineering-stop-re-prompting-your-coding-agent-every-session-4lec</link>
      <guid>https://dev.to/baskduf/harness-engineering-stop-re-prompting-your-coding-agent-every-session-4lec</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%2F7i93rhgr7i8k09e3x6z3.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%2F7i93rhgr7i8k09e3x6z3.png" alt=" " width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every time I started a new agent session, I was re-explaining the same things.&lt;/p&gt;

&lt;p&gt;The architecture rules. The patterns to avoid. The decisions I'd already made. The approaches that already failed.&lt;/p&gt;

&lt;p&gt;The agent would forget everything and I'd be back to square one.&lt;/p&gt;

&lt;p&gt;My first instinct was to write better prompts. Longer, more detailed, more explicit. But that just made the problem worse — now I had a 200-line prompt to maintain, and the agent still forgot it all next session.&lt;/p&gt;

&lt;p&gt;The real problem isn't the prompt. &lt;strong&gt;Prompts are session-scoped. They disappear.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  A Different Approach: Harness Engineering
&lt;/h2&gt;

&lt;p&gt;Instead of putting rules in prompts, what if we put them in the repository itself?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Prompting is temporary. Context is session-scoped. A harness is project-scoped.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The idea is simple: every time an agent makes a recurring mistake, convert it into a durable artifact in the repo instead of re-prompting.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agent repeats a bad pattern → add a lint rule that blocks it&lt;/li&gt;
&lt;li&gt;Agent forgets architecture decisions → write an ADR in &lt;code&gt;docs/decisions/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Agent retries approaches that already failed → log them in &lt;code&gt;docs/failures/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Agent ignores conventions → codify them in &lt;code&gt;AGENTS.md&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The repository gets smarter with every mistake. The agent reads the repo at the start of each session and picks up all the rules automatically — no prompting required.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Five Components of a Harness
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. &lt;code&gt;AGENTS.md&lt;/code&gt; — Instruction Document&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A file the agent reads at the start of every session. Contains project overview, directory rules, forbidden patterns, test commands, and PR behavior. Think of it as a permanent briefing document.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Architecture Constraints&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Automated rules that block invalid code before it merges. Linters, type checks, import boundaries, pre-commit hooks. If &lt;code&gt;AGENTS.md&lt;/code&gt; says "no direct DB access from routes", add a lint rule that enforces it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Feedback Loops&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Signals the agent uses to self-correct. Test failures, CI failures, lint errors. A good harness gives the agent clear, actionable failure messages so it can fix its own mistakes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Knowledge Store (&lt;code&gt;docs/&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Durable context that survives session resets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docs/decisions/&lt;/code&gt; — why certain architectural choices were made&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docs/failures/&lt;/code&gt; — approaches already tried and rejected&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docs/conventions/&lt;/code&gt; — project-specific coding rules&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docs/domain/&lt;/code&gt; — business terminology and domain knowledge&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Drift Checks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Scripts that detect when the harness itself goes stale. Is &lt;code&gt;AGENTS.md&lt;/code&gt; referencing files that no longer exist? Are there temporary files that never got cleaned up? Drift checks catch this automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  harness-starter-kit
&lt;/h2&gt;

&lt;p&gt;I built a starter kit that applies this pattern to any existing project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usage:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Clone it inside your target repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;workspace/
└── target-repo/
    ├── harness-starter-kit/
    └── existing project files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then give your coding agent this prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Read ./harness-starter-kit first, then apply the harness engineering 
starter kit to this repository. Preserve existing architecture, tools, 
and conventions. Do not overwrite existing files without explaining why.
Finish with a short adoption report.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent inspects your repo, adapts to your existing tools (eslint, tsc, ruff, etc.), and installs only the missing harness files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key design decisions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Non-destructive — never overwrites existing files&lt;/li&gt;
&lt;li&gt;Tool-agnostic — works with whatever you already use&lt;/li&gt;
&lt;li&gt;Agent-agnostic — works with Claude Code, Cursor, Copilot, etc.&lt;/li&gt;
&lt;li&gt;Profiles available for generic, Python, and TypeScript projects&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Better prompting is a local fix. Harness engineering is a systemic fix.&lt;/p&gt;

&lt;p&gt;Every recurring agent failure should become at least one durable artifact — a clearer rule, an automated constraint, a test, a decision record, or a drift check. That's the core loop.&lt;/p&gt;

&lt;p&gt;The goal isn't to write the perfect prompt. It's to build a repository that makes the same mistakes increasingly unlikely over time.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://github.com/baskduf/harness-starter-kit" rel="noopener noreferrer"&gt;GitHub: harness-starter-kit&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Have you been dealing with agents repeating the same mistakes? How are you handling it?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>tooling</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
