跪拜 Guibai
← All articles
Frontend · Backend · Artificial Intelligence

AI Gets Dumber the Longer You Chat — Here's the Real Reason

By Escape ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Context-window mismanagement is the silent killer of AI-assisted development productivity. Developers who treat a chat window as a persistent project memory end up fighting the model's attention limits instead of leveraging agent loops, tool calling, and short-lived sessions that keep output reliable.

Summary

AI doesn't remember your chat history. Every request re-sends the full conversation plus system prompts, project rules, and code discussions, so a session that runs for weeks can easily carry 50,000+ tokens per call. That volume dilutes the model's attention, lets stale instructions pollute current reasoning, and drives up latency and cost.

Coding agents work around this by giving models tools — file access, shell commands, code editing — and running them in an observe-think-act loop. Instead of generating a one-shot answer, an agent reads the project, plans a change, executes it, checks the result, and iterates until the task is done. Sub-agents split work across planner, coder, tester, and reviewer roles, turning a single developer into an AI team lead.

The practical fix for context rot is discipline: one task per session, clear constraints, and a staged workflow of analysis, plan confirmation, execution, and verification. Enterprises are wiring agents into Jira, Git, and databases via MCP so a manager can ask for a delay-risk report and get a structured answer drawn from live systems.

Takeaways
A single long-running chat session re-sends the entire history on every request, quickly consuming the context window and degrading output quality.
AI models process tokens, not words; a token is a variable-length chunk produced by a model-specific tokenizer, and different tokenizers split the same text differently.
Context pollution occurs when contradictory instructions accumulate — an early rule to never touch the database gets buried under a later instruction to adjust it, forcing the model to guess which is current.
Coding agents are not chatbots; they combine a model with tools (read, write, command) and run an observe-think-act loop that reads the environment, plans, executes, and verifies.
Tool calling is declarative: the model emits a JSON request like {"tool": "command", "arguments": {"command": "ls"}}, and the agent runtime executes it and feeds the result back to the model.
Skills load domain rules on demand rather than stuffing everything into the system prompt, preventing context bloat from project specs, coding standards, and test policies.
MCP (Model Context Protocol) standardizes how agents connect to external systems — Git, databases, Jira — so every tool doesn't need a bespoke integration.
Sub-agents split complex work across planner, coding, test, and review agents, letting one developer orchestrate a team of AI workers.
Vibe coding — telling AI to build an entire e-commerce site in one prompt — produces unstable, unmaintainable code; spec-driven development with staged confirmation is the enterprise alternative.
An effective AI workflow runs analysis first, confirms a plan, executes in bounded steps, verifies output with tests, and finishes with a review pass — never a single giant prompt.
Conclusions

Most developers blame the model when output degrades, but the failure mode is architectural: stateless APIs force full-context resends, so session hygiene is an engineering discipline, not a model-quality issue.

The observe-think-act loop is what separates a tool that generates code from one that does engineering; the loop lets the agent recover from its own mistakes by re-reading the environment after each action.

Skill systems and MCP solve the same problem at different layers — Skills manage what the model knows, MCP manages what the model can reach — and together they keep context lean while expanding capability.

Spec coding flips the human-AI relationship: the developer becomes a reviewer and rule-definer, not a line-by-line coder, which demands stronger architecture and communication skills than raw coding speed.

Concepts & terms
Token
The smallest unit of text an AI model processes, produced by a tokenizer. A token can be a whole word, part of a word, or a single character, depending on the model. Models see numeric token IDs, not raw text.
Context Window
The maximum number of tokens an AI model can process in a single request. A 128K context window means roughly 128,000 tokens can be sent at once. Every request re-sends the full conversation history, so long sessions quickly fill this window.
Agent Loop
The observe-think-act-feedback cycle that lets a coding agent complete multi-step tasks. The agent reads the environment, decides on a tool call, executes it, feeds the result back to the model, and repeats until the task is done.
Tool Calling
A mechanism where the model outputs a structured request (usually JSON) specifying which tool to invoke and with what arguments. The agent runtime executes the tool and returns the result to the model for further reasoning.
Skill
A pattern that loads domain-specific rules or knowledge on demand rather than preloading everything into the system prompt. This keeps the context small and avoids token waste on rules irrelevant to the current task.
MCP (Model Context Protocol)
A standardized protocol that lets AI agents connect to external systems — such as Git, databases, or project management tools — through a uniform interface, eliminating the need for custom integrations per tool.
Sub Agent
A child agent spawned by a main orchestrator agent to handle a specific sub-task, such as planning, coding, testing, or reviewing. This mirrors a human software team structure and allows parallel or specialized work.
Spec Coding
Specification-driven development where a human defines detailed requirements, constraints, and acceptance criteria upfront, and AI agents execute, test, and review against that spec, as opposed to ad-hoc vibe coding.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