◀ 用語一覧
NO.3.5

Harness Engineering

更新: 2026.07.22

一言で

Harness Engineering は、AI から最高の結果を引き出すための足場設計。

ただ制限するだけではなく、目的・文脈・役割・検証方法を整えて、AI が迷わず安全に成果へ向かえる状態を作る。

古き良き時代(2021 〜 2024)

昔の LLM chat はシンプルだった。ユーザーがプロンプトを投げ、LLM が回答を返す。

flowchart LR
  You[ユーザー] -->|プロンプト| LLM[LLM]
  LLM -->|回答| You

  classDef human fill:#102033,stroke:#00f0ff,color:#e8f4ff,stroke-width:2px;
  classDef llm fill:#302500,stroke:#ffb000,color:#fff4d6,stroke-width:2px;
  class You human;
  class LLM llm;

この世界では、context はほぼ プロンプトの中に人間が手で詰めるもの だった。

現在(2025 〜)

現在は、プロジェクトのコンテキストツール群 を備えた エージェント/ハーネス が LLM の前に立つ。

---
config:
  flowchart:
    htmlLabels: true
  themeCSS: |
    .nodeLabel { text-align: center !important; }
    .nodeLabel .llm-row { display: flex !important; flex-direction: row !important; justify-content: center !important; align-items: center !important; gap: 6px !important; margin-top: 4px !important; }
    .nodeLabel .llm-row img { width: 22px !important; height: 22px !important; object-fit: contain !important; }
    .nodeLabel .llm-row img.ms-ico { width: 17px !important; height: 17px !important; }
---
flowchart LR
  Project[ユーザー] -->|プロンプト / 指示書 / スキル / MCP| Agent[エージェント<br/>別名:ハーネス<br/><br/>Copilot Chat<br/>Copilot CLI<br/>Claude Code<br/>Codex]
  Agent -->|回答 / PR / 編集| Project
  Agent -->|コンテキスト| LLM["<b>LLM</b><div class='llm-row'><img src='/theomonfort/llm-openai.png' alt=''/><img src='/theomonfort/llm-anthropic.svg' alt=''/><img src='/theomonfort/llm-gemini.png' alt=''/><img src='/theomonfort/llm-grok.png' alt=''/><img class='ms-ico' src='/theomonfort/llm-microsoft.svg' alt=''/></div>"]
  LLM -->|次の一手| Agent
  Agent -->|ツール呼び出し| Tools[ツール群<br/>読む / 編集 / 実行]
  Tools -->|結果| Agent

  classDef human fill:#102033,stroke:#00f0ff,color:#e8f4ff,stroke-width:2px;
  classDef llm fill:#302500,stroke:#ffb000,color:#fff4d6,stroke-width:2px;
  classDef agent fill:#132812,stroke:#9bbc0f,color:#f4ffd8,stroke-width:2px;
  classDef tools fill:#2a0f1a,stroke:#ff2e88,color:#ffd6e7,stroke-width:2px;
  class Project human;
  class LLM llm;
  class Agent agent;
  class Tools tools;

魔法ではない。エージェントは LLM を直接呼ぶ代わりに、何を読ませるか・どのツールを使わせるか・結果をどう戻すか を管理するレイヤー。

Agent / Harness の裏側(簡略版)

  • 実行ループ:LLM が次の一手を決め、tool 実行 → 結果を context に戻す、を done まで繰り返す。
  • コンテキスト管理:system prompt、available tools、user task、tool results を整理し、毎回の LLM call に必要な context として渡す。
# --- Setup ---
system_prompt = "You are a helpful coding assistant..."
available_tools = [search_web, read_file, edit_file, run_terminal]

# --- Agent Loop ---
user_task = input("How can I help you?")
context = [system_prompt, available_tools, user_task]

while True:
    next_step = await llm.determine_next_step(context)
    context.append(next_step)

    if next_step.intent == "done":
        return next_step.final_answer

    result = await execute_tool(next_step.tool, next_step.args)
    context.append(result)

何でハーネスする?

AI を強くする技術ツールは 1 つではない。常に読ませるもの必要な時だけ呼ぶもの を分ける。

