github / github/copilot-cli

Dynamic context injection in Skills (`!command` placeholder)

オープン
#4,088 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:context-memory
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
6

説明

### Feature request for product/service

GitHub Copilot CLI

### Describe the request

Add **dynamic context injection** to Agent Skills (`SKILL.md`) in GitHub Copilot CLI.

I’m proposing the !`<command>` command placeholder inside the skill body. When the skill is invoked, Copilot CLI would run the shell command locally **before** sending the skill content to the model, then replace the placeholder with the command’s stdout.

That would let skills combine live data + instructions in a single turn, instead of asking the agent to make a separate shell call at runtime.

### Example

```md
---
name: summarize-changes
description: Summarize uncommitted changes and flag risks
---

## Current changes

!`git diff HEAD`

## Instructions

Summarize the changes above in 2–3 bullets and list risks.
If the diff is empty, say there are no uncommitted changes.
```

### Why this matters

Today, skills that depend on live state usually have to tell the agent to run shell commands itself during the interaction. That is slower, uses extra tokens, and is less reliable — the agent may skip the command, choose the wrong one, or reason from stale file context instead of actual output.

With injection, repeatable workflows like PR review, commit summaries, and pre-merge checks become self-bootstrapping: the skill gathers facts first, then the model reasons over them.

### Use cases

- Branch / PR review: `!`git diff master...HEAD``, `!`gh pr diff``
- Commit helper: `!`git diff --staged``
- Pre-ship checks: test output, lint output, or other command results

### Suggested safeguards

- Respect existing shell-execution policies / hooks
- Make command injection opt-in per skill and/or configurable globally
- Cap or truncate large stdout
- Surface command failures clearly when the injected command fails

### Prior art

Claude Code already ships this pattern as part of the Agent Skills standard extension: https://code.claude.com/docs/en/skills#inject-dynamic-context

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、GitHub Copilot CLI における Agent Skills (SKILL.md) の呼び出しと、既存の shell 実行ポリシーまたはフックを追跡します。提案されているプレースホルダーの動作について、リンク先の Claude Code の動的コンテキストのドキュメントを確認し、保護策、出力制限、コマンドの失敗をどのように動作させるべきかを判断します。skill が、コンテンツをモデルに送信する前にローカルの stdout から !`command` を展開でき、提示されたポリシー保護が適用されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
shell
領域
cli
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。