codewhale.history 2.12.0 → 2.13.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/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ All notable changes to the CodeWhale Tools Pack.
4
4
 
5
5
  ---
6
6
 
7
+ ## [2.13.0] — 2026-07-18
8
+
9
+ ### Added
10
+ - teach-me: Persistent score tracking across sessions. At session start, users can
11
+ opt in to score tracking under a chosen name. Scores are stored per-user in
12
+ `<workspace>/scores-teach-me/<name>.json`. Returning users see a welcome-back
13
+ summary with total rounds, sessions, strengths, weaknesses, and a suggested next
14
+ level. Level defaults to `last_level` for returning users.
15
+
7
16
  ## [2.12.0] — 2026-07-17
8
17
 
9
18
  ### Added
package/README.md CHANGED
@@ -237,6 +237,30 @@ compiles but the path is broken — you find and fix it.
237
237
 
238
238
  **Triggers:** `teach me logic-paths` · `teach me paths` · `teach me flow`
239
239
 
240
+ ### Persistent Score Tracking
241
+
242
+ Scores can now be saved across sessions. At the start of each teach-me session,
243
+ you're asked whether to track your scores. If you say yes, you're prompted for
244
+ a name — scores are stored per-user in `<workspace>/scores-teach-me/<name>.json`.
245
+
246
+ Returning users get a welcome-back summary showing total rounds, sessions,
247
+ strengths, weaknesses, last level played, and a suggested next level.
248
+
249
+ | Scenario | What happens |
250
+ |---|---|
251
+ | User specifies level (`teach me logic-paths level 4`) | Use level 4 |
252
+ | User doesn't specify, first session | Default level 3 (as today) |
253
+ | User doesn't specify, returning user | Use `last_level` from their score file |
254
+ | Suggested next level | Displayed in welcome-back, but user must explicitly change it (`level 4`) |
255
+ | First-ever session, user says yes to tracking | Create fresh file for that name |
256
+ | First-ever session, user says no to tracking | No file, current behaviour |
257
+ | Returning user, says yes this time | Load existing file, show welcome-back summary, append new session at end |
258
+ | Returning user, says no this time | No update written, current behaviour |
259
+ | Name changes mid-session | Not supported — asked only at session start |
260
+ | `scores-teach-me/` doesn't exist | Create directory |
261
+ | File is corrupted JSON | Warn, start fresh for that name |
262
+ | Multiple names (Alice / Bob) | Separate files, separate stats |
263
+
240
264
  ## Want to take this further
241
265
  If you've enjoyed using //teach-me and want to audit your entire specification repository and get a formatted report with readiness scores, band distributions, and ranked improvement recommendations, check out our licensed product //spec-analysis. Contact the developer for more info.
242
266
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codewhale.history",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
4
4
  "license":"AGPL-3.0",
5
5
  "description": "CodeWhale utility commands: session history, tool listing, file snapshot, interactive code quiz — global install",
