github / github/copilot-cli

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

Aperta
#4,088 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area:context-memory
Lingua principale
Shell
Stelle
11.2k
Fork
1.9k
Merge medio
14h 16m
PR unite (30g)
6

Descrizione

### 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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia tracciando l’invocazione di Agent Skills (SKILL.md) e le policy o gli hook esistenti per l’esecuzione della shell in GitHub Copilot CLI. Esamina la documentazione collegata di Claude Code sul contesto dinamico per il comportamento proposto dei segnaposto e determina come devono funzionare le salvaguardie, i limiti dell’output e i fallimenti dei comandi. Il lavoro è completato quando uno skill può espandere !`command` dall’output stdout locale prima che il suo contenuto venga inviato al modello, con le protezioni delle policy indicate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
shell
Ambito
cli
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.