Skip to content

Commit 25d3468

Browse files
matthewwilsonclaude
andcommitted
Improve startup flow and fix permission handling
Rewrite Rule 0 to handle "start the tutorial" as the first message without deferring to navigation agents, eliminating the circular "say start to begin" prompt. Clarify Rule 8 to tell Copilot to read agent files directly instead of trying to invoke them programmatically. Remove the auto-approve preToolUse hook (Copilot CLI only processes deny responses). Simplify permissions note and README getting started. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3b6c9db commit 25d3468

5 files changed

Lines changed: 36 additions & 86 deletions

File tree

.github/agents/start.agent.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ Reset the tutorial and start from the very beginning. Do the following steps in
1717
```
1818
3. Read the file `tutorial/lessons/00-welcome.md`
1919
4. Present its contents to the user in a warm, welcoming way. Make it feel like a fresh start.
20+
21+
Note: If this is the very first message of the session, the welcome banner from copilot-instructions.md Rule 0 should already have been shown. You don't need to show it again.

.github/copilot-instructions.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,32 @@ When suggesting navigation to the user, tell them to type `/agent` and select fr
2525

2626
## Permissions Note
2727

28-
The tutorial frequently edits `tutorial/state.json` for navigation. If the user is prompted for permission on every state.json edit, suggest they restart with:
29-
```
30-
copilot --allow-tool 'edit(tutorial/state.json)' --allow-tool 'read(tutorial/*)'
31-
```
32-
Or, when prompted, they can select **"Yes, approve for session"** to auto-approve for the rest of the session.
28+
The tutorial frequently edits `tutorial/state.json` for navigation. If the user is prompted for permission on a state.json edit, tell them to select **"Yes, approve for session"** to auto-approve for the rest of the session.
3329

3430
## Behaviour Rules
3531

36-
0. **Greet the user on session start.** When the session begins — before the user has typed anything — display the following welcome banner EXACTLY as shown (preserve the box-drawing characters and ASCII art):
32+
0. **Welcome the user on the first message of every session.** This rule handles the very first message, regardless of what the user typed (including "start the tutorial", "hello", or anything else). Do not defer to navigation agents for the first message — handle it entirely here.
3733

38-
```
39-
██╗███╗ ██╗███████╗████████╗██╗██╗
40-
██║████╗ ██║██╔════╝╚══██╔══╝██║██║
41-
██║██╔██╗ ██║███████╗ ██║ ██║██║
42-
██║██║╚██╗██║╚════██║ ██║ ██║██║
43-
██║██║ ╚████║███████║ ██║ ██║███████╗
44-
╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝╚══════╝
34+
a. Display the following welcome banner EXACTLY as shown (preserve the box-drawing characters and ASCII art):
4535

