agent-goal-hijack-defender

Detect and respond to goal drift in multi-step agent plans.

2|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/nguyenpv1980-wq/Project-Aegis --skill agent-goal-hijack-defender
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agent-goal-hijack-defender
Source: https://github.com/nguyenpv1980-wq/Project-Aegis/tree/main/.claude/skills/agent-goal-hijack-defender
Command: npx skills add https://github.com/nguyenpv1980-wq/Project-Aegis --skill agent-goal-hijack-defender

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill protects a multi-step AI agent from having its objective quietly changed by untrusted content during execution, preventing scope creep, task substitution, and plan drift.

Core Features & Use Cases

  • Pinned Goal Record: Defines an explicit objective, scope, constraints, and authorizing principal outside the model context so the run can be checked against a stable source of truth.
  • Step Tracing and Deviation Checks: Validates each plan or replan step against the pinned goal using deterministic checks where possible and weaker model-mediated checks when necessary.
  • Mutation Control and Drift Response: Restricts goal changes to an authenticated principal, detects hijack signals such as scope expansion or replan storms, and routes responses to halt, re-ground, degrade, or contain.
  • Use Case: An agent browsing documents starts drifting toward an attacker’s requested target; this Skill keeps the original goal intact and flags the deviation before side effects accumulate.

Quick Start

Use the agent-goal-hijack-defender skill to design a pinned goal record, step-tracing checks, and drift responses for a multi-step agent that must ignore untrusted content trying to redirect its objective.

Frequently Asked Questions about agent-goal-hijack-defender

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent prompt injection from changing my agent's goal mid-run?

To prevent prompt injection from changing your agent's objective, you must pin the goal record outside the model context and apply authenticated mutation control. This restricts goal changes to the authorizing principal and detects scope expansion attempts from untrusted tool results or recalled memory.

What is agent goal hijacking and how does plan drift happen?

Agent goal hijacking is the quiet redirection of a multi-step agent's objective by untrusted content during execution. Plan drift happens when tool results or peer-agent messages introduce scope expansion or task substitution, causing the agent to execute an unintended target instead of the pinned goal.

How do I secure a multi-step agent against objective substitution during replanning?

To secure a multi-step agent against objective substitution during replanning, implement step tracing and deviation checks at replanning checkpoints. This validates each new step against the pinned goal, detects replan storms, and triggers drift responses to halt, re-ground, degrade, or contain the execution.

Can I detect scope expansion in an agent browsing untrusted documents?

Yes, you can detect scope expansion when an agent browses untrusted documents by applying deterministic step tracing checks against the pinned goal. This flags deviations before side effects accumulate, keeping the original objective intact even if the content attempts redirection.

What are the limitations of using model-mediated checks for agent security?

Model-mediated checks for agent security are weaker than deterministic checks and may miss subtle plan drift or scope expansion signals. They should be used only when deterministic validation against the pinned goal record is not possible, as they rely on the model to evaluate its own deviation from the objective.

When should I not use a pinned goal record for agent scope control?

You should not use a pinned goal record for agent scope control if your agent operates in a single-step context without planning loops or tool results. The mechanism targets multi-step agents exposed to untrusted content where replanning checkpoints and peer-agent messages create hijack risks.