PRECEPT: Security Self-Improvement of Coding Agents via Evolving Principles
Guo et al. in Agents
Can coding agents remember a security fix?
PRECEPT: Security Self-Improvement of Coding Agents via Evolving Principles
They could fix a flaw, then repeat it
In 14 held-out SeCodePLT chains, Codex, Claude Code, and Qwen Code (Qwen3.6) fixed 85.7% of flaws after seeing security-test failures.
Recurrence on later same-class tasks was 26.7%, versus 27.5% without an earlier fix; the difference was not clear.
General advice worked only after it got specific
All 218 rules (24.2%) and CWE-relevant rules (23.3%) barely changed recurrence from 27.5%; neither reduction was measurable.
A rule restated for a code class lowered recurrence to 16.7%. Task-specific guidance reached 6.9%, but had to be written per task.
A redirect rule shows what evolving principles add

PRECEPT adds a code situation, required check, and allowed behavior to published advice. Dashed boxes trace a redirect rule; gray boxes show code on one held-out task, where its check misses //evil.com.
PRECEPT turns failures into auditable library changes
- 1
Test
Run the current agent on training tasks; record documents opened, edits, diffs, and failed tests.
- 2
Analyze
Diagnose failures as missing, unread, misapplied, or too strict; each cause points to a different repair.
- 3
Draft
Make named, traceable edits into class-level rules without training-task details.
- 4
Decide
Fresh paired runs test revisions; a ledger pools inconclusive evidence. Validation selects a library; clear >3-point pass@1 losses against the unmodified agent trigger rejection.
The lesson persisted after the repair
Later-task recurrence in new sessions: 36/42 successful-fix pairs, 14 held-out chains; library given only at later task (EQ1a).
More working outputs passed security than under baselines
S|P = share of functional outputs passing security; best baseline per agent. SeCodePLT test: 129 tasks from held-out families (EQ2).
Security was not bought by breaking functionality
pass@1 = functional success; ten executions per SeCodePLT test task. Floor: 3 points below the unmodified agent (EQ2).
The search kept improving after its first win

Each plotted point is a kept library's secure-pass@1, requiring functional and security passes. Validation gains were slower and varied; one-quarter to two-thirds came after the first keep.
Rules traveled across agents, less evenly across models
On SeCodePLT, libraries learned by the three Qwen3.6 agent scaffolds yielded 96.5–98.2% S|P across them; pass@1 stayed within the 3-point floor.
Qwen3.6's library raised Mistral's S|P from 81.9% to 97.3%; Mistral's library gave Qwen3.6 86.5%, not significantly above the 85.5% seed. On CWEval, pass@1 fell beyond the floor in C, C++, and JavaScript.
Transfer crossed scaffolds, but model and language still mattered.
What the evidence does not settle
Security is test-defined
Benchmarks cover anticipated attacks; passing them cannot establish security against vulnerabilities their tests never exercise.
Repositories remain open
On SusVibes, no library significantly beat no guidance; project knowledge and getting rules to later edits remain unresolved.
Runs are costly and narrow
Main results use one Qwen3.6 run per agent; each used 35,600–46,400 executions and 0.25–0.30M deployment input tokens per execution, versus 0.11–0.16M without guidance.
Why it matters
- A repair is not a lesson until it persists across sessions and applies to unseen code.
- For test-rich function tasks, evolve scoped principles and gate changes with paired evidence and a functionality floor.
- Can project-specific rules reach the edits that need them in long repository tasks?
12 slides, 3 min
5 days ago