TL;DR: Context, not model choice, determines whether AI security automation makes correct decisions, according to Pixee research showing that injected code and security context raised repair performance from 15% to 63% and that similar gains appeared in repository-aware program repair. The practical lesson is that security teams need curated, validated context layers, not bigger prompts.
At a glance
What this is: This is an analysis of context engineering for security, with the key finding that the information an AI sees matters more than the model itself for accurate security decisions.
Why it matters: It matters because IAM, NHI, and broader security programmes increasingly rely on AI-assisted decisions, and those decisions fail when the system lacks the right operational, architectural, and governance context.
By the numbers:
- Injected security and code context raised one model's buffer-overflow repair rate from 15% to 63%.
- Repository knowledge on top of bug-report context raised Llama 3.3's fix rate from 65% to 74%.
- More recent work found that input length alone can degrade performance by 13.9% to 85% even when the relevant facts are retrievable.
👉 Read Pixee's analysis of context engineering for security decisions
Context
Context engineering for security is the discipline of giving an AI the right information at the right moment so it can make a correct security decision. In this article, the primary problem is not model capability but decision quality, because the same model can produce materially different outcomes when it is given code, architecture, policy, and workflow context instead of a narrow prompt. That matters directly for AI-assisted security operations and for identity-governed systems that now depend on machine-mediated decisions.
The article's core argument is that security automation fails when it is treated like a generic language task. Correct triage, safe remediation, and design-time risk review all depend on facts that are specific to the codebase, the organisation, and the operating model. That makes context engineering relevant to NHI and IAM programmes whenever AI is being asked to evaluate access, privilege, or security posture.
Key questions
Q: How should security teams govern AI systems that can both triage and remediate alerts?
A: Treat them as privileged non-human identities with explicit ownership, scoped permissions, and revocation paths. Separate recommendation rights from execution rights, and require audit trails for every action that changes production state. If the system can act, its access should be reviewed like any other high-risk identity, not left inside an operations workflow.
Q: Why do AI security fixes fail when the model has only code snippets?
A: Because snippets omit the surrounding facts that determine exploitability and safe remediation. Security decisions depend on dataflow, runtime behaviour, dependency relationships, trust boundaries, and organisational policy. Without that context, the model can guess correctly about syntax but still produce a fix that is unsafe, incomplete, or impossible to merge.
Q: How do you know whether context engineering is actually working?
A: Look for lower false-positive rates, higher merge rates on proposed fixes, fewer escalations caused by missing ownership, and better alignment between AI recommendations and policy. The signal is not model confidence. The signal is whether the AI makes decisions that survive review and map cleanly into your operating model.
Q: What is the difference between context engineering and prompt engineering for security?
A: Prompt engineering shapes the instructions you give a model. Context engineering governs the full set of information the model can use, including retrieved data, code relationships, workflow metadata, and historical decisions. In security, that broader discipline matters more because the quality of the answer depends on the quality and completeness of the decision context.
Technical breakdown
Why context beats model size in security decisions
Security outcomes depend on whether the model has enough decision-grade context, not just whether it is large or sophisticated. A model that sees only a snippet and a CVE number has to infer exploitability and remediation safety, which is a weak basis for security work. When the same model receives code, dataflow, policy, and architecture context, it can distinguish a real risk from a theoretical one and produce fixes that fit the environment. That is why context engineering is a control discipline, not a prompt-writing trick.
Practical implication: build curated context pipelines for analysis and remediation, rather than relying on larger prompts or newer models.
Program context is the missing security input
The article separates code context from program context, and that distinction is important. Code context includes files, dependencies, reachability, and runtime behaviour. Program context includes trust boundaries, asset criticality, policy, ownership, historical decisions, and workflow. Most tools do a reasonable job on the first category, but the second category determines whether a finding is urgent, who owns it, and whether a proposed fix is acceptable. Without that organisational layer, an AI can reason correctly about the code and still land in the wrong queue.
Practical implication: connect AI security tooling to ownership, criticality, and policy data so decisions route into the right workflow.
Context engineering across the software lifecycle
Context engineering applies both before code exists and after findings are generated. At design time, it helps reviewers reason about intent, data exposure, and authorization gaps before a vulnerability can be scanned. In triage and remediation, it reduces noise by using reachability and exploitability context, then produces fixes that align with local conventions and dependencies. That makes it a lifecycle control, not a point solution. The discipline is to gather, validate, and reuse context so the same knowledge helps at design review and in incident-prioritised remediation.
Practical implication: treat context as a reusable control plane that supports design review, triage, and fix validation.
NHI Mgmt Group analysis
Context engineering is becoming the control plane for AI-assisted security decisions. When the model is commoditised, differentiation moves to the quality, provenance, and ordering of the context it receives. That is especially relevant in security, where a wrong answer is not a stylistic problem but a governance failure. For NHI and IAM programmes, the same logic applies to machine-driven access decisions, secret handling, and remediation workflows. The practitioner takeaway is that context quality now belongs in control design, not just in tooling selection.
Program context is the overlooked governance layer in AI security. Security teams often focus on code adjacency, but the article shows that ownership, criticality, workflow, and policy are what make a decision operationally correct. This is a strong fit for identity governance thinking because access, privilege, and accountability all depend on organisational context, not only technical context. If an AI cannot see who owns the system or what policy applies, it cannot make a trustworthy security recommendation. Practitioners should treat governance metadata as part of the security input set.
Design-time AI review is where context engineering can prevent future identity and access mistakes. The article's lifecycle framing matters because many security and identity failures are seeded before deployment, when architecture and intent are still negotiable. A proposed system that handles sensitive data, delegates privileges, or automates approvals needs context about trust boundaries and acceptable access patterns before code is written. That is particularly relevant for agentic AI and NHI use cases, where privilege and delegation can expand quickly. The practitioner conclusion is to shift context-aware review upstream, before those access patterns harden.
Decision traces need to be auditable if AI is going to touch security operations. If context is what makes the decision, then the assembled context, the retrieval path, and the resulting output all become part of the control evidence. That aligns with NIST-CSF, NIST-800-53, and NIST-AIRMF thinking about governance, accountability, and measurement. It also gives identity teams a clearer way to test whether an AI recommendation was made with sufficient organisational context. The practitioner conclusion is to require traceable decision inputs, not just visible outputs.
Context graph: the real product is judgment, not the data structure. The article's distinction between a context graph and context engineering is useful because many teams confuse storage with control. A graph can hold relationships, but it cannot decide what should be retrieved, what should be excluded, or whether the result is safe for action. In identity security programmes, the same lesson applies to entitlement graphs and policy stores. The practitioner conclusion is to judge systems by their decision logic, not by the richness of their database.
What this signals
Context engineering will matter more as AI is pushed deeper into triage, remediation, and access-related decision flows. The practical shift for teams is to define which governance inputs must accompany each recommendation, then measure whether the output still makes sense when ownership, policy, and risk appetite are added to the prompt.
Decision-context debt: this is the build-up of missing governance, ownership, and policy data around an AI workflow, and it will increasingly determine whether the system is safe to trust. Security and identity teams should expect higher review demands, stronger evidence requirements, and tighter audit expectations as these workflows mature.
For identity programmes, the next control question is not whether AI can reason, but whether it can reason with the same accountability model the organisation expects from human operators. That means tying AI outputs to policy, access boundaries, and traceable evidence, then reviewing those outputs as security decisions rather than convenience features.
For practitioners
- Define the context inputs for each AI security decision Document which code, runtime, ownership, policy, and criticality inputs must be present before an AI can triage a finding or propose a fix.
- Separate code context from governance context Map the technical facts a model needs to the organisational facts it also needs, including service ownership, approved patterns, and escalation rules.
- Require traceable decision evidence Capture what context was retrieved, how it was ordered, and why the recommendation was accepted so reviewers can audit AI-assisted security decisions.
- Use context-aware review before deployment Apply AI-assisted analysis at design time to catch trust-boundary and authorization gaps before they become embedded in code or workflow.
Key takeaways
- The core risk is not that AI is weak, but that security teams often feed it incomplete context and then trust the result anyway.
- The evidence in the article shows that the same model performs materially better when code, repository, and program context are added to the decision flow.
- Practitioners should build context governance, traceability, and lifecycle review into AI-assisted security operations before expanding automation further.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5 and NIST AI RMF set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | PR.AC-4 | AI-assisted security decisions still depend on managed access and correct authorization context. |
| NIST SP 800-53 Rev 5 | AC-6 | Least privilege matters when AI systems retrieve broader context than a human reviewer would. |
| NIST AI RMF | GOVERN | The article is fundamentally about governance of AI-assisted security decisions. |
| OWASP Agentic AI Top 10 | Agentic workflows can fail when context is incomplete or poorly ordered. |
Limit AI retrieval and action scope under AC-6 to the minimum context required for each task.
Key terms
- Context Engineering: The practice of selecting, curating, and delivering the information an AI system uses at runtime. In agentic environments, context engineering is a security function because the quality, provenance, and trust level of the inputs directly shape the system’s actions and outputs.
- Program Context: The organisational information that shapes a security decision, such as ownership, criticality, workflow, policy, and escalation rules. It is distinct from code context and often determines whether an AI recommendation is useful, routable, and acceptable in the real programme.
- Context graph: A persistent data layer that links telemetry with organisational knowledge such as asset ownership, tickets, prior investigations, and business workflows. It gives AI systems the context needed to interpret alerts correctly instead of guessing from isolated logs.
What's in the full article
Pixee's full article covers the operational detail this post intentionally leaves for the source:
- Controlled study results showing how injected security and code context changed repair outcomes across vulnerability classes
- A deeper explanation of context graphs, retrieval order, and validation steps that make AI-assisted fixes reviewable
- Lifecycle examples showing how design-time review, triage, and remediation each need different context inputs
- The article's comparison of code context versus program context, including ownership, policy, and workflow metadata
Deepen your knowledge
The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, secrets management, and agentic AI identity. It helps practitioners connect identity controls to the broader security decisions their programmes now automate.
Published by the NHIMG editorial team on August 19, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org