Inject follow-up instructions into a live GitHub Copilot CLI session from another terminal.
claude -p "Build a GitHub Copilot CLI follow-up steering tool in the current directory. Create a preToolUse hook that reads stdin JSON, extracts sessionId, reads only the unread lines after the last <LAST_READ> marker from ~/.followup-instructions/<session-id>-instruction.md, appends a new <LAST_READ> marker to that file, and when unread text exists returns hook JSON that denies the current tool call once and includes the unread text as UPDATED USER INSTRUCTION in the denial reason. Also create one terminal UI command named magicsteer that lists active sessions from ~/.copilot/session-state and sends follow-up instructions to one selected session, an install.sh that installs the hook into ~/.copilot/hooks, registers it in ~/.copilot/config.json, installs only magicsteer into ~/.local/bin, an uninstall.sh that removes it, and a concise README with install, usage, and one real example transcript." --dangerously-skip-permissions --verbose
run:
./install.shit installs:
- the hook at
~/.copilot/hooks/followup-pretool.sh magicsteerat~/.local/bin/- the hook entry in
~/.copilot/config.json
use command magicsteer in a new terminal window, select a session, and submit a steering prompt, while an active copilot session is running.
- Start Copilot CLI in terminal A.
- Open
magicsteerin terminal B. - Send a new instruction while Copilot is still working.
- Copilot picks it up on the next tool call.
full session transcript
╭────────────────────────────────────────────────╮
│ ╭─╮╭─╮ │
│ ╰─╯╰─╯ GitHub Copilot v1.0.24 │
│ █ ▘▝ █ Describe a task to get started. │
│ ▔▔▔▔ │
│ Tip: /plugin Manage plugins and │
│ plugin marketplaces │
│ Copilot uses AI. Check for mistakes. │
╰────────────────────────────────────────────────╯
● Environment loaded: 1 hook, 1 MCP server, 42 skills
● Model changed to: gpt-5-mini (medium)
❯ sleep for 60 secs and generate 20 English names for my dog.
● Sleeping for 60 seconds as requested, then will generate 20 English dog names. Running a brief sleep to honor the delay, then
returning the list.
● Sleep for 60 seconds (shell)
│ sleep 60
└ 1 line...
✗ Read shell output Waiting up to 5 seconds for command output
└ Denied by preToolUse hook: User updated the task during the current session. This is a new user instruction for the current
session, not environment noise.
Treat the instruction below as higher priority than any conflicting earlier request, plan, or assumption. Re-evaluate your plan
before continuing.
Retry the blocked tool call only if it still matches the updated instruction.
UPDATED USER INSTRUCTION:
I've changed my mind, generate French names instead pls.
● Shell "Sleep for 60 seconds" completed
● Here are 20 French dog names:
1. Amélie
2. Belle
3. Bijou
4. Brigitte
5. Chérie
6. Coco
7. Émile
8. Fleur
9. Gaston
10. Hugo
11. Jacques
12. Léon
13. Lucie
14. Marcel
15. Noémie
16. Olivier
17. Pierre
18. René
19. Simone
20. Zoé
● Task complete
└ Slept 60 seconds and generated 20 French dog names: Amélie, Belle, Bijou, Brigitte, Chérie, Coco, Émile, Fleur, Gaston, Hugo,
Jacques, Léon, Lucie, Marcel, Noémie, Olivier, Pierre, René, Simone, Zoé.