Skip to content

Commit d37d444

Browse files
committed
Connect guided interactions to the tutor
1 parent 652825f commit d37d444

30 files changed

Lines changed: 689 additions & 63 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ All notable changes to `explorables` are documented here.
66

77
### Added
88

9+
- A bounded loopback tutor event stream and `explorables tutor` listener so lesson navigation and
10+
checkpoint actions in the browser can prompt the adjacent coding-agent tutor during an active
11+
session without analytics, accounts, raw control telemetry, or private host APIs.
12+
913
- Opt-in `teaching.mode: tutor-led` presentation: the coding-agent conversation leads the live
1014
lesson while the browser defaults to checkpoint, explorable, evidence, exercise, and collapsed
1115
reference notes. Stable `data-tutor-*` state keeps host inspection provider-neutral.
@@ -36,6 +40,9 @@ All notable changes to `explorables` are documented here.
3640

3741
### Changed
3842

43+
- Tutor-led lessons now keep prerequisite bridges and foundational definitions in the main lesson
44+
flow; only worked explanations and recaps remain in the optional reference-notes disclosure.
45+
3946
- `AI from First Principles` is versioned as `0.6.0-tutor-led.1`, now contains sixteen lessons, and
4047
uses Codex/Claude conversation as the primary teaching surface. Its browser-progress namespace is
4148
intentionally fresh; earlier local progress remains untouched under its prior course version.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ Agent Plugins-compatible clients discover the portable `start-course` skill. Cod
5454

5555
```bash
5656
explorables start [path]
57+
explorables tutor [--url <local-course-url>]
5758
explorables validate [path]
5859
explorables test [path]
5960
explorables build [path]
6061
explorables new <name>
6162
```
6263

63-
`explorables start` uses the strict default address `127.0.0.1:4173` so local resume state remains available. `--port <port>` is supported explicitly, but a different port has separate browser storage.
64+
`explorables start` uses the strict default address `127.0.0.1:4173` so local resume state remains available. `--port <port>` is supported explicitly, but a different port has separate browser storage. During an active guided session, the host adapter runs `explorables tutor` beside the server. It listens only to the local server's bounded semantic event stream so browser checkpoint actions can prompt the coding-agent tutor; it sends no analytics or remote learner data.
6465

6566
From this source checkout, run the CLI as `pnpm exec explorables` or use the root scripts:
6667

apps/site/playwright.config.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
import { defineConfig } from "@playwright/test";
21
import path from "node:path";
2+
import { defineConfig } from "@playwright/test";
3+
4+
const sitePort = process.env.EXPLORABLES_SITE_TEST_PORT ?? "4174";
5+
const siteUrl = `http://127.0.0.1:${sitePort}`;
36

47
export default defineConfig({
58
testDir: "./tests",
6-
use: { baseURL: "http://127.0.0.1:4174" },
9+
use: { baseURL: siteUrl },
710
webServer: {
8-
command: "pnpm site:dev --host 127.0.0.1 --port 4174",
11+
command: `pnpm site:dev --host 127.0.0.1 --port ${sitePort}`,
912
cwd: path.resolve(import.meta.dirname, "../.."),
10-
url: "http://127.0.0.1:4174",
13+
url: siteUrl,
1114
reuseExistingServer: !process.env.CI,
1215
},
1316
});

