github / github/copilot-cli

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

Ouverte
#4,088 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area:context-memory
Langage dominant
Shell
Étoiles
11.2k
Forks
1.9k
Merge moyen
14 h 16 min
PR mergées (30 j)
6

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par retracer l’invocation de Agent Skills (SKILL.md) et les politiques ou hooks existants d’exécution du shell dans GitHub Copilot CLI. Consultez la documentation liée de Claude Code sur le contexte dynamique pour le comportement proposé des espaces réservés et déterminez comment doivent fonctionner les garde-fous, les limites de sortie et les échecs de commande. Le travail est terminé lorsqu’un skill peut développer !`command` à partir de la sortie standard locale avant que son contenu soit envoyé au modèle, avec les protections de politique indiquées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
shell
Domaine
cli
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.