eklavya-mcp 1.0.1 → 1.2.0
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.
- package/README.md +3 -1
- package/bin/eklavya-mcp.sh +1 -1
- package/dist/assets/tutor-skill.md +122 -10
- package/dist/cli.js +33 -4
- package/dist/cli.js.map +1 -1
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -1
- package/dist/migrations/004_attempt_outcome.sql +15 -0
- package/dist/migrations/005_session_concept_origin.sql +24 -0
- package/dist/migrations/006_attempt_format.sql +31 -0
- package/dist/store.js +172 -12
- package/dist/store.js.map +1 -1
- package/dist/tools/config_tools.js +18 -1
- package/dist/tools/config_tools.js.map +1 -1
- package/dist/tools/get_session_quiz_plan.js +158 -19
- package/dist/tools/get_session_quiz_plan.js.map +1 -1
- package/dist/tools/log_session_concepts.js +24 -4
- package/dist/tools/log_session_concepts.js.map +1 -1
- package/dist/tools/record_attempt.js +50 -8
- package/dist/tools/record_attempt.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,9 @@ State lives in `~/.eklavya/knowledge.db` (SQLite, WAL). Override with `EKLAVYA_H
|
|
|
34
34
|
```bash
|
|
35
35
|
eklavya doctor # check the install
|
|
36
36
|
eklavya config get
|
|
37
|
-
eklavya config set mode enforced [--repo]
|
|
37
|
+
eklavya config set mode enforced [--repo] # how hard it pushes
|
|
38
|
+
eklavya config set focus concept # what it teaches
|
|
39
|
+
eklavya config set focus learn --topic caching
|
|
38
40
|
eklavya export-rules --out .cursor/rules/eklavya.md
|
|
39
41
|
eklavya db-path
|
|
40
42
|
```
|
package/bin/eklavya-mcp.sh
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# Keep PINNED_VERSION in step with .claude-plugin/plugin.json and
|
|
13
13
|
# mcp/package.json. A test asserts all three match.
|
|
14
14
|
|
|
15
|
-
PINNED_VERSION="1.0
|
|
15
|
+
PINNED_VERSION="1.2.0"
|
|
16
16
|
|
|
17
17
|
MCP_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
|
18
18
|
LOCAL_SERVER="$MCP_DIR/dist/server.js"
|
|
@@ -22,7 +22,7 @@ Each concept needs a `context`: one line naming the actual decision, in the actu
|
|
|
22
22
|
- Good: `"set httpOnly on the refresh cookie in auth.ts:42"`
|
|
23
23
|
- Useless: `"used cookies"`
|
|
24
24
|
|
|
25
|
-
If a concept has no slug yet, just log it — unknown slugs are created. Use kebab-case and check the response: `matched` tells you the concept already existed under a canonical slug, and you should use that slug from then on.
|
|
25
|
+
If a concept has no slug yet, just log it — unknown slugs are created. Use kebab-case and check the response: `matched` tells you the concept already existed under a canonical slug, and you should use that slug from then on; `created` tells you a bare placeholder was made, and you owe it a `upsert_concepts` call (see *Growing the graph*).
|
|
26
26
|
|
|
27
27
|
Never interrupt the implementation to teach. Logging is silent. Teaching happens after the work is done, or when the developer asks.
|
|
28
28
|
|
|
@@ -35,7 +35,9 @@ error, and do not mention hooks or exit codes. Just run the quiz below, then
|
|
|
35
35
|
finish your turn normally.
|
|
36
36
|
|
|
37
37
|
It fires at most once per batch of work, so this is your one chance to teach
|
|
38
|
-
what the task covered. If the developer declines, record
|
|
38
|
+
what the task covered. If the developer declines outright, record it and let it
|
|
39
|
+
go. If they say they do not know, that is not a decline — that is the whole
|
|
40
|
+
reason you are here. Teach it.
|
|
39
41
|
|
|
40
42
|
## Before you teach or quiz
|
|
41
43
|
|
|
@@ -54,9 +56,13 @@ Then call `get_session_quiz_plan`. It returns the concepts worth asking about *a
|
|
|
54
56
|
| `tier_to_ask` | The difficulty to pitch at. This is how a concept gets harder as they get better — not the concept's own tier. |
|
|
55
57
|
| `description` | The canonical one-line meaning of the concept. Anchor the question to *this*, so tier-3 questions stay on the concept instead of drifting into whatever the diff happened to contain. |
|
|
56
58
|
| `context` | The real decision in the real file. This is what makes the question grounded. |
|
|
57
|
-
| `asked_before` | Questions this developer has **already been asked** about this concept, with the tier and
|
|
59
|
+
| `asked_before` | Questions this developer has **already been asked** about this concept, with the tier, grade and `outcome` each got. |
|
|
60
|
+
| `already_taught` | They blanked on this before and you explained it. The next question is a follow-up, not a first encounter. |
|
|
58
61
|
| `prereqs_unmet` | Prerequisites they have not mastered yet. |
|
|
59
62
|
| `last_grade` | How the last attempt went. |
|
|
63
|
+
| `framing` | What this focus requires of the question. Authoritative — see *Focus*. |
|
|
64
|
+
| `format_to_use` | How to put it. Always `mcq` today — four options via `AskUserQuestion`, never a blank prompt. |
|
|
65
|
+
| `bridge_context` | `learn` focus: the session's work touched this topic concept, and here is the code. |
|
|
60
66
|
|
|
61
67
|
If `questions_needed` is 0, say nothing and move on. `reason: "cooldown"` means they were quizzed recently; `reason: "already_covered"` means every candidate was already asked about in this session; `reason: "mode_off"` means Eklavya is dormant.
|
|
62
68
|
|
|
@@ -69,6 +75,7 @@ This is the promise the whole tool rests on, and `asked_before` is how you keep
|
|
|
69
75
|
- **A question in `asked_before` is spent.** Not "reword it" — spent. Ask a different thing about the same concept.
|
|
70
76
|
- If they scored 4 or 5 on it, `tier_to_ask` has already moved up: the new question should be asking for something the old one did not (mechanism → judgement → failure mode).
|
|
71
77
|
- If they scored 1 or 2 on it, come at the *same* level from a different angle. Same tier, different door — a concrete scenario instead of an abstraction, or their own code instead of a hypothetical.
|
|
78
|
+
- If they scored 0 with `outcome: "dont_know"`, you already taught this. Ask the thing your explanation set up, and say so — the question should sound like the second half of a conversation.
|
|
72
79
|
- If `asked_before` is empty, you have a clean slate; use `tier_to_ask` and `description`.
|
|
73
80
|
- `record_attempt` returns `repeat_question: true` if you asked something already on record. Treat it as a mistake you just made, and do not do it again in the same quiz.
|
|
74
81
|
|
|
@@ -86,11 +93,15 @@ The `known` list in the profile is the other half: **never ask about a slug in `
|
|
|
86
93
|
|
|
87
94
|
**One question at a time.** Ask, wait for the answer, grade it, give a tight explanation, then the next. Never post a numbered list of five questions — that is a test, not teaching.
|
|
88
95
|
|
|
96
|
+
**Ask it as multiple choice, using `AskUserQuestion`.** Every plan item carries `format_to_use`, and today it is always `mcq`. This is not decoration — it is the difference between a question that gets answered and one that gets skipped. Someone mid-task will not type a paragraph for a quiz they did not ask for, and their silence is not evidence they did not know. See *Multiple choice* below for how to build one that is worth answering.
|
|
97
|
+
|
|
89
98
|
**Ground every question in the diff you just wrote.** Reference the file, the line, the decision. The concept is abstract; the code in front of them is not.
|
|
90
99
|
|
|
91
100
|
- Grounded: *"I set `httpOnly: true` on the refresh cookie in `auth.ts` but left the access token in memory. What attack is that split defending against, and what does it cost us?"*
|
|
92
101
|
- Textbook, avoid: *"What is an httpOnly cookie?"*
|
|
93
102
|
|
|
103
|
+
**…unless the focus says otherwise.** See *Focus* below. The rule above is `project` focus, which is the default and most of the time. `concept` focus changes what "grounded" means, and getting that wrong in either direction is the most likely way to ask a bad question.
|
|
104
|
+
|
|
94
105
|
**Match the tier.** This is the difference between a quiz that teaches and one that annoys:
|
|
95
106
|
|
|
96
107
|
| Tier | Asks for | Shape |
|
|
@@ -103,33 +114,134 @@ The `known` list in the profile is the other half: **never ask about a slug in `
|
|
|
103
114
|
|
|
104
115
|
Definitions are tier 1 **only**. If you find yourself asking "what is X" at tier 3, you have written a bad question.
|
|
105
116
|
|
|
117
|
+
## Multiple choice
|
|
118
|
+
|
|
119
|
+
Use the **`AskUserQuestion`** tool. One question per call — the tool accepts up to four, but four at once is a test, not teaching.
|
|
120
|
+
|
|
121
|
+
**Shape:**
|
|
122
|
+
|
|
123
|
+
- **Exactly four options.** One correct, three plausible.
|
|
124
|
+
- **`header`**: set it to `unsure→Other` (12 chars, fits). The tool appends an "Other" choice automatically, and that is the escape hatch for *"I don't know"* — but only if they notice it. The chip is on every question and costs no words.
|
|
125
|
+
- **`question`**: the stem, grounded per the plan's `framing`. Do not number the options in the text; the tool renders them.
|
|
126
|
+
- **`description`** on each option: one clause. This is where a near-miss gets to be genuinely tempting.
|
|
127
|
+
- **`preview`**: use it when the options are *code*. Four snippets side by side is a far better question than four sentences describing snippets.
|
|
128
|
+
|
|
129
|
+
**Distractors are the whole question.** Three obviously-wrong options is a free point that teaches nothing and insults them. Each wrong option should be something a competent person could believe:
|
|
130
|
+
|
|
131
|
+
- the right answer to the *adjacent* concept (`SameSite` vs `httpOnly` vs `Secure`)
|
|
132
|
+
- true, but not what was asked
|
|
133
|
+
- the common misconception — the one you would have to correct in a code review
|
|
134
|
+
- right mechanism, wrong direction or wrong actor
|
|
135
|
+
|
|
136
|
+
If you cannot write three that pass that bar, your stem is too vague. Fix the stem, not the options.
|
|
137
|
+
|
|
138
|
+
**Never restate the answer in the stem.** *"What does httpOnly do — does it block JavaScript access?"* is not a question.
|
|
139
|
+
|
|
140
|
+
**Recording it.** `record_attempt` with `format: "mcq"`, `options` as the labels you offered, `answer` as the one they picked, and `question` as the **stem only**. Options belong in `options`, never in `question` — the stem is what gets fingerprinted, so options baked in there would make every reshuffle look like a brand-new question and quietly undo *never the same question twice*.
|
|
141
|
+
|
|
142
|
+
**Grading multiple choice is different, and the server enforces it.** `mcq` caps at **grade 4**. Grade 5 means *correct, and explained why*, and picking an option cannot show that — one in four is a coin. `record_attempt` clamps it and returns `grade_capped: true`; if you see that, you were grading recognition like recall.
|
|
143
|
+
|
|
144
|
+
Within the cap, still grade honestly:
|
|
145
|
+
|
|
146
|
+
| Grade | Means |
|
|
147
|
+
|---|---|
|
|
148
|
+
| 4 | picked the right option |
|
|
149
|
+
| 3 | right option, but their "Other" text or follow-up showed it was a guess |
|
|
150
|
+
| 2 | picked a distractor that is the shape of the idea |
|
|
151
|
+
| 1 | picked a distractor built on a misconception |
|
|
152
|
+
| 0 | "Other" with *I don't know* (`outcome: dont_know` — **teach it**), or a decline (`outcome: declined`) |
|
|
153
|
+
|
|
154
|
+
**If they want to explain, let them, and say so.** Someone who picks "Other" and types a real answer has just given you better evidence than the multiple choice could. Grade that as the free answer it is — `format: "open"`, and the cap does not apply.
|
|
155
|
+
|
|
106
156
|
## Grading
|
|
107
157
|
|
|
108
|
-
Call `record_attempt` for **every** answer, including skips — pass `question` verbatim, because that text is what stops the same question coming back later. Grade honestly on SM-2's 0–5:
|
|
158
|
+
Call `record_attempt` for **every** answer, including blanks and skips — pass `question` verbatim, because that text is what stops the same question coming back later. Pass `outcome` as well: `answered`, `dont_know`, or `declined`. Grade honestly on SM-2's 0–5:
|
|
109
159
|
|
|
110
160
|
| Grade | Means |
|
|
111
161
|
|---|---|
|
|
112
|
-
| 0 |
|
|
162
|
+
| 0 | no answer — either a blank ("I don't know") or a decline. Pass `outcome` to say which |
|
|
113
163
|
| 1 | wrong, and the misconception is load-bearing |
|
|
114
164
|
| 2 | wrong, but the shape of the idea is there |
|
|
115
165
|
| 3 | correct, but hesitant or incomplete — got there slowly |
|
|
116
166
|
| 4 | correct and clean |
|
|
117
167
|
| 5 | correct, and explained *why*, or caught a nuance you didn't ask for |
|
|
118
168
|
|
|
119
|
-
Before you pick a number, state to yourself what in their answer justifies it. A gate built on inflated grades teaches nothing and the developer knows it. Being generous here is not kindness — it is the one failure mode that makes this whole tool pointless.
|
|
169
|
+
For multiple choice the ceiling is 4, and the server enforces it — see *Multiple choice*. Before you pick a number, state to yourself what in their answer justifies it. A gate built on inflated grades teaches nothing and the developer knows it. Being generous here is not kindness — it is the one failure mode that makes this whole tool pointless.
|
|
170
|
+
|
|
171
|
+
Then give feedback. **Four sentences or fewer for a grade of 2 or better** — correct the specific thing they got wrong and stop; don't re-teach a topic they mostly have. A blank is a different job, and has its own section below.
|
|
172
|
+
|
|
173
|
+
If they answer and get it wrong, do not immediately give the answer. Ask one narrower question that isolates the gap. If they miss that too, then teach it as below.
|
|
174
|
+
|
|
175
|
+
## When they say "I don't know"
|
|
176
|
+
|
|
177
|
+
**This is the most important thing in this file.** A blank is not a skip. A skip says *leave me alone*; "I don't know" says *teach me*, and it is the single clearest request for teaching you will ever get. Answering it with a three-sentence correction and moving on is the failure this tool exists to prevent — the developer who understood least got taught least.
|
|
178
|
+
|
|
179
|
+
Both record as grade 0. What separates them is `outcome`, and what you do next.
|
|
180
|
+
|
|
181
|
+
**Teach it. Properly, in this order:**
|
|
120
182
|
|
|
121
|
-
|
|
183
|
+
1. **Name the mechanism** in one sentence — the thing that is actually true, stated plainly.
|
|
184
|
+
2. **Show the code.** Quote the two or three real lines from the diff that make it true. They are looking at a file they have never read; the lines are the whole lesson.
|
|
185
|
+
3. **Say what it generalises to** — the rule they can carry to the next codebase, not just this one.
|
|
186
|
+
4. **One-line takeaway.** What to remember if they forget everything else.
|
|
122
187
|
|
|
123
|
-
|
|
188
|
+
Six to ten sentences. The four-sentence cap above is for near-misses, where you are correcting a detail. Here there is no detail to correct: the topic *is* the gap.
|
|
189
|
+
|
|
190
|
+
**Then record and move on.** `grade: 0`, `outcome: "dont_know"`, and put the explanation you just gave in `feedback`. Do not re-ask the same concept in the same breath — grade 0 pins mastery at the floor, so it resurfaces on its own tomorrow, and `asked_before` will force a *different* question about a concept you have now taught. The spaced re-check is free and it is better than an immediate one, which only tests whether they can repeat a paragraph they just read.
|
|
191
|
+
|
|
192
|
+
**Never offer to stop because they are blanking.** Two blanks in a row is not a hint that they want out — it is evidence you are pitching too high. Drop a tier and keep going. Tier-1 recall on something you have just explained is fair, and it rebuilds footing. If they want to stop, they will say so; wait to be told.
|
|
193
|
+
|
|
194
|
+
**Never dump the remaining answers as a list.** If the quiz ends early, it ends. A wall of four explanations at the door is not teaching, it is a receipt.
|
|
195
|
+
|
|
196
|
+
**When `already_taught` is true** on a plan item, they blanked on this before and you explained it. Open the next question as a follow-up to that explanation — *"last time I showed you that `_work_section()` can return an empty string; so what happens to the nav link when it does?"* — not as a first encounter. Building on a lesson is what makes it stick; asking cold throws it away.
|
|
124
197
|
|
|
125
198
|
## Growing the graph
|
|
126
199
|
|
|
127
|
-
|
|
200
|
+
`log_session_concepts` creates any slug it does not recognise, which is what keeps logging cheap — but it creates it bare: tier 2, domain `general`, no edges. That is a placeholder, not a concept.
|
|
201
|
+
|
|
202
|
+
**When the response reports `created` slugs, follow it with `upsert_concepts`** giving each one a real `domain`, an honest `tier`, and at least one `prerequisite_of` edge to something that already exists. The response says so itself, in `next_action`, naming the slugs — that field exists because this instruction lives in a skill that may never have loaded, and the debt has to reach you either way.
|
|
203
|
+
|
|
204
|
+
This is not tidiness. `prereqs_unmet` is computed from those edges, so a concept with none can never be reported as unfair to ask about, however far out of its depth the learner is. Skip this step and every concept in a new domain arrives as a bare tier-2 node, the fairness check silently passes, and the developer gets mechanism questions about code they have never read. An isolated node teaches nothing about what to learn next, and worse, it tells the planner nothing about what not to ask yet.
|
|
205
|
+
|
|
206
|
+
## Focus
|
|
207
|
+
|
|
208
|
+
Eklavya has two dials and they are not the same thing. **Mode** is how hard to push. **Focus** is what to teach. Every plan returns `focus` and a `framing` line; the framing is authoritative — follow it over your instincts, and over the grounding rule above where they differ.
|
|
209
|
+
|
|
210
|
+
### project (the default)
|
|
211
|
+
|
|
212
|
+
What the sections above describe. The code is the subject. Name the file, the line, the decision.
|
|
213
|
+
|
|
214
|
+
### concept
|
|
215
|
+
|
|
216
|
+
The same subject matter, asked so the answer transfers to a different codebase. **This does not mean textbook questions.** The diff stops being the *subject* and becomes the *motivation*: open from what was just written, then ask for the general rule, the class of problem, or where else it applies.
|
|
217
|
+
|
|
218
|
+
- Right: *"We gave the profile cache a 60s TTL in `profile.ts`. TTL is one answer to cache invalidation — what problem is it actually solving, and what kind of data makes it the wrong answer?"*
|
|
219
|
+
- Wrong, because it is `project` focus wearing a hat: *"Why did we pick 60s rather than 30s here?"* — a fine question, but the answer is about this file and dies with it.
|
|
220
|
+
- Also wrong, and the failure this focus invites: *"What is a TTL?"* That is tier-1 recall. Generalisation is not the same as vagueness, and a definition question is not the general version of anything.
|
|
221
|
+
|
|
222
|
+
The test: **could a correct answer be reused on a different project?** If not, you have written a `project` question. Plan items in this focus arrive with `context: null` on purpose — the code is deliberately withheld so you reach for the idea instead.
|
|
223
|
+
|
|
224
|
+
Items with `reason: "concept_widening"` are prerequisites and domain siblings the task did not touch directly. They are the ideas the diff is an instance of. Ask about them on their own terms.
|
|
225
|
+
|
|
226
|
+
### learn
|
|
227
|
+
|
|
228
|
+
The developer named a topic. Teach that topic, in the prerequisite order the plan gives you, whether or not today's work touches it.
|
|
229
|
+
|
|
230
|
+
- When an item carries **`bridge_context`**, the session's work *did* touch that concept, and that string is the real code. Use it as the worked example — a topic taught through code they watched get written beats a hypothetical every time.
|
|
231
|
+
- When it does not, teach it on its own terms. **Do not force a link to unrelated work.** A strained bridge from a CSS bug to cache invalidation is worse than no bridge; it teaches that the connection is arbitrary.
|
|
232
|
+
|
|
233
|
+
`reason: "no_topic"` means the focus is `learn` but nothing was set — ask what they want to learn and set it before quizzing. `reason: "topic_unknown"` means the graph has nothing matching; offer the closest domain from `get_concept_graph`, or teach from first principles and `upsert_concepts` as you go. Do not invent questions about concepts that do not exist.
|
|
234
|
+
|
|
235
|
+
**Focus never changes when you interrupt.** The Stop hook still fires on real work, and `learn` focus does not license teaching an unrelated topic mid-task. Topic study on demand is `/eklavya:learn`, which the developer asks for.
|
|
128
236
|
|
|
129
237
|
## Mode
|
|
130
238
|
|
|
131
|
-
- **ambient** — offer. If they
|
|
239
|
+
- **ambient** — offer. If they *decline*, record it (grade 0, `outcome: "declined"`) and drop it immediately. Do not ask twice. Do not guilt them. A decline is not the same as "I don't know" — see below.
|
|
132
240
|
- **enforced** — the quiz is required before committing. Say so plainly and once: the gate exists, here is what it needs, let's get through it. Supportive, not punitive. Never imply they are being punished.
|
|
241
|
+
|
|
242
|
+
A blank grades 0, and 0 never passes the gate — so a session answered entirely with "I don't know" would leave nothing to ask and a commit that can never go through. When that happens the plan comes back with `reason: "gate_retry"`: the concepts you just taught, offered again a tier lower, with `already_taught` set and `asked_before` holding the question that produced the blank. **This is a second lap, not a re-ask.** Open it as the follow-up to your own explanation — *"I showed you why the refresh cookie is httpOnly; so which of the two tokens survives an XSS payload?"* — and ask something the first question did not. It is the only route out of the gate, so do not skip past it, and do not treat it as the tool repeating itself.
|
|
243
|
+
|
|
244
|
+
A concept they explicitly **declined** is not offered again. That is deliberate: the gate holding against a decline is enforcement working. If they are stuck behind it, the honest thing to say is that answering the retry questions is the way through, not that the tool is broken.
|
|
133
245
|
- **off** — do nothing at all.
|
|
134
246
|
|
|
135
247
|
## The bar
|
package/dist/cli.js
CHANGED
|
@@ -17,6 +17,8 @@ Usage:
|
|
|
17
17
|
eklavya export-rules [--out <file>] Write the tutor pedagogy as a Cursor rules file
|
|
18
18
|
eklavya config get Show the effective configuration
|
|
19
19
|
eklavya config set <key> <value> Change a setting (add --repo to scope it to this repo)
|
|
20
|
+
e.g. mode ambient|enforced|off, focus project|concept|learn
|
|
21
|
+
add --topic <topic> when setting focus to "learn"
|
|
20
22
|
eklavya doctor Check that everything is wired up
|
|
21
23
|
eklavya db-path Print the database location
|
|
22
24
|
|
|
@@ -76,11 +78,31 @@ function configCommand(args) {
|
|
|
76
78
|
if (!(key in DEFAULT_CONFIG)) {
|
|
77
79
|
fail(`Unknown setting "${key}". Known: ${Object.keys(DEFAULT_CONFIG).join(', ')}`);
|
|
78
80
|
}
|
|
81
|
+
// `focus learn` is useless without a topic, so let one call say both rather
|
|
82
|
+
// than leaving a state that the planner will only refuse later.
|
|
83
|
+
const topicIndex = args.indexOf('--topic');
|
|
84
|
+
const topic = topicIndex === -1 ? undefined : args[topicIndex + 1];
|
|
85
|
+
if (topicIndex !== -1 && !topic)
|
|
86
|
+
fail('--topic needs a value.');
|
|
87
|
+
if (topic !== undefined && key !== 'focus' && key !== 'focus_topic') {
|
|
88
|
+
fail('--topic only applies when setting focus.');
|
|
89
|
+
}
|
|
90
|
+
if (key === 'focus' && value === 'learn' && topic === undefined) {
|
|
91
|
+
fail('focus "learn" needs a topic: eklavya config set focus learn --topic <topic>');
|
|
92
|
+
}
|
|
93
|
+
// A topic is always a string. Number-parsing it would turn a topic like "html5"
|
|
94
|
+
// -- or worse, "2" -- into something `coerce` then silently drops.
|
|
95
|
+
const isTopicKey = key === 'focus_topic';
|
|
79
96
|
let parsed = value;
|
|
80
|
-
if (
|
|
97
|
+
if (isTopicKey)
|
|
98
|
+
parsed = value;
|
|
99
|
+
else if (value === 'true' || value === 'false')
|
|
81
100
|
parsed = value === 'true';
|
|
82
101
|
else if (value !== '' && !Number.isNaN(Number(value)))
|
|
83
102
|
parsed = Number(value);
|
|
103
|
+
const patch = { [key]: parsed };
|
|
104
|
+
if (topic !== undefined && key === 'focus')
|
|
105
|
+
patch.focus_topic = topic;
|
|
84
106
|
let target;
|
|
85
107
|
if (scopeRepo) {
|
|
86
108
|
if (!resolved.repoRoot)
|
|
@@ -90,8 +112,10 @@ function configCommand(args) {
|
|
|
90
112
|
else {
|
|
91
113
|
target = resolved.globalPath;
|
|
92
114
|
}
|
|
93
|
-
writeConfigFile(target,
|
|
94
|
-
|
|
115
|
+
writeConfigFile(target, patch);
|
|
116
|
+
for (const [k, v] of Object.entries(patch)) {
|
|
117
|
+
process.stdout.write(`${k} = ${JSON.stringify(v)} -> ${target}\n`);
|
|
118
|
+
}
|
|
95
119
|
}
|
|
96
120
|
function doctor() {
|
|
97
121
|
const file = dbPath();
|
|
@@ -115,7 +139,12 @@ function doctor() {
|
|
|
115
139
|
lines.push(`database error: ${err instanceof Error ? err.message : String(err)}`);
|
|
116
140
|
}
|
|
117
141
|
const resolved = loadConfig();
|
|
118
|
-
|
|
142
|
+
const fromRepo = resolved.repoPath ? ' (from this repo)' : '';
|
|
143
|
+
lines.push(`mode: ${resolved.config.mode}${fromRepo}`);
|
|
144
|
+
lines.push(`focus: ${resolved.config.focus}${resolved.config.focus === 'learn' ? ` (${resolved.config.focus_topic ?? 'no topic set'})` : ''}${fromRepo}`);
|
|
145
|
+
if (resolved.overrides.length > 0) {
|
|
146
|
+
lines.push(`overridden by repo: ${resolved.overrides.join(', ')}`);
|
|
147
|
+
}
|
|
119
148
|
process.stdout.write(`${lines.join('\n')}\n`);
|
|
120
149
|
if (!ok)
|
|
121
150
|
process.exit(1);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5F,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,KAAK,GAAG
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5F,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,KAAK,GAAG;;;;;;;;;;;;;;CAcb,CAAC;AAEF,SAAS,IAAI,CAAC,OAAe;IAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;IACrC,OAAO,CAAC,IAA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C,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEjD,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,cAAc;YACjB,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;QAC3B,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,MAAM,EAAE,CAAC;QAClB,KAAK,SAAS;YACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC;YACtC,OAAO;QACT,KAAK,SAAS,CAAC;QACf,KAAK,IAAI,CAAC;QACV,KAAK,QAAQ;YACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO;QACT;YACE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -4,6 +4,8 @@ import path from 'node:path';
|
|
|
4
4
|
import { globalConfigPath } from './paths.js';
|
|
5
5
|
export const DEFAULT_CONFIG = {
|
|
6
6
|
mode: 'ambient',
|
|
7
|
+
focus: 'project',
|
|
8
|
+
focus_topic: null,
|
|
7
9
|
pass_threshold: 0.7,
|
|
8
10
|
max_questions_per_task: 4,
|
|
9
11
|
min_minutes_between_quizzes: 20,
|
|
@@ -66,6 +68,14 @@ function coerce(raw, base) {
|
|
|
66
68
|
const out = { ...base };
|
|
67
69
|
if (raw.mode === 'ambient' || raw.mode === 'enforced' || raw.mode === 'off')
|
|
68
70
|
out.mode = raw.mode;
|
|
71
|
+
if (raw.focus === 'project' || raw.focus === 'concept' || raw.focus === 'learn')
|
|
72
|
+
out.focus = raw.focus;
|
|
73
|
+
if (typeof raw.focus_topic === 'string' && raw.focus_topic.trim()) {
|
|
74
|
+
out.focus_topic = raw.focus_topic.trim();
|
|
75
|
+
}
|
|
76
|
+
else if (raw.focus_topic === null) {
|
|
77
|
+
out.focus_topic = null;
|
|
78
|
+
}
|
|
69
79
|
if (typeof raw.pass_threshold === 'number' && raw.pass_threshold >= 0 && raw.pass_threshold <= 1) {
|
|
70
80
|
out.pass_threshold = raw.pass_threshold;
|
|
71
81
|
}
|
|
@@ -97,12 +107,14 @@ export function loadConfig(cwd = process.cwd()) {
|
|
|
97
107
|
const globalRaw = readJson(globalPath) ?? {};
|
|
98
108
|
const repoRaw = repoPath ? (readJson(repoPath) ?? {}) : {};
|
|
99
109
|
const raw = { ...globalRaw, ...repoRaw };
|
|
110
|
+
const overrides = Object.keys(repoRaw).filter((key) => key in globalRaw && JSON.stringify(globalRaw[key]) !== JSON.stringify(repoRaw[key]));
|
|
100
111
|
return {
|
|
101
112
|
config: coerce(raw, DEFAULT_CONFIG),
|
|
102
113
|
raw,
|
|
103
114
|
globalPath,
|
|
104
115
|
repoPath,
|
|
105
116
|
repoRoot,
|
|
117
|
+
overrides,
|
|
106
118
|
};
|
|
107
119
|
}
|
|
108
120
|
/** Writes via temp file + rename: the git hook may be reading mid-write. */
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;A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AAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,KAA8B;IAC1E,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC;IAEzC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,MAAM,GAAG,GAAG,GAAG,IAAI,QAAQ,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEzB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAqB,EAAE,MAAc;IACnE,OAAO,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACzF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- Grade 0 was carrying two opposite meanings: "I don't know, teach me" and
|
|
2
|
+
-- "not now, leave me alone". The tutor skill collapsed them into one row of its
|
|
3
|
+
-- grading table, so a learner asking to be taught was dropped exactly like one
|
|
4
|
+
-- asking to be left alone (observed: four blanks in one session, nothing
|
|
5
|
+
-- taught). SM-2 wants both at 0 -- neither is a recall success -- so the
|
|
6
|
+
-- distinction cannot live in `grade`.
|
|
7
|
+
--
|
|
8
|
+
-- It has to be recorded rather than inferred, because the useful question comes
|
|
9
|
+
-- a day later: "did I already teach this, or has it never been explained?"
|
|
10
|
+
-- `feedback` text cannot answer that reliably.
|
|
11
|
+
--
|
|
12
|
+
-- NULL means "recorded before this column existed"; readers must treat it as
|
|
13
|
+
-- unknown, not as any particular outcome.
|
|
14
|
+
ALTER TABLE attempts ADD COLUMN outcome TEXT
|
|
15
|
+
CHECK (outcome IN ('answered','dont_know','declined'));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- `required` is derived from the concepts the session's *work* touched, but
|
|
2
|
+
-- `passed` was satisfiable by any concept in `session_concepts` -- and
|
|
3
|
+
-- `record_attempt` inserts a row there for anything it is asked about, so that
|
|
4
|
+
-- review debt is not free. The two ends never matched: answering concepts the
|
|
5
|
+
-- planner pulled in from elsewhere raised `passedCount` while leaving `required`
|
|
6
|
+
-- frozen, so a gate whose bar was set by today's diff could be cleared without
|
|
7
|
+
-- answering a single question about today's diff.
|
|
8
|
+
--
|
|
9
|
+
-- Focus modes make that the main path rather than a trickle. `concept` focus
|
|
10
|
+
-- widens selection to domain siblings and prerequisites on purpose, and `learn`
|
|
11
|
+
-- focus selects from a topic that may have nothing to do with the session at
|
|
12
|
+
-- all.
|
|
13
|
+
--
|
|
14
|
+
-- So the origin has to be recorded. 'work' is a concept the implementer logged
|
|
15
|
+
-- as part of the task; 'review' is one the tutor pulled in. Both still record
|
|
16
|
+
-- attempts, update mastery and count as `answered` -- review debt stays real --
|
|
17
|
+
-- but only 'work' can satisfy the bar the work itself set.
|
|
18
|
+
--
|
|
19
|
+
-- NULL means "recorded before this column existed". Those rows are read as
|
|
20
|
+
-- 'work', which is what they were in every case that mattered: before focus
|
|
21
|
+
-- modes there was nothing to widen with except same-domain review, and treating
|
|
22
|
+
-- them as 'review' would retroactively unpass gates that have already passed.
|
|
23
|
+
ALTER TABLE session_concepts ADD COLUMN origin TEXT
|
|
24
|
+
CHECK (origin IN ('work','review'));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
-- A blank prompt is a bad interface for a quiz you did not ask for. Mid-task,
|
|
2
|
+
-- the honest answer to "walk me through what the browser does with this" is
|
|
3
|
+
-- often nothing at all -- not because the learner does not know, but because
|
|
4
|
+
-- typing a paragraph costs more than the question is worth right then.
|
|
5
|
+
-- Recognition is cheap to answer and still teaches, so the default question
|
|
6
|
+
-- shape becomes multiple choice.
|
|
7
|
+
--
|
|
8
|
+
-- Two columns, because the two facts are needed for different reasons:
|
|
9
|
+
--
|
|
10
|
+
-- `format` is what makes the grade readable later. A correct multiple-choice
|
|
11
|
+
-- answer is weaker evidence than a correct free answer -- one in four is a
|
|
12
|
+
-- coin -- so `record_attempt` caps it, and any future rebalancing of mastery
|
|
13
|
+
-- needs to know which attempts were recognition and which were recall. Inferring
|
|
14
|
+
-- it from whether `options` is NULL would work today and break the moment a
|
|
15
|
+
-- format arrives that has no options.
|
|
16
|
+
--
|
|
17
|
+
-- `options` exists so the question text does not have to carry them. Question
|
|
18
|
+
-- fingerprinting (PRD goal 2) hashes `question`, so baking four shuffled options
|
|
19
|
+
-- into that string would make every reshuffle look like a brand-new question and
|
|
20
|
+
-- silently undo "never ask the same question twice". The stem goes in
|
|
21
|
+
-- `question`; the options live here as a JSON array.
|
|
22
|
+
--
|
|
23
|
+
-- NULL `format` means "recorded before this column existed" -- unknown, and in
|
|
24
|
+
-- particular not an assertion that it was free-form.
|
|
25
|
+
--
|
|
26
|
+
-- fill_blank and open are accepted now though nothing writes them yet: the CHECK
|
|
27
|
+
-- is the expensive part to change later, and the next phase adds both.
|
|
28
|
+
ALTER TABLE attempts ADD COLUMN format TEXT
|
|
29
|
+
CHECK (format IN ('mcq','fill_blank','open'));
|
|
30
|
+
|
|
31
|
+
ALTER TABLE attempts ADD COLUMN options TEXT;
|