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

推荐订阅源

Jina AI
Jina AI
C
Check Point Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Know Your Adversary
Know Your Adversary
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
Latest news
Latest news
Project Zero
Project Zero
T
Threat Research - Cisco Blogs
P
Palo Alto Networks Blog
雷峰网
雷峰网
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News and Events Feed by Topic
P
Privacy International News Feed
Vercel News
Vercel News
T
The Exploit Database - CXSecurity.com
S
Secure Thoughts
Application and Cybersecurity Blog
Application and Cybersecurity Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Full Disclosure
T
Tenable Blog
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
SecWiki News
SecWiki News
C
CERT Recently Published Vulnerability Notes
Forbes - Security
Forbes - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
S
Security Affairs
The GitHub Blog
The GitHub Blog
J
Java Code Geeks
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
O
OpenAI News
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
Engineering at Meta
Engineering at Meta
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News and Events Feed by Topic
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
Schneier on Security
Schneier on Security
W
WeLiveSecurity
Recorded Future
Recorded Future
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 三生石上(FineUI控件)

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 Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Constraint Decay: Why Your AI Coding Agent Passes Tests But Breaks Production
Toni Antunovic · 2026-05-29 · via DEV Community

Toni Antunovic

A paper published this week on arxiv has a name that should land with weight in any engineering meeting: Constraint Decay: The Fragility of LLM Agents in Backend Code Generation. The finding is precise and uncomfortable. LLM coding agents generate plausible backend code when requirements are loose. As structural constraints accumulate, performance collapses. Capable model configurations lose 30 points on average in assertion pass rates from a baseline unconstrained task to a fully specified production task. Weaker configurations approach zero.

            This is not a benchmark complaint. It is a description of what happens in your codebase every day. Your AI coding agent produces code that satisfies functional tests, makes the CI pipeline green, and ships. The structural violations, the ORM misuse, the architectural drift, the missing query composition constraints sit silently in the diff until they cause a production incident.


            > 
                **Paper reference:** "Constraint Decay: The Fragility of LLM Agents in Backend Code Generation" (arxiv 2605.06445, May 2026). The study evaluated 80 greenfield generation tasks and 20 feature-implementation tasks across eight web frameworks. Trending on Hacker News today with substantial developer discussion confirming the pattern in real codebases.


            ## What Constraint Decay Actually Looks Like

            The paper introduces a precise definition. Constraint decay is the measurable drop in an LLM agent's ability to satisfy structural requirements as the number of non-functional constraints grows. Functional correctness, meaning the code does what you described, stays relatively stable. Structural correctness, meaning the code follows your architectural patterns, ORM conventions, query composition rules, and framework idioms, degrades sharply.


            The researchers tested agents against eight backend frameworks. Flask, the most explicit and minimal framework, produced the best results. Django and FastAPI, both convention-heavy and relying on implicit structural contracts, produced the worst. The root cause analysis pointed to two specific failure categories that dominated the results:



                - **Incorrect query composition:** Agents writing raw queries or composing ORM queries in ways that violate the expected query patterns for the framework.
                - **ORM runtime violations:** Agents generating code that passes static analysis and unit tests but violates runtime ORM contracts, triggering errors only under real data conditions or at the database layer.


            These failure modes share one property: they are invisible to functional tests. A unit test that mocks the database layer will pass. An integration test that does not exercise the specific query path will pass. The violation surfaces in production, often under load or with production-shaped data.


            ## The Test Suite Cannot See What It Was Not Asked to See

            Here is the structural problem. When you ask an AI coding agent to implement a feature, you describe the functional requirement. The agent generates code that satisfies that description. Your test suite validates the functional behavior. Everyone signs off.


            But your test suite was also written by the same agent, or by developers who inherited the same mental model of what the code should do. It tests what was intended. It does not test whether the implementation respects the implicit structural contracts of your framework, your ORM configuration, or your team's architectural decisions documented somewhere in a CLAUDE.md or a markdown file that may not have been loaded into the agent's context window when it wrote the code.


            > 
                **The documentation accumulation problem:** Hacker News discussion on the constraint decay paper surfaced a pattern that every team running agentic workflows recognizes. Teams accumulate extensive markdown files documenting style guides, corner cases, and architectural patterns. This guidance "piles up" and is not fully reviewed. The agent receives it as context but its effectiveness degrades as the constraint count grows. The very documentation you created to constrain the agent becomes part of the decay problem.


            Consider a realistic Django example. Your team uses a repository pattern and has established conventions for queryset composition. The convention is documented in your CLAUDE.md. The agent generates a new view. The view works. The tests pass. But the implementation bypasses the repository layer and calls the ORM directly with a queryset chain that does not match the team's select_related and prefetch_related conventions. Under production load with 50,000 rows, this generates N+1 query patterns that the test suite never triggered because the test fixtures had three rows.

# What the agent generated: passes all tests, violates structural constraints
class OrderListView(LoginRequiredMixin, ListView):
    def get_queryset(self):
        # Direct ORM call, bypasses repository pattern
        # Missing prefetch_related("items__product") convention
        return Order.objects.filter(
            user=self.request.user,
            status__in=["pending", "processing"]
        ).order_by("-created_at")

