CLAUDE.md Operating Contract to Prevent LLM Drift and Improve Action-Rate in Long Coding Sessions Workflow value: 90/100

Status: active · Freshness: 70/100 · Confidence: 1.00 · Level: intermediate

Categories: Quality Control, Context & Memory, Debugging, Shipping, CLAUDE.md, Subagents, Multi-Agent

Original source: r/ClaudeAI post/comment

What problem this solves Prevents 'Claude Code rot' or 'long-session drift' in LLM agents, where intelligence degrades, context is lost, and actions become ineffective over long, multi-hour coding sessions. It specifically addresses eight failure modes like wrong context, memory loaded as noise, stale state, uncollapsed plans, unchecked test output, and misinterpretation of instructions.

Summary A reusable operating contract (CLAUDE.md) for Claude Code agents designed to prevent 'long-session drift' and improve action-rate by establishing six clear rules. This contract addresses common failure modes like context loss, stale state, and poor action selection, providing a structured way to guide the agent's behavior and maintain performance over extended sessions.

Why it is useful This workflow provides a concrete, reusable, and validated solution to a common and frustrating problem experienced by users running LLMs for extended coding tasks: 'model rot' or 'drift.' By offering a simple, copyable operating contract (CLAUDE.md) and a clear testing method (DEMO.md), it empowers users to significantly improve their agent's action-rate and consistency. Its transferability, explicit validation signals (action-rate improvement, demo videos), and open-source nature make it highly valuable for the library.

Workflow Identify common failure modes in long Claude Code sessions (e.g., wrong context, memory as noise, stale state, uncollapsed plans, unchecked test output, misinterpreting instructions).

Access the 'weasel' GitHub repository ( https://github.com/jaswalmohit8-collab/weasel ) to obtain the CLAUDE.md operating contract.

Integrate the CLAUDE.md file into your agent's context, instructing it to read and adhere to the contract's six rules.

Test the behavior shift using the provided DEMO.md prompt or your own real-world coding tasks.

Observe improved 'action-rate' (PASS entries divided by total gated entries) and reduced occurrence of the identified failure modes.

Iteratively refine the rules in the operating contract based on observed agent behavior and new failure patterns, contributing back to the repo if desired.

Tools / artifacts CLAUDE.md (operating contract file)

DEMO.md (two-minute prompt for testing)

GitHub repository (jaswalmohit8-collab/weasel)

Claude Code (or Kimi Code)

Validation signals Reported 'action-rate from single-digit to consistent double-digit' after implementation.

Demo videos in the GitHub repo showing the same file running under Kimi Code and Claude Code.

DEMO.md provides a reproducible, two-minute test for behavior shift.

The author invites community contributions (issues, pull requests) with 'be…

为什么值得关注

能改变理解方式,而不只是重复常识;有直接可用的方法、工具或操作价值;它提供了新的理解或解释,而不只是表面观点

来源:reddit,领域:tech,保留分:0.66