46-
╔══════════════════════════════════════════════════════════════╗
47-
║ Welcome to the Instil GitHub Copilot CLI Tutorial ║
48-
╚══════════════════════════════════════════════════════════════╝
49-
```
36+
```
37+
---
38+
██╗███╗ ██╗███████╗████████╗██╗██╗
39+
██║████╗ ██║██╔════╝╚══██╔══╝██║██║
40+
██║██╔██╗ ██║███████╗ ██║ ██║██║
41+
██║██║╚██╗██║╚════██║ ██║ ██║██║
42+
██║██║ ╚████║███████║ ██║ ██║███████╗
43+
╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝╚══════╝
5044
51-
Then read `tutorial/state.json` to find the current lesson number. If `currentLesson` is 0 and `startedAt` is empty, say: "You're all set! Just say **start** or type `/agent start` and we'll begin. (Or say **progress** to see what's ahead.)" Otherwise say: "Picking up where you left off (lesson N). Say **next** to continue, or **start** to restart." Then read the matching lesson file from `tutorial/lessons/` (zero-padded prefix, e.g. `00-welcome.md`) and present its contents.
45+
╔══════════════════════════════════════════════════════════════╗
46+
║ Welcome to the Instil GitHub Copilot CLI Tutorial ║
47+
╚══════════════════════════════════════════════════════════════╝
48+
```
49+
50+
b. Read `tutorial/state.json` to determine what to do next:
51+
52+
- **Fresh start** (`startedAt` is empty) OR **user said "start" / "restart"**: Update `startedAt` to the current ISO timestamp in `tutorial/state.json`, then read `tutorial/lessons/00-welcome.md` and present its contents.
53+
- **Returning user** (has progress and did NOT say "start"/"restart"): Say "Picking up where you left off (lesson N). Say **start** if you'd rather restart." Then read `tutorial/current-lesson.md` and present the current lesson.
5254

5355
1. **Stay in tutorial mode.** Don't drift off-topic. If the user asks something unrelated to the tutorial or the sample app, gently redirect them back to the current lesson.
5456

@@ -64,7 +66,17 @@ Or, when prompted, they can select **"Yes, approve for session"** to auto-approv
6466

6567
7. **Exit tutorial mode only if the user explicitly says so** — e.g., "exit tutorial" or "I'm done with the tutorial". Then behave as a normal Copilot CLI instance.
6668

67-
8. **Understand natural language navigation.** When the user says things like "next lesson", "go to the next one", "skip this", "give me a hint", "show my progress", "restart", "switch to QA track" — use the corresponding navigation agent. You don't need to wait for a specific `/agent` command.
69+
8. **Handle natural language navigation directly.** After the first message (which Rule 0 handles), when the user says things like "next lesson", "go to the next one", "skip this", "give me a hint", "show my progress", "restart", or "switch to QA track" — read the corresponding agent file from `.github/agents/` (e.g., `.github/agents/next.agent.md` for "next lesson") and follow its step-by-step instructions. You do not need to invoke `/agent` — just read the file and do what it says.
70+
71+
| User says | Agent file to read |
72+
|-----------|-------------------|
73+
| "next", "next lesson", "continue" | `.github/agents/next.agent.md` |
74+
| "start", "restart", "start over" | `.github/agents/start.agent.md` |
75+
| "hint", "give me a hint", "help" | `.github/agents/hint.agent.md` |
76+
| "skip", "skip this" | `.github/agents/skip.agent.md` |
77+
| "progress", "show progress" | `.github/agents/progress.agent.md` |
78+
| "QA track", "switch to QA" | `.github/agents/qa.agent.md` |
79+
| "core track", "switch to core" | `.github/agents/core.agent.md` |
6880

6981
## QA Track (Lessons 18-22)
7082

.github/hooks/auto-approve-state.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/hooks/hooks.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@
2424
"comment": "Check exercise completion after file edits",
2525
"timeoutSec": 30
2626
}
27-
],
28-
"preToolUse": [
29-
{
30-
"type": "command",
31-
"bash": "bash .github/hooks/auto-approve-state.sh",
32-
"comment": "Auto-approve writes to tutorial/state.json",
33-
"timeoutSec": 5
34-
}
3527
]
3628
}
3729
}

README.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,16 @@ An interactive, hands-on tutorial for learning GitHub Copilot CLI — built enti
88
- [Node.js](https://nodejs.org/) (includes `npm`, required for the sample app and validators)
99
- **Windows only:** [Git for Windows](https://git-scm.com/download/win) (provides Git Bash)
1010

11-
## Install GitHub Copilot CLI
12-
13-
**macOS / Linux (Homebrew):**
14-
```bash
15-
brew install copilot-cli
16-
```
17-
18-
**Cross-platform (npm, requires Node.js 22+):**
19-
```bash
20-
npm install -g @github/copilot
21-
```
22-
23-
**Windows (winget):**
24-
```powershell
25-
winget install GitHub.Copilot
26-
```
27-
28-
Then log in:
29-
```bash
30-
copilot
31-
/login
32-
```
33-
3411
## Getting Started
3512

3613
```bash
3714
git clone git@github.com:instil/github-copilot-tutorial.git
3815
cd github-copilot-tutorial
39-
copilot --allow-tool 'edit(tutorial/state.json)' --allow-tool 'read(tutorial/*)'
16+
copilot -i "start the tutorial"
4017
```
4118

42-
The `--allow-tool` flags let Copilot manage tutorial state without prompting for permission on every navigation step. When Copilot CLI opens, it will automatically detect the tutorial and greet you. Say **"start"** or type `/agent start` to begin your first lesson.
19+
When Copilot CLI opens, it will automatically detect the tutorial and greet you.
20+
Say **"start"** or type `/agent start` to begin your first lesson.
4321

4422
## Navigation
4523

0 commit comments

Comments
 (0)