# What the team's architectural contract requires
class OrderListView(LoginRequiredMixin, ListView):
    def get_queryset(self):
        # Uses repository layer per team convention
        # Applies correct prefetch strategy documented in architecture.md
        return self.order_repository.get_active_for_user(
            user=self.request.user,
            prefetch_items=True
        )

            A functional test that checks "does the view return the right orders for this user" passes in both cases. The structural violation only surfaces when someone reads the code during review, or when the database query count alarm fires at 2am.


            ## Why Constraint Decay Gets Worse With Your Codebase Over Time

            The paper's findings have a compounding property that matters for teams with mature codebases. As a codebase grows, the number of structural constraints accumulates. You add a caching layer. You establish a specific serializer pattern. You document which database operations are allowed in view code versus service code. You adopt a specific approach to transaction boundaries.


            Each new constraint is another item in the context that the agent must simultaneously satisfy. The decay curve the paper documents is not linear: it is a cliff. At some constraint count, agent performance does not gracefully degrade. It collapses. Teams that have been successfully using AI coding agents for six months start experiencing a different failure mode profile than they saw in month one, not because the model got worse, but because the codebase accumulated structural constraints that now exceed the agent's effective constraint satisfaction capacity.


            The Hacker News discussion confirmed this with practitioner data. One developer noted they generate 80% of their code with LLMs and observe the complexity tradeoff directly: constraints that used to live in formal language constructs now live in informal natural language, and the enforcement is gone. Another noted that agents tend to over-apply patterns they encounter, making it difficult to break established conventions even when beneficial, and easy to introduce violations of conventions that were not included in the specific prompt context.


            ## What Static Analysis Catches That Tests Miss

            This is where local-first SAST tooling earns its place in the agentic workflow. The constraint decay failure modes, incorrect query composition, ORM violations, architectural drift, are exactly the categories that static analysis can detect before the code reaches the test suite, before it reaches CI, and before it reaches production.


            Static analysis does not care whether code is functionally correct. It checks structure. It checks patterns. It checks whether the code you committed matches the rules you have encoded. For AI-generated code with constraint decay characteristics, this is the enforcement layer that the test suite cannot provide.

# LucidShark pre-commit hook catching ORM structural violations
# in a Django project with repository pattern enforcement

$ git commit -m "feat: add order list view"

Running LucidShark quality gates...

[SAST] Analyzing changed files...
  src/views/orders.py

[WARNING] Direct ORM query in view layer (line 12)
  Rule: ARCH-ORM-001 - Repository pattern required for database access in views
  Pattern: Order.objects.filter() called directly in View class
  Expected: Use self.order_repository or OrderRepository()

[WARNING] Missing prefetch annotation (line 14)
  Rule: PERF-ORM-003 - Active queryset on Order must include items prefetch
  Pattern: Order.objects.filter() without .prefetch_related("items")
  Doc reference: docs/architecture.md#query-conventions

2 structural violations found.
Commit blocked. Fix violations before committing.

Tip: Run `lucidshark check --explain ARCH-ORM-001` for remediation guidance.

            This output is generated locally, before the code leaves your machine. No API call to an external review service. No waiting for CI. No production incident. The structural violation that constraint decay produced is caught at the commit boundary by rules that encode your team's actual architectural contracts.


            ## Encoding Your Structural Constraints as Enforceable Rules

            The practical implication of the constraint decay paper is that natural language documentation is not a reliable constraint mechanism for LLM agents. Your CLAUDE.md is not a contract. Your architecture.md is not enforcement. They are context that degrades in effectiveness as constraint count grows.


            The solution is not to write better documentation. The solution is to encode your structural constraints as machine-checkable rules that run at commit time, regardless of how many constraints the agent was supposed to hold in context.

# lucidshark.config.yml - encoding structural constraints as rules

rules:
  # Repository pattern enforcement
  - id: ARCH-ORM-001
    name: "No direct ORM in view layer"
    pattern: "*.objects.filter|get|create|update|delete"
    files: ["views/**/*.py", "api/**/*.py"]
    message: "Direct ORM access in view layer violates repository pattern"
    severity: error

  # Query composition conventions
  - id: PERF-ORM-003
    name: "Order queryset must prefetch items"
    pattern: "Order.objects"
    require_pattern: "prefetch_related"
    message: "Order querysets require prefetch_related('items') per query conventions"
    severity: warning

  # Transaction boundary enforcement
  - id: ARCH-TXN-001
    name: "Multi-step writes require transaction decorator"
    pattern: "def (create|update|delete)_.*\(self"
    context_check: "@transaction.atomic"
    files: ["services/**/*.py"]
    message: "Service methods with write operations require @transaction.atomic"
    severity: error

  # Framework-specific structural checks
  sast:
    semgrep_rules:
      - "p/django"
      - "p/python"
    custom_rules: ".lucidshark/rules/"

            These rules are the machine-readable version of your structural constraints. They do not decay. They do not depend on whether the agent loaded the right documentation in its context window. They run at commit time on every diff, AI-generated or human-written, and they fail the commit if the structure does not match the contract.


            ## The Framework-Specific Dimension

            The paper's finding that Flask outperforms Django and FastAPI is instructive beyond the benchmark. It explains a pattern that experienced agentic developers have observed: AI coding agents produce more reliable code in minimal, explicit frameworks and more problematic code in convention-heavy frameworks.


            The implication for teams is that the risk profile of AI-generated code is not uniform across your stack. A Python service using Flask with explicit dependency injection and minimal framework magic is a lower constraint-decay risk than a Django application with signals, middleware conventions, custom managers, and a repository layer. Your quality gate strategy should reflect this: heavier structural enforcement where constraint decay risk is highest.

