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

Agent Experience Resets to Zero After Every Requirement: Close the Second Loop to Make It an Expert

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

Without the experience loop, agents remain faster code generators rather than domain experts, and every new requirement still demands the same manual context from a human. Closing that loop converts completed work into reusable knowledge, which cuts explanation and rework on later requirements and changes the cost structure of agent-driven development.

Summary

The standard Agent workflow treats every requirement as a fresh problem: it gathers context, writes code, and produces a result, but the process materials die in the chat history. That leaves a human to re-explain business rules, edge cases, and past pitfalls on every similar request. The proposed structure splits the work into two closed loops: an execution loop that pushes a requirement from intake to closing, and an experience loop that captures the judgments, corrections, and evidence produced along the way.

The execution loop is built as a chain of stages with hard gates. Humans confirm only at three points: requirement interpretation, technical plan, and production release. In between, the Agent acts autonomously, with quality enforced by TDD defined before implementation, diff-to-test mapping, and a git pre-push hook that runs PMD and coverage checks. Acceptance happens in an independent environment with positive, negative, and regression cases written to a verification file; the Agent does not deploy to pre-release or production.

The experience loop relies on a three-tier memory (code repo, project memory, long-term knowledge) and a “no direct upgrade” rule: process facts stay in project memory until reviewed, then selectively enter long-term knowledge. Feedback must land on platform comments, not chat, and closing distillation sorts results into stable knowledge, process improvements, and one-time archives. The author admits high integration cost and a missing measurement system, and says the current implementation is single-Agent only, with an Agent Team design planned but not yet validated.

Takeaways
— The execution loop pushes a requirement from intake to closing with human gates only at requirement interpretation, technical plan, and production release.
— Quality gates are hardened through TDD written before implementation, diff-to-test mapping, and a git pre-push hook that runs PMD and coverage checks.
— Acceptance requires positive, negative, and regression cases, with all evidence written to a readable verification file.
— The Agent does not automate production deployment or release; humans execute the final push, with the Agent preparing materials.
— The experience loop stores facts in a three-tier memory: code repo, project memory, and long-term knowledge, and follows a 'no direct upgrade' rule to avoid noise pollution.
— Feedback must land on platform comment systems with commit, CR, and verification links, not in chat, so it stays traceable and analyzable.
— Closing distillation categorizes output into stable knowledge, process improvements, and one-time materials, with only reviewed entries entering long-term knowledge.
— The system lacks a measurement framework for self-iteration; four dimensions are proposed: human effort, requirement quality, production stability, and collaboration efficiency.
— The current implementation is a single Agent for backend requirements; an Agent Team with frontend, backend, testing, and a lead is planned but not yet validated.
Conclusions

The most counterintuitive part of the design is that comment-heavy collaboration clusters around requirement clarification and planning, not coding; once the plan is confirmed, current Agent capabilities handle implementation with less fine-tuning.

The 'no direct upgrade' rule is a practical antidote to knowledge base death: letting every temporary conclusion into long-term memory pollutes trust, so a deliberate human-confirmed separation preserves signal.

Treating a requirement as an asset rather than a consumable reframes the economics of agent development: the goal is not faster code generation but a rising baseline of business understanding.

The stated lack of measurement is the honest weak point: without baselines, the claimed self-iteration loop cannot distinguish real progress from guesswork, which is exactly where most agent systems fail in production.

Concepts & terms
Execution loop
The closed cycle that drives a single requirement from intake to closing: gather context, clarify, plan, implement, review, accept, release, and observe. It answers 'how to do this thing right this time'.
Experience loop
The closed cycle that turns the judgments, pitfalls, and corrections from one requirement into context for the next. It answers 'how to avoid detours next time' and is what turns a code generator into a domain expert.
Hard gate
A quality control mechanism that cannot be bypassed by the Agent, such as a git pre-push hook that runs static analysis and coverage checks and rejects the push on failure, as opposed to a prompt that merely asks the Agent to behave.
Diff-to-test mapping
The practice of tying every behavior change in production code to a specific test assertion, so that 'tested' means every changed line is watched by an explicit test rather than covered by a vague module-level regression run.
From the discussion
Featured comments
去吧波波鸟

No problem — prompts are negotiating, hooks are legislating, that hits the nail on the head. Self-iteration without metrics is blind tweaking; I'm sold on that too.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