惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
L
LangChain Blog
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
Y
Y Combinator Blog
月光博客
月光博客
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
小众软件
小众软件
H
Help Net Security
Last Week in AI
Last Week in AI
B
Blog RSS Feed
宝玉的分享
宝玉的分享
N
Netflix TechBlog - Medium
博客园 - 叶小钗
The GitHub Blog
The GitHub Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Harness Engineering: Stop Re-Prompting Your Coding Agent ...
Yuan · 2026-05-26 · via DEV Community

Yuan

Every time I started a new agent session, I was re-explaining the same things.

The architecture rules. The patterns to avoid. The decisions I'd already made. The approaches that already failed.

The agent would forget everything and I'd be back to square one.

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.

The real problem isn't the prompt. Prompts are session-scoped. They disappear.


A Different Approach: Harness Engineering

Instead of putting rules in prompts, what if we put them in the repository itself?

Prompting is temporary. Context is session-scoped. A harness is project-scoped.

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.

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

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.


The Five Components of a Harness

1. AGENTS.md — Instruction Document

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.

2. Architecture Constraints

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

3. Feedback Loops

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.

4. Knowledge Store (docs/)

Durable context that survives session resets:

  • docs/decisions/ — why certain architectural choices were made
  • docs/failures/ — approaches already tried and rejected
  • docs/conventions/ — project-specific coding rules
  • docs/domain/ — business terminology and domain knowledge

5. Drift Checks

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


harness-starter-kit

I built a starter kit that applies this pattern to any existing project.

Usage:

Clone it inside your target repo:

workspace/
└── target-repo/
    ├── harness-starter-kit/
    └── existing project files

Then give your coding agent this prompt:

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.

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

Key design decisions:

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

Why This Matters

Better prompting is a local fix. Harness engineering is a systemic fix.

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.

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

👉 GitHub: harness-starter-kit


Have you been dealing with agents repeating the same mistakes? How are you handling it?