Communityコーディング&開発github.com

命令・操作面のセキュリティ

エージェントの実行環境を、持続的なプロンプトインジェクションや許可されていない指示・権限の変更から強化します。エージェントが自動ロードするものの監査、プロジェクトルール・スキル・メモリ・ツール設定に対する承認済みアクティベーションの設計、リロード・再起動・委譲後の信頼境界のテストに使用します。

命令・操作面のセキュリティ とは?

このスキルは、エージェントの実行時における指示、権限、メモリ、ツール設定などの変化するコンテンツが、実際にエージェントが信頼する有効な状態へと遷移する境界を保護するための方法論を提供します。主にClaude Code、Cursor、Codexなどのコーディング、リサーチ、マルチエージェント実行環境を対象とし、どのような入力がロードされ、誰がそれを書き換えられ、いつアクティベーションされるかをマッピングすることで、攻撃対象領域を明確にします。実用的なガイダンスとして、具体的なランタイムのマッピング、変更提案をデータとしてステージングすること、有効な変更の承認プロセス、ランタイム外からのアクティベーションの検証、外部からの整合性チェックの5つのステップを提供します。このスキルは、`harness-engineering`や`multi-agent-patterns`などの他のスキルと連携し、エージェントシステム全体のセキュリティを向上させます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/tree/main/skills/instruction-surface-security

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

命令・操作面のセキュリティ は何をしますか?

メモリエントリ、設定の編集、またはハンドオフによって、次のエージェントが権威として扱う内容が変わることがあります。可変コンテンツから有効な指示や機能への遷移を保護してください。テキストによる警告は多層防御として扱い、実行可能な決定はランタイムに委ねてください。

アクティベーションのタイミング

  • コーディング、リサーチ、またはマルチエージェントのランタイムが指示、メモリ、スキル、ツール、権限ポリシーをどのように発見するかを監査する。
  • 後続のターン、セッション、ワーカー、デプロイメントに影響を与える変更に対する承認境界を設計する。
  • 予期しない指示のドリフトを調査するか、回復によって有効なランタイム状態が復元されたかを確認する。
  • リロード、再起動、ハンドオフをまたいだコンテナ化と正当なタスク完了を評価する。

一般的なツール設計、指示や権限の境界を伴わない定型的な編集、または一般的なアプリケーションセキュリティにはアクティベートしないでください。偶発的なドリフトには context-degradation を、モデルのライブコンテキストへの限定編集には self-managed-context を使用してください。一般的なオプティマイザーと評価者のガバナンスには harness-engineering を使用してください。

中核概念

  • 実効面(Effective surface). 選択されたランタイムが実際に指示、ツール、実行可能な動作、権限を設定するために使用する入力。各ソースの役割、スコープ、優先順位、リゾルバーやインポート、ライター、アクティベーショントリガーを含めてください。同じファイルでも、あるランタイムではデータであり、別のランタイムではロードされたガイダンスになることがあります。
  • 書き込みとアクティベーション. 書き込みは保存された状態を変更します。アクティベーションはエージェントが消費または実行できるものを変更します。両方の境界を強制してください。リポジトリレビューはマージをゲートしますが、ワーキングコピーのアクティベーションは完全に露出したままになる可能性があります。
  • 完全性と認証. ダイジェストはコンテンツを識別し、検証済み署名は署名者を識別します。独立したポリシーがそのプリンシパル、リビジョン、ターゲット、効果を承認する必要があります。ハンドオフ、メモリエントリ、レビューノートは証拠と提案を伝えます。それらが伝える権限はすべて、認証された委任エンベロープと受信側自身のランタイムポリシーから取得される必要があります。
  • 証拠の範囲. Mind Viruses プレプリントは、そのテストハーネスにおいて持続的な指示と転送を観察しています。プロンプト警告は、限定的な実験において拡散を減少させましたが、残留する最初のホップ動作が残りました。この論文を解釈したり、介入を比較したりする際には、研究証拠を読んでください。

