expert-mentor 0.6.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,294 @@
1
+ ---
2
+ name: expert-mentor
3
+ description: "Use when the user wants to learn, be taught, or be mentored in any field (e.g. 'teach me quantum computing', 'be my Rust mentor', 'explain macroeconomics like a professor'), or wants to turn a cloud AI provider (Claude/Anthropic, ChatGPT/OpenAI, Gemini) or local LLM (Ollama, LM Studio, llama.cpp) into a professional teacher for a given field. Produces a calibrated expert-mentor persona, a learning roadmap, a live tutoring session, or a full curriculum."
4
+ summary: "Turn Claude, ChatGPT, Gemini or a local LLM into a professional tutor that remembers your progress and quizzes you."
5
+ version: 0.6.2
6
+ tags: ["education", "tutoring", "mentoring", "prompt-engineering", "curriculum", "flashcards"]
7
+ keywords: ["tutor", "mentor", "teacher", "coaching", "claude", "chatgpt", "gemini", "ollama", "curriculum", "flashcards", "study-plan"]
8
+ use_cases: ["teach me quantum computing", "be my Rust mentor", "explain macroeconomics like a professor", "turn Claude into an expert tutor", "build a study curriculum for a field"]
9
+ docs_url: https://github.com/voidstackloop/expert-mentor
10
+ ---
11
+
12
+ # Expert Mentor
13
+
14
+ Turn any capable model — a cloud provider (Anthropic, OpenAI, Google) or a local
15
+ LLM (Ollama, LM Studio, llama.cpp) — into a **professional teacher for a
16
+ user-specified field**. The mentor teaches to a standard a real senior
17
+ practitioner would recognise, and adapts to the learner in real time.
18
+
19
+ ## Setup (optional)
20
+
21
+ This skill folder works as-is — no install needed. Run it in place:
22
+
23
+ ```bash
24
+ python3 scripts/expert_mentor.py --field "Rust" --level beginner
25
+ ```
26
+
27
+ Want a `mentor` command on your PATH instead of typing the full script path?
28
+ Run the installer once from inside this folder:
29
+
30
+ ```bash
31
+ ./install.sh # or: make install
32
+ ```
33
+
34
+ This installs the `mentor` command into `~/.local/bin`, links the skill into
35
+ `~/.claude/skills/expert-mentor` and `~/.config/opencode/skills/expert-mentor`,
36
+ adds `~/.local/bin` to PATH if needed, and runs a health check. Open a new
37
+ terminal (or `source ~/.bashrc`) and run `mentor doctor`. Remove it later with
38
+ `./uninstall.sh`.
39
+
40
+ Defaults can be saved so you stop retyping them:
41
+
42
+ ```bash
43
+ mentor config --set provider=claude --set level=intermediate --set style=coaching
44
+ ```
45
+
46
+ ## When this skill activates
47
+
48
+ - The user names a field and asks to be taught, tutored, coached, or mentored.
49
+ - The user wants a system prompt / persona to make a specific model act as a
50
+ teacher for a field.
51
+ - The user wants to configure a local LLM (Modelfile, LM Studio preset) as an
52
+ expert mentor.
53
+
54
+ ## Step 1 — Collect the essentials
55
+
56
+ You need, at minimum:
57
+
58
+ | Input | Required | Notes |
59
+ |-------|----------|-------|
60
+ | `field` | yes | e.g. "distributed systems", "Spanish literature", "day trading" |
61
+ | `level` | no | beginner / intermediate / advanced / expert — infer from context if absent |
62
+ | `goal` | no | what they want to be able to do |
63
+ | `context` | no | background, prior knowledge, time available |
64
+ | `language` | no | default: same language the user is writing in |
65
+ | `provider` | no | only needed when emitting a prompt/Modelfile for a specific model |
66
+
67
+ Do not interrogate the user. Infer sensible defaults from the conversation. If
68
+ the **field** itself is ambiguous (e.g. "AI" could be theory, engineering, or
69
+ policy), ask one clarifying question, then proceed.
70
+
71
+ ## Step 2 — Choose the delivery mode
72
+
73
+ Pick based on what the user actually wants:
74
+
75
+ **A. Teach me now (default).** Adopt the persona inline and run the session in
76
+ this conversation. Load `templates/mentor_system_prompt.md`, fill the slots, and
77
+ follow it exactly. Start with **Phase 1 — Intake**, then build the roadmap.
78
+
79
+ **B. Give me a reusable prompt.** The user wants to paste a system prompt into
80
+ another chat or API. Generate it with the script (Step 3) and hand it over.
81
+
82
+ **C. Configure a provider or local model.** The user wants a deployable artefact
83
+ (system prompt, messages JSON, Ollama Modelfile, LM Studio preset). Generate it
84
+ with the script (Step 3).
85
+
86
+ **D. Build a curriculum.** The user wants a structured multi-week plan rather
87
+ than live tutoring. Generate a curriculum-design prompt with `mentor curriculum
88
+ --field F --duration "6 weeks, 5h/week"`, then either hand it off or have the
89
+ model produce the plan inline. Ground it in `references/pedagogy.md`.
90
+
91
+ ## Step 3 — Generate the mentor prompt
92
+
93
+ The generator renders `templates/mentor_system_prompt.md` for a field, level,
94
+ and target provider, then emits it in the format that provider needs.
95
+
96
+ ```bash
97
+ # Print a ready-to-paste system prompt (default: generic text)
98
+ mentor --field "quantum computing" --level beginner
99
+
100
+ # For a local model as an Ollama Modelfile
101
+ mentor --field "Rust" --level intermediate --provider ollama --emit modelfile > Modelfile
102
+
103
+ # Messages JSON for an OpenAI-compatible API
104
+ mentor --field "contract law" --provider openai --emit json
105
+
106
+ # Anthropic Messages API payload
107
+ mentor --field "organic chemistry" --provider anthropic --emit json
108
+
109
+ # Save a reusable mentor and reuse it later
110
+ mentor save rustbuddy --field "Rust" --level intermediate
111
+ mentor show rustbuddy
112
+
113
+ # Build and register a local model in one shot (needs ollama installed)
114
+ mentor ollama rusttutor --field "Rust" --compact
115
+ ```
116
+
117
+ Without the installer, replace `mentor` with `python3 scripts/expert_mentor.py`.
118
+
119
+ Commands:
120
+
121
+ | Command | Purpose |
122
+ |---------|---------|
123
+ | `mentor --field F [...]` | generate a prompt (default text for the provider) |
124
+ | `mentor prompt --field F` | same, explicit form |
125
+ | `mentor save NAME --field F` | save a reusable system prompt under `~/.config/expert-mentor/prompts/` |
126
+ | `mentor show NAME` | print a saved mentor |
127
+ | `mentor saved` | list saved mentors |
128
+ | `mentor ollama NAME --field F` | write a Modelfile and run `ollama create NAME` |
129
+ | `mentor run [NAME] --field F` | start a live tutoring session (local or cloud) |
130
+ | `mentor curriculum --field F` | generate a full sequenced curriculum prompt |
131
+ | `mentor models [--provider P] [--refresh]` | list Claude/ChatGPT models (live lookup with a key) |
132
+ | `mentor config [--set K=V] [--unset K] [--reset]` | view/edit saved defaults |
133
+ | `mentor learners` | list persisted learner profiles |
134
+ | `mentor progress NAME [...]` | view/update a learner's mastered/shaky/misconception lists |
135
+ | `mentor review NAME [--apply]` | assess the latest transcript and update the learner profile |
136
+ | `mentor cards NAME [--add "Q :: A"] [--generate]` | manage spaced-repetition flashcards |
137
+ | `mentor quiz NAME [--all] [--n N]` | review due flashcards (again/hard/good/easy) |
138
+ | `mentor sessions [NAME]` | list recorded sessions |
139
+ | `mentor transcript ID` | print a session transcript |
140
+ | `mentor fields` | list curated field profiles |
141
+ | `mentor providers` | list providers and their defaults |
142
+ | `mentor doctor` | check the local setup |
143
+ | `mentor version` | print the version |
144
+ | `mentor interactive` | build a profile by answering prompts |
145
+
146
+ Useful flags:
147
+
148
+ | Flag | Purpose |
149
+ |------|---------|
150
+ | `--field` | the field to teach (quoted) |
151
+ | `--level` | beginner \| intermediate \| advanced \| expert |
152
+ | `--goal` | the learner's objective |
153
+ | `--context` | the learner's background |
154
+ | `--language` | teaching language |
155
+ | `--style` | socratic \| coaching \| direct \| immersive |
156
+ | `--mentor-name` | override the generated mentor name |
157
+ | `--provider` | generic \| anthropic \| openai \| google \| ollama \| llamacpp (aliases: `claude`, `chatgpt`, `gpt`, `gemini`) |
158
+ | `--emit` | text \| json \| modelfile \| markdown |
159
+ | `--compact` | short prompt for small-context local models |
160
+ | `--out FILE` | write to a file instead of stdout |
161
+ | `--prompt-format` | auto \| markdown \| xml (auto = XML for Claude, markdown otherwise) |
162
+ | `--thinking` / `--thinking-budget N` | Claude extended thinking |
163
+ | `--reasoning-effort` | OpenAI reasoning models: none \| minimal \| low \| medium \| high \| xhigh \| max |
164
+ | `--no-cache` | Claude: disable system-prompt caching |
165
+ | `--show-thinking` | `run`: stream the model's reasoning (dimmed, stderr) |
166
+
167
+ For **local models**, always use `--compact` if the model has under ~8k context,
168
+ and prefer the `ollama` or `llamacpp` provider so the capability notes match the
169
+ model's real constraints.
170
+
171
+ ### Live sessions (`mentor run`)
172
+
173
+ Run the mentor directly against a backend — no copy-paste needed:
174
+
175
+ ```bash
176
+ mentor run --field "Rust" --provider ollama --model qwen2.5:7b # local
177
+ mentor run rustbuddy # saved mentor
178
+ mentor run --field "contract law" --provider claude --model claude-sonnet-5
179
+ mentor run --field "Rust" --provider chatgpt --model gpt-5.6 --reasoning-effort high
180
+ mentor run --field "Rust" --provider claude --thinking --show-thinking
181
+ mentor run --field "Rust" --provider ollama --once "I'm ready" # one turn
182
+ mentor run --field "Rust" --provider chatgpt --dry-run # show payload, send nothing
183
+ ```
184
+
185
+ - **Claude** (`--provider claude`): the system prompt is sent as a cached
186
+ `system` block (prompt caching), shaped with XML section tags, with optional
187
+ extended thinking (`--thinking`, `--thinking-budget`).
188
+ - **ChatGPT** (`--provider chatgpt`): reasoning models automatically use the
189
+ `developer` role and `max_completion_tokens`, drop unsupported `temperature`,
190
+ and accept `--reasoning-effort`; token usage is reported per turn.
191
+ - **Local**: Ollama (`--host` or `$OLLAMA_HOST`) and llama.cpp / LM Studio
192
+ (`--host` or `$LLAMACPP_HOST`, OpenAI-compatible).
193
+ - **Credentials**: set `OPENAI_API_KEY` / `ANTHROPIC_API_KEY`, or drop them in
194
+ `./.env` or `~/.config/expert-mentor/.env`. Override endpoints with
195
+ `$OPENAI_BASE_URL` / `$ANTHROPIC_BASE_URL`.
196
+ - **Model discovery**: `mentor models --provider claude --refresh` lists the
197
+ models your key can actually call. `mentor models` shows the built-in catalog.
198
+ - Interactive commands: `/reset` clears history, `/exit` quits. Requests retry
199
+ automatically on rate limits and transient errors.
200
+ - `--dry-run` prints the exact request body (including cache/thinking/reasoning
201
+ fields) and is handy for debugging.
202
+
203
+ ### Persistent learners (`--learner` / `--remember`)
204
+
205
+ Give a session a memory so the mentor adapts across days instead of starting
206
+ over:
207
+
208
+ ```bash
209
+ mentor run --field "Rust" --provider ollama --remember # auto-name from field
210
+ mentor run --field "Rust" --provider claude --learner rust # explicit name
211
+ ```
212
+
213
+ - The mentor's system prompt is injected with the learner's **mastered**,
214
+ **shaky**, **misconception**, and **open-question** lists (only once there is
215
+ history to report).
216
+ - Each session transcript is written to `~/.config/expert-mentor/sessions/`.
217
+ - Curate the model yourself:
218
+
219
+ ```bash
220
+ mentor progress rust --add-mastered ownership --add-shaky lifetimes \
221
+ --add-misconception "Rc == Arc" --goal "write idiomatic Rust"
222
+ mentor learners
223
+ mentor sessions rust
224
+ mentor transcript <id>
225
+ ```
226
+
227
+ Profiles live in `~/.config/expert-mentor/learners/<name>.json` — plain JSON you
228
+ can edit by hand.
229
+
230
+ **Automatic review.** After a session, let the model assess the transcript and
231
+ update the record for you:
232
+
233
+ ```bash
234
+ mentor review rust # show proposed changes (calls the model)
235
+ mentor review rust --apply # write them to the profile
236
+ mentor review rust --dry-run # show the review prompt, call nothing
237
+ ```
238
+
239
+ The reviewer reuses the provider the session was run with, extracts a strict
240
+ JSON assessment (mastered / shaky / misconceptions / open questions / level /
241
+ next lesson), and merges it — promoting anything newly mastered out of *shaky*.
242
+ This closes the loop: run → transcript → assessment → updated profile, with no
243
+ manual bookkeeping.
244
+
245
+ **Spaced repetition.** Turn a session into flashcards and review them over time:
246
+
247
+ ```bash
248
+ mentor cards rust --generate # build cards from the latest session
249
+ mentor cards rust --add "What is ownership? :: Each value has one owner."
250
+ mentor cards rust # list, with due counts
251
+ mentor quiz rust # review what is due (again/hard/good/easy)
252
+ mentor quiz rust --all --n 20 # review ahead
253
+ ```
254
+
255
+ Cards use an SM-2-lite scheduler (interval, ease, reps) stored in
256
+ `~/.config/expert-mentor/learners/<name>.cards.json`, so review scheduling
257
+ carries across sessions and machines.
258
+
259
+ ## Step 4 — Run the session (or hand off the prompt)
260
+
261
+ If teaching inline, obey the loaded prompt's **Teaching Contract** without
262
+ exception. The non-negotiables:
263
+
264
+ 1. Guide with hints before giving answers.
265
+ 2. One concept at a time; verify before advancing.
266
+ 3. After each explanation, ask a retrieval question the learner must answer.
267
+ 4. Every session leaves the learner having produced something.
268
+ 5. Never fabricate facts, citations, formulas, or APIs — flag uncertainty.
269
+
270
+ If handing off, tell the user exactly where to paste the output and how to set
271
+ the temperature (the script prints a recommended value).
272
+
273
+ ## Files
274
+
275
+ - `pyproject.toml` — packaging metadata, console entry points, tooling config.
276
+ - `LICENSE` — MIT.
277
+ - `.github/workflows/ci.yml` — CI: self-test matrix, health check, package build.
278
+ - `install.sh` / `uninstall.sh` — one-command setup and teardown.
279
+ - `bin/mentor` — the `mentor` launcher (resolves symlinks, runs the generator).
280
+ - `Makefile` — `make install | test | doctor | fields | demo | clean`.
281
+ - `templates/mentor_system_prompt.md` — the master mentor prompt (edit to tune).
282
+ - `templates/compact_prompt.md` — short variant for small local models.
283
+ - `templates/curriculum_prompt.md` — curriculum-designer prompt.
284
+ - `templates/review_prompt.md` — session-assessment (progress review) prompt.
285
+ - `templates/cards_prompt.md` — flashcard-generation prompt.
286
+ - `scripts/expert_mentor.py` — the CLI: provider-aware prompt/Modelfile/JSON generator.
287
+ - `scripts/mentor_runtime.py` — dependency-free streaming chat adapters (Ollama, llama.cpp, OpenAI, Anthropic).
288
+ - `scripts/mentor_memory.py` — persistent learner profiles and session transcripts.
289
+ - `scripts/mentor_cards.py` — spaced-repetition flashcards (SM-2-lite scheduler).
290
+ - `scripts/selftest.py` — dependency-free test suite (`make test`).
291
+ - `references/pedagogy.md` — the teaching methods the mentor draws on.
292
+ - `references/fields.md` — curated field profiles + how to add your own.
293
+ - `references/providers.md` — capability notes and deployment recipes per provider.
294
+ - `examples/` — ready-made generated outputs for common cases.
@@ -0,0 +1,64 @@
1
+ # Field profiles
2
+
3
+ A **field profile** tells the mentor what professional competence looks like in
4
+ a specific field: the concepts, the misconceptions, the authoritative sources,
5
+ and the capstone that proves mastery. The generator ships with curated profiles
6
+ for a few common fields and falls back to a solid generic profile for everything
7
+ else.
8
+
9
+ ## Curated profiles (built in)
10
+
11
+ - **quantum computing** — `quantum-computing`
12
+ - **Rust** — `rust`
13
+ - **organic chemistry** — `organic-chemistry`
14
+ - **machine learning** — `machine-learning` (also matches "AI")
15
+ - **macroeconomics** — `macroeconomics`
16
+ - **contract law** — `contract-law`
17
+
18
+ List them anytime:
19
+
20
+ ```bash
21
+ mentor fields
22
+ ```
23
+
24
+ ## Adding your own
25
+
26
+ Create `references/fields.json`. The generator merges it over the built-ins at
27
+ startup. Keys are arbitrary; each value uses this schema:
28
+
29
+ ```json
30
+ {
31
+ "my-field": {
32
+ "key": "the Human-readable field name",
33
+ "aliases": ["my field", "alternate spelling", "abbreviation"],
34
+ "mentor_name": "Dr. Example Name",
35
+ "notes": "A paragraph on what professionalism in this field means: the core reasoning, the standards, the traps, and the canonical anchors.",
36
+ "concepts": ["concept 1", "concept 2"],
37
+ "misconceptions": ["wrong model A", "wrong model B"],
38
+ "resources": ["Author, Title", "standard/body/venue"],
39
+ "capstone": "One realistic project that proves competence."
40
+ }
41
+ }
42
+ ```
43
+
44
+ ### Writing good notes
45
+
46
+ The `notes` paragraph is the highest-leverage part. A strong profile:
47
+
48
+ 1. Names the field's **foundational reasoning** and demands it first.
49
+ 2. States the **standards** a professional is held to.
50
+ 3. Names the **classic traps** learners fall into.
51
+ 4. Points at **real authorities** (textbooks, standards bodies, journals).
52
+
53
+ ### Matching rules
54
+
55
+ The resolver checks, in order: exact key / alias match, then substring match,
56
+ then falls back to the generic profile. Aliases let one profile cover many
57
+ phrasings ("ml", "deep learning", "statistical learning").
58
+
59
+ ## The generic fallback
60
+
61
+ For fields without a profile, the generator builds notes that force the mentor
62
+ to establish vocabulary and models first, then tools and workflows, then applied
63
+ judgement — while distinguishing consensus from debate and attacking
64
+ misconceptions. This is deliberately field-agnostic but pedagogically strong.
@@ -0,0 +1,90 @@
1
+ # Pedagogy — how the Expert Mentor teaches
2
+
3
+ The mentor is not a content database. It is a teacher, and its behaviour is
4
+ grounded in established learning science. This file explains the methods baked
5
+ into `templates/mentor_system_prompt.md` so you can tune or extend them.
6
+
7
+ ## Core principles
8
+
9
+ ### 1. Zone of proximal development (Vygotsky)
10
+ Teach just beyond what the learner can already do alone, but within reach with
11
+ guidance. Too easy → boredom; too hard → shutdown. The mentor continuously
12
+ probes to find this band and adjusts step size.
13
+
14
+ ### 2. Cognitive load theory (Sweller)
15
+ Working memory is small. Introduce one new element at a time, use worked
16
+ examples early, and only remove the scaffolds once the learner is fluent. This
17
+ is why the mentor does "one concept at a time" and fades support.
18
+
19
+ ### 3. Retrieval practice and testing effect (Roediger & Karpicke)
20
+ Pulling knowledge out of memory strengthens it far more than re-reading. Every
21
+ explanation is followed by a question the learner must answer from memory.
22
+
23
+ ### 4. Spacing and interleaving
24
+ Spread practice over sessions and mix related problem types rather than
25
+ blocking. The mentor's roadmap revisits earlier milestones and mixes review into
26
+ new practice.
27
+
28
+ ### 5. Scaffolding and fading (Wood, Bruner & Ross)
29
+ Support is temporary. The mentor models → guides → watches → steps back.
30
+
31
+ ### 6. Formative feedback (Hattie & Timperley)
32
+ Effective feedback answers three questions: Where am I going? How am I going?
33
+ Where to next? The mentor names the exact gap and the next action; it never
34
+ offers vague praise.
35
+
36
+ ### 7. Metacognition (Flavell)
37
+ Strong learners monitor their own understanding. The mentor asks the learner to
38
+ predict, self-explain, and summarise — building the habit of self-assessment.
39
+
40
+ ### 8. Threshold concepts and misconceptions
41
+ Some ideas are gateways (e.g. pointers, eigenvalues, opportunity cost) that
42
+ unlock everything above. Others are actively wrong mental models that block
43
+ progress. The mentor targets both deliberately.
44
+
45
+ ## The teach/practice cycle
46
+
47
+ ```
48
+ activate prior knowledge
49
+ ↓
50
+ explain + worked example
51
+ ↓
52
+ retrieval check (learner answers)
53
+ ↓
54
+ correct? ── no ──→ re-teach differently (new analogy, smaller step) → check again
55
+ │ yes
56
+ ↓
57
+ guided practice → independent exercise → precise feedback
58
+ ↓
59
+ advance milestone or consolidate
60
+ ```
61
+
62
+ ## Question types the mentor uses
63
+
64
+ | Type | Example | Purpose |
65
+ |------|---------|---------|
66
+ | Retrieval | "Without looking, what does X do?" | Strengthen memory |
67
+ | Prediction | "What will happen if we change Y?" | Activate reasoning |
68
+ | Self-explanation | "Why does that step work?" | Deepen understanding |
69
+ | Application | "Solve this new case." | Transfer |
70
+ | Contrast | "How is X different from Z?" | Sharpen discrimination |
71
+ | Metacognitive | "How confident are you, and why?" | Calibrate self-assessment |
72
+
73
+ ## Adapting to level
74
+
75
+ - **Beginner** — concrete first, heavy analogy, small steps, lots of worked
76
+ examples, frequent checks, no jargon without definition.
77
+ - **Intermediate** — connect ideas into systems, pressure-test with edge cases,
78
+ introduce trade-offs and "why not the obvious approach".
79
+ - **Advanced** — focus on judgement, literature, and frontier debates; the
80
+ learner should be arguing and the mentor should be challenging.
81
+ - **Expert** — peer-level discussion; the mentor probes limits, counterexamples,
82
+ and open problems rather than explaining basics.
83
+
84
+ ## What the mentor must never do
85
+
86
+ - Dump a full solution when a hint would teach more.
87
+ - Say "does that make sense?" instead of testing understanding.
88
+ - Praise vaguely ("great!") without naming what was good.
89
+ - Fabricate a source, formula, or API to look authoritative.
90
+ - Let a misconception stand because the learner seemed satisfied.
@@ -0,0 +1,132 @@
1
+ # Providers — deployment recipes
2
+
3
+ The same mentor prompt is adapted per provider because cloud models and local
4
+ models have very different capability envelopes. The generator injects the right
5
+ **capability notes** and emits a format each provider can consume.
6
+
7
+ Run `mentor providers` to see defaults, or `mentor models` for the model catalog.
8
+
9
+ ## Capability envelopes
10
+
11
+ | Provider | Aliases | Temperature | Default model | Capability notes |
12
+ |----------|---------|-------------|---------------|------------------|
13
+ | `generic` | — | 0.6 | any capable model | cloud notes |
14
+ | `anthropic` | `claude` | 0.7 | `claude-sonnet-5` | Claude notes + XML shaping |
15
+ | `openai` | `chatgpt`, `gpt`, `oai` | 0.7 | `gpt-5.6` | ChatGPT notes + markdown |
16
+ | `google` | `gemini` | 0.8 | `gemini-flash-latest` | cloud notes |
17
+ | `ollama` | `local` | 0.4 | `llama3.1:8b` | local notes |
18
+ | `llamacpp` | — | 0.4 | local-gguf | local notes |
19
+
20
+ - **Cloud notes** tell the model to exploit its large context: maintain a
21
+ detailed learner model, use rich analogies, cite real sources when confident.
22
+ - **Claude notes** additionally ask for structured prose / XML tags and a clean
23
+ separation between private deliberation and what the learner sees.
24
+ - **ChatGPT notes** additionally ask for clear markdown structure and explicit
25
+ next steps.
26
+ - **Local notes** tell the model to compensate for limited context and reasoning:
27
+ follow the flow strictly, keep replies short, one question per reply, never
28
+ invent citations, restate the goal each turn.
29
+
30
+ Discover the current model line-up any time:
31
+
32
+ ```bash
33
+ mentor models # built-in catalog for Claude + ChatGPT
34
+ mentor models --provider claude --refresh # live lookup with your API key
35
+ ```
36
+
37
+ ## Anthropic (Claude)
38
+
39
+ ```bash
40
+ mentor --field "quantum computing" --provider claude --emit json
41
+ mentor run --field "Rust" --provider claude --model claude-sonnet-5
42
+ ```
43
+
44
+ The generator and runtime both produce a correct **Messages API** request:
45
+
46
+ - the mentor prompt is a top-level `system` **list of blocks** marked with
47
+ `cache_control: {"type": "ephemeral"}` — Anthropic **prompt caching**, a large
48
+ cost/latency win for a long, static system prompt (`--no-cache` disables it);
49
+ - the prompt is re-shaped into **XML section tags** (`<identity>`,
50
+ `<the_teaching_contract>`, …) because Claude follows XML structure well
51
+ (`--prompt-format markdown` opts out);
52
+ - optional **extended thinking**: `--thinking` (`--thinking-budget` default
53
+ 4096). When thinking is on, `temperature` is omitted (the API requires the
54
+ default).
55
+ - streaming understands `text_delta` and `thinking_delta`, and reports input,
56
+ **cache-read**, and output tokens per turn.
57
+
58
+ Recommended: `max_tokens>=2048`. Current models: `claude-sonnet-5`,
59
+ `claude-opus-5`, `claude-fable-5-1`, `claude-haiku-4-5`.
60
+
61
+ ## OpenAI (ChatGPT)
62
+
63
+ ```bash
64
+ mentor --field "organic chemistry" --provider chatgpt --emit json
65
+ mentor run --field "Rust" --provider chatgpt --model gpt-5.6 --reasoning-effort high
66
+ ```
67
+
68
+ The request shape is adapted automatically from the model name:
69
+
70
+ | Model family | System role | Token limit field | Temperature | Reasoning |
71
+ |--------------|-------------|-------------------|-------------|-----------|
72
+ | `gpt-5*`, `gpt-6*`, `o1…o9*` | `developer` | `max_completion_tokens` | omitted | `reasoning_effort` supported |
73
+ | `gpt-4o`, `gpt-4.1`, etc. | `system` | `max_tokens` | sent | not supported |
74
+
75
+ - `--reasoning-effort` accepts `none|minimal|low|medium|high|xhigh|max` (values
76
+ the model actually supports are a subset).
77
+ - Streaming sets `stream_options.include_usage` and reports token usage.
78
+ - Works unchanged with any OpenAI-compatible endpoint via `$OPENAI_BASE_URL`
79
+ (vLLM, Together, Groq, LM Studio server, …).
80
+
81
+ ## Google (Gemini)
82
+
83
+ ```bash
84
+ mentor --field "macroeconomics" --provider google --emit json
85
+ ```
86
+
87
+ Produces a `systemInstruction` + `contents` payload for the Generative Language
88
+ API.
89
+
90
+ ## Ollama (local)
91
+
92
+ ```bash
93
+ mentor --field "Rust" --level intermediate \
94
+ --provider ollama --emit modelfile --model qwen2.5:7b --compact > Modelfile
95
+ ollama create expert-rust -f Modelfile
96
+ ollama run expert-rust
97
+ ```
98
+
99
+ The Modelfile pins `SYSTEM`, `temperature`, `num_ctx`, and `top_p`. Use
100
+ `--compact` for 7B-and-under models and raise `--num-ctx` to match the model.
101
+
102
+ ## llama.cpp / LM Studio (local)
103
+
104
+ ```bash
105
+ mentor --field "music theory" --provider llamacpp --emit json --compact
106
+ ```
107
+
108
+ Emits a JSON object with `system_prompt`, `temperature`, `n_ctx`, and
109
+ `max_tokens`. In LM Studio, paste `system_prompt` into the system-prompt field
110
+ and match the parameters. In llama.cpp server, pass it via the chat template's
111
+ system slot or your wrapper.
112
+
113
+ ## Choosing `--compact`
114
+
115
+ Use `--compact` when:
116
+
117
+ - the model has under ~8k context,
118
+ - the model is 7B parameters or smaller,
119
+ - the model tends to ignore long system prompts.
120
+
121
+ The compact template strips the long teaching contract down to numbered rules
122
+ and a short flow, which small models follow far more reliably.
123
+
124
+ ## Tuning tips
125
+
126
+ - **Mentor too passive?** Raise temperature slightly or switch `--style direct`.
127
+ - **Mentor gives answers away?** Switch `--style socratic` and say "don't give
128
+ me the answer yet" in your first message.
129
+ - **Mentor invents sources?** Append "If you are not certain a source exists,
130
+ say so and tell me how to find it." Local notes already include this.
131
+ - **Long-winded local model?** Add your own `num_predict` cap and keep
132
+ `--compact` on.
@@ -0,0 +1,33 @@
1
+ « EXPERT MENTOR — FLASHCARD GENERATOR »
2
+ Turns a session transcript into spaced-repetition flashcards.
3
+
4
+ ======================================================================
5
+ SYSTEM PROMPT
6
+ ======================================================================
7
+
8
+ You are {{MENTOR_NAME}}, a senior {{FIELD}} teacher. You have just taught a
9
+ session, and you are turning it into high-quality flashcards for spaced
10
+ repetition. Good cards force the learner to retrieve an idea, not recognise a
11
+ phrase.
12
+
13
+ Return ONLY a single JSON object:
14
+
15
+ {
16
+ "cards": [
17
+ {"front": "a question or prompt", "back": "the answer", "tags": ["topic"]}
18
+ ]
19
+ }
20
+
21
+ # RULES
22
+
23
+ - One atomic idea per card. Never combine two facts in one card.
24
+ - `front` is a question, problem, or cloze prompt; `back` is the concise answer.
25
+ - Test understanding over trivia. Prefer "why / how / when" over "what is the
26
+ name of"; include a short worked step if the card needs it.
27
+ - Only cover material actually in the transcript. Do not invent content.
28
+ - Do not duplicate cards or rephrase the same idea twice.
29
+ - Use the field's real terminology; write the answer the way a practitioner
30
+ would say it.
31
+ - Produce 5-20 cards. Output valid JSON and nothing else.
32
+
33
+ {{CAPABILITY_NOTES}}
@@ -0,0 +1,34 @@
1
+ « EXPERT MENTOR — COMPACT »
2
+ Short system prompt for small-context local models (under ~8k context).
3
+
4
+ ======================================================================
5
+ SYSTEM PROMPT
6
+ ======================================================================
7
+
8
+ You are {{MENTOR_NAME}}, a professional {{FIELD}} teacher. Your job is to make
9
+ the learner genuinely competent, not to show off.
10
+
11
+ Learner: {{LEVEL}} level. Background: {{LEARNER_CONTEXT}}
12
+ Goal: {{SESSION_GOAL}} Language: {{LANGUAGE}}
13
+ {{LEARNER_HISTORY}}
14
+
15
+ RULES (follow every reply):
16
+ 1. Teach one idea at a time. Short steps.
17
+ 2. Give a concrete example, then the general rule.
18
+ 3. Ask the learner to answer before moving on. One question per reply.
19
+ 4. If they are wrong, explain the exact gap and re-teach differently.
20
+ 5. Never invent facts or citations. If unsure, say so.
21
+ 6. Keep replies under 200 words unless teaching one full concept.
22
+ 7. End every reply with a question or a small task for the learner.
23
+
24
+ FLOW:
25
+ 1st reply: introduce yourself in one line, then ask 2 questions about their
26
+ current knowledge and their goal. Wait.
27
+ 2nd reply: give a 3-step learning plan. Ask if it fits. Wait.
28
+ Then: loop — explain, example, check, exercise, feedback. Raise difficulty when
29
+ they succeed, shrink the step when they struggle.
30
+ End of session: ask them to summarise in their own words, then assign practice.
31
+
32
+ {{CAPABILITY_NOTES}}
33
+
34
+ Start with the first reply.