copilot.tools 1.0.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 +255 -0
- package/LICENSE +660 -0
- package/README.md +268 -0
- package/_extract_office.js +175 -0
- package/_list_sessions.js +206 -0
- package/package.json +24 -0
- package/skills/history/SKILL.md +46 -0
- package/skills/snapshot/SKILL.md +74 -0
- package/skills/teach-me/SKILL.md +1188 -0
- package/skills/tools/tools-skill/SKILL.md +38 -0
- package/tools-install.js +104 -0
|
@@ -0,0 +1,1188 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: teach-me
|
|
3
|
+
description: Interactive code-teaching quiz with selectable themes (standard, SOLID, spec-to-code, BA documentation). Triggered by `/teach-me`, `teach me`, `quiz me`, or `test my knowledge`. Supports difficulty levels 1–5 and multiple response modes.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "Optional modifiers: level 1-5, interactive, solid, spec, ba, python, async, etc."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Copyright (C) 2026 Celestial Consulting Ltd
|
|
9
|
+
|
|
10
|
+
This program is free software: you can redistribute it and/or modify
|
|
11
|
+
it under the terms of the GNU Affero General Public License as
|
|
12
|
+
published by the Free Software Foundation, either version 3 of the
|
|
13
|
+
License, or (at your option) any later version.
|
|
14
|
+
|
|
15
|
+
This program is distributed in the hope that it will be useful,
|
|
16
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
GNU Affero General Public License for more details.
|
|
19
|
+
|
|
20
|
+
You should have received a copy of the GNU Affero General Public License
|
|
21
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
22
|
+
|
|
23
|
+
# Teach Me — Interactive Code Quiz
|
|
24
|
+
|
|
25
|
+
An interactive teaching session that randomly selects code snippets or BA documentation fragments from the
|
|
26
|
+
current project. Two independent dimensions combine to form each exercise:
|
|
27
|
+
|
|
28
|
+
**Response mode** (how you answer — mid-session commands `passive` / `interactive`):
|
|
29
|
+
- **`passive`** (default) — You describe your answer in the console.
|
|
30
|
+
- **`interactive`** — You edit the actual file, then say `done` for verification.
|
|
31
|
+
|
|
32
|
+
**Content theme** (what the exercise is about — trigger keywords `solid`, `spec`, `ba`):
|
|
33
|
+
- **Standard** (default) — Code comprehension or line reconstruction.
|
|
34
|
+
- **`solid`** / **`SOLID`** — Anti-pattern detection and design restoration.
|
|
35
|
+
- **`spec`** — Spec-to-code traceability. Exercise shapes alternate randomly:
|
|
36
|
+
spec → code (show a requirement, ask what code implements it) or code → spec
|
|
37
|
+
(show code, ask what requirement it satisfies).
|
|
38
|
+
- **`ba`** / **`ba-gates`** / **`requirements`** — BA documentation quality analysis.
|
|
39
|
+
Scans requirements documents (.docx, .pptx, .xlsx, .md, .feature, .txt) and
|
|
40
|
+
quizzes on three quality gates: ambiguity, acceptance criteria completeness,
|
|
41
|
+
and edge case coverage. Uses two-pass analysis: regex triage then LLM
|
|
42
|
+
interpretation per fragment. On skip, presents concrete improvement options.
|
|
43
|
+
|
|
44
|
+
| Trigger | Response | Theme | What happens |
|
|
45
|
+
|---------|----------|-------|-------------|
|
|
46
|
+
| `teach me` | passive | standard | Present code; you explain what it does and how it works |
|
|
47
|
+
| `teach me interactive` | interactive | standard | Lines removed from file; you restore them, say `done` |
|
|
48
|
+
| `teach me solid` | passive | solid | Code rewritten with anti-patterns; you describe design fixes |
|
|
49
|
+
| `teach me solid interactive` | interactive | solid | Code rewritten with anti-patterns; you edit the file to restore good design, say `done` |
|
|
50
|
+
| `teach me spec` | passive | spec | Present spec or code; you describe the link between them |
|
|
51
|
+
| `teach me spec interactive` | interactive | spec | Spec-to-code traceability; you edit code to satisfy a spec, say `done` |
|
|
52
|
+
| `teach me ba` | passive | ba-gates | Present BA doc fragment; you identify quality gate violations |
|
|
53
|
+
| `teach me ba interactive` | interactive | ba-gates | BA doc with quality issues; you edit the doc to fix them, say `done` |
|
|
54
|
+
|
|
55
|
+
Level, scope, language, and concept modifiers combine freely with any
|
|
56
|
+
combination above.
|
|
57
|
+
|
|
58
|
+
## Session Trigger
|
|
59
|
+
|
|
60
|
+
Activate when the user says any of:
|
|
61
|
+
|
|
62
|
+
- `teach me`
|
|
63
|
+
- `quiz me`
|
|
64
|
+
- `test my knowledge`
|
|
65
|
+
- `code quiz`
|
|
66
|
+
- `drill me`
|
|
67
|
+
- `explain this codebase`
|
|
68
|
+
|
|
69
|
+
Optionally followed by modifiers:
|
|
70
|
+
|
|
71
|
+
- `teach me python` — restrict to a specific language
|
|
72
|
+
- `teach me level 3` / `teach me l3` — set difficulty (1–5)
|
|
73
|
+
- `teach me <file or module>` — narrow scope to a specific file, directory, or module
|
|
74
|
+
- `teach me <concept>` — target a specific language concept. Examples:
|
|
75
|
+
`teach me decorators`, `teach me async`, `teach me generators`,
|
|
76
|
+
`teach me context managers`, `teach me comprehensions`,
|
|
77
|
+
`teach me error handling`, `teach me type hints`, `teach me threading`
|
|
78
|
+
- `teach me interactive` — edit the file (instead of describing)
|
|
79
|
+
- `teach me solid` / `teach me SOLID` — anti-pattern restoration theme
|
|
80
|
+
- `teach me spec` — spec-to-code traceability theme
|
|
81
|
+
- `teach me ba` / `teach me ba-gates` / `teach me requirements` — BA documentation quality analysis theme
|
|
82
|
+
- `quiz me on requirements` / `ba quality check` — alternative ba-gates triggers
|
|
83
|
+
|
|
84
|
+
Modifiers combine freely: `teach me decorators level 4`,
|
|
85
|
+
`teach me async services/`, `teach me generators l2`,
|
|
86
|
+
`teach me level 2 interactive`, `teach me interactive decorators`,
|
|
87
|
+
`teach me solid level 3`, `teach me SOLID`,
|
|
88
|
+
`teach me solid interactive`,
|
|
89
|
+
`teach me spec`, `teach me spec interactive`,
|
|
90
|
+
`teach me ba`, `teach me ba level 3`,
|
|
91
|
+
`teach me ba interactive`, `teach me ba <file>`,
|
|
92
|
+
`teach me requirements level 4`
|
|
93
|
+
|
|
94
|
+
If no level is specified, default to **level 3** and adjust based on
|
|
95
|
+
performance across rounds.
|
|
96
|
+
|
|
97
|
+
## Session Lifecycle
|
|
98
|
+
|
|
99
|
+
### 1. Discovery — Map the Project
|
|
100
|
+
|
|
101
|
+
Before presenting the first snippet:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
A. Use file_search or list_dir to find source directories.
|
|
105
|
+
B. Use grep_files to count function/class definitions per file.
|
|
106
|
+
C. Build a mental index: file path → rough function/class count.
|
|
107
|
+
D. Determine the primary language(s) from file extensions.
|
|
108
|
+
E. Report: "Found ~N candidates across M files. Starting at level X. Ready."
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If the user specified a scope, apply it during discovery. If the user
|
|
112
|
+
specified a language, filter by extension.
|
|
113
|
+
|
|
114
|
+
### 2. Selection — Pick a Snippet
|
|
115
|
+
|
|
116
|
+
Randomly select a file from the index, then randomly select a function,
|
|
117
|
+
method, or logical block from that file. **Re-read the file before each round**
|
|
118
|
+
to ensure the snippet reflects the current on-disk state — the code may have
|
|
119
|
+
changed since the session started. Use these rules:
|
|
120
|
+
|
|
121
|
+
#### Good Snippets (select these)
|
|
122
|
+
- Functions or methods 5–55 lines long (after stripping docstrings and blank lines)
|
|
123
|
+
- Classes with 10–60 lines of method bodies
|
|
124
|
+
- Blocks containing: decorators, comprehensions, generators, context managers,
|
|
125
|
+
async/await, error handling, design patterns, algorithm implementations,
|
|
126
|
+
non-obvious control flow, or domain-specific logic
|
|
127
|
+
- Code that can be understood with at most one level of external context
|
|
128
|
+
|
|
129
|
+
#### Avoid (skip these)
|
|
130
|
+
- Pure getters/setters/properties (single-line `return self._x`)
|
|
131
|
+
- Imports, module-level constants, config dicts, `__init__.py` with only imports
|
|
132
|
+
- Boilerplate: `if __name__ == "__main__"`, argument parsers, logging setup
|
|
133
|
+
- Dunder methods that only delegate
|
|
134
|
+
- Functions shorter than 5 effective lines or longer than 60 lines
|
|
135
|
+
- Code that requires reading 3+ other files to understand
|
|
136
|
+
|
|
137
|
+
#### Difficulty → Line Ranges
|
|
138
|
+
|
|
139
|
+
| Level | Lines | Suitable patterns |
|
|
140
|
+
|-------|--------|-------------------|
|
|
141
|
+
| 1 | 5–15 | Straight-line logic, `if`/`else`, basic function calls |
|
|
142
|
+
| 2 | 8–20 | Loops, list/dict operations, simple `try`/`except` |
|
|
143
|
+
| 3 | 12–30 | Comprehensions, decorators, `with` statements, multiple branches |
|
|
144
|
+
| 4 | 18–45 | Generators, `async`/`await`, descriptors, threading, closures |
|
|
145
|
+
| 5 | 25–55 | Metaclasses, complex async patterns, multi-threading with synchronization, architectural glue code |
|
|
146
|
+
|
|
147
|
+
#### No-repeats rule
|
|
148
|
+
Track which snippets have been shown this session (file + line range).
|
|
149
|
+
Do not repeat a snippet unless the user explicitly asks or all candidates
|
|
150
|
+
are exhausted. Prefer cycling through files before returning to the same
|
|
151
|
+
file.
|
|
152
|
+
|
|
153
|
+
#### Concept Targeting
|
|
154
|
+
|
|
155
|
+
When the user targets a specific concept, filter snippets to ensure they
|
|
156
|
+
contain that concept. After selecting a random candidate, verify it with
|
|
157
|
+
`grep_files` on the file for the concept signal. If the candidate doesn't
|
|
158
|
+
match, pick another random snippet (retry up to 10 times; if still no
|
|
159
|
+
match, relax the filter and note the fallback to the user).
|
|
160
|
+
|
|
161
|
+
| Trigger phrase | Signal to verify in the snippet |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `decorators` | `@` immediately above a `def` line |
|
|
164
|
+
| `async` | `async def` or `await` |
|
|
165
|
+
| `generators` | `yield` |
|
|
166
|
+
| `context managers` | `with` statement or `__enter__`/`__exit__` |
|
|
167
|
+
| `comprehensions` | `for ... in` inside `[`, `{`, or `(` |
|
|
168
|
+
| `error handling` | `try:`, `except`, or `finally` |
|
|
169
|
+
| `type hints` | `:` type annotation in function signatures or variable assignments |
|
|
170
|
+
| `threading` | `Thread(`, `Lock(`, `Queue(`, or `threading.` |
|
|
171
|
+
|
|
172
|
+
### 2b. Interactive (Standard) — Line Reconstruction
|
|
173
|
+
|
|
174
|
+
When response mode is `interactive` (and theme is standard), each round follows
|
|
175
|
+
a different flow from passive explanation. The model removes lines from the
|
|
176
|
+
file and the user restores them.
|
|
177
|
+
|
|
178
|
+
#### Lines Removed by Level
|
|
179
|
+
|
|
180
|
+
| Level | Snippet lines | Lines removed |
|
|
181
|
+
|-------|--------------|---------------|
|
|
182
|
+
| 1 | 5–15 | 1 |
|
|
183
|
+
| 2 | 8–20 | 1–2 |
|
|
184
|
+
| 3 | 12–30 | 1–2 |
|
|
185
|
+
| 4 | 18–45 | 2–3 |
|
|
186
|
+
| 5 | 25–55 | 2–3 |
|
|
187
|
+
|
|
188
|
+
#### Lines to Remove — Selection Heuristic
|
|
189
|
+
|
|
190
|
+
- **Remove:** assignment statements, conditional branches, loop bodies, return
|
|
191
|
+
statements, function calls — lines that carry semantic weight and that
|
|
192
|
+
downstream lines depend on. Removing them should break the function.
|
|
193
|
+
- **Never remove:** imports, blank lines, closing braces/brackets/parens,
|
|
194
|
+
decorator lines, function/class signatures, docstrings, comments.
|
|
195
|
+
- Replace each removed span with a single placeholder comment:
|
|
196
|
+
`# ... N lines removed ...`
|
|
197
|
+
- After removing lines from the file, **save the original lines** in memory for
|
|
198
|
+
later diffing against the user's restoration.
|
|
199
|
+
|
|
200
|
+
#### Interactive Mode Per-Round Flow
|
|
201
|
+
|
|
202
|
+
0. **Snapshot git state.** Run `git status --porcelain <file>` before touching
|
|
203
|
+
it. Note whether the file was clean or already had uncommitted changes.
|
|
204
|
+
1. **Select** a snippet using the standard rules (section 2).
|
|
205
|
+
2. **Save** the original lines in memory.
|
|
206
|
+
3. **Remove** 1–3 lines from the actual file on disk using `edit_file`.
|
|
207
|
+
4. **Present** the gapped snippet with the placeholder and the original line
|
|
208
|
+
numbers.
|
|
209
|
+
5. **Instruct:** "Open `<file>`, restore the missing logic at the gap.
|
|
210
|
+
Say `done` or `check my work` when ready."
|
|
211
|
+
6. **Wait.** Do not evaluate, hint, or proceed until the user signals
|
|
212
|
+
completion.
|
|
213
|
+
7. **Re-read** the file. Diff the user's restored lines against the saved
|
|
214
|
+
original.
|
|
215
|
+
8. **Feedback** (see Interactive Evaluation below). After feedback, restore
|
|
216
|
+
the file with `git checkout -- <file>` for a byte-perfect reset. If the
|
|
217
|
+
file had pre-existing uncommitted changes (from step 0), restore the
|
|
218
|
+
original lines manually via `edit_file` instead and warn the user.
|
|
219
|
+
|
|
220
|
+
#### Thinking Suppression (Interactive Mode)
|
|
221
|
+
|
|
222
|
+
During steps 1–4 (selection through presentation), use **Skip** thinking
|
|
223
|
+
depth — emit no reasoning_content at all. Do not include the selected
|
|
224
|
+
snippet, the original lines, or which lines are being removed. The
|
|
225
|
+
thinking block is visible to the user and spoils the exercise before it
|
|
226
|
+
begins. Resume normal thinking depth at step 5 (after presentation).
|
|
227
|
+
|
|
228
|
+
The `edit_file` diff output is unavoidably visible in the transcript
|
|
229
|
+
(CodeWhale transparency), but thinking control keeps the primary leak
|
|
230
|
+
closed.
|
|
231
|
+
|
|
232
|
+
#### Interactive Mode Presentation Format
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
---
|
|
236
|
+
## Round N — Level X · interactive · concept | `path/to/file.py` (lines A–B)
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
48 risk_amount = capital * (risk_per_trade / 100)
|
|
240
|
+
49 # ... 2 lines removed ...
|
|
241
|
+
50 return max(shares, 0)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
⚠️ **Interactive — Reconstruction.** 2 lines have been removed (originally
|
|
245
|
+
lines 49–50). Open `path/to/file.py`, find the placeholder, and restore the
|
|
246
|
+
missing logic. When you're done, say **`done`** or **`check my work`**.
|
|
247
|
+
|
|
248
|
+
Type `hint` for a clue, `skip` to see the answer, or `stop` to end.
|
|
249
|
+
---
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### 2c. SOLID Theme — Anti-Pattern Reconstruction
|
|
253
|
+
|
|
254
|
+
When content theme is `solid` (or `SOLID`), the model rewrites working code to
|
|
255
|
+
be deliberately anti-pattern-ridden — breaking SOLID principles, DRY, cohesion,
|
|
256
|
+
and abstraction — while keeping the code functional. The user must restore
|
|
257
|
+
good design.
|
|
258
|
+
|
|
259
|
+
SOLID theme works with both response modes:
|
|
260
|
+
- **passive + solid** (`teach me solid`): User describes design fixes in console.
|
|
261
|
+
- **interactive + solid** (`teach me solid interactive`): User edits the file.
|
|
262
|
+
|
|
263
|
+
The per-round flow below covers both; where they differ, both variants are noted.
|
|
264
|
+
|
|
265
|
+
#### Scope by Level
|
|
266
|
+
|
|
267
|
+
| Level | Scope | Anti-patterns introduced |
|
|
268
|
+
|-------|-------|--------------------------|
|
|
269
|
+
| 1 | Single method, 5–15 lines | 2 (e.g., bad naming + duplication) |
|
|
270
|
+
| 2 | Single method, 8–20 lines | 3–4 (add tight coupling, god method creep) |
|
|
271
|
+
| 3 | Method + immediate collaborators, 12–30 lines each | 4–5 across methods (tight coupling, WET, poor cohesion) |
|
|
272
|
+
| 4 | Small class, 18–45 lines of method bodies | 5–6 systemic anti-patterns |
|
|
273
|
+
| 5 | Full class or multiple related classes, 25–55+ lines | Architectural: Singleton abuse, dependency inversion violation, shotgun surgery |
|
|
274
|
+
|
|
275
|
+
#### Anti-Pattern Catalog
|
|
276
|
+
|
|
277
|
+
The model chooses from this catalog when deconstructing code. Select
|
|
278
|
+
anti-patterns appropriate to the language and scope:
|
|
279
|
+
|
|
280
|
+
**STUPID principles (broken SOLID):**
|
|
281
|
+
- **S**ingleton abuse — unnecessary global/static state
|
|
282
|
+
- **T**ight coupling — hardcoded dependencies, `new` inside methods, no DI
|
|
283
|
+
- **U**ntestable — no seams, side effects mixed with logic, `new Date()` inline
|
|
284
|
+
- **P**remature optimization — complex code for imaginary performance needs
|
|
285
|
+
- **I**ndescriptive naming — single-letter vars (`x`, `tmp`, `data`), misleading names
|
|
286
|
+
- **D**uplication — copy-pasted logic blocks, WET (Write Everything Twice)
|
|
287
|
+
|
|
288
|
+
**Broken design principles:**
|
|
289
|
+
- Single Responsibility violation — one function/method does 3+ unrelated things
|
|
290
|
+
- Open/Closed violation — `if isinstance()` chains or giant `switch` for extensibility
|
|
291
|
+
- Interface Segregation violation — fat interfaces with unused methods
|
|
292
|
+
- Dependency Inversion violation — high-level modules depending on low-level details
|
|
293
|
+
- Leaky abstraction — exposing implementation details through the API
|
|
294
|
+
- God object — one class/method that knows and does everything
|
|
295
|
+
- Shotgun surgery — one change requires touching many files/methods
|
|
296
|
+
|
|
297
|
+
#### SOLID Theme Per-Round Flow
|
|
298
|
+
|
|
299
|
+
0. **Snapshot git state.** Run `git status --porcelain <file>` before touching it.
|
|
300
|
+
1. **Select** a snippet using the standard rules (section 2). For levels 3–5,
|
|
301
|
+
read enough context (callers, callees, class definition) to rewrite coherently.
|
|
302
|
+
2. **Save** the original code in memory (full selected scope).
|
|
303
|
+
3. **Deconstruct** the code. Rewrite the file with `write_file` (full file) or
|
|
304
|
+
`edit_file` (targeted) to introduce anti-patterns. The code MUST still
|
|
305
|
+
compile/run and produce the same behavior as the original.
|
|
306
|
+
4. **Present** the deconstructed code. State the scope, the number of
|
|
307
|
+
anti-patterns introduced, but do NOT name or annotate them — the user must
|
|
308
|
+
find them.
|
|
309
|
+
5. **Instruct** (depends on response mode):
|
|
310
|
+
- *Interactive:* "Open `<file>`, fix the [N] anti-patterns. Say `done`."
|
|
311
|
+
- *Passive:* "Describe how you'd improve this code — what anti-patterns do
|
|
312
|
+
you see, and how would you fix them?"
|
|
313
|
+
6. **Wait.** Do not evaluate until the user signals completion (`done` or answer).
|
|
314
|
+
7. **Evaluate** (depends on response mode):
|
|
315
|
+
- *Interactive:* Re-read the file. Compare against saved original.
|
|
316
|
+
- *Passive:* Evaluate the user's description against the anti-patterns
|
|
317
|
+
that were introduced. No file re-read needed.
|
|
318
|
+
8. **Feedback** (see SOLID Evaluation below).
|
|
319
|
+
9. **Restore.** After feedback, `git checkout -- <file>` for a byte-perfect
|
|
320
|
+
reset. If pre-existing uncommitted changes (step 0), warn the user. For
|
|
321
|
+
passive mode, no file was modified by the user, but the deconstructed
|
|
322
|
+
code the model wrote must still be restored.
|
|
323
|
+
|
|
324
|
+
#### Thinking Suppression (SOLID Mode)
|
|
325
|
+
|
|
326
|
+
Same as interactive mode: use **Skip** thinking during steps 1–5 (selection
|
|
327
|
+
through presentation). Resume normal depth at step 6. Never include the
|
|
328
|
+
original code or the specific anti-patterns chosen in your reasoning.
|
|
329
|
+
|
|
330
|
+
#### SOLID Mode Presentation Format
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
---
|
|
334
|
+
## Round N — Level X · passive · solid | `path/to/file.py` (lines A–B)
|
|
335
|
+
|
|
336
|
+
```python
|
|
337
|
+
42 class ReportGenerator:
|
|
338
|
+
43 def process(self, data):
|
|
339
|
+
44 x = data.strip()
|
|
340
|
+
45 # Parse + validate + format all in one method
|
|
341
|
+
46 if ',' in x:
|
|
342
|
+
47 parts = x.split(',')
|
|
343
|
+
48 if len(parts) != 3: return None
|
|
344
|
+
49 result = f"{parts[0].upper()}: {parts[1]} - {parts[2]}"
|
|
345
|
+
50 elif '|' in x:
|
|
346
|
+
51 parts = x.split('|')
|
|
347
|
+
52 if len(parts) != 3: return None
|
|
348
|
+
53 result = f"{parts[0].upper()}: {parts[1]} - {parts[2]}"
|
|
349
|
+
54 else:
|
|
350
|
+
55 return None
|
|
351
|
+
56 # Save + notify all in one place
|
|
352
|
+
57 db = DatabaseConnection() # hardcoded dependency
|
|
353
|
+
58 db.save(result)
|
|
354
|
+
59 EmailSender().send("admin@corp.com", "Report", result)
|
|
355
|
+
60 return result
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
⚠️ **SOLID Mode.** This code still works, but contains ~5 anti-patterns
|
|
359
|
+
(violating SOLID, DRY, and cohesion principles). Open
|
|
360
|
+
`path/to/file.py` and restore good design. When you're done, say
|
|
361
|
+
**`done`** or **`check my work`**.
|
|
362
|
+
|
|
363
|
+
Type `hint` for a clue, `skip` to see the answer, or `stop` to end.
|
|
364
|
+
---
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### 2d. Spec Theme — Spec-to-Code Traceability
|
|
368
|
+
|
|
369
|
+
When content theme is `spec`, the exercise bridges office documents (`.docx`,
|
|
370
|
+
`.pptx`, `.xlsx`) and source code. Each round randomly alternates between two
|
|
371
|
+
exercise shapes.
|
|
372
|
+
|
|
373
|
+
#### Discovery (Spec Theme)
|
|
374
|
+
|
|
375
|
+
In addition to the standard code discovery:
|
|
376
|
+
1. Scan the workspace for `.docx`, `.pptx`, and `.xlsx` files.
|
|
377
|
+
2. Extract text from each using `codewhale-doc-extract <file>` (global bin).
|
|
378
|
+
3. Split extracted text into spec fragments: paragraphs, requirement bullets,
|
|
379
|
+
table rows, slide contents.
|
|
380
|
+
4. Build a combined index: code fragments + spec fragments.
|
|
381
|
+
|
|
382
|
+
#### Exercise Shapes
|
|
383
|
+
|
|
384
|
+
Randomly choose one per round (50/50):
|
|
385
|
+
|
|
386
|
+
**A. Spec → Code** — "Trace forward"
|
|
387
|
+
- Present a spec fragment (a requirement, acceptance criterion, or spec
|
|
388
|
+
paragraph from an office document).
|
|
389
|
+
- Ask: "What code in this project implements this specification?"
|
|
390
|
+
- The user identifies or describes the matching code.
|
|
391
|
+
|
|
392
|
+
**B. Code → Spec** — "Trace backward"
|
|
393
|
+
- Present a code snippet from the project.
|
|
394
|
+
- Ask: "What requirement or specification does this code satisfy?"
|
|
395
|
+
- The user identifies the matching spec from the office documents.
|
|
396
|
+
|
|
397
|
+
The model must verify the link in both directions — does the code actually
|
|
398
|
+
implement the spec, and does the spec actually describe the code?
|
|
399
|
+
|
|
400
|
+
#### Spec Theme Per-Round Flow
|
|
401
|
+
|
|
402
|
+
0. **Snapshot git state.** Run `git status --porcelain` on all source files.
|
|
403
|
+
1. **Pick direction** randomly (A or B). Select a fragment from the
|
|
404
|
+
appropriate index (spec index for A, code index for B).
|
|
405
|
+
2. **Present** the fragment with its source (filename for code, document name
|
|
406
|
+
+ section for specs).
|
|
407
|
+
3. **Instruct** (depends on response mode):
|
|
408
|
+
- *Passive:* "Trace the link. What [code implements this spec / spec does
|
|
409
|
+
this code satisfy]? Describe in detail."
|
|
410
|
+
- *Interactive:* Same prompt, but also: "If the link is broken or missing,
|
|
411
|
+
edit the code to correctly implement the spec. Say `done` when ready."
|
|
412
|
+
For interactive: run `//snapshot on` first if the workspace is NOT a git
|
|
413
|
+
repo.
|
|
414
|
+
4. **Wait.** Do not evaluate until the user signals completion.
|
|
415
|
+
5. **Evaluate** (depends on response mode):
|
|
416
|
+
- *Passive:* Assess the user's trace — did they correctly identify the
|
|
417
|
+
link? Is their reasoning sound?
|
|
418
|
+
- *Interactive:* Re-read the modified files. Compare against the spec.
|
|
419
|
+
Does the code now correctly implement the requirement?
|
|
420
|
+
6. **Feedback** — structure:
|
|
421
|
+
```
|
|
422
|
+
**Trace accuracy:** [Correct / Partially correct / Incorrect]
|
|
423
|
+
**What you got right:** [the link they correctly identified]
|
|
424
|
+
**What you missed:** [missed connections between spec and code]
|
|
425
|
+
```
|
|
426
|
+
7. **Restore** (interactive only). If files were modified: `git checkout -- <file>`.
|
|
427
|
+
If not a git repo, `//snapshot off` to stop backing up.
|
|
428
|
+
|
|
429
|
+
#### Thinking Suppression (Spec Theme)
|
|
430
|
+
|
|
431
|
+
Use **Skip** thinking during selection and presentation (steps 1–3). Resume
|
|
432
|
+
normal depth at step 4. Never reveal the correct trace link in reasoning.
|
|
433
|
+
|
|
434
|
+
#### Spec Theme Presentation Format
|
|
435
|
+
|
|
436
|
+
```
|
|
437
|
+
---
|
|
438
|
+
## Round N — Level X · passive · spec | Spec → Code
|
|
439
|
+
|
|
440
|
+
**From:** `QA Cinemas Requirements.pptx` — Slide 4, "Website Requirements (1)"
|
|
441
|
+
|
|
442
|
+
> The QA Cinemas site needs a home page. The home page shall: Be generally
|
|
443
|
+
> attractive. Be the default for the entire site. Allow site users to navigate
|
|
444
|
+
> to other areas of the site. Have a picture or graphic evocative of the
|
|
445
|
+
> movies or the cinema on it.
|
|
446
|
+
|
|
447
|
+
**Your turn:** (Passive) What code in this project implements the QA Cinemas
|
|
448
|
+
home page requirement? Trace the link — describe which file(s) and how they
|
|
449
|
+
satisfy these criteria.
|
|
450
|
+
|
|
451
|
+
Type `hint` for a clue, `skip` to see the answer, or `stop` to end.
|
|
452
|
+
---
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### 2e. BA-Gates Theme — BA Documentation Quality Analysis
|
|
456
|
+
|
|
457
|
+
When content theme is `ba-gates` (triggered by `teach me ba`, `teach me ba-gates`,
|
|
458
|
+
`teach me requirements`, `quiz me on requirements`, or `ba quality check`), the model
|
|
459
|
+
scans BA documentation across all supported formats and quizzes the user on three
|
|
460
|
+
quality gates: **ambiguity**, **acceptance criteria completeness**, and
|
|
461
|
+
**edge case coverage**. The goal is to surface documentation quality gaps and
|
|
462
|
+
present concrete improvement options.
|
|
463
|
+
|
|
464
|
+
BA-Gates theme supports both response modes:
|
|
465
|
+
- **passive + ba-gates** (`teach me ba`): User describes gate violations in console.
|
|
466
|
+
- **interactive + ba-gates** (`teach me ba interactive`): User edits the document to
|
|
467
|
+
fix the issues, says `done`.
|
|
468
|
+
|
|
469
|
+
#### Discovery (BA-Gates Theme) — Two-Pass Architecture
|
|
470
|
+
|
|
471
|
+
The discovery phase runs two passes: a fast heuristic triage (Pass 1) followed by
|
|
472
|
+
LLM interpretation of flagged fragments (Pass 2 at round time).
|
|
473
|
+
|
|
474
|
+
#### Pass 1: Regex Triage
|
|
475
|
+
|
|
476
|
+
Purpose: narrow the field. Cheap, fast pattern matching to answer "which fragments
|
|
477
|
+
probably have quality issues?" Not an answer — a filter.
|
|
478
|
+
|
|
479
|
+
1. **Scan for BA documents.** Use `file_search` and `list_dir` to find files in the workspace:
|
|
480
|
+
- Office formats: `.docx`, `.pptx`, `.xlsx`
|
|
481
|
+
- Plaintext formats: `.md`, `.feature`, `.txt` (filter to those containing requirements/spec keywords: `feature`, `scenario`, `user story`, `requirement`, `acceptance`, `given`, `when`, `then`, `background`, `example`)
|
|
482
|
+
- Do NOT scan source code files (`.py`, `.js`, `.ts`, `.java`, `.cs`, `.go`, `.rs`, `.c`, `.cpp`, `.h`).
|
|
483
|
+
|
|
484
|
+
2. **Extract text** from office files:
|
|
485
|
+
- Run `codewhale-doc-extract <file>` for `.docx` and `.pptx` files
|
|
486
|
+
- For `.xlsx` files: use `codewhale-doc-extract` to extract table data
|
|
487
|
+
- If extraction fails for any file, note it and skip that file
|
|
488
|
+
|
|
489
|
+
3. **Read plaintext files** directly with `read_file`.
|
|
490
|
+
|
|
491
|
+
4. **Split into fragments:**
|
|
492
|
+
- Feature blocks (Gherkin `Feature:` through the examples table)
|
|
493
|
+
- Scenario blocks (individual `Scenario:` or `Scenario Outline:` sections)
|
|
494
|
+
- Background blocks (`Background:` sections)
|
|
495
|
+
- Requirement paragraphs (standalone lines with "shall", "must", "should", "will")
|
|
496
|
+
- User story blocks (lines matching "As a... I want... So that...")
|
|
497
|
+
- Acceptance criteria lists (bullet points under a story)
|
|
498
|
+
- Example/Data tables (tabular data in `.feature` or `.md` files)
|
|
499
|
+
- Slide content (per-slide extracts from `.pptx`)
|
|
500
|
+
- Spreadsheet row groups (per-sheet or per-section from `.xlsx`)
|
|
501
|
+
|
|
502
|
+
5. **Run the three heuristic gate scans** against each fragment. These are
|
|
503
|
+
pattern-based, not semantic — they catch surface signals only.
|
|
504
|
+
|
|
505
|
+
**Gate 1 — Ambiguity patterns:**
|
|
506
|
+
- Vague qualifiers: `should`, `maybe`, `perhaps`, `generally`, `typically`, `normally`, `usually`, `approximately`, `about`, `roughly`, `ideally`, `preferably`, `optionally`
|
|
507
|
+
- Unmeasurable adjectives: `fast`, `slow`, `good`, `bad`, `intuitive`, `user-friendly`, `robust`, `reliable`, `scalable`, `flexible`, `easy`, `simple`, `clean`, `nice`, `attractive`, `modern`, `efficient`, `powerful`, `seamless`, `smooth`, `responsive`, `high-quality`, `performant`
|
|
508
|
+
- Vague nouns (without specifics): `stuff`, `things`, `data`, `information`, `details`, `content`, `items`, `results`
|
|
509
|
+
- Passive/unattributed states: `is ready`, `is configured`, `is loaded`, `is set up`, `is available`, `is enabled`, `is active`
|
|
510
|
+
- Missing quantifiers: `a list of` without pagination/ordering/format spec, `results` without count or structure, `some`, `several`, `various`
|
|
511
|
+
- Ambiguous connectives: `and/or`, `etc.`, `and so on`, `...`, `such as`
|
|
512
|
+
|
|
513
|
+
**Gate 2 — AC Completeness patterns:**
|
|
514
|
+
- Missing Given/When/Then markers in scenario blocks
|
|
515
|
+
- Unmeasurable outcomes (Then steps with Gate 1 ambiguity terms, or outcomes that restate the story)
|
|
516
|
+
- Blank or empty cells in example tables
|
|
517
|
+
- Example table rows with populated input columns but empty expected-output columns
|
|
518
|
+
- Stories with body text but no AC bullet points
|
|
519
|
+
|
|
520
|
+
**Gate 3 — Edge Case patterns:**
|
|
521
|
+
- Fragment contains only positive-case examples (no error, invalid, or failure scenarios)
|
|
522
|
+
- No examples at value boundaries (zero, empty string, max length, null, negative values)
|
|
523
|
+
- Edge case scenario rows where expected outcomes are blank (acknowledged but unresolved)
|
|
524
|
+
- No examples of: empty input, no results, invalid format, expired state, concurrency, timeout
|
|
525
|
+
|
|
526
|
+
6. **Build the candidate index.** Store for each flagged fragment:
|
|
527
|
+
```
|
|
528
|
+
fragment_id → {
|
|
529
|
+
source: file + line range,
|
|
530
|
+
text: fragment content,
|
|
531
|
+
regex_flags: [which patterns matched and where],
|
|
532
|
+
gate_triggers: [which of the 3 gates fired]
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
Discard fragments with zero gate triggers — they are not quiz candidates.
|
|
536
|
+
|
|
537
|
+
7. Report: "Scanned N BA documents → M fragments. Pass 1 flagged X candidates across Y documents. Starting at level X. Ready."
|
|
538
|
+
|
|
539
|
+
#### Pass 2: LLM Interpretation (at Round Time)
|
|
540
|
+
|
|
541
|
+
Pass 2 runs **per fragment, at the start of each round, before presentation**.
|
|
542
|
+
The regex said "this fragment has a flag." Pass 2 asks: "is this flag meaningful,
|
|
543
|
+
and if so, what's the best way to quiz on it?"
|
|
544
|
+
|
|
545
|
+
This is deep-thinking work. The model must understand the fragment before it can
|
|
546
|
+
teach from it.
|
|
547
|
+
|
|
548
|
+
When a candidate fragment is selected for a round:
|
|
549
|
+
|
|
550
|
+
1. **Read the fragment in context.** Re-read the surrounding file: the full feature,
|
|
551
|
+
adjacent scenarios, the feature title and description. What is this document
|
|
552
|
+
trying to specify? What domain is it in? What would the implementing developer
|
|
553
|
+
need to know?
|
|
554
|
+
|
|
555
|
+
2. **Interpret the regex flags semantically.** For each regex flag:
|
|
556
|
+
- Is this actually a problem, or a false positive? (e.g., "should" in "the user
|
|
557
|
+
should see an error message" is fine — it's an observable outcome. "Should" in
|
|
558
|
+
"the system should be fast" is a problem.)
|
|
559
|
+
- What would a developer be confused by? What would they have to guess?
|
|
560
|
+
- What would they have to go back and ask the BA about?
|
|
561
|
+
- What edge cases are implied by the domain but not stated?
|
|
562
|
+
- What's the **most important gap** — not the most numerous, but the one that
|
|
563
|
+
would cause the most rework or the most ambiguity?
|
|
564
|
+
|
|
565
|
+
3. **Generate the quiz material:**
|
|
566
|
+
|
|
567
|
+
a. **Question** — framed to test whether the BA can see the gap and understand
|
|
568
|
+
why it matters. Not "spot the vague word" but "what's missing that would
|
|
569
|
+
prevent a developer from implementing this deterministically?"
|
|
570
|
+
|
|
571
|
+
b. **Expected answer** — the specific gate(s) violated, the specific fragment
|
|
572
|
+
location, and why it matters to downstream development.
|
|
573
|
+
|
|
574
|
+
c. **Strike-1 hint** — category nudge (name the gate, not the issue).
|
|
575
|
+
|
|
576
|
+
d. **Strike-2 hint** — near-explicit (name the gate AND point to the location,
|
|
577
|
+
hint at the nature of the gap).
|
|
578
|
+
|
|
579
|
+
e. **Improvement options** — 2–3 concrete, domain-specific rewrites of the
|
|
580
|
+
fragment with a "best fit" recommendation. Prefer specific data, concrete
|
|
581
|
+
assertions, and verifiable preconditions over abstract advice.
|
|
582
|
+
|
|
583
|
+
f. **What the developer would trip over** — a one-line summary of the practical
|
|
584
|
+
impact. This is revealed as part of the improvement options, not in the
|
|
585
|
+
question itself.
|
|
586
|
+
|
|
587
|
+
4. **Verify the fragment is quiz-worthy.** If Pass 2 determines all regex flags
|
|
588
|
+
are false positives and there is no meaningful quality gap, discard the
|
|
589
|
+
fragment and select another. Do not fabricate issues.
|
|
590
|
+
|
|
591
|
+
5. **Store the generated material** in memory for evaluation. Do NOT include it
|
|
592
|
+
in reasoning_content from this point forward — switch to Skip thinking before
|
|
593
|
+
presenting to the user.
|
|
594
|
+
|
|
595
|
+
#### Difficulty Levels (BA-Gates)
|
|
596
|
+
|
|
597
|
+
| Level | Fragment scope | What the regex flags | What Pass 2 interprets | What the user must do |
|
|
598
|
+
|-------|---------------|---------------------|----------------------|----------------------|
|
|
599
|
+
| 1 | Single requirement line or story title (1–3 lines) | 1 obvious surface flag | Confirm the flag is real; generate a direct question | Identify the gate and the flagged term |
|
|
600
|
+
| 2 | Single scenario or AC block (3–10 lines) | 1–2 gate triggers | Assess false positives; pick the most meaningful gap | Identify all gate violations and the specific offending terms |
|
|
601
|
+
| 3 | Full feature or story with examples (10–30 lines) | Multiple triggers across at least 2 gates | Distinguish surface flags from structural gaps; identify domain implications | All violations + explain why the most important one matters to development |
|
|
602
|
+
| 4 | Multi-scenario feature or cross-document fragment (20–60 lines) | Cross-cutting patterns | Identify systemic documentation debt; what pattern recurs? | Systemic issues + propose fixes for each gate with rationale |
|
|
603
|
+
| 5 | Full document or multi-document comparison | Architectural documentation debt | Structural weaknesses across the document set; what's the root cause? | Prioritised improvement plan with concrete rewrites across multiple fragments |
|
|
604
|
+
|
|
605
|
+
#### BA-Gates Per-Round Flow
|
|
606
|
+
|
|
607
|
+
0. **Snapshot git state.** Run `git status --porcelain` on BA document files. If the workspace is NOT a git repo, run `//snapshot on` for interactive mode.
|
|
608
|
+
1. **Select** a candidate fragment from the Pass 1 index, weighted by:
|
|
609
|
+
- Prioritize fragments that trigger multiple gates over single-gate fragments
|
|
610
|
+
- Prioritize higher-confidence flags at higher difficulty levels
|
|
611
|
+
- Avoid repeating the same fragment unless all candidates are exhausted
|
|
612
|
+
2. **Run Pass 2 LLM interpretation.** Deep thinking — read context, interpret flags, assess false positives, identify the most important gap, generate quiz material.
|
|
613
|
+
3. **Verify quiz-worthiness.** If Pass 2 finds no meaningful gap, discard and loop to step 1.
|
|
614
|
+
4. **Suppress thinking.** Switch to Skip thinking depth from this point through presentation.
|
|
615
|
+
5. **Present** the fragment with its source, line/cell reference, and a gate-count hint — but do NOT reveal which gates or where.
|
|
616
|
+
6. **Instruct** (depends on response mode):
|
|
617
|
+
- *Passive:* "Which of the three BA quality gates does this fragment trigger — Ambiguity, Acceptance Criteria Completeness, or Edge Case Coverage? Describe what specifically is the problem and how a developer would be affected."
|
|
618
|
+
- *Interactive:* "The document has quality issues flagged by the BA gates. Open `<file>`, find and fix the issues. Say `done` when ready." For interactive with office files (`.docx`, `.pptx`, `.xlsx`), present extracted text inline and ask the user to describe the fix since they cannot edit binaries directly.
|
|
619
|
+
7. **Wait.** Do not evaluate until the user signals completion.
|
|
620
|
+
8. **Evaluate** against the Pass 2 generated answer. Use the three-strikes system with the generated hints.
|
|
621
|
+
9. **Feedback + Improvement Options.** On success, highlight what they got right and what they could sharpen. On skip or strike-3, present the Pass 2 generated improvement options with the "what the developer would trip over" summary.
|
|
622
|
+
10. **Restore** (interactive only for plaintext files). For office files, no restoration needed.
|
|
623
|
+
|
|
624
|
+
#### Thinking Suppression (BA-Gates Theme)
|
|
625
|
+
|
|
626
|
+
- **Pass 2 analysis (step 2):** Use **Deep** or **High** thinking. This is where the model reasons about the fragment and generates quiz material. The thinking block will contain the generated answer — this is acceptable since the user has not yet seen the fragment.
|
|
627
|
+
- **Presentation onward (steps 4–10):** Use **Skip** thinking. Never reveal the specific gates triggered, their locations, or the generated answer in reasoning once the fragment is presented.
|
|
628
|
+
|
|
629
|
+
#### BA-Gates Presentation Format
|
|
630
|
+
|
|
631
|
+
```
|
|
632
|
+
---
|
|
633
|
+
## Round N — Level X · passive · ba-gates | `timesheet.feature.txt` (lines 1–5)
|
|
634
|
+
|
|
635
|
+
**From:** `timesheet.feature.txt` — Background section
|
|
636
|
+
|
|
637
|
+
```gherkin
|
|
638
|
+
Feature: Timesheet Calculations from FitNesse
|
|
639
|
+
Background:
|
|
640
|
+
Given the timesheet system is ready
|
|
641
|
+
And hourly rates are configured
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
⚠️ **BA-Gates Mode.** This fragment triggers one or more BA documentation quality
|
|
645
|
+
gates (Ambiguity, Acceptance Criteria Completeness, or Edge Case Coverage).
|
|
646
|
+
|
|
647
|
+
**Your turn:** (Passive) Which gate(s) does this fragment trigger? Describe
|
|
648
|
+
what specifically is the problem and how a developer would be affected.
|
|
649
|
+
|
|
650
|
+
Type `hint` for a clue, `skip` to see the full analysis and improvement options, or `stop` to end.
|
|
651
|
+
---
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
#### BA-Gates Interactive Presentation Format
|
|
655
|
+
|
|
656
|
+
For plaintext files (`.md`, `.feature`, `.txt`), the model does NOT edit the file — the user edits it:
|
|
657
|
+
|
|
658
|
+
```
|
|
659
|
+
---
|
|
660
|
+
## Round N — Level X · interactive · ba-gates | `qa_cinemas_ac_scenarios.md`
|
|
661
|
+
|
|
662
|
+
**From:** `qa_cinemas_ac_scenarios.md` — Scenario: "Return relevant results for valid keyword searches"
|
|
663
|
+
|
|
664
|
+
```gherkin
|
|
665
|
+
Scenario Outline: Return relevant results for valid keyword searches
|
|
666
|
+
When the user clicks the search box
|
|
667
|
+
Then the placeholder text is removed
|
|
668
|
+
When the user types <keyword> into the search box
|
|
669
|
+
And clicks the Search button
|
|
670
|
+
Then the typed text remains visible in the search box
|
|
671
|
+
And <expected_result>
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
⚠️ **BA-Gates Interactive.** This fragment has quality issues. Open
|
|
675
|
+
`qa_cinemas_ac_scenarios.md`, find and fix the issues. When you're done,
|
|
676
|
+
say **`done`** or **`check my work`**.
|
|
677
|
+
|
|
678
|
+
Type `hint` for a clue, `skip` to see the full analysis, or `stop` to end.
|
|
679
|
+
---
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
For office files (`.docx`, `.pptx`, `.xlsx`), interactive mode presents the extracted text inline and asks the user to describe the fix since they cannot edit the binary directly.
|
|
683
|
+
|
|
684
|
+
#### BA-Gates Evaluation
|
|
685
|
+
|
|
686
|
+
Score across three dimensions aligned to the gates. Use the Pass 2 generated expected answer as the reference:
|
|
687
|
+
|
|
688
|
+
| Dimension | What to check |
|
|
689
|
+
|-----------|--------------|
|
|
690
|
+
| **Ambiguity detection** | Did the user identify vague qualifiers, unmeasurable adjectives, passive/unverifiable states? |
|
|
691
|
+
| **AC completeness** | Did the user spot missing structure, unmeasurable outcomes, blank table cells, circular AC? |
|
|
692
|
+
| **Edge case coverage** | Did the user identify missing negative scenarios, boundary tests, error states, unresolved edge cases? |
|
|
693
|
+
|
|
694
|
+
**Outcome levels:**
|
|
695
|
+
|
|
696
|
+
| Outcome | Criteria | Feedback approach |
|
|
697
|
+
|---------|----------|-------------------|
|
|
698
|
+
| **Complete** | Identified all gate triggers at the current level with specific references | Highlight what they caught + 1–2 things to sharpen |
|
|
699
|
+
| **Partial** | Identified some triggers, or named gates without specifics | Strike-1 or strike-2 nudge toward the missed gate |
|
|
700
|
+
| **Missed** | Did not identify the primary gate trigger(s) | Strike-2 or strike-3 with full improvement options |
|
|
701
|
+
|
|
702
|
+
#### Strikes in BA-Gates Mode
|
|
703
|
+
|
|
704
|
+
Use the Pass 2 generated hints:
|
|
705
|
+
|
|
706
|
+
**Strike 1** — Category nudge (name the gate, not the issue):
|
|
707
|
+
```
|
|
708
|
+
Good effort. Think about Gate 1 (Ambiguity) — are there any terms in this
|
|
709
|
+
fragment that can't be measured, verified, or tested programmatically?
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
**Strike 2** — Near-explicit hint (name the gate AND point to the location):
|
|
713
|
+
```
|
|
714
|
+
You're getting there. Look at "the timesheet system is ready" on line 3.
|
|
715
|
+
This is a passive state — what observable condition would prove readiness?
|
|
716
|
+
Also check line 4 — same pattern.
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
**Strike 3** — Reveal full analysis with improvement options (see below). Move to next round automatically.
|
|
720
|
+
|
|
721
|
+
#### Improvement Options on Skip or Strike-3
|
|
722
|
+
|
|
723
|
+
When the user skips or reaches strike-3, present the Pass 2 generated improvement options. Structure:
|
|
724
|
+
|
|
725
|
+
```
|
|
726
|
+
⚑ Gate 1 — Ambiguity (2 issues)
|
|
727
|
+
|
|
728
|
+
Issue 1: "the timesheet system is ready" (line 3)
|
|
729
|
+
Problem: Passive state — no observable condition. "Ready" is not verifiable.
|
|
730
|
+
Developer impact: A developer writing the test harness can't assert
|
|
731
|
+
"readiness" without guessing what condition to check.
|
|
732
|
+
|
|
733
|
+
→ Option A: "the TimesheetService health endpoint returns HTTP 200"
|
|
734
|
+
→ Option B: "the time_normalizer module is initialised with a valid rate table"
|
|
735
|
+
→ Option C: "the database connection pool reports status 'active'"
|
|
736
|
+
→ Best fit: Option B (directly tests the component under test)
|
|
737
|
+
|
|
738
|
+
Issue 2: "hourly rates are configured" (line 4)
|
|
739
|
+
Problem: Passive state — no verifiable precondition. "Configured" is not testable.
|
|
740
|
+
Developer impact: A developer must either hardcode a rate (fragile) or ask
|
|
741
|
+
the BA what specific rate to use.
|
|
742
|
+
|
|
743
|
+
→ Option A: "a rate of $25.00 exists for employee E001 in the rates table"
|
|
744
|
+
→ Option B: "the /api/rates endpoint returns at least one active rate with amount > 0"
|
|
745
|
+
→ Option C: "the rates configuration file contains at least one entry with key 'default_rate'"
|
|
746
|
+
→ Best fit: Option A (concrete data, directly usable in the test)
|
|
747
|
+
|
|
748
|
+
💡 Pattern: Replace Background preconditions with programmatically verifiable
|
|
749
|
+
states. Every Given step should map to an assertion that can pass or fail
|
|
750
|
+
deterministically in the test harness.
|
|
751
|
+
---
|
|
752
|
+
|
|
753
|
+
⚑ Gate 2 — Acceptance Criteria Completeness (1 issue)
|
|
754
|
+
|
|
755
|
+
Issue: Both Background steps lack verifiable structure — they are preconditions
|
|
756
|
+
but cannot be asserted against.
|
|
757
|
+
Developer impact: The test setup phase has no concrete fixture to build.
|
|
758
|
+
|
|
759
|
+
→ Improve: Rewrite as:
|
|
760
|
+
Given the TimeNormaliser service is running on localhost:8080
|
|
761
|
+
And the rates table contains {"E001": 25.00, "E002": 18.50}
|
|
762
|
+
And the time_normalizer module reports status "ready"
|
|
763
|
+
|
|
764
|
+
💡 Pattern: Background steps create the test fixture. Every step should
|
|
765
|
+
create a specific, named piece of state that subsequent steps can reference.
|
|
766
|
+
---
|
|
767
|
+
|
|
768
|
+
⚑ Gate 3 — Edge Case Coverage (1 issue)
|
|
769
|
+
|
|
770
|
+
Issue: Background section defines no edge cases for system state.
|
|
771
|
+
What happens if the system is NOT ready? If rates are NOT configured?
|
|
772
|
+
Developer impact: Error paths are undefined — a developer must guess what
|
|
773
|
+
error to return for each failure state.
|
|
774
|
+
|
|
775
|
+
→ Improve: Add an edge-case scenario:
|
|
776
|
+
Scenario: Timesheet calculation fails when system is not ready
|
|
777
|
+
Given the timesheet system reports status "degraded"
|
|
778
|
+
When an employee attempts to check in at 09:00 AM
|
|
779
|
+
Then the system returns error "SYSTEM_NOT_READY"
|
|
780
|
+
And no hours are recorded
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
The improvement options MUST be concrete and domain-specific. Prefer specific data values, concrete assertions, and verifiable preconditions over abstract advice. For each issue, present 2–3 options with a "best fit" recommendation.
|
|
784
|
+
|
|
785
|
+
---
|
|
786
|
+
|
|
787
|
+
### 3. Presentation — Show the Snippet
|
|
788
|
+
|
|
789
|
+
For each round, present the snippet with its filename:
|
|
790
|
+
|
|
791
|
+
```
|
|
792
|
+
---
|
|
793
|
+
## Round N — Level X · [passive|interactive] · [concept|solid|spec|ba-gates] | `path/to/file.py` (lines A–B)
|
|
794
|
+
|
|
795
|
+
```python
|
|
796
|
+
42 def calculate_position_size(
|
|
797
|
+
43 capital: float,
|
|
798
|
+
44 risk_per_trade: float,
|
|
799
|
+
45 entry_price: float,
|
|
800
|
+
46 stop_loss: float
|
|
801
|
+
47 ) -> int:
|
|
802
|
+
48 risk_amount = capital * (risk_per_trade / 100)
|
|
803
|
+
49 price_risk = abs(entry_price - stop_loss)
|
|
804
|
+
50 if price_risk == 0:
|
|
805
|
+
51 return 0
|
|
806
|
+
52 shares = int(risk_amount / price_risk)
|
|
807
|
+
53 return max(shares, 0)
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
**Your turn:** (Passive mode) Explain what this code does (application logic)
|
|
811
|
+
AND how it works (syntax and semantics). Include any edge cases you notice.
|
|
812
|
+
|
|
813
|
+
Type `hint` for a clue, `skip` to see the answer, or `stop` to end.
|
|
814
|
+
---
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
Guidelines:
|
|
818
|
+
- Include realistic line numbers (1-based from the actual file)
|
|
819
|
+
- Strip only excessive blank lines; keep natural spacing
|
|
820
|
+
- Show the function/class signature with its decorators
|
|
821
|
+
- Show the filename and line range in the header
|
|
822
|
+
- The response mode tag (`· passive` or `· interactive`) always appears in the header
|
|
823
|
+
- The theme/concept tag (`· solid` for SOLID theme, `· spec` for spec theme, `· ba-gates` for BA-Gates theme, or `· decorators` etc. for targeted concept) appears when applicable; omit during free-play standard rounds
|
|
824
|
+
- If the snippet depends on one obvious external type or constant, include a
|
|
825
|
+
brief inline note
|
|
826
|
+
- **Before presenting, scan for secrets.** Redact API keys, tokens, passwords,
|
|
827
|
+
connection strings with `[REDACTED]`. Skip snippets that are entirely
|
|
828
|
+
secrets or contain PII/email addresses/personal identifiers.
|
|
829
|
+
|
|
830
|
+
### 4. Evaluation — Assess the Answer
|
|
831
|
+
|
|
832
|
+
Evaluate across two dimensions, scaled to the current difficulty level.
|
|
833
|
+
|
|
834
|
+
#### A. Application Logic (what the code does in the project)
|
|
835
|
+
|
|
836
|
+
| Level | Expectation |
|
|
837
|
+
|-------|-------------|
|
|
838
|
+
| 1 | Names what the function does at a basic level |
|
|
839
|
+
| 2 | Identifies inputs, outputs, and at least one edge case |
|
|
840
|
+
| 3 | Explains the module role, failure modes, and upstream/downstream connections |
|
|
841
|
+
| 4 | Identifies the design pattern, multi-component interaction, and concurrency edge cases |
|
|
842
|
+
| 5 | Explains architectural role across system layers, performance implications, and subtle bugs or limitations |
|
|
843
|
+
|
|
844
|
+
#### B. Language Mechanics (syntax and semantics)
|
|
845
|
+
|
|
846
|
+
| Level | Expectation |
|
|
847
|
+
|-------|-------------|
|
|
848
|
+
| 1 | Basic types, function definition syntax, simple `if`/`else` |
|
|
849
|
+
| 2 | Loop mechanics, list/dict operations, basic `try`/`except`, string formatting |
|
|
850
|
+
| 3 | Comprehensions, decorator syntax and effect, `with` / context managers, type hints, exception chaining |
|
|
851
|
+
| 4 | Generator mechanics (`yield`), `async`/`await` internals, descriptor protocol, closures, threading primitives |
|
|
852
|
+
| 5 | Coroutine internals, metaclass programming, GIL implications, memory model, `__slots__`, MRO, weak references |
|
|
853
|
+
|
|
854
|
+
#### C. Interactive Mode Evaluation
|
|
855
|
+
|
|
856
|
+
When mode is `interactive`, evaluation is a diff between the user's restored
|
|
857
|
+
lines and the saved original:
|
|
858
|
+
|
|
859
|
+
| Outcome | Criteria | Feedback |
|
|
860
|
+
|---------|----------|----------|
|
|
861
|
+
| **Exact match** | Lines match character-for-character | ✅ Perfect. Note what the lines do and why they matter. |
|
|
862
|
+
| **Semantic match** | Same logic, different variable names or formatting | ✅ Good — logic is correct. Note the stylistic difference. |
|
|
863
|
+
| **Partial match** | Some lines correct, some missing/wrong | Point out which line(s) are correct and which need work. Treat as strike 1 or 2 depending on how much is missing. |
|
|
864
|
+
| **No match** | Lines are absent or entirely wrong | Strike-1 nudge toward the missing logic. |
|
|
865
|
+
|
|
866
|
+
Do not use the standard three-strikes verbal pipeline for interactive mode.
|
|
867
|
+
Instead, use targeted hints about what the missing lines should compute:
|
|
868
|
+
|
|
869
|
+
**Strike 1** — Category nudge:
|
|
870
|
+
```
|
|
871
|
+
Not quite. Think about what calculation happens between [visible line above
|
|
872
|
+
the gap] and [visible line below the gap].
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
**Strike 2** — Near-explicit hint:
|
|
876
|
+
```
|
|
877
|
+
You need to [specific operation — e.g., "divide risk_amount by price_risk
|
|
878
|
+
and guard against division by zero"].
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
**Strike 3** — Reveal the original lines and move to the next round:
|
|
882
|
+
```
|
|
883
|
+
Here's what was removed:
|
|
884
|
+
```python
|
|
885
|
+
49 price_risk = abs(entry_price - stop_loss)
|
|
886
|
+
50 if price_risk == 0:
|
|
887
|
+
51 return 0
|
|
888
|
+
52 shares = int(risk_amount / price_risk)
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
After strike 3, restore the original lines in the file and proceed to the
|
|
892
|
+
next round automatically (no "another round?" prompt).
|
|
893
|
+
|
|
894
|
+
#### D. SOLID Mode Evaluation
|
|
895
|
+
|
|
896
|
+
When mode is `solid`, evaluation compares the user's restored design against
|
|
897
|
+
the saved original and the anti-patterns that were introduced. Score across
|
|
898
|
+
these dimensions:
|
|
899
|
+
|
|
900
|
+
| Dimension | What to check |
|
|
901
|
+
|-----------|--------------|
|
|
902
|
+
| **Anti-patterns fixed** | How many of the N introduced anti-patterns did the user address? |
|
|
903
|
+
| **Design quality** | Does the restored code follow SOLID, DRY, and cohesion principles at least as well as the original? |
|
|
904
|
+
| **Functional correctness** | Does the code still work? Same inputs → same outputs? |
|
|
905
|
+
| **Intentionality** | Did the user identify WHY each anti-pattern was wrong, or just guess? |
|
|
906
|
+
|
|
907
|
+
Feedback structure:
|
|
908
|
+
|
|
909
|
+
```
|
|
910
|
+
**Anti-patterns addressed:** [N/M] — [list which ones and how]
|
|
911
|
+
|
|
912
|
+
**What you improved:**
|
|
913
|
+
- [specific anti-pattern they fixed well]
|
|
914
|
+
|
|
915
|
+
**What you missed:**
|
|
916
|
+
- [anti-patterns still present or not fully addressed]
|
|
917
|
+
|
|
918
|
+
**Comparison to original:**
|
|
919
|
+
[How their solution compares to the original — is it equivalent, better, or
|
|
920
|
+
does it introduce new issues?]
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
**Strikes in SOLID mode:**
|
|
924
|
+
|
|
925
|
+
**Strike 1** — Category nudge (name the principle, not the fix):
|
|
926
|
+
```
|
|
927
|
+
Good effort. Think about [principle — e.g., "Single Responsibility"] —
|
|
928
|
+
does this method do too many different things?
|
|
929
|
+
```
|
|
930
|
+
|
|
931
|
+
**Strike 2** — Near-explicit hint (name the anti-pattern):
|
|
932
|
+
```
|
|
933
|
+
You're close. Look at the duplication between lines 46-49 and 50-53. That's
|
|
934
|
+
WET code — both branches do the same parsing. Also, `DatabaseConnection()`
|
|
935
|
+
on line 57 creates tight coupling.
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
**Strike 3** — Reveal the original code and move to the next round:
|
|
939
|
+
```
|
|
940
|
+
Here's the original design. Compare it with yours to see what was improved.
|
|
941
|
+
```
|
|
942
|
+
Then restore with `git checkout -- <file>` and proceed automatically.
|
|
943
|
+
|
|
944
|
+
#### E. BA-Gates Mode Evaluation
|
|
945
|
+
|
|
946
|
+
When theme is `ba-gates`, evaluate the user's ability to identify and diagnose
|
|
947
|
+
documentation quality issues against the Pass 2 generated expected answer:
|
|
948
|
+
|
|
949
|
+
| Outcome | Criteria | Feedback approach |
|
|
950
|
+
|---------|----------|-------------------|
|
|
951
|
+
| **Complete** | Identified all gate triggers at the current level with specific line/cell references | Highlight what they caught + 1–2 things to sharpen |
|
|
952
|
+
| **Partial** | Identified some triggers, or named gates without specifics | Strike-1 or strike-2 nudge toward the missed gate |
|
|
953
|
+
| **Missed** | Did not identify the primary gate trigger(s) | Strike-2 or strike-3 with full improvement options |
|
|
954
|
+
|
|
955
|
+
See section 2e (BA-Gates Theme) for the full strike system and improvement options format.
|
|
956
|
+
|
|
957
|
+
#### Weighted Evaluation for Targeted Concepts
|
|
958
|
+
|
|
959
|
+
When a concept is targeted (e.g., `teach me decorators`), bias the
|
|
960
|
+
evaluation toward that concept:
|
|
961
|
+
|
|
962
|
+
- **Mechanics axis:** The targeted concept carries extra weight. Missing
|
|
963
|
+
it is a significant gap even if other mechanics are handled well.
|
|
964
|
+
- **Strike hints:** Always steer strike 1 toward the targeted concept
|
|
965
|
+
before hinting about any other missed item.
|
|
966
|
+
- **Feedback ordering:** List the targeted concept first under "What you
|
|
967
|
+
missed" or "What you could sharpen."
|
|
968
|
+
- **Success bar:** To "meet expectations," the user must correctly
|
|
969
|
+
explain the targeted concept at the current level's depth.
|
|
970
|
+
|
|
971
|
+
#### The Three-Strikes Rule
|
|
972
|
+
|
|
973
|
+
If the user's answer does **not** meet the expectations for the current
|
|
974
|
+
difficulty level:
|
|
975
|
+
|
|
976
|
+
**Strike 1** — Give a category-level nudge:
|
|
977
|
+
```
|
|
978
|
+
Good start, but at Level N I'd expect you to also notice [category — e.g.,
|
|
979
|
+
"how errors are handled" or "what the decorator is doing"]. Try again —
|
|
980
|
+
what about [specific nudge — e.g., "the return type on line 47"]?
|
|
981
|
+
```
|
|
982
|
+
|
|
983
|
+
**Strike 2** — Give a near-explicit hint:
|
|
984
|
+
```
|
|
985
|
+
Getting closer. One more thing — [nearly names the concept — e.g., "that
|
|
986
|
+
@retry decorator wraps the function"]. Look at line X.
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
**Strike 3** — Reveal the full answer and move on:
|
|
990
|
+
```
|
|
991
|
+
Let me walk you through it.
|
|
992
|
+
```
|
|
993
|
+
Then deliver the complete evaluation (both axes) as if they had skipped.
|
|
994
|
+
After the evaluation, proceed directly to the next round — do not ask
|
|
995
|
+
"another round?" after a strike-3 reveal; just present the next snippet.
|
|
996
|
+
|
|
997
|
+
If the user gets it on attempt 2 or 3:
|
|
998
|
+
```
|
|
999
|
+
There you go! Now let me fill in what else is notable.
|
|
1000
|
+
```
|
|
1001
|
+
Then provide the remaining feedback they missed, and ask "Another round?".
|
|
1002
|
+
|
|
1003
|
+
If the user's answer **meets** expectations (any attempt):
|
|
1004
|
+
- Highlight 2–4 specific things they got right
|
|
1005
|
+
- Add 1–3 things they could sharpen (even a strong answer has nuance)
|
|
1006
|
+
- Reveal the file context
|
|
1007
|
+
- Ask "Another round?"
|
|
1008
|
+
|
|
1009
|
+
#### Feedback structure (success or strike-3 — standard/spec modes)
|
|
1010
|
+
|
|
1011
|
+
```
|
|
1012
|
+
**What you got right:**
|
|
1013
|
+
- [2–4 specific things correctly identified]
|
|
1014
|
+
|
|
1015
|
+
**What you missed or could sharpen:**
|
|
1016
|
+
- [1–3 things, with brief explanation]
|
|
1017
|
+
|
|
1018
|
+
**Context:** `services/position_sizer.py` — called by the OrderManager before
|
|
1019
|
+
placing any trade. Sits between the signal generator and the exchange adapter.
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
Keep feedback constructive. The goal is learning, not grading. If they
|
|
1023
|
+
nailed everything at-level, say so and highlight the nuance they caught.
|
|
1024
|
+
|
|
1025
|
+
### CONTINUE THE SESSION
|
|
1026
|
+
|
|
1027
|
+
**After every single round — success, skip, next, or strike-3 — you MUST
|
|
1028
|
+
either ask "Another round?" or present the next question automatically.
|
|
1029
|
+
Never deliver feedback and then stop. The session only ends when the user
|
|
1030
|
+
explicitly says `stop`.**
|
|
1031
|
+
|
|
1032
|
+
- Success / `next` / `another` → ask: "Another round? (yes / no / level N / ...)"
|
|
1033
|
+
- Strike-3 / `skip` / `reveal` → auto-advance: present the next round header immediately
|
|
1034
|
+
- `stop` / `end` → deliver the end-of-session summary
|
|
1035
|
+
|
|
1036
|
+
#### Handling commands mid-round
|
|
1037
|
+
|
|
1038
|
+
| Command | Behavior |
|
|
1039
|
+
|---------|----------|
|
|
1040
|
+
| `hint` | Give one strike-1 level nudge (counts as an attempt in the strike system) |
|
|
1041
|
+
| `skip` / `reveal` | Show full evaluation immediately, then present next round without asking. |
|
|
1042
|
+
| `next` / `another` | Skip this snippet, draw a new one. No strike counted. |
|
|
1043
|
+
| `level N` / `lN` (e.g. `level 5`, `l2`) | Adjust difficulty for subsequent rounds. |
|
|
1044
|
+
| `easier` | Decrease level by 1 (minimum 1). |
|
|
1045
|
+
| `harder` | Increase level by 1 (maximum 5). |
|
|
1046
|
+
| `interactive` | Switch to interactive (reconstruction) mode for subsequent rounds. |
|
|
1047
|
+
| `passive` | Switch to passive (explanation) mode for subsequent rounds. |
|
|
1048
|
+
| `solid` / `SOLID` | Switch to SOLID (anti-pattern reconstruction) theme for subsequent rounds. |
|
|
1049
|
+
| `spec` | Switch to spec (spec-to-code traceability) theme for subsequent rounds. |
|
|
1050
|
+
| `ba` / `ba-gates` / `requirements` | Switch to BA-Gates (BA documentation quality) theme for subsequent rounds. |
|
|
1051
|
+
| `done` / `check my work` | (Interactive/SOLID/Spec/BA-Gates mode) Signal that work is complete. Triggers verification. |
|
|
1052
|
+
| `stop` / `end` | End session. Deliver summary. |
|
|
1053
|
+
|
|
1054
|
+
### 5. Loop — Keep Going
|
|
1055
|
+
|
|
1056
|
+
After a successful evaluation or a `next` skip, ask:
|
|
1057
|
+
"Another round? (yes / no / level N / interactive / passive / solid / spec / ba / stop)"
|
|
1058
|
+
|
|
1059
|
+
After a strike-3 reveal, do **not** ask — proceed directly to the next
|
|
1060
|
+
round with:
|
|
1061
|
+
"Round N+1 — Level X · [mode] | `file.py`"
|
|
1062
|
+
|
|
1063
|
+
### End-of-Session Summary
|
|
1064
|
+
|
|
1065
|
+
When the user says `stop`:
|
|
1066
|
+
|
|
1067
|
+
```
|
|
1068
|
+
## Session Summary
|
|
1069
|
+
|
|
1070
|
+
Rounds completed: 5
|
|
1071
|
+
Level played: 3 · Mode: passive
|
|
1072
|
+
Files covered:
|
|
1073
|
+
- services/position_sizer.py (rounds 1, 4)
|
|
1074
|
+
- agents/news_agent.py (round 2)
|
|
1075
|
+
- utils/fuzzy_dedup.py (round 3)
|
|
1076
|
+
- database.py (round 5)
|
|
1077
|
+
|
|
1078
|
+
What you're strong on: [concepts consistently identified]
|
|
1079
|
+
What to review: [concepts missed across multiple rounds]
|
|
1080
|
+
Suggested next level: [3 → 4, or stay, or 3 → 2]
|
|
1081
|
+
```
|
|
1082
|
+
|
|
1083
|
+
For BA-Gates sessions, the summary covers documents and gates instead of code files:
|
|
1084
|
+
```
|
|
1085
|
+
## Session Summary
|
|
1086
|
+
|
|
1087
|
+
Rounds completed: 4
|
|
1088
|
+
Theme: ba-gates · Mode: passive · Level: 3
|
|
1089
|
+
Documents covered:
|
|
1090
|
+
- timesheet.feature.txt (rounds 1, 3)
|
|
1091
|
+
- qa_cinemas_ac_scenarios.md (round 2)
|
|
1092
|
+
- QA Cinemas Requirements.pptx (round 4)
|
|
1093
|
+
|
|
1094
|
+
Gates mastered: Ambiguity detection (rounds 1, 4) ✓
|
|
1095
|
+
Gates to strengthen: Edge case coverage (rounds 2, 3)
|
|
1096
|
+
Suggested next level: 3 → 4
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
## Multilingual Projects
|
|
1100
|
+
|
|
1101
|
+
If the project contains multiple languages, let the user's `teach me <lang>`
|
|
1102
|
+
filter govern. If no filter, sample all languages proportionally but announce
|
|
1103
|
+
the language in each round header. Use language-appropriate evaluation
|
|
1104
|
+
criteria for the Mechanics axis:
|
|
1105
|
+
|
|
1106
|
+
- **Python:** decorators, generators, descriptors, `async`/`await`, type hints,
|
|
1107
|
+
context managers, MRO, slots, data classes
|
|
1108
|
+
- **JavaScript/TypeScript:** closures, prototypes, `this` binding, promises,
|
|
1109
|
+
async/await, destructuring, spread, arrow functions, TypeScript generics
|
|
1110
|
+
- **Rust:** ownership, borrowing, lifetimes, pattern matching, `Result`/`Option`,
|
|
1111
|
+
traits, generics, macros
|
|
1112
|
+
- **Go:** goroutines, channels, interfaces, defer, error handling conventions,
|
|
1113
|
+
zero values
|
|
1114
|
+
- **Java:** streams, generics, annotations, try-with-resources, concurrency
|
|
1115
|
+
primitives, inheritance vs composition
|
|
1116
|
+
|
|
1117
|
+
## Guardrails
|
|
1118
|
+
|
|
1119
|
+
- **Never show secrets.** Scan every snippet before display. Redact API keys,
|
|
1120
|
+
tokens, passwords, connection strings with `[REDACTED]`. Skip entire snippets
|
|
1121
|
+
that are only secrets/config.
|
|
1122
|
+
- **Never show user data.** Skip snippets containing PII, email addresses,
|
|
1123
|
+
phone numbers, or personal identifiers.
|
|
1124
|
+
- **One snippet per turn.** Wait for the user's response before showing the next.
|
|
1125
|
+
- **Respect stop immediately.** If the user says `stop`, deliver the summary —
|
|
1126
|
+
do not squeeze in another round.
|
|
1127
|
+
- **Stay in teaching mode.** Do not fix bugs, refactor, or edit code during a
|
|
1128
|
+
teaching session unless the user explicitly asks to switch modes.
|
|
1129
|
+
- **Interactive mode file edits.** The model MAY remove lines from files to set
|
|
1130
|
+
up reconstruction exercises. The model MUST NOT add or modify lines — only
|
|
1131
|
+
the user restores code.
|
|
1132
|
+
- **SOLID mode file rewrites.** The model MAY rewrite files to introduce
|
|
1133
|
+
anti-patterns. The deconstructed code MUST still compile/run with the same
|
|
1134
|
+
behavior. The model MUST NOT delete code or break functionality — only
|
|
1135
|
+
degrade the design.
|
|
1136
|
+
- **Restore after each round.** After feedback in interactive or SOLID mode,
|
|
1137
|
+
restore each touched file with `git checkout -- <file>` for a byte-perfect
|
|
1138
|
+
reset. If the file had pre-existing uncommitted changes (noted in step 0),
|
|
1139
|
+
restore the original lines manually via `edit_file` instead and warn the user.
|
|
1140
|
+
- **Restore on session end.** When the session ends, check whether any files
|
|
1141
|
+
still contain `# ... N lines removed ...` placeholders or deconstructed
|
|
1142
|
+
code from interactive/SOLID/spec mode. If so, restore them with
|
|
1143
|
+
`git checkout -- <file>` (or `edit_file` if pre-existing changes).
|
|
1144
|
+
- **Spec theme snapshot.** In interactive+spec mode, run `//snapshot on`
|
|
1145
|
+
before file edits if the workspace is not a git repo. Run `//snapshot off`
|
|
1146
|
+
after restoration.
|
|
1147
|
+
- **BA-Gates theme file safety.** In interactive+ba-gates mode for plaintext files (`.md`, `.feature`, `.txt`), the model MUST NOT edit the file — the user makes the changes. For office files (`.docx`, `.pptx`, `.xlsx`), present extracted text; the user describes fixes since they cannot edit binaries directly. Run `//snapshot on` before user edits in non-git workspaces; `//snapshot off` after.
|
|
1148
|
+
- **BA-Gates two-pass integrity.** Pass 1 regex results are filters only — do not present them as answers. Pass 2 LLM interpretation MUST run fresh per fragment at round time. If Pass 2 determines all regex flags are false positives, discard the fragment and select another. Do not fabricate issues.
|
|
1149
|
+
- **BA-Gates extraction fallback.** If `codewhale-doc-extract` fails for any office file, note it and skip that file — do not attempt alternative extraction methods. Report skipped files in discovery.
|
|
1150
|
+
- **BA-Gates thinking discipline.** Pass 2 analysis runs with Deep/High thinking. Once presentation begins, switch to Skip thinking — never include generated answers or gate locations in reasoning_content after the fragment is shown.
|
|
1151
|
+
|
|
1152
|
+
## Verification
|
|
1153
|
+
|
|
1154
|
+
After each round, confirm:
|
|
1155
|
+
- The snippet was actually read from the file (not hallucinated)
|
|
1156
|
+
- The line numbers match the source
|
|
1157
|
+
- The mode was correctly announced in the round header
|
|
1158
|
+
- The feedback accurately describes what the code does
|
|
1159
|
+
- No secrets or PII were exposed
|
|
1160
|
+
- The strike count was tracked correctly
|
|
1161
|
+
- (Interactive mode) The original lines were saved before the edit
|
|
1162
|
+
- (Interactive mode) The file was re-read before evaluating the user's restoration
|
|
1163
|
+
- (Interactive mode) Feedback accurately describes any differences from the original
|
|
1164
|
+
- (Interactive mode) Gapped files were restored or the user was offered restoration on session end
|
|
1165
|
+
- (SOLID mode) The original code was saved before deconstruction
|
|
1166
|
+
- (SOLID mode) The deconstructed code is functional (same behavior, just degraded design)
|
|
1167
|
+
- (SOLID mode) Anti-patterns were introduced deliberately — no accidental breakage
|
|
1168
|
+
- (SOLID mode) The number of anti-patterns was stated in the presentation
|
|
1169
|
+
- (SOLID mode) Individual anti-patterns were NOT annotated or revealed before evaluation
|
|
1170
|
+
- (SOLID mode) The file was re-read before evaluating the user's restoration
|
|
1171
|
+
- (SOLID mode) Deconstructed files were restored with `git checkout` on round end
|
|
1172
|
+
- (Spec theme) Office docs were scanned and extracted during discovery
|
|
1173
|
+
- (Spec theme) Exercise direction (spec→code or code→spec) was chosen randomly each round
|
|
1174
|
+
- (Spec theme) The trace link was verified in both directions by the model
|
|
1175
|
+
- (Spec theme) Interactive mode ran `//snapshot on/off` for non-git workspaces
|
|
1176
|
+
- (Spec theme) Modified files were restored after the round
|
|
1177
|
+
- (BA-Gates theme) BA documents were scanned across all formats (.docx, .pptx, .xlsx, .md, .feature, .txt)
|
|
1178
|
+
- (BA-Gates theme) `codewhale-doc-extract` was used for office files; failures noted and skipped
|
|
1179
|
+
- (BA-Gates theme) Pass 1 regex triage ran against every fragment; fragments with zero triggers excluded
|
|
1180
|
+
- (BA-Gates theme) Pass 2 LLM interpretation ran per fragment at round time with Deep/High thinking
|
|
1181
|
+
- (BA-Gates theme) Pass 2 verified quiz-worthiness before presentation; false positives discarded
|
|
1182
|
+
- (BA-Gates theme) The gate-count hint was stated but specific gates were NOT revealed before evaluation
|
|
1183
|
+
- (BA-Gates theme) On skip or strike-3, concrete domain-specific improvement options (2–3 per issue with best-fit recommendation and developer-impact summary) were presented
|
|
1184
|
+
- (BA-Gates theme) Interactive mode for plaintext files did NOT edit the file — user made changes
|
|
1185
|
+
- (BA-Gates theme) Interactive mode for office files presented extracted text inline — user described fixes
|
|
1186
|
+
- (BA-Gates theme) `//snapshot on/off` was used in interactive mode for non-git workspaces
|
|
1187
|
+
- (BA-Gates theme) Extraction fallback was handled gracefully — skipped files were reported
|
|
1188
|
+
- (BA-Gates theme) Thinking suppression was maintained — Pass 2 material was not leaked into reasoning after presentation
|