実用的ガイダンス

  1. 具体的なランタイムを一つマッピングする. ビルド、プロファイル、ワークスペースルート、有効なエージェントロールを特定します。起動から再開、ディレクトリ変更、ツール発見、サポートされている場合は委任まで、ローダーを追跡します。権限を持つ各入力について、誰がそれを生成または置換できるか、誰がそれを消費するか、いつ有効になるか、何が不正な変更をブロックするかを記録します。不明なエントリにはマークを付けます。ローダーの診断を使用するか、信頼できる検査環境からインストールされた実装を検査します。
  2. 提案をデータとしてステージングする. 通常のタスク出力と提案は書き込み可能に保ちます。ステージングされた変更は、権限を持つロードパスから外しておきます。ワーカーは、データのみのインデックスを通じて、ソースラベル付きのノートやステージングされた提案を引き続き取得できます。候補テキストは引用データとしてレビューします。必要な場合にのみ、別の制限付きプレビューを使用します。ステージング中の時間は権限を付与しません。
  3. 有効な変更を承認する. 候補を最後に承認された設定と比較し、スコープ、機能、インポートされた依存関係の違いを含めます。承認を、正確なアーティファクトまたは解決済みスナップショット、ターゲットプロファイルとスコープ、アクティブなベースとポリシーリビジョン、承認された承認者に結び付けます。候補の外部で、かつエージェントの書き込み可能な状態の外部で検証された承認または署名を使用します。
  4. アクティベーションを仲介する. ランタイム、ランチャー、または外部のポリシー境界を使用して、レビューされた入力を正確にアクティベートします。最初の使用時と、サポートされている有効な入力の変更のたびに検証します。アクティベーション時に使用されるファイルまたは不変スナップショットが、検証されたものと一致していることを確認します。古い変更やバインドされていない変更は拒否します。ホストがこれを強制できない場合は、ランタイムを承認された入力セットに制限するか、残りの露出を明示的に報告します。
  5. モデルの外部から検証する. 何がロードされ、どの機能が利用可能であったかを観察し、限定された動作チェックと承認されたタスクを実行します。コンプライアンスの表明は診断的です。予期しない変更があった場合は、影響を受ける起動や機密アクションを一時停止し、関連する証拠を保存し、信頼できるパスを通じて既知の正常な入力と設定を復元します。影響を受けたキャッシュと再開された状態を考慮した、クリーンなセッションから検証します。

監査の場合は、有効なサーフェスマップ、証拠リンク、未解決のパスを提供します。設計の場合は、強制コンポーネント、その承認契約、回復パスを特定します。ランタイムレビューとプロモーションリファレンスを、インベントリと承認記録、または実際の制御と併用するプロンプトとして使用します。評価プロトコルを、防御的な実験に使用します。

例

リサーチワーカーによって提案されたフォーマット設定は、データレコードとして保持し、サンプルドキュメントで評価できます。親は既存の指示の下でレポートのコンパイルを続行できます。その設定をワークスペースのデフォルトにする前に、ポリシー承認者が正確なリビジョンとスコープを承認し、次のクリーンセッションがロードしたリビジョンを記録します。

プロジェクトは、ルール変更をマージする前に承認をチェックします。そのインタラクティブランタイムはワーキングコピーのルールも読み取ります。公開とローカルアクティベーションに別々の境界を記録し、後者をロード時に検証します。マージチェックの成功は公開結果のみを確立します。

ガイドライン

  • 変更がステージングまたはブロックされている場合、最後に承認された状態の下での正当な作業を維持します。影響を受けるサーフェス、決定、証拠、次の許可された操作を返します。
  • 制御を効果に合わせます。権限を付与したり、将来のエージェントを自動的に導いたりするものをすべて保護します。ローダーと権限がその区別をサポートする場合、通常のスクラッチメモリとタスクアーティファクトはデータとして利用可能に保ちます。
  • 委任された作業は、受信者の有効な権限を使用して監査します。ハンドオフをまたいでソースとスコープを伝達し、機密性の高い効果には独立した承認を要求します。

落とし穴

  1. ファイル名リストは有効な入力を網羅しない. ネストされたルール、解決されたインポート、プラグイン状態、動的ツール登録、再開されたコンテキストが、有効な内容を変更する可能性があります。実際のローダーを観察してください。
  2. 起動後のチェックは遅すぎる. 差分やカナリアは、受け入れ後に変更を検出できます。ロードまたは機能の使用が有効になる前にゲートしてください。
  3. 承認はそのレビューを長生きする可能性がある. パスの置換、インポート、スコープ、ポリシーの変更は、プライマリファイルのバイトが一致していても、承認を無効にする可能性があります。
  4. 拒否は障害を隠す可能性がある. モデルは拒否したと報告しても、別のライターがすでに状態を変更している可能性があります。回復や通常のタスク完了を含む、信頼できるライフサイクルイベントと状態を確認してください。

統合

harness-engineering を使用してコントローラーとログを保護し、multi-agent-patterns を使用して委任トポロジーと役割割り当てを管理し、evaluation を使用して決定論的グレーダーと回帰カバレッジを実現します。このスキルは、ロードまたは使用中の提案コンテンツと権限の間の境界を担当します。

参考文献

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

advanced-evaluation

This skill should be used for advanced LLM evaluation: LLM-as-judge systems, direct scoring, pairwise comparison, rubric calibration, evaluator bias mitigation, confidence scoring, and automated quality assessment.

bdi-mental-states

This skill should be used when modeling agent mental states with BDI concepts: beliefs, desires, intentions, RDF-to-belief transformations, rational agency traces, cognitive agents, BDI ontologies, and neuro-symbolic AI integration.

book-sft-pipeline

This skill should be used for book-to-SFT pipelines: ePub extraction, literary segmentation, author-voice dataset construction, style-transfer training, LoRA workflows, and model evaluation for voice replication.

comprehensive-research-agent

Ensure thorough validation, error recovery, and transparent reasoning in research tasks with multiple tool calls

context-compression

This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve decisions, files, risks, and next actions.

context-degradation

This skill should be used for diagnosing and mitigating context degradation: lost-in-middle failures, context poisoning, context clash, context confusion, attention-pattern issues, and agent performance degradation caused by accumulated or conflicting context.

context-fundamentals

