為何 AI 智能體拒絕協作:命題邏輯與基本工程規範勝過 Vibe Coding
When Your Agent Refuses to Collaborate: Why Propositional Logic and Basic Hygiene Beat Raw Vibe Coding
作者指出,AI 智能體編碼反覆出錯,問題往往不在模型,而在需求缺乏命題邏輯,以及程式碼庫未設置適合智能體的工程防護。他以交易機械人為例,對照模糊要求與明確架構限制,並建議從首個 commit 起加入版本管理、測試、lint 和 CI 閘門。他亦建議編寫 Agent-Native CONTRIBUTING.md,明訂執行流程、跨檔案依賴及驗證條件,減少反覆提示與人工盯改。
Spending hours debugging AI-generated code with more AI? The problem isn't the model—it's a lack of domain architecture, propositional logic, and agent-native repository guardrails.
I keep seeing the same complaint across X, Reddit, and Dev.to: developers spending six hours debugging code that took an AI assistant ten minutes to generate—usually by throwing more prompts at the exact same assistant until the codebase collapses into an unmaintainable hallucination loop.
When your agent "refuses to collaborate," the problem usually isn't the model, but I think most of the time, it comes down to one of two things (or both): a lack of propositional logic in how we formulate instructions, and an absence of basic software engineering hygiene adapted for the AI era.
Basically, if you treat an LLM like a magic 8-ball, you get magic 8-ball architecture, and you can't act surprised. Here is why domain expertise still rules, and the exact stack I use to stop arguing with my agents and make them ship production-grade code on the first pass.
1. Propositional Logic vs. "Make Me Money, Bro"
Prompt engineering isn't about knowing secret buzzwords, but applied propositional logic. You cannot formalize a system if you don't understand the premises, constraints, and state transitions of the thing you are building.
A good friend of mine, who's actually a solid developer with a decade of experience in crypto spent months trying to build a trading bot using AI assistants. Every attempt ended in broken execution loops, bad math, or hallucinated SDK methods.
I asked him what he actually prompted the agent to do.
His answer: "Just make me f*cking trading bot that makes money, bro."
With no comments on his prompt, I took his failure as a personal challenge, sitting down with the exact same class of model, but instead of asking for "a bot that makes money," I gave it deterministic architectural constraints:
- Routing & Execution: Target Uniswap V2 router contracts specifically for liquidity pools.
- Chain Indexing: Parse transaction hashes and state logs via Etherscan and Basescan APIs.
- Oracle / Pricing Layer: Pull real-time price conversions and slippage baselines through the CoinGecko API.
- Security & Pre-Flight Checks: Integrate Skillware's wallet screening and contract reader microservices to verify token contracts and prevent honeypot execution before signing any transaction.
and much more. From sentiment analysis pulled form the web, to technical analysis and output formatting.
The agent delivered a working, modular trading bot in less than a few hours.
Why This Gatekeeping Should Exist
If you want to build a nuclear reactor, you need a working grasp of nuclear physics, material sciences, and thermodynamics, and if you are a hairdresser trying to vibe-code a nuclear reactor in your garage, you are going to fail—and honestly, for the better.
This is a form of natural gatekeeping I fully support, as in the AI era, raw syntax memorization is cheap, which makes taste, deep industry expertise, cross-domain knowledge, and architectural intuition more valuable than ever. "I have a cool idea, let's vibe-code it" hits a brick wall the second your system encounters real-world entropy.
2. Treat Day Zero as Production-Grade
The fastest way to eliminate back-and-forth prompting is to stop treating AI prototypes like scratchpads. From the very first commit, set up your repository as if it’s going to production tomorrow:
-
Strict Git Versioning & Changelogs: Force atomic commits and maintain a living
CHANGELOG.mdfollowing Keep a Changelog standards. - Automated Testing & Edge-Case Simulations: Unit tests aren't enough. Build stress tests and simulation scripts that throw malformed payloads, rate limits, and network drops at your code.
-
Linters, Formatters & CI Gates: Wire up
ruff,eslint,prettier, or strict type-checking (mypy/tsc) inside local pre-commit hooks and GitHub Actions.
When these hard gates exist in the repo, the agent doesn't have to guess whether its code works—the environment tells it immediately.
3. Write an Agent-Native CONTRIBUTING.md
Historically, CONTRIBUTING.md was written for humans: "Please be nice in the issues, follow our code of conduct, and use this PR template."
Look at your commit history today, and think who is actually writing the bulk of the boilerplate and patches? AI agents. Your documentation should target the entities doing the heavy lifting, not humans that copy paste contributing guides and feed them straight up to their assistants without even reading them.
In all my repos, I include an AI-Native Contributing Guide or Workflow (you can use it alongside files like AGENTS.md or .cursorrules if that's your cup of tea) that speaks directly to autonomous and/or semi-autonomous logical systems, employed as coding agents in cold, unambiguous operational logic:
What Goes Into an Agent-Native Guide:
-
The Mandatory Execution Loop: Define the exact workflow from
Iteration -> Local Verification -> Test Suite Execution -> Changelog Update -> Commit. The agent is forbidden from asking for human review until all verification gates pass with zero warnings. -
Ripple Effects & Hidden Dependencies: Agents struggle with implicit coupling across files. Map it out explicitly:
- "If you bump the version in
pyproject.toml, you MUST also update__version__insrc/__init__.pyand append an entry toCHANGELOG.md." - "If you modify
scripts/ingest.py, you must update its mock fixtures intests/test_ingest.pyand sync the CLI flags inREADME.md."
- "If you bump the version in
-
State & Memory Anchors: Instruct the agent to read
CHANGELOG.mdand recentgit log -n 5outputs before proposing changes. This gives the agent instant episodic memory of what has already been tried, what was recently refactored, and what is next on the roadmap.
<!-- Example snippet from an AI-Native CONTRIBUTING.md -->
## Agent Operational Protocol
1. READ `CHANGELOG.md` and run `pytest` before writing any code to establish baseline health.
2. COUPLED FILES: Any schema modification in `core/models.py` requires an immediate sync in `api/validators.py` and `docs/schema.md`.
3. HARD GATE: Do not return control to the human operator until `make lint && make test && make simulate` exits with code 0.
4. Better Diffs, Less Micromanagement
Setting up this stack does two things simultaneously:
First, for experienced engineers, it kills micromanagement. You literally stop acting as a human linter copy-pasting stack traces back into a chat window, giving the agent a sandboxed environment with strict physics, and it iterates until it satisfies the compiler and test suite.
Second, for AI-native builders with minimal software backgrounds, this structure is how you actually learn. When you have clean changelogs, updated docs, and atomic git diffs, you stop blindly accepting 500-line code dumps you don't understand. You can look at a commit and ask sharp, architectural questions:
"Why did you modify the state handler in this diff instead of the retry wrapper?"
Over time, you start recognizing the behavioral patterns and blind spots of your AI assistants. You learn how to guide them with precision rather than frustration, which makes things easier for both sides.
Wrapping Up
AI assistants might repalce many things according to narrative intensive marketing headlines, but I assure you, they aren't replacing engineering discipline, but penalizing the lack of it at 10x speed.
Know your domain. Express your requirements with logical precision. Build hard verification gates into your repositories, and write documentation for the systems actually reading your codebase.
Most importantly: be respectful to your assistants, have fun experimenting, and enjoy the craft of building things from scratch!
來源:DEV Community · dev.to