6
6
  "bin": {
@@ -98,8 +98,9 @@ Modifiers combine freely: `teach me decorators level 4`,
98
98
  `teach me logic-paths`, `teach me logic-paths level 4`,
99
99
  `teach me logic-paths interactive`
100
100
 
101
- If no level is specified, default to **level 3** and adjust based on
102
- performance across rounds.
101
+ If no level is specified, default to **level 3** for new users and adjust based
102
+ on performance across rounds. For returning users with score tracking enabled,
103
+ default to their `last_level` from the score file (see section 1b).
103
104
 
104
105
  ## Session Lifecycle
105
106
 
@@ -118,6 +119,135 @@ E. Report: "Found ~N candidates across M files. Starting at level X. Ready."
118
119
  If the user specified a scope, apply it during discovery. If the user
119
120
  specified a language, filter by extension.
120
121
 
122
+ ### 1b. Identity & Score Tracking
123
+
124
+ After discovery, before presenting the first round, ask about persistent score
125
+ tracking. Score files are stored per-user in `<workspace>/scores-teach-me/<name>.json`.
126
+ The filename IS the identity — no name field inside the JSON.
127
+
128
+ **Prompt flow:**
129
+
130
+ 1. **Ask:** "Track your scores across sessions? (yes / no)"
131
+ 2. **If no:** Proceed to the first round. No file created, no scores saved at session end.
132
+ 3. **If yes:** "What name should I use?"
133
+ 4. **Load or create** `scores-teach-me/<name>.json`:
134
+ - If `scores-teach-me/` doesn't exist: create it (`exec_shell mkdir`).
135
+ - If the file doesn't exist: create a fresh score file (see format below).
136
+ - If the file exists: load it, show the welcome-back summary (see below), then proceed.
137
+ - If the file exists but is corrupted JSON: warn the user, start fresh for that name.
138
+ 5. **Track throughout the session:** In memory, record each round's outcome
139
+ (complete / partial / missed), the files covered, and any strengths/weaknesses
140
+ observed. At session end, append a session record and write the updated file.
141
+
142
+ **Level selection with scores enabled:**
143
+
144
+ | Scenario | What happens |
145
+ |---|---|
146
+ | User specifies level (`teach me logic-paths level 4`) | Use level 4 |
147
+ | User doesn't specify, first session | Default level 3 (as today) |
148
+ | User doesn't specify, returning user | Use `last_level` from their score file |
149
+ | Suggested next level | Displayed in welcome-back, but user must explicitly change it (`level 4`) |
150
+
151
+ **Session tracking scenarios:**
152
+
153
+ | Scenario | What happens |
154
+ |---|---|
155
+ | First-ever session, user says yes to tracking | Create fresh file for that name |
156
+ | First-ever session, user says no to tracking | No file, current behaviour |
157
+ | Returning user, says yes this time | Load existing file, show welcome-back summary, append new session at end |
158
+ | Returning user, says no this time | No update written, current behaviour |
159
+ | Name changes mid-session | Not supported — asked only at session start |
160
+ | `scores-teach-me/` doesn't exist | Create directory |
161
+ | File is corrupted JSON | Warn, start fresh for that name |
162
+ | Multiple names (Alice / Bob) | Separate files, separate stats |
163
+
164
+ **Welcome-back message (returning user):**
165
+
166
+ When a score file is loaded, present the welcome-back summary after the
167
+ discovery report, before the first round:
168
+
169
+ ```
170
+ Welcome back, <name>! 45 rounds across 8 sessions.
171
+ Last: level 3 logic-paths (passive) — 3/5 complete. Suggested next: level 4.
172
+ Strong on: branch tracing, anti-pattern detection.
173
+ Review: async dispatch, edge case coverage.
174
+
175
+ Found ~150 candidates across 12 files. Starting at level 3. Ready.
176
+ ```
177
+
178
+ If the returning user specified a different theme or level in this session's
179
+ trigger, adjust the starting level accordingly but still show the historical
180
+ welcome-back context.
181
+
182
+ **First-session message (new user with tracking):**
183
+
184
+ ```
185
+ Got it, <name>. I'll track your scores in scores-teach-me/<name>.json.
186
+ Found ~150 candidates across 12 files. Starting at level 3. Ready.
187
+ ```
188
+
189
+ **Score file format (`scores-teach-me/<name>.json`):**
190
+
191
+ ```json
192
+ {
193
+ "stats": {
194
+ "total_rounds": 45,
195
+ "total_sessions": 8,
196
+ "last_level": 3,
197
+ "suggested_next_level": 4,
198
+ "themes": {
199
+ "standard": { "rounds": 20, "sessions": 4 },
200
+ "solid": { "rounds": 10, "sessions": 2 },
201
+ "logic-paths": { "rounds": 10, "sessions": 1 },
202
+ "ba-gates": { "rounds": 5, "sessions": 1 }
203
+ },
204
+ "modes": {
205
+ "passive": { "rounds": 35, "sessions": 6 },
206
+ "interactive": { "rounds": 10, "sessions": 2 }
207
+ },
208
+ "strengths": ["branch tracing", "anti-pattern detection"],
209
+ "weaknesses": ["async dispatch", "edge case coverage"],
210
+ "last_session": "2026-07-18"
211
+ },
212
+ "sessions": [
213
+ {
214
+ "date": "2026-07-18",
215
+ "theme": "logic-paths",
216
+ "mode": "passive",
217
+ "level": 3,
218
+ "rounds": 5,
219
+ "complete": 3,
220
+ "partial": 1,
221
+ "missed": 1,
222
+ "suggested_next_level": 4,
223
+ "files_covered": ["services/order_handler.py", "services/inventory.py"],
224
+ "start_point_types": ["pubsub", "test"],
225
+ "strengths": ["direct call chain tracing"],
226
+ "weaknesses": ["conditional branch awareness"]
227
+ }
228
+ ]
229
+ }
230
+ ```
231
+
232
+ **Initial (fresh) score file:**
233
+
234
+ ```json
235
+ {
236
+ "stats": {
237
+ "total_rounds": 0,
238
+ "total_sessions": 0,
239
+ "last_level": 3,
240
+ "suggested_next_level": 3,
241
+ "themes": {},
242
+ "modes": {},
243
+ "strengths": [],
244
+ "weaknesses": [],
245
+ "last_session": null
246
+ },
247
+ "sessions": []
248
+ }
249
+ ```
250
+
121
251
  ### 2. Selection — Pick a Snippet
122
252
 
123
253
  Randomly select a file from the index, then randomly select a function,
@@ -1409,6 +1539,45 @@ Paths to strengthen: Round 2 (missed validation step), Round 4 (missed timeo
1409
1539
  Suggested next level: 3 → 4
1410
1540
  ```
1411
1541
 
1542
+ ### Save Score File
1543
+
1544
+ When the user said yes to tracking at session start, after delivering the
1545
+ end-of-session summary:
1546
+
1547
+ 1. **Build a session record** from the in-memory round outcomes:
1548
+ - `date`: today's date (YYYY-MM-DD)
1549
+ - `theme`: the theme played (standard, solid, spec, ba-gates, logic-paths)
1550
+ - `mode`: passive or interactive
1551
+ - `level`: the level played
1552
+ - `rounds`: total rounds completed
1553
+ - `complete`, `partial`, `missed`: outcome counts
1554
+ - `suggested_next_level`: from the summary
1555
+ - `files_covered`: list of files touched
1556
+ - `start_point_types`: (logic-paths only) list of start-point types used
1557
+ - `strengths`: concepts consistently identified
1558
+ - `weaknesses`: concepts missed across rounds
1559
+
1560
+ 2. **Append** the session record to the `sessions` array.
1561
+
1562
+ 3. **Recalculate stats:**
1563
+ - `total_rounds` += session rounds
1564
+ - `total_sessions` += 1
1565
+ - `last_level`: the level played this session
1566
+ - `suggested_next_level`: from the session summary
1567
+ - `themes.<theme>.rounds` += session rounds
1568
+ - `themes.<theme>.sessions` += 1
1569
+ - `modes.<mode>.rounds` += session rounds
1570
+ - `modes.<mode>.sessions` += 1
1571
+ - `strengths`: merge and deduplicate across sessions
1572
+ - `weaknesses`: merge and deduplicate across sessions
1573
+ - `last_session`: today's date
1574
+
1575
+ 4. **Write** the updated file with `write_file` to `scores-teach-me/<name>.json`.
1576
+
1577
+ 5. **Confirm:** "Scores saved for <name>."
1578
+
1579
+ If the user said no to tracking at session start, skip this step entirely.
1580
+
1412
1581
  ## Multilingual Projects
1413
1582
 
1414
1583
  If the project contains multiple languages, let the user's `teach me <lang>`
@@ -1466,6 +1635,11 @@ criteria for the Mechanics axis:
1466
1635
  - **Logic-paths verification before presentation.** The model MUST walk the full path using live file reads before presenting it — do not rely on discovery-stage analysis. Code may have changed between discovery and the current round.
1467
1636
  - **Logic-paths concurrent safety.** If the project uses multi-threading, multi-processing, or async, clearly explain which parts of the path execute sequentially and which may race or interleave. State the model's assumptions about scheduling.
1468
1637
  - **Logic-paths thinking discipline.** During selection and path verification (before presentation), use Skip thinking — never include the correct path, start/end points, or the bug location in reasoning_content after the round is presented.
1638
+ - **Score tracking opt-in.** Always ask before tracking. Never assume — the user must explicitly say yes and provide a name. If they say no, do not create or write any score file.
1639
+ - **Score file identity.** The filename IS the identity. Do not embed a name field inside the JSON. Name is derived from the filename: `scores-teach-me/<name>.json`.
1640
+ - **Score file location.** Always write to `<workspace>/scores-teach-me/<name>.json`. Never write outside the workspace. Create the `scores-teach-me/` directory if it doesn't exist.
1641
+ - **Score file integrity.** Read the file with `read_file` before appending. If the JSON is corrupted, warn the user and start fresh. Never silently overwrite a valid score file due to a parse error.
1642
+ - **Score file privacy.** The score file contains no PII beyond the user's chosen name. Do not include email addresses, full names, or any other identifying information unless the user explicitly provides it as their name.
1469
1643
 
1470
1644
  ## Verification
1471
1645
 
@@ -1516,3 +1690,18 @@ After each round, confirm:
1516
1690
  - (Logic-paths theme) The full path was revealed on skip or strike-3 with function names in order
1517
1691
  - (Logic-paths theme) Modified files were restored with `git checkout` on round end (or `edit_file` if pre-existing changes)
1518
1692
  - (Logic-paths theme) Thinking suppression was maintained — path, start/end points, and bug locations were not leaked into reasoning after presentation
1693
+ - (Score tracking) User was asked "Track your scores?" before the first round
1694
+ - (Score tracking) If user said yes, they were prompted for a name
1695
+ - (Score tracking) `scores-teach-me/` directory was created if it didn't exist
1696
+ - (Score tracking) Fresh score file was created for new users with correct initial format
1697
+ - (Score tracking) Existing score file was loaded and welcome-back summary shown for returning users
1698
+ - (Score tracking) If user said no, no score file was created or written
1699
+ - (Score tracking) Level defaulted to `last_level` for returning users (unless user overrode)
1700
+ - (Score tracking) Suggested next level was displayed but NOT auto-applied
1701
+ - (Score tracking) Session record was appended to `sessions` array on session end
1702
+ - (Score tracking) Stats were recalculated correctly after appending (totals, themes, modes)
1703
+ - (Score tracking) Strengths and weaknesses were merged and deduplicated across sessions
1704
+ - (Score tracking) Corrupted JSON was detected, user was warned, and a fresh file was created
1705
+ - (Score tracking) Score file was written to `<workspace>/scores-teach-me/<name>.json`
1706
+ - (Score tracking) "Scores saved for <name>" confirmation was shown on session end
1707
+ - (Score tracking) No PII beyond the user's chosen name was stored in the score file