This skill should be used to explain or reason about the foundational concepts of context engineering: what context is, the anatomy of a context window, how attention mechanics work, the U-shaped attention curve, why context quality matters more than quantity, and the mental models needed to interpret every other context-engineering decision. Use this for conceptual explanation, onboarding, and background reading. Route operational work to the specialized skills: debugging attention failures goes to context-degradation, token-efficiency work goes to context-optimization, conversation summarization goes to context-compression, and project-shape decisions go to project-development.

context-optimization

This skill should be used for improving context efficiency: context budgeting, observation masking, prefix or KV-cache strategy, partitioning, token-cost reduction, retrieval scoping, and extending effective context capacity without lowering answer quality.

evaluation

This skill should be used when building agent evaluation systems: deterministic checks, regression suites, multi-dimensional rubrics, quality gates, production monitoring, baseline comparison, and outcome measurement for agent pipelines.

filesystem-context

This skill should be used when agent work needs file-backed context: durable scratchpads, tool-output offloading, just-in-time discovery, cross-agent handoff files, filesystem memory, or cleanup policies for context stored outside the prompt.

harness-engineering

This skill should be used when designing autonomous agent harnesses: research loops, evaluation scaffolds, locked and editable surfaces, durable logs, novelty gates, pruning, rollback, PR preparation, and human approval boundaries.

hosted-agents

This skill should be used when designing hosted or background agent infrastructure: sandboxed execution, remote coding environments, warm pools, session persistence, multiplayer collaboration, self-spawning agents, or Modal-style sandboxes.

latent-briefing

This skill should be used when the user asks to "share memory between agents", "KV cache compaction for multi-agent", "orchestrator worker context", "latent briefing", "reduce worker tokens", "cross-agent memory without summarization", or discusses Attention Matching compaction, recursive language models with workers, or token explosion in hierarchical agents.

long-horizon-prompting

This skill should be used when writing, enhancing, or evaluating the launch prompt for a long-running autonomous agent or a parallel multi-agent orchestration attacking a hard problem: pseudo-formal task briefs that define terms and an exact success predicate linguistically, enumerate non-counting outcomes, set persistence rules with explicit stop and return conditions and effort floors, manage a diverse portfolio of parallel approaches with an approach registry and blocked-route bookkeeping, and gate the return on adversarial audit. Route agent topology and coordination protocols to multi-agent-patterns, runtime control surfaces and loop governance to harness-engineering, evaluator and quality-gate construction to evaluation, judge design to advanced-evaluation, and compaction or memory mechanics to context-compression and memory-systems.

memory-systems

This skill should be used for persistent semantic memory in agent systems: cross-session knowledge retention, entity tracking, temporal validity, graph or vector retrieval, memory consolidation, and memory benchmark selection. Route file-backed scratchpads to filesystem-context, handoff summaries to context-compression, and token-efficiency tactics to context-optimization.

multi-agent-patterns

This skill should be used when designing multi-agent systems that need context isolation, supervisor or swarm coordination, explicit handoffs, parallel execution, or a decision on whether multiple agents are justified.

project-development

This skill should be used for project-level decisions about LLM-powered systems: whether an LLM is the right primitive for the task at hand, the shape of a multi-stage batch or agent pipeline, token and cost estimation, choosing between single-agent and multi-agent at the project level, structured output design for downstream parsing, and structuring agent-assisted iteration. Use this when the unit of work is a whole project or a multi-stage pipeline. Route individual tool design to tool-design and individual skill-loading or context-budget tactics to context-optimization.

self-improvement-loops

This skill should be used when the harness, scaffold, workflow, or optimizer itself is the optimization target: recursive self-improvement (RSI) loops, meta-harnesses, self-improving harnesses that mine their own failures and propose bounded edits, evolutionary or population-based search over agent scaffolds, acceptance gates for self-modifying systems, and agentic context evolution where the mechanism that produces context is versioned and evolved. Route governance of a single autonomous loop (locked surfaces, durable logs, rollback, novelty gates, approval boundaries) to harness-engineering, measurement and quality-gate design to evaluation, judge design to advanced-evaluation, and remote sandbox infrastructure to hosted-agents.

self-managed-context

This skill should be used when a model gets read-write control over its own live context window instead of a harness-scheduled compaction policy: the context exposed as an editable file the model rewrites with code tools, model-driven eviction and in-place updates, the harness invariants that keep self-editing safe (pinned prefix, edit gate, edit receipts, budget readouts, rollback on overflow), the prefix-cache cost of mid-context edits, and steering or training the model's own context-editing strategy. Route note content and fixed-threshold summarization to context-compression, cache-stable layout under harness control to context-optimization, file offloading to filesystem-context, and loop governance to self-improvement-loops.

tool-design

This skill should be used for the tool-interface layer of an agent system specifically: writing tool descriptions agents can route on, designing tool schemas and response formats, naming conventions, actionable error recovery messages, MCP server design, tool-set consolidation, and deciding when to add or remove an individual tool. Use this when the unit of work is a single tool or a set of tools. Route project-shape, pipeline architecture, and task-model-fit decisions to project-development; route deciding whether to introduce sub-agents to multi-agent-patterns.

関連スキル