技術ツール置き場所 / 設定使いどころ
リポジトリ全体の custom instructions.github/copilot-instructions.mdリポジトリ全体の規約・禁止事項・検証コマンド
パス別の custom instructions.github/instructions/*.instructions.md + applyTotests/**api/** など領域別ルール
Agent skills.github/skills/*/SKILL.md / ~/.copilot/skills/PR description、frontend design など専門手順
Custom agents.github/agents/*.agent.md / ~/.copilot/agents/役割・モデル・使えるツールを切り替える
Hooks.github/hooks/*.jsonツール実行前後に script を差し込み、deny / log / notify する
MCP serversMCP 設定ファイルGitHub、Figma、Playwright、Jira、Salesforce へ接続
Tool permissionsagent host の権限設定read/search のみ、edit 可、コマンド実行可などを制御

GitHub Docs の名称は Repository-wide custom instructionsPath-specific custom instructions。VS Code 側では後者を file-based instructions とも呼ぶ。

エコシステム対応表

同じ「AI の足場」でも、置き場所やファイル名はエコシステムごとに少し違う。

LayerGitHub / CopilotOpen ecosystem
Global instructions.github/copilot-instructions.mdAGENTS.md
Path-specific rules.github/instructions/*.instructions.mdnested AGENTS.md
Skills(project).github/skills/*/SKILL.md.agents/skills/*/SKILL.md
Skills(personal)~/.copilot/skills/~/.agents/skills/
Custom agentsCopilot custom agentsagent definitions / plugins
MCP / toolsmcp.configmcp.config

Copilot の強みは、主要ベンダーの形式を native にサポートできること。CLI では /help を入力すると、今使える形式やコマンドを確認できる。

よく使う概念

良い harness はツールの寄せ集めではなく、AI が迷わない進め方 を先に決める。

何をする?何が良くなる?
Spec-to-code / Spec-driven先に what / why を spec にし、plan → tasks → implement へ落とす仕様が source of truth になり、vibe coding ではなく予測可能な実装になる
Multi-phase coding planorchestrator が実装を複数 phase に分解し、各 phase の目的・順序・完了条件を決める大きな変更でも、AI が一気に突っ込まず段階的に進められる
File assignmentPlanner が触るファイルを明示し、orchestrator が file overlap を見て並列化する複数 agent が同じファイルを壊し合わず、Coder / Designer を並列に走らせられる
Prompt engineeringSkill / Agent を作る時に role・objective・deliverable を明確に書く何者として、何を達成し、何を出力すべきかがぶれない
Context engineeringタスクに必要な context だけを構造化して渡す余計な情報で迷わず、コードベース・仕様・制約に沿った回答になる
Approval gatesspec / plan / PR / release など重要な節目で人間が確認する自動化の速度を保ちながら、危険な判断だけ人間が止められる

先に spec・phase・file ownership・role/objective/deliverable・context・approval を設計すると、AI は速くなるだけでなく、やり直しも減る。

例:Ultralight

Ultralight は Microsoft の Developer Advocate、Burke Holland さんの multi-agent orchestration 例。
Multi-phase execution plan を作り、ファイルの重なりを検出し、Planner / Coder / Designer に並列で仕事を渡す harness になっている。

flowchart LR
  User[User prompt] --> O[Orchestrator<br/>Claude Sonnet 4.6<br/>multi-phase plan]

  O --> P[Planner<br/>Claude Opus 4.6<br/>research + docs]
  O --> C[Coder<br/>GPT-5.3-Codex<br/>scoped code changes]
  O --> D[Designer<br/>Claude Opus 4.6<br/>UI / UX owner]

  D -.-> S[Frontend Design Skill<br/>used by Designer<br/>brand / layout / CSS]
  C -.-> M[MCP Server<br/>used by Coder<br/>GitHub / Playwright<br/>docs]

  P --> O
  C --> O
  D --> O
  O --> R[Pull Request<br/>human review]

  classDef host fill:#102033,stroke:#00f0ff,color:#e8f4ff,stroke-width:2px;
  classDef agent fill:#132812,stroke:#9bbc0f,color:#f4ffd8,stroke-width:2px;
  classDef harness fill:#2a1020,stroke:#ff2e88,color:#ffe8f4,stroke-width:2px;
  classDef ship fill:#302500,stroke:#ffb000,color:#fff4d6,stroke-width:2px;
  class O host;
  class P,C,D agent;
  class S,M harness;
  class R ship;

🚀 数クリックで試せるように Codespace 対応のリポジトリを用意しました: theomonfort/ultralight-template

このサイトを作るハーネス

この playbook サイト自体も、同じ考え方のハーネスで作っている。Orchestrator(Theo)が指示書とプロンプトで全体を束ね、フェーズごとに CLI built-in agent・custom agent・skill・MCP を使い分ける。

Orchestrator:Theo + 指示書 / プロンプト Explore / Research CLI Built-in Agents planner Custom agent LOCAL Opus 4.8 Coding CLI Built-in Agents Opus 4.8 Tester Custom agent LOCAL GPT-5.5 Review CLI Built-in · Rubber Duck GPT系 Grill-me Skill LOCAL MCP Context7 MCP server LOCAL Slide Creator Skill REPO Prototyper Skill REPO MCP Playwright MCP server LOCAL

🟦 Orchestrator / Custom agent ・ ⬜ CLI Built-in ・ 🟩 MCP ・ 🟥 Skill。Local は手元の設定、Repo はこのリポジトリ内に置いたもの。