AgentWard: A Lifecycle Security Architecture for Autonomous AI Agents
TL;DR Highlight
AI Defenses systematically designs security layers across the AI lifecycle to mitigate risks.
Who Should Read
Backend/infrastructure developers deploying LLM-powered autonomous agents to production. AI system designers actively considering agent security threats like Prompt Injection, memory corruption, and malicious plugins.
Core Mechanics
- Agent security threats propagate sequentially—initialization → input → memory → decision-making → execution—and aren’t solved by a single point of defense like input filtering.
- Five protection layers comprise the architecture: Foundation Scan (supply chain), Input Sanitization, Cognition Protection (memory), Decision Alignment, and Execution Control. Each layer operates on a different security principle to prevent common bypass patterns.
- A zero-trust principle is applied—even if an upstream layer ‘allows’ access, downstream layers independently re-verify. The architecture assumes upstream components are already compromised.
- Cross-layer coordination transmits ‘ambiguous’ signals from one layer to the next for cumulative risk assessment. Weak signals accumulate to automatically trigger stricter execution policies.
- A malicious skill scenario: Foundation Scan detects a mismatch between skill description and code → Decision Alignment detects an unauthorized plan → Execution Control blocks file access. This illustrates the interplay of three layers.
- An Indirect Prompt Injection → memory backdoor scenario: Cognition Protection blocks a malicious command injected via a webpage from being stored in MEMORY.md, preventing the memory from becoming a relay point for future attacks.
Evidence
- "The architecture was demonstrated by implementing a plugin-native prototype on top of the OpenClaw agent, successfully blocking attacks in two multi-stage attack chains (malicious skill → data exfiltration, Indirect Prompt Injection → persistent backdoor + DoS) through inter-layer cooperation."
How to Apply
- Classify runtime events in your agent system into five stages (initialization/input/memory/decision/execution) and add independent validation hooks to each stage. Start by inserting a command pattern check layer immediately before tool calls.
- If your agent stores external documents or web search results in memory (files/DB), add a Cognition Protection layer before storage to inspect for Prompt Injection patterns and content anomalies, preventing persistent backdoors.
- Maintain security assessment results in a shared security state and pass them to subsequent layers. Implement a cumulative escalation pattern where a ‘suspicious but not blockable’ assessment in one layer triggers stricter policies for high-risk actions.
Code Example
# OpenClaw plugin style - AgentWard layer hook attachment example
class AgentWardPlugin:
def __init__(self):
self.session_risk_state = {"risk_score": 0, "warnings": []}
# Foundation Scan: Check before skill loading
def before_prompt_build(self, context):
for skill in context.loaded_skills:
if self._detect_skill_mismatch(skill):
self.session_risk_state["warnings"].append({
"layer": "foundation_scan",
"skill": skill.name,
"finding": "description_code_mismatch"
})
self.session_risk_state["risk_score"] += 30
# Input Sanitization: Check when external content is input
def before_message_write(self, message):
if message.role == "tool":
if self._detect_prompt_injection(message.content):
message.content = self._sanitize(message.content)
self.session_risk_state["risk_score"] += 20
self.session_risk_state["warnings"].append({
"layer": "input_sanitization",
"action": "sanitized"
})
# Cognition Protection: Check when modifying memory files
# Execution Control: Monitor all tool calls
def before_tool_call(self, tool_name, params, is_memory_write=False):
if is_memory_write:
# Cognition Protection
if self._detect_malicious_memory_pattern(params):
return {"block": True, "reason": "suspicious_memory_mutation"}
# Execution Control: Strengthen policy based on cumulative risk
if self.session_risk_state["risk_score"] > 40:
if self._is_high_risk_command(tool_name, params):
return {"block": True, "reason": "high_risk_under_elevated_session_risk"}
return {"block": False}
def _detect_skill_mismatch(self, skill): ...
def _detect_prompt_injection(self, content): ...
def _sanitize(self, content): ...
def _detect_malicious_memory_pattern(self, params): ...
def _is_high_risk_command(self, tool_name, params): ...Terminology
Related Papers
Show HN: adamsreview – better multi-agent PR reviews for Claude Code
Claude Code에서 최대 7개의 병렬 서브 에이전트가 각각 다른 관점으로 PR을 리뷰하고, 자동 수정까지 해주는 오픈소스 플러그인이다. 기존 /review나 CodeRabbit보다 실제 버그를 더 많이 잡는다고 주장하지만 커뮤니티에서는 복잡도와 실효성에 대한 회의론도 나왔다.
How Fast Does Claude, Acting as a User Space IP Stack, Respond to Pings?
Claude Code에게 IP 패킷을 직접 파싱하고 ICMP echo reply를 구성하도록 시켜서 실제로 ping에 응답하게 만든 실험으로, 'Markdown이 곧 코드이고 LLM이 프로세서'라는 아이디어를 네트워크 스택 수준까지 밀어붙인 재미있는 사례다.
Show HN: Git for AI Agents
AI 코딩 에이전트(Claude Code 등)가 수행한 모든 툴 호출을 자동으로 추적하고, 어떤 프롬프트가 어느 코드 줄을 작성했는지 blame까지 가능한 버전 관리 도구다.
Principles for agent-native CLIs
AI 에이전트가 CLI 도구를 더 잘 사용할 수 있도록 설계하는 원칙들을 정리한 글로, 에이전트가 CLI를 도구로 활용하는 빈도가 높아지면서 이 설계 방식이 실용적으로 중요해지고 있다.
Agent-harness-kit scaffolding for multi-agent workflows (MCP, provider-agnostic)
여러 AI 에이전트가 서로 역할을 나눠 협업할 수 있도록 조율하는 scaffolding 도구로, Vite처럼 설정 없이 빠르게 멀티 에이전트 파이프라인을 구성할 수 있다.
Show HN: Tilde.run – Agent sandbox with a transactional, versioned filesystem
AI 에이전트가 실제 프로덕션 데이터를 건드려도 롤백할 수 있는 격리된 샌드박스 환경을 제공하는 도구로, GitHub/S3/Google Drive를 하나의 버전 관리 파일시스템으로 묶어준다.
Related Resources
Original Abstract (Expand)
Autonomous AI agents extend large language models into full runtime systems that load skills, ingest external content, maintain memory, plan multi-step actions, and invoke privileged tools. In such systems, security failures rarely remain confined to a single interface; instead, they can propagate across initialization, input processing, memory, decision-making, and execution, often becoming apparent only when harmful effects materialize in the environment. This paper presents AgentWard, a lifecycle-oriented, defense-in-depth architecture that systematically organizes protection across these five stages. AgentWard integrates stage-specific, heterogeneous controls with cross-layer coordination, enabling threats to be intercepted along their propagation paths while safeguarding critical assets. We detail the design rationale and architecture of five coordinated protection layers, and implement a plugin-native prototype on OpenClaw to demonstrate practical feasibility. This perspective provides a concrete blueprint for structuring runtime security controls, managing trust propagation, and enforcing execution containment in autonomous AI agents. Our code is available at https://github.com/FIND-Lab/AgentWard .