@dzhechkov/harness-cli 0.3.204 → 0.3.205

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.
Files changed (2) hide show
  1. package/README.md +42 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1248,6 +1248,48 @@ Bridge: with the agentdb backend enabled, `dz recall` itself is the bridge — i
1248
1248
 
1249
1249
  `dz recall` is **hybrid** when the vector tier is available and **exactly the old lexical command** when it is not — enabling it never changes behavior for projects that skip it.
1250
1250
 
1251
+ #### The apply leg — learned lessons injected into the prompt that needs them
1252
+
1253
+ A feedback loop has three legs: **collect → rank → apply**. dz collected automatically and never read
1254
+ back: learned lessons reached an agent only when `feature-adr` asked, or when a human typed
1255
+ `dz recall`. A store nobody reads is a write-only log.
1256
+
1257
+ Two hooks close the loop:
1258
+
1259
+ | hook | what it does |
1260
+ |---|---|
1261
+ | `.claude/helpers/dz-embed-daemon.mjs` (SessionStart) | holds the embedder resident and answers recall over a unix socket |
1262
+ | `.claude/helpers/recall-hook.cjs` (UserPromptSubmit) | scores your prompt against the store and injects only what clears the relevance floor |
1263
+
1264
+ **Silence is the feature.** When nothing is relevant the hook prints nothing at all. The floors are
1265
+ MEASURED, not chosen: on a 32-probe labeled set (16 RU + 16 EN, half irrelevant) a max-cosine floor of
1266
+ `0.38` for Cyrillic prompts and `0.31` for Latin ones classified every probe correctly. `"спасибо"`
1267
+ scores `0.259` and `"какой статус?"` `0.318` — both stay silent.
1268
+ A z-score `(max−mean)/sd` was tried and **failed at 69 % accuracy** (MEASURED — reproducer `npx vitest run test/recall-hook-policy.test.ts`).
1269
+ Why it fails: an off-topic query has a flat similarity profile, so its best hit
1270
+ stands out relative to its own mean. A prompt shorter than `10` characters or carrying fewer than two
1271
+ content tokens is skipped outright — a bare `"json"` really is close to technical lessons, but carries
1272
+ no intent.
1273
+
1274
+ **Cost, stated honestly.** Loading the embedder takes ~1478 ms; a warm embed takes 6–8 ms. Without a
1275
+ resident model the hook would add ~2 s to every prompt and you would switch it off within a day. With
1276
+ the daemon a turn costs **50–83 ms**, and **37 ms** when the daemon is absent (it then stays silent
1277
+ rather than blocking). The daemon holds the model in memory — **~427 MB RSS** — and exits after 30
1278
+ minutes idle. It refuses to start twice and opens the store read-only, so it can never be the writer
1279
+ that tears a database file for a concurrent reader.
1280
+
1281
+ Nothing about it can stall a turn: no daemon, no deps, a malformed payload, a slow socket — all exit 0
1282
+ in silence.
1283
+
1284
+ ```bash
1285
+ # ask in plain language; the hook has already surfaced the relevant lessons
1286
+ "почему codex барьер даёт ложный grade D" # → injects the matching lesson (0.63)
1287
+ "спасибо" # → nothing injected
1288
+ ```
1289
+
1290
+ Disable it by removing the two hook entries from `.claude/settings.json`; stop the daemon with
1291
+ `printf '{"op":"stop"}\n' | nc -U .dz/embed.sock`.
1292
+
1251
1293
  #### Cross-lingual recall, and changing the embedding model
1252
1294
 
1253
1295
  The default embedder (`Xenova/paraphrase-multilingual-MiniLM-L12-v2`) is **multilingual**: a Russian
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzhechkov/harness-cli",
3
- "version": "0.3.204",
3
+ "version": "0.3.205",
4
4
  "description": "The dz CLI — install AI skills for Claude Code, Codex, OpenCode, Hermes, OpenClaude, GitHub Copilot. 35 commands, 13 presets, 6 platform targets.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@
54
54
  "@dzhechkov/skills-reverse-engineering": "^0.1.0",
55
55
  "@dzhechkov/skills-presentation-storyteller": "^0.1.0",
56
56
  "@dzhechkov/skills-website-cloner": "^0.1.0",
57
- "@dzhechkov/harness-core": "0.3.103"
57
+ "@dzhechkov/harness-core": "0.3.104"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/node": "^25.6.0",