learning-agent 0.2.2 → 0.2.3

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
@@ -7,6 +7,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.3] - 2026-02-01
11
+
12
+ ### Added
13
+
14
+ - **SQLite Graceful Degradation** (2f0)
15
+ - Works as dev dependency without native bindings failing
16
+ - JSONL-only mode when SQLite unavailable
17
+ - Keyword search falls back gracefully
18
+ - Warning displayed in degraded mode
19
+
20
+ - **Claude Code Integration** (ctv, 8lp, 6nw, 501, 2jp, lfy)
21
+ - Claude Plugin structure (`.claude-plugin/`) with manifest and commands
22
+ - `/learn` slash command for quick lesson capture
23
+ - `/check-plan` slash command for plan-time retrieval
24
+ - Auto-invoke triggers for lesson capture patterns
25
+ - Detection triggers wired to Claude Code workflow
26
+ - AGENTS.md includes reference to CLAUDE.md
27
+
28
+ - **Context Recovery** (gpv)
29
+ - `lna prime` command for context recovery after compaction/clear
30
+ - Outputs workflow rules, commands, and quality gates
31
+
32
+ - **Diagnostics** (qi0)
33
+ - `setup claude --status` shows integration health
34
+ - Displays settings file, hook status, slash command availability
35
+ - JSON output with `--json` flag
36
+
37
+ ### Changed
38
+
39
+ - **Architecture Refactoring** (e73, zpl)
40
+ - Split sqlite.ts (644 lines) into focused modules (<200 lines each)
41
+ - Module imports now use barrel exports (Parnas principles)
42
+ - Cleaner internal boundaries and improved maintainability
43
+
44
+ - **CLI Improvements** (79k, e2r)
45
+ - CLI releases database resources on SIGINT/SIGTERM signals
46
+ - `setup claude --uninstall` removes AGENTS.md section and CLAUDE.md reference
47
+ - Clean uninstall preserves other content
48
+
49
+ ### Fixed
50
+
51
+ - Claude now uses CLI commands instead of editing JSONL directly (0p5)
52
+ - Plan-time lessons now appear via check-plan hook integration (6nw)
53
+
10
54
  ## [0.2.2] - 2026-02-01
11
55
 
12
56
  ### Added
@@ -186,7 +230,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
186
230
  - Vitest test suite
187
231
  - tsup build configuration
188
232
 
189
- [Unreleased]: https://github.com/Nathandela/learning_agent/compare/v0.2.2...HEAD
233
+ [Unreleased]: https://github.com/Nathandela/learning_agent/compare/v0.2.3...HEAD
234
+ [0.2.3]: https://github.com/Nathandela/learning_agent/compare/v0.2.2...v0.2.3
190
235
  [0.2.2]: https://github.com/Nathandela/learning_agent/compare/v0.2.1...v0.2.2
191
236
  [0.2.1]: https://github.com/Nathandela/learning_agent/compare/v0.2.0...v0.2.1
192
237
  [0.2.0]: https://github.com/Nathandela/learning_agent/compare/v0.1.0...v0.2.0
package/README.md CHANGED
@@ -49,6 +49,27 @@ pnpm test
49
49
  pnpm download-model
50
50
  ```
51
51
 
52
+ ## Development
53
+
54
+ ### Test Scripts
55
+
56
+ | Script | Duration | Tests | Use Case |
57
+ |--------|----------|-------|----------|
58
+ | `pnpm test:fast` | ~6s | 385 | **Rapid feedback during development** |
59
+ | `pnpm test` | ~60s | 653 | Full suite before committing |
60
+ | `pnpm test:changed` | varies | varies | Only tests affected by recent changes |
61
+ | `pnpm test:watch` | - | - | Watch mode for TDD workflow |
62
+ | `pnpm test:all` | ~60s | 653 | Full suite with model download |
63
+
64
+ **Recommended workflow:**
65
+ 1. Use `pnpm test:fast` while coding for rapid feedback
66
+ 2. Run `pnpm test` before committing
67
+ 3. CI runs the full suite
68
+
69
+ ### Why test:fast is fast
70
+
71
+ The CLI integration tests spawn Node.js processes (~400ms overhead each) and account for 95% of test time. `test:fast` skips these, running only unit tests that verify all business logic.
72
+
52
73
  ## Architecture
53
74
 
54
75
  ```
