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

推荐订阅源

WordPress大学
WordPress大学
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 聂微东
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
量子位
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
B
Blog RSS Feed
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
GbyAI
GbyAI
Jina AI
Jina AI
宝玉的分享
宝玉的分享
腾讯CDC
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
D
Docker
博客园_首页
N
News and Events Feed by Topic
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Help Net Security
Help Net Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cisco Blogs
F
Fortinet All Blogs
SecWiki News
SecWiki News
AI
AI
S
Schneier on Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Last Watchdog
The Last Watchdog
Martin Fowler
Martin Fowler
A
About on SuperTechFans
T
Troy Hunt's Blog
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
Hacker News: Ask HN
Hacker News: Ask HN
F
Full Disclosure
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
InfoQ
S
Security @ Cisco Blogs
Project Zero
Project Zero
Simon Willison's Weblog
Simon Willison's Weblog
C
Cyber Attacks, Cyber Crime and Cyber Security
J
Java Code Geeks
N
News | PayPal Newsroom
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
H
Hacker News: Front Page

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
How I made AI agents think Architecturally
Ansh Sonkar · 2026-06-06 · via DEV Community

Github

Last week I had Claude Code open on a postgres formatter file. I asked it to refactor a small helper. It came back with a 12 line patch. Looked clean. Lint passed. I was about to hit accept.

Before I did, the agent ran a check I'd wired in. Output:

Diff Validation
Risk: HIGH
Files changed: 1
Union blast radius: 83 transitive dependents

Violations (1):
HIGH high_blast packages/pg-meta/src/pg-format/index.ts
Modifying this file affects 83 transitive dependents (>50).

83 files import this thing. The agent paused, threw out its own patch, and asked if I wanted to split the change instead.

The check is a tool called validate_diff. Runs in well under a millisecond on a 7,000-file repo. It's part of an MCP server I built called Carto, and this post is about why a check like this matters, how I made it fast enough to run on every diff, and the numbers that made me trust it.

The problem

AI coding tools are confident. They'll propose a 12-line patch to a file with 83 transitive dependents like it's nothing. You accept it. Things break downstream.

The reason is simple. Your AI tool reads the file it's editing. Maybe a few greps. Maybe a vector search hit. It doesn't read the import graph. It doesn't know which files are load-bearing. It has no model of what depends on what.

Most of the time this is fine. The patch lands somewhere reasonable, tests pass, the change ships. The bad case is the silent one. The agent refactors a utility 60 other files import. Tests pass locally because the cascade doesn't run. Three days later something downstream breaks. The agent isn't in the room anymore.

This isn't a model problem. The LLM can't reason about a graph it doesn't have. RAG over file chunks doesn't fix it either, because what the AI needs is a graph, not more snippets. More context, not different context.

The fix has to be structural. Something the agent can query the way I'd run git log and grep -r before touching code I don't know.

So I built Carto

Carto indexes your codebase into a local SQLite database. Import graph, domain map, blast radius for every file. It exposes validate_diff and 21 other tools over MCP, and your AI calls them mid-task.

validate_diff takes the unified diff the agent is about to propose and returns the risk level, every file the change touches transitively, and whether it crosses domain boundaries it shouldn't. All of this before it proposes the patch. The AI revises, splits the change, or flags it. The bad diff never makes it to your screen.

The other tools answer obvious questions. What depends on this file. What domain is it in. What files do I need to touch to add rate limiting to /api/users. What patterns already exist before I write new code. validate_diff is the one I built the rest of the system around.

carto init auto-wires into Cursor, Claude Code, Kiro, Windsurf, VS Code Copilot, Codex, Claude Desktop, Zed, JetBrains. Install once, restart your AI tool, and from then on the AI calls Carto on its own.

How it works

The validate_diff pipeline is five steps. Parse the diff. Look up each changed file's blast radius (precomputed at index time). OR-aggregate the blast radii into a union. Check for new cross-domain imports. Score it.

The whole thing finishes in microseconds because of the bitmap layer. A naive implementation would round-trip to SQLite for every file in the diff. Carto stores reverse-deps as Uint32Array bitsets built from SQLite, so a union over 20 files' blast radii is one OR pass over data already in memory.

Indexing uses tree-sitter to parse every file for imports and symbols, around 0.05 to 0.2ms per file. Babel goes deeper on API handler files only, to extract routes and models. Domains are detected by running Leiden+CPM clustering over the import graph. Files that heavily import each other cluster together. Names are inferred from path tokens.

Numbers

validate_diff runs at 0.084ms median on a 7,567-file repo (vscode). p99 is 0.489ms. The budget I'd set going in was p50 under 5ms, p99 under 15ms. Cleared by 30 to 60x.

The budget mattered because this has to run inside the agent loop on every proposed diff. At 50ms the agent skips the call. At 0.08ms there's no reason not to make it.

Indexing on real repos, M-series Mac, 8 cores:

  • prisma/prisma, 961 files: 961ms first run, 431ms re-sync, 0.7 MB on disk
  • supabase/supabase, 6,330 files: 5.4s first run, 1.2s re-sync, 4.0 MB
  • microsoft/vscode, 7,567 files: 7.7s first run, 1.0s re-sync, 6.7 MB
  • zed-industries/zed in Rust, 1,752 files: 3.0s first run, 491ms re-sync, 4.4 MB

Re-sync uses an mtime+size cache, so only changed files get re-parsed. That's how Carto runs from git hooks (pre-commit, post-merge, post-rewrite, post-checkout) without slowing anything down.

Bitmap engine vs raw SQLite on vscode across five tools: 10.7x median speedup. get_high_impact_files peaks at 559x. 12 corpus repos pass full parity tests, so the bitmap layer is a speedup, never a behavior change.

The agent remembers

Every validate_diff call writes a row to a local SQLite log. Three tables: ai_sessions, decisions, interventions. Lives in .carto/carto.db. Never leaves the machine, never shared between projects.

So five hours later, a different session can ask did_we_discuss_this("snake_case naming") and get the answer back. The AI stops relitigating things that were already settled. It
stops contradicting its own past output inside the same repo.

This was the smallest piece to build, honestly the most useful one. The agent's worst trait is that it forgets, and SQLite turns out to be a fine memory.

Why this shape was already in my head

Before Carto I was building Emfirge, a cloud security agent that maps AWS infrastructure into a graph and simulates the blast radius of every change. To make its AI understand AWS, I wrote a module called cartography.py. Mapped resources, built a graph, wrote it into a structured map. The AI stopped hallucinating about IAM and VPC peering.

One night I was watching Claude Code propose a refactor inside a file with 60+ dependents and realized I'd already solved this once. For AWS. Same exact shape. Source code and cloud infra are both directed graphs of components with declared dependencies. Carto is cartography.py retargeted at source.

Try it

npm install -g carto-md
cd your-project
carto init

carto init detects every AI tool installed on your machine and writes the right MCP config for each. Restart your AI tool, ask it to do something architectural, and watch it call get_blast_radius instead of just grepping.

No daemon. Just 4 git hooks keep the index fresh. Stale files re-parse inline at MCP query time. 22 MCP tools total. MIT, runs locally, free.

github.com/theanshsonkar/carto

If you run it on a large repo and the numbers don't match, open an issue with the SHA and I'll dig in.