# High constraint-decay risk: Django with multiple implicit contracts
# The agent must simultaneously satisfy: ORM conventions, signal hooks,
# custom manager methods, serializer patterns, permission classes,
# and transaction boundaries

class OrderService:
    def create_order(self, user, cart_data):
        # Agent may violate any of: transaction boundary, signal firing order,
        # custom manager usage, select_for_update requirement on inventory
        with transaction.atomic():
            order = Order.objects.create_from_cart(
                user=user,
                cart_data=cart_data
            )
            # post_save signal expected by analytics service
            # Agent frequently omits or duplicates signal triggers
            order_created.send(sender=Order, instance=order, user=user)
            return order

# Lower constraint-decay risk: Flask with explicit contracts
# Fewer implicit conventions for the agent to violate

def create_order(user_id: int, cart_data: CartData, db: Session) -> Order:
    # Explicit: no signals, no custom manager magic, transaction is explicit
    with db.begin():
        order = Order(user_id=user_id, status="pending")
        db.add(order)
        for item in cart_data.items:
            line = OrderLine(product_id=item.product_id, quantity=item.quantity)
            order.lines.append(line)
    return order

            ## Practical Quality Gate Strategy for Constraint Decay

            The constraint decay paper gives teams a concrete framework for thinking about AI-generated code risk. Here is how to translate that into a gate strategy:


            ### 1. Audit your structural constraint count
            List every implicit structural contract in your codebase: ORM patterns, transaction conventions, serializer patterns, permission patterns, caching conventions, query composition rules. The higher this count, the higher your constraint decay risk for AI-generated code. Prioritize encoding the highest-impact constraints as rules first.


            ### 2. Separate functional and structural review
            Your test suite handles functional validation. Your pre-commit quality gate handles structural validation. These are different concerns and should not be conflated. A green test suite does not indicate structural correctness for AI-generated code.


            ### 3. Apply differential scrutiny by framework
            AI-generated code in convention-heavy frameworks like Django, Rails, or Spring carries higher constraint-decay risk. Apply heavier static analysis rule sets to these areas. AI-generated code in minimal, explicit frameworks carries lower risk.


            ### 4. Encode constraints at the boundary, not in the prompt
            Natural language constraints in CLAUDE.md are context, not enforcement. Machine-checkable rules at the commit boundary are enforcement. Use both, but rely on the rules for structural compliance.


            > 
                **On the documentation accumulation problem:** The Hacker News discussion surfaced the pattern where teams accumulate guidance documents that "pile up" without full review. LucidShark's approach is to treat your quality rule configuration as the authoritative structural specification, not your markdown documentation. The rules config is version-controlled, reviewed, and enforced. The markdown is explanatory.


            ## The Bigger Picture: Agentic Development Needs Structural Gates

            The constraint decay paper lands at a moment when the industry is accelerating agentic code generation. Microsoft just canceled thousands of internal Claude Code licenses after costs spiraled, pushing developers back to GitHub Copilot CLI. DeepSeek Reasonix launched today as a terminal coding agent built around prefix caching for cost reduction. The tooling ecosystem is expanding rapidly, each tool promising faster code generation at lower cost.


            What none of these tools address is the structural correctness problem. Faster generation of structurally violated code is not a win. The constraint decay paper provides the academic framing for something practitioners have been experiencing: AI coding agents are reliable for functional requirements and unreliable for structural requirements, and this gap widens as codebases mature.


            Local-first quality gates are the structural enforcement layer that the AI coding tool ecosystem does not provide. They run on your machine, with your rules, encoding your team's actual architectural contracts. They are not dependent on which AI coding tool your employer happens to be licensing this quarter. They work with Claude Code, Copilot CLI, Reasonix, or any agent that produces code and commits it.


            The paper's conclusion is worth quoting directly: "jointly satisfying functional and structural requirements remains a key open challenge." That challenge does not disappear by waiting for model improvements. It is addressed by building structural enforcement into the development workflow today.



                **Add structural constraint enforcement to your AI coding workflow today.**
                LucidShark runs locally with no API calls, no data leaving your machine, and no per-review fees. It integrates with Claude Code via MCP and installs as a pre-commit hook in under two minutes. Encode your team's structural constraints as rules and catch constraint decay violations before they reach CI or production.

                ```

npx lucidshark@latest init



                    Open source under Apache 2.0. <a href="https://github.com/toniantunovic/lucidshark">View on GitHub</a> or <a href="https://lucidshark.com/docs">read the docs</a>.