@@ -194,6 +215,62 @@ import {
194
215
 
195
216
  See [examples/](examples/) for usage examples.
196
217
 
218
+ ## Lesson Schema
219
+
220
+ Lessons are stored as JSONL records with the following schema:
221
+
222
+ ### Required Fields
223
+
224
+ All lessons must have these fields:
225
+
226
+ | Field | Type | Description |
227
+ |-------|------|-------------|
228
+ | `id` | string | Unique identifier (e.g., "L12345678") |
229
+ | `type` | "quick" \| "full" | Lesson complexity level |
230
+ | `trigger` | string | What caused the lesson (context/situation) |
231
+ | `insight` | string | What was learned (the takeaway) |
232
+ | `tags` | string[] | Categorization tags |
233
+ | `source` | string | How it was captured (user_correction, self_correction, test_failure, manual) |
234
+ | `context` | object | Tool/intent context |
235
+ | `created` | ISO string | Creation timestamp |
236
+ | `confirmed` | boolean | Whether user confirmed the lesson |
237
+
238
+ ### Optional Fields
239
+
240
+ | Field | Type | Description |
241
+ |-------|------|-------------|
242
+ | `evidence` | string | Supporting evidence (full lessons only) |
243
+ | `severity` | "high" \| "medium" \| "low" | Importance level (separate from type) |
244
+ | `citation` | object | File/line reference (file, line, commit) |
245
+
246
+ **Note**: The `severity` field is separate from `type`. A quick lesson can have high severity, and a full lesson can have low severity.
247
+
248
+ ### Session-Start Loading
249
+
250
+ At session start, lessons are loaded based on:
251
+ - **High severity** lessons are always loaded
252
+ - **Confirmed** lessons are prioritized
253
+ - Only non-invalidated lessons are included
254
+
255
+ ### Complete JSON Example
256
+
257
+ ```json
258
+ {
259
+ "id": "L12345678",
260
+ "type": "full",
261
+ "trigger": "API returned 401 despite valid JWT token",
262
+ "insight": "Auth API requires X-Request-ID header in all requests",
263
+ "evidence": "Traced in network tab, discovered missing header requirement",
264
+ "severity": "high",
265
+ "tags": ["api", "auth", "headers"],
266
+ "source": "test_failure",
267
+ "context": { "tool": "fetch", "intent": "API authentication" },
268
+ "created": "2024-01-15T10:30:00.000Z",
269
+ "confirmed": true,
270
+ "citation": { "file": "src/api/client.ts", "line": 42 }
271
+ }
272
+ ```
273
+
197
274
  ## Lesson Types
198
275
 
199
276
  ### Quick Lesson (fast capture)
@@ -260,6 +337,32 @@ Version 0.2.2 - Hardening release with quality gates based on [LANDSCAPE.md](doc
260
337
  | [doc/PLAN.md](doc/PLAN.md) | Implementation plan |
261
338
  | [AGENTS.md](AGENTS.md) | Agent instructions overview |
262
339
  | [.claude/CLAUDE.md](.claude/CLAUDE.md) | Claude Code project instructions |
340
+ | [doc/test-optimization-baseline.md](doc/test-optimization-baseline.md) | Test performance metrics |
341
+
342
+ ## Testing
343
+
344
+ ### Test Organization
345
+
346
+ Tests are organized for parallelization:
347
+
348
+ ```
349
+ src/
350
+ ├── *.test.ts # Unit tests (fast)
351
+ ├── cli/ # CLI integration tests (split by command)
352
+ │ ├── cli-test-utils.ts # Shared utilities
353
+ │ ├── learn.test.ts
354
+ │ ├── search.test.ts
355
+ │ └── ...
356
+ ├── storage/ # Storage layer tests
357
+ ├── embeddings/ # Embedding model tests (skipped if model unavailable)
358
+ └── ...
359
+ ```
360
+
361
+ ### Known Limitations
362
+
363
+ **Embedding concurrency**: The `node-llama-cpp` native addon may crash under heavy parallel load. This is a known limitation of the underlying C++ library. Tests pass reliably under normal conditions.
364
+
365
+ **Timing-based tests**: Some tests verify performance thresholds. These use generous limits (5000ms) to avoid flakiness on slow CI machines.
263
366
 
264
367
  ## License
265
368