TRANSMISSION // 2611.33519v1
Can coding agents learn from security mistakes?
Source published
PRECEPT turns coding agents’ security failures into tested, evolving guidance. Its benchmark results are promising, but repository-scale tests show important limits.

A coding agent may fix a vulnerability when a test exposes it, then make the same kind of mistake later. A preprint introduces PRECEPT, a method for evolving secure-coding guidance from those failures—and reports strong results on function-level benchmarks, alongside a sobering result on repository tasks.
A program can pass its ordinary tests and still contain a security flaw. And even if an AI coding agent fixes that flaw after a test points it out, the repair may not become a lasting lesson. A new preprint asks whether agents can learn from their own security failures and apply what they learn to later, different code.
The authors call this ability “security self-improvement.” They present PRECEPT, a system that evolves a library of secure-coding principles based on an agent’s past failures. The work is a research preprint on arXiv, not evidence that the method is ready for routine use in software development.
Fixing a bug is not the same as learning from it
In an initial study, the researchers followed 14 sequences of coding tasks involving Codex, Claude Code and Qwen Code. The agents were shown failing security tests and asked to repair vulnerable code. They fixed the vulnerability in 85.7% of cases. But in a new session, they later introduced the same category of vulnerability in 26.7% of executions—close to the 27.5% rate for agents that had not seen the earlier failure.
The study suggests a distinction between being able to make a secure fix and retaining a useful lesson. When the earlier fix remained in the same conversation, recurrence dropped on later tasks from the same task family. But that benefit did not reliably carry to a different family of tasks involving the same vulnerability category.
The researchers also tested two straightforward ways to carry lessons forward. Agents’ own notes helped on tasks related to the original repair, but were less effective at generalizing. General secure-coding guidance also did not reliably prevent recurrence. More specific guidance—describing the relevant type of code and what it must check—worked better in the study, but task-by-task instructions would be impractical to write for every new coding task.
How PRECEPT evolves its guidance
PRECEPT starts with principles from established secure-coding sources. It then runs an iterative loop: the agent attempts training tasks; a separate analysis identifies failures and likely gaps in the guidance; a drafting step proposes a revision aimed at a class of code, rather than a single task; and fresh executions test whether the revision helps.
A revision is kept only when the tests indicate a security improvement without functional performance dropping below a set tolerance. This safeguard matters: code that refuses to handle valid input might pass some security tests while no longer doing its job. The principles remain readable text, and the system records where they came from and how they changed. The underlying coding model is not updated by this process.
Strong results on function-level tasks, but a key caveat
In tests on SeCodePLT, a benchmark of Python coding tasks, PRECEPT’s libraries raised the share of working code that also passed the benchmark’s security tests to 97.1–98.5% across the three agents. The paper reports 81.9% for the strongest unaided agent and 87.7% for the strongest baseline. On the study’s later-task sequences, recurrence fell from 26.7% after a fix alone to 11.5% with PRECEPT’s library.
These figures concern particular benchmarks and their tests—not a guarantee that code is secure in every real-world setting. The authors explicitly define security in terms of the attacks checked by the benchmark. A test suite can only assess vulnerabilities its designers anticipated.
That limitation becomes especially important in the paper’s repository-level experiment, which used tasks drawn from real Python projects. PRECEPT did not significantly improve security there. Under the tested conditions, only a small share of the agents’ working code passed security tests. The authors point to challenges that differ from single-function tasks: an agent may need project-specific knowledge, the useful lessons may be scattered across individual projects, and guidance may not reach the relevant code edits. This result cautions against treating the stronger function-level numbers as evidence of success on full software repositories.
The main results also use one underlying model, Qwen3.6, with three coding-agent tools, and one evolution run per agent. The paper reports transfer tests across agents and models, but those do not remove the uncertainty from limited runs or establish broad effectiveness across development environments. The authors also describe the evolution process as computationally costly.
PRECEPT offers a concrete way to turn security failures into reusable, testable guidance. The findings suggest that lessons may persist better when they are specific enough to guide code, yet broad enough to apply beyond one task. Whether that approach can handle the complexity and context of real repositories remains an open question. The paper is a preprint, and its claims should be read as benchmark results awaiting further testing, not as proof that coding agents can reliably secure software on their own.
- AI coding agents
- software security
- secure code generation
- PRECEPT
- vulnerability recurrence
- AI evaluation
Reviewed cross-references
These connections were reviewed by a model, not independently fact-checked by a human. Similarity does not imply agreement; consult the original papers and the evidence below.
For AI coding assistants, useful context is not always secure context
Supporting evidence: Both studies suggest that security guidance must be applied to relevant code: PRECEPT reports that general published principles did not reliably prevent recurrence, while CASE-Bench finds that withholding safeguards reduced secure pass rates and agents observed relevant safeguards in only 27–36% of trajectories. This is a bounded connection, not a direct replication: PRECEPT evolves principles from agent failures, whereas CASE-Bench studies repository context on different tasks and models.
Model review: · openai-codex/gpt-6-luna
Evidence and provenance
Selected excerpts, not complete papers. PDF extraction can omit figures or damage equations, tables and reading order; sources may be preprints.
2611.33519v1 — Original paper
Excerpt reference:
static/papers/2611.33519v1.md:152-214
Basis: Paper text
Source SHA-256:83f40a1b3c96a19bef22a8b3f9c5a876e4fca944e4a9e06a075c871aeede6be42611.06294v1 — Original paper
Excerpt reference:
static/papers/2611.06294v1.md:197-268
Basis: Paper text
Source SHA-256:1f8679ac7bbd3d82164221906e610f766ea453a56106cc2501e86d5a608134e9
Related reading
Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.
How AI coding teams can hide malicious behavior
Source published
Shared keywords: ai coding agents, software security
AI Agents Audit Rust’s Unsafe Boundaries
Source published
Shared keywords: ai coding agents, software security
Can LLMs Find Vulnerabilities for the Right Reasons?
Source published
Shared keywords: ai evaluation, software security
When AI Coding Agents Should Delegate
Source published
Shared keywords: ai coding agents
Why AI coding agents need more than a rulebook
Source published
Shared keywords: ai coding agents, ai evaluation