apps/site/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function App() {
125125

126126
<section className="section course-feature" id="course">
127127
<div>
128-
<p className="kicker">Course 001 · thirteen foundation lessons</p>
128+
<p className="kicker">Course 001 · sixteen foundation lessons</p>
129129
<h2>
130130
AI from
131131
<br />

docs/PRD.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,10 @@ teaching:
765765
```
766766
767767
`tutor-led` makes the coding-agent conversation the live teaching surface. The browser defaults to
768-
the active checkpoint, explorable, evidence, and exercise, while complete lesson prose remains
769-
available through an accessible reference-notes disclosure. Omitting the profile preserves the
770-
ordinary browser-led rendering used by existing and standalone courses.
768+
the prerequisite bridge and foundational definitions followed by the active checkpoint,
769+
explorable, evidence, and exercise; worked explanations and recaps may remain in an accessible
770+
reference-notes disclosure. Omitting the profile preserves the ordinary browser-led rendering used
771+
by existing and standalone courses.
771772

772773
The runtime exposes read-only `data-explorables-*` and `data-tutor-*` attributes for the visible
773774
lesson, Guided position, active checkpoint, checkpoint phase, mode, and persistence status. These
@@ -1019,6 +1020,8 @@ They allow:
10191020

10201021
They are not sent to a remote analytics service.
10211022

1023+
The trusted parent runtime may promote a small allowlist of semantic lesson and checkpoint events to the loopback course server so an actively listening coding-agent tutor can react. This local bridge must be bounded, versioned, process-memory-only, unavailable from static builds, and free of raw control telemetry. It must not call private host APIs or treat interaction as proof of understanding.
1024+
10221025
Recommended event conventions:
10231026

10241027
```text
@@ -1544,11 +1547,15 @@ When asked to start the course, Codex should:
15441547
1. Read `COURSE.md`.
15451548
2. Verify dependencies.
15461549
3. Run `pnpm course`.
1547-
4. Open the local URL in the built-in browser.
1548-
5. Inspect the visible lesson and checkpoint state and introduce that checkpoint in conversation.
1549-
6. Teach the minimum prerequisite concepts, ask for a prediction, then direct the learner to use
1550+
4. Run `pnpm tutor` in a second terminal and keep the tutoring turn open while waiting for its
1551+
semantic events during the active session.
1552+
5. Open the local URL in the built-in browser.
1553+
6. Inspect the visible lesson and checkpoint state and introduce that checkpoint in conversation.
1554+
7. React to semantic browser checkpoint events without inferring understanding from a click.
1555+
8. Teach the minimum prerequisite concepts, ask for a prediction, then direct the learner to use
15501556
the browser activity and report its evidence.
1551-
7. Move into exercise files only when referenced by the current lesson.
1557+
9. Move into exercise files only when referenced by the current lesson, and stop the listener when
1558+
the session ends.
15521559

15531560
Codex may activate the portable `start-course` skill or use `AGENTS.md` directly. Both paths must produce the same course behavior.
15541561

@@ -1567,10 +1574,13 @@ When asked to start the course, Claude Code Desktop should:
15671574

15681575
1. Read `CLAUDE.md` and `COURSE.md`.
15691576
2. Start the preview using `.claude/launch.json` or `pnpm course`.
1570-
3. Open the local course in the Browser or Preview pane.
1571-
4. Keep the preview beside the conversation where practical.
1572-
5. Use file and terminal panes for exercises.
1573-
6. Apply the same tutoring restrictions as Codex.
1577+
3. Start the local tutor-event listener in a second terminal and keep the tutoring turn open while
1578+
waiting for its events during the active session.
1579+
4. Open the local course in the Browser or Preview pane.
1580+
5. Keep the preview beside the conversation where practical.
1581+
6. React to semantic browser checkpoint events without inferring understanding from a click.
1582+
7. Use file and terminal panes for exercises.
1583+
8. Apply the same tutoring restrictions as Codex.
15741584

15751585
Claude may activate the same portable `skills/start-course/SKILL.md` when its Agent Plugins integration supports it; `.claude/launch.json` remains a thin preview adapter.
15761586

@@ -1587,6 +1597,12 @@ No remote progress record is needed.
15871597

15881598
The host must also honor the course-session language in section 6.4. Pausing flushes local browser progress before the host stops the local process. Reviewing does not roll progress back. Restarting from a checkpoint and resetting the course require explicit confirmation. Host conversation history may supplement the runtime state but is never the authoritative progress record.
15891599

1600+
During active tutoring, the host runs `explorables tutor` against the loopback course URL and keeps
1601+
the tutoring turn open while the learner works in the browser. A semantic browser event is new
1602+
learner input: the host may acknowledge the action, address an explicitly saved response, direct
1603+
the learner to the next current checkpoint, and resume waiting. The listener stops with the
1604+
tutoring session. It does not make a static course page or an inactive host conversation autonomous.
1605+
15901606
## 16.5 Adapter principle
15911607

15921608
Host-specific files must remain thin wrappers.

docs/architecture.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ Every locally persistent course also writes a smaller, versioned session record
9797

9898
The visible session panel is the host-neutral continuity surface. The lesson root also exposes read-only `data-explorables-*` attributes for course/version, visible lesson, Guided position, checkpoint, mode, and persistence status. Neither surface can complete a checkpoint. Review navigation leaves the Guided position intact; a confirmed restart uses the reducer to delete the selected checkpoint and all later progress. The local server uses a strict port so it cannot silently move state to a different browser origin.
9999

100+
While a local tutor is active, the trusted parent runtime publishes bounded semantic navigation and checkpoint events to an in-memory Server-Sent Events bridge on the same loopback server. `explorables tutor` consumes that stream in the host terminal. It excludes raw control events, applies size and shape validation, retains at most fifty process-local events for reconnection, and does not exist in a static build. The bridge does not alter browser progress, sandbox permissions, or the rule that interaction alone is not proof of understanding.
101+
100102
## Agent Plugin packaging and hosts
101103

102-
Each distributable course root is an Agent Plugins v1 package. Root `plugin.json` declares portable identity and `skills/start-course/SKILL.md` is the single portable component. The skill locates the course root, reads `AGENTS.md` and `COURSE.md`, starts `pnpm course`, and then follows the active lesson. No MCP server is needed because the existing CLI and local files supply the workflow without another process or permission surface.
104+
Each distributable course root is an Agent Plugins v1 package. Root `plugin.json` declares portable identity and `skills/start-course/SKILL.md` is the single portable component. The skill locates the course root, reads `AGENTS.md` and `COURSE.md`, starts `pnpm course`, keeps `pnpm tutor` listening and the tutoring turn open while the learner uses the browser, and then follows the active lesson. No MCP server is needed because the existing CLI, local event stream, and course files supply the workflow without another permission surface.
103105

104106
`AGENTS.md` remains the canonical host-neutral tutoring policy. Codex can read it directly or activate the portable skill. Claude Code Desktop retains a thin `CLAUDE.md` adapter and the officially supported `.claude/launch.json` preview configuration. Both open localhost, inspect the same active-state attributes, teach from the same Markdown, and run the same tests. No runtime package calls private host APIs.
105107

docs/course-authoring.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ Keep tasks focused and deterministic. Include an edge case or intentional failur
356356

357357
Put launch and tutoring policy in `AGENTS.md`. It must prohibit solving central starter files before an attempt and revealing protected paths. `CLAUDE.md` should contain `@AGENTS.md` plus only Preview-specific guidance. `.claude/launch.json` uses schema version `0.0.1`, runs `pnpm course`, and names the preview port. Do not put lesson content in host adapters.
358358

359-
Keep `plugin.json` at the course root and target the canonical Agent Plugins v1 schema. Its `name` and `version` must match `COURSE.md`. Put portable startup instructions in `skills/start-course/SKILL.md`; its `name` must match the `start-course` directory, and it should read `../../AGENTS.md` rather than copy the tutoring policy. MCP is optional in Agent Plugins v1 and is not needed for an explorables course.
359+
Keep `plugin.json` at the course root and target the canonical Agent Plugins v1 schema. Its `name` and `version` must match `COURSE.md`. Put portable startup instructions in `skills/start-course/SKILL.md`; its `name` must match the `start-course` directory, and it should read `../../AGENTS.md` rather than copy the tutoring policy. During active tutoring the skill runs `pnpm tutor` in a second terminal, keeps the tutoring turn open, and reacts to its semantic browser events; raw explorable controls are deliberately excluded. MCP is optional in Agent Plugins v1 and is not needed for an explorables course.
360360

361361
## 8. Validate and publish
362362

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# ADR 0012: bounded local tutor event stream
2+
3+
Status: accepted Date: 21 August 2026
4+
5+
## Context
6+
7+
Guided browser interactions update authoritative course progress, but the adjacent coding-agent tutor does not automatically observe a click. Read-only DOM attributes let a host inspect state during a turn; they do not notify an actively tutoring host when a learner completes a checkpoint, saves a prediction, restarts, skips, or navigates.
8+
9+
Embedding a second model-backed chatbot would split the conversation, require credentials or a hosted service, and violate the product boundary. Calling private Codex or Claude APIs would make the course format provider-specific and fragile. Treating every raw explorable event as tutor input would also produce high-volume control noise.
10+
11+
## Decision
12+
13+
The local development server exposes an in-memory Server-Sent Events endpoint on the existing loopback origin. The main runtime publishes only bounded, versioned semantic events: lesson opened, checkpoint completed or restarted, lesson skipped, and mode changed. A submitted checkpoint response may be included because the learner explicitly intended it for course tutoring. Raw mouse, keyboard, slider, and render events are not forwarded.
14+
15+
The `explorables tutor` command listens to that stream. Portable start-course skills and canonical tutor policies keep the listener running in a second terminal while the host is actively tutoring and treat each event as new learner input. The host responds according to the current checkpoint policy and never treats a click as proof of understanding.
16+
17+
The bridge is loopback-only, process-memory-only, bounded, and absent from static builds. It writes no activity file, database, analytics record, or remote request. It does not call a private host API and cannot create a new host turn after the tutor has stopped listening.
18+
19+
## Consequences
20+
21+
- Browser checkpoints can prompt an immediate response from an actively listening Codex or Claude tutoring turn.
22+
- The same CLI and event contract work across hosts; adapters remain thin.
23+
- The tutor listener must remain active for automatic reactions. A static site or stopped listener preserves browser learning but cannot wake a host conversation.
24+
- Sandboxed explorable permissions and CSP do not change. Only the trusted parent runtime may publish to the same-origin bridge.
25+
- Event payload validation, byte limits, an in-memory replay buffer, and tests bound the local surface.

docs/implementation-plan.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,20 @@ state why training is a separate activity before entering gradient descent.
248248

249249
Exit check: the full check/build/course/browser/site matrix passes; the pull request is merged only
250250
after required CI is green.
251+
252+
## Milestone 15 — reciprocal tutor interaction and visible foundations
253+
254+
Deliverables:
255+
256+
- Add a bounded, versioned, process-memory-only loopback event stream for semantic lesson and
257+
checkpoint actions, plus a CLI listener that host adapters keep open during active tutoring.
258+
- Publish learner checkpoint submissions, explorable checkpoint completion, navigation, restart,
259+
skip, and mode changes without exposing raw control telemetry or weakening iframe isolation.
260+
- Keep the prerequisite bridge and foundational definitions visible in tutor-led lessons while
261+
leaving worked explanations and recaps available as optional reference notes.
262+
- Cover the bridge, runtime publication, beginner content visibility, and learner/explorable event
263+
sources with unit, browser, accessibility, build, and validation checks.
264+
265+
Exit check: completing learner and explorable checkpoints emits semantic events the adjacent tutor
266+
can react to; the first lesson visibly defines its core vocabulary before the prediction control;
267+
and the full repository verification matrix passes.

docs/implementation-status.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Implementation status
22

3-
Updated: 20 August 2026
3+
Updated: 21 August 2026
44

55
## Completed
66

@@ -59,6 +59,8 @@ Updated: 20 August 2026
5959
- Integrated all five frontier-family views into the learner-facing Atlas alongside the exact tiny Transformer and GPT-2 baseline. A shared guided prompt asks learners to identify the changed information path, inspect its evidence label, and recognize which numerical comparisons the incomplete source freeze does not support.
6060
- Added a published-only GPT lineage: report-derived GPT-1 and GPT-3 configurations complement the GPT-2 code baseline, while GPT-4 presents the technical report's explicit architecture-withholding boundary as an undisclosed interior. Later product names are not used to infer topology.
6161
- Completed Model Atlas hardening and documentation: the PRD, architecture, authoring guide, course roadmap, changelog, security model, actual catalogue bundle budget, responsive browser interaction, semantic fallback, and full repository checks now cover the feature. Redundant inline runtime source maps were removed after measurement showed they dominated compressed iframe size; compile diagnostics retain source locations.
62+
- Added a bounded in-memory loopback tutor event stream and `explorables tutor` listener. First-party and scaffolded tutor adapters now keep that listener active so lesson navigation and checkpoint completion, restart, skip, and mode changes can prompt the adjacent coding-agent tutor without private host APIs, raw interaction telemetry, accounts, or a second chatbot.
63+
- Made the tutor-led lesson setup and foundational definitions visible beside the conversation instead of hiding them inside collapsed reference notes. The existing three-lesson beginner runway defines AI, machine learning, models, data, parameters, training, inference, generative AI, language models, LLMs, and model-versus-product boundaries before gradient descent.
6264

6365
## Current work
6466

@@ -90,6 +92,7 @@ learner-study evidence also remain.
9092
## Latest verification
9193

9294
```text
95+
21 Aug reciprocal tutor + visible foundations pass (format/lint/typecheck, 38 suites/113 tests, collection and minimal validation, all builds, 20 course suites/61 model tests, 14 starter/reference exercise pairs, 18 browser tests including learner/explorable tutor events, visible definitions, responsive layout, and axe, plus 2 site tests and live loopback-listener verification)
9396
20 Aug tutor-led LLM runway pass (clean pnpm 11 worktree: format/lint/typecheck, 36 suites/109 tests, collection and minimal validation, all builds, 20 course suites/61 model tests, 14 starter/reference exercise pairs, 17 browser tests including tutor state/reference notes/ordered-list containment/320px/axe, and 2 site tests)
9497
20 Aug course orientation pass (clean Node 24/pnpm 11 worktree: format/lint/typecheck, 34 suites/105 tests, collection and minimal validation, all builds, 18 course suites/57 tests, 14 starter/reference pairs, 16 browser tests including overview/contextual order/320px/axe, and 2 site tests)
9598
20 Aug compact library hero pass (16 browser tests; 320×700, 720×800, 900×700, 1100×760, and 1427×900 geometry; light/dark in-app Codex visual QA; scoped format/lint, typecheck, 33 suites/102 tests, validation, and all builds)

0 commit comments

Comments
 (0)