@jeffober/thatch 0.1.25 → 0.1.27

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 (70) hide show
  1. package/README.md +7 -7
  2. package/artifacts/skills/common.md +1 -1
  3. package/artifacts/skills/thatch-change-walkthrough.md +2 -2
  4. package/artifacts/skills/thatch-code-archaeology.md +252 -0
  5. package/artifacts/skills/thatch-code-review.md +4 -4
  6. package/artifacts/skills/thatch-code-walkthrough.md +2 -2
  7. package/artifacts/skills/thatch-coding-workflow.md +79 -0
  8. package/artifacts/skills/{pr-description.md → thatch-pr-description.md} +1 -1
  9. package/artifacts/skills/thatch-review-context.md +9 -0
  10. package/artifacts/skills/thatch-review-followup.md +281 -0
  11. package/artifacts/skills/thatch-review-pedantic.md +16 -1
  12. package/artifacts/skills/thatch-review-response.md +365 -0
  13. package/artifacts/skills/thatch-review-synthesizer.md +92 -5
  14. package/artifacts/skills/{split-overlarge-pr.md → thatch-split-overlarge-pr.md} +1 -1
  15. package/artifacts/skills/{ticket-description.md → thatch-ticket-description.md} +3 -3
  16. package/bin/release +3 -3
  17. package/bin/thatch +8 -8
  18. package/docs/dev/README.md +1 -1
  19. package/docs/dev/skills.md +34 -9
  20. package/docs/plans/README.md +9 -6
  21. package/docs/plans/intuition-drives.md +147 -0
  22. package/docs/plans/nomenclater.md +89 -0
  23. package/docs/plans/prediction-consolidation.md +361 -0
  24. package/docs/qa/README.md +20 -3
  25. package/docs/user/README.md +33 -5
  26. package/package.json +1 -1
  27. package/src/db.ts +6 -6
  28. package/src/embeddings.ts +2 -2
  29. package/src/extract-queue.ts +4 -4
  30. package/src/extraction.ts +4 -4
  31. package/src/git.ts +1 -1
  32. package/src/hygiene.ts +1 -1
  33. package/src/index.ts +28 -28
  34. package/src/mcp.ts +5 -5
  35. package/src/prompts.ts +71 -65
  36. package/src/setup.ts +19 -19
  37. package/src/sideband.ts +3 -3
  38. package/src/skills.ts +105 -6
  39. package/src/tool-defs.ts +11 -11
  40. package/src/tools.ts +1 -1
  41. package/artifacts/skills/thatch-workflow-research.md +0 -91
  42. package/docs/in-progress/prediction-engine.md +0 -404
  43. package/docs/plans/001-memory-store.md +0 -106
  44. package/docs/plans/002-agent-driven-pipelines.md +0 -59
  45. package/docs/plans/003-memory-hygiene.md +0 -61
  46. package/docs/qa/use-cases/README.md +0 -51
  47. package/docs/qa/use-cases/UC-001-memory-roundtrip.md +0 -20
  48. package/docs/qa/use-cases/UC-002-dedup-cycle.md +0 -23
  49. package/docs/qa/use-cases/UC-003-extraction-nudge.md +0 -56
  50. package/docs/qa/use-cases/UC-004-cli-inspection.md +0 -22
  51. package/docs/qa/use-cases/UC-005-setup-install.md +0 -34
  52. package/docs/qa/use-cases/UC-006-cursor-hook-lifecycle.md +0 -32
  53. package/docs/qa/use-cases/UC-007-recall-nudge.md +0 -31
  54. package/docs/qa/use-cases/UC-008-hygiene-heartbeat.md +0 -26
  55. package/docs/qa/use-cases/UC-009-flush-tools-tiers.md +0 -33
  56. package/docs/qa/use-cases/UC-010-prime.md +0 -25
  57. package/docs/qa/use-cases/UC-011-write-time-similarity-warning.md +0 -24
  58. package/docs/qa/use-cases/UC-012-model-migration.md +0 -28
  59. package/docs/qa/use-cases/UC-013-compaction-context.md +0 -25
  60. package/docs/qa/use-cases/UC-014-skill-install-drift.md +0 -28
  61. package/docs/qa/use-cases/UC-015-env-override-matrix.md +0 -28
  62. package/docs/qa/use-cases/UC-016-concurrent-session-isolation.md +0 -37
  63. package/docs/qa/use-cases/UC-017-buffer-tool-vs-buffer-batch.md +0 -27
  64. package/docs/qa/use-cases/UC-018-mcp-startup-setup-detection.md +0 -38
  65. package/docs/qa/use-cases/UC-019-archived-memory-lifecycle.md +0 -36
  66. package/docs/qa/use-cases/UC-020-extraction-escalation.md +0 -52
  67. package/docs/qa/use-cases/UC-021-prediction-autofire.md +0 -21
  68. package/docs/qa/use-cases/UC-022-prediction-dedup.md +0 -19
  69. package/docs/qa/use-cases/UC-023-prediction-confidence-model.md +0 -23
  70. package/docs/qa/use-cases/UC-024-prediction-delete.md +0 -20
@@ -1,52 +0,0 @@
1
- # UC-020: Extraction nudge escalation and acknowledgment
2
-
3
- _Automatable: missedNudges counter + escalation tiers + extraction_done accept
4
- are testable with the mock client and a synthetic tool call sequence._
5
-
6
- **Preconditions**
7
- - thatch active in an opencode, Claude Code, or Cursor session
8
- - For the child-sub-agent path: opencode with
9
- `OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true`
10
-
11
- **Steps**
12
- 1. Do some non-thatch tool work (read files, run commands). Do NOT write any
13
- memories.
14
- 2. Send a message. Observe the extraction nudge — polite tone (missedCount=0).
15
- 3. Ignore the nudge. Send another message without writing a memory (missedCount=1).
16
- 4. Repeat step 3 (missedCount=2).
17
- 5. Repeat step 3 again (missedCount=3+).
18
- 6. Acknowledge by calling `thatch_extraction_done` in the session.
19
- 7. Send another message.
20
-
21
- **Expected**
22
- - Step 2: the nudge is polite, referencing the queued tool interactions.
23
- - Step 4: after 2 consecutive misses (missedCount=2), the nudge is insistent
24
- (directive tone).
25
- - Step 5: after 3+ consecutive misses (missedCount>=3), the nudge is ALL-CAPS.
26
- - The buffer was NOT drained at any point during steps 2-5 — the buffer
27
- persists until a memory is written or `extraction_done` is called. The nudge
28
- repeats each turn with escalated tone (and the payload grows if new tool
29
- activity adds entries between nudges).
30
- - Step 6: `thatch_extraction_done` in the parent accepts the buffer (moves it
31
- to a holding area) and resets the `missedNudges` counter. The tool returns
32
- `"[acknowledged]"`. Held entries drop when the extractor completes (child
33
- memory write, child `extraction_done`, or child idle); if the child errors
34
- or is deleted first, the entries requeue and the nudge replays.
35
- - Step 7: no extraction nudge appears (buffer is accepted). If the user prompt
36
- semantically matches existing memories, a recall nudge may appear instead.
37
- - Alternative drain path (opencode direct extraction): when the parent session
38
- goes idle with pending tool interactions, the plugin calls
39
- `triggerExtraction` — creates a child session via the SDK client and prompts
40
- it directly. The `extracting` set suppresses the nudge in `chat.message`
41
- while the child runs. The child writes memories via
42
- `thatch_memory_remember`, which drains the parent's snapshot entries via
43
- `consumeSnapshot`. When the child goes idle, the snapshot is drained
44
- (covering no-save runs), the child session is deleted, and a toast fires
45
- with the metrics. This path bypasses the nudge-and-acknowledge cycle
46
- entirely — no `missedNudges` counter, no escalation. The nudge path is
47
- fallback only (when `triggerExtraction` throws).
48
- - Alternative drain path (agent-initiated): if a child sub-agent (dispatched
49
- via the `task` tool in the fallback nudge path) writes a memory via
50
- `thatch_memory_remember`, the parent's buffer is also drained via the
51
- `childToParent` Map — the `missedNudges` counter resets for the parent
52
- session.
@@ -1,21 +0,0 @@
1
- # UC-021: Prediction auto-fire
2
-
3
- **Preconditions**
4
- - An opencode session (or Claude Code / Cursor with the MCP server running and sideband socket live)
5
- - A clean DB (no existing matchers or predictions)
6
-
7
- **Steps**
8
-
9
- 1. Send a prompt expressing a preference, e.g. "I prefer to handle error cases before happy paths. Record this preference."
10
- 2. Observe the agent calls `prediction_update` with `signal: "create"`.
11
- 3. Start a new session (or send a fresh prompt in the same session).
12
- 4. Send a prompt matching the matcher context, e.g. "Write a function to parse a JSON config file."
13
- 5. Send an unrelated prompt, e.g. "What's the weather like?"
14
-
15
- **Expected**
16
- - Step 2: Agent calls `thatch_prediction_update` with a matcher describing the context ("writing functions", "error handling") and a prediction describing the preference ("handle errors before happy paths"). The tool returns `[created]` and seeds confidence at 0.50 with 0 evidence.
17
- - Step 4: The `chat.message` hook embeds the prompt, finds matchers above the 0.45 threshold, scores linked predictions, and injects a `[thatch] User decision model` nudge. The 0-evidence prediction uses "you may prefer" (not "you tend to"). The agent may follow the prediction, surface it, or ignore it.
18
- - Step 5: No prediction nudge (cosine below threshold). No extra synthetic parts.
19
- - Claude Code / Cursor: The `flush-tools` hook fires predictions alongside the recall nudge via the sideband socket. The `flush-predictions` CLI subcommand provides standalone prediction-only output.
20
-
21
- _Automatable: yes — the auto-fire path is tested in `plugin.test.ts` (prediction nudge via chat.message, independent firing, no-match suppression). The end-to-end "agent acts on prediction" flow is manual._
@@ -1,19 +0,0 @@
1
- # UC-022: Prediction create-on-existing (dedup + link)
2
-
3
- **Preconditions**
4
- - An opencode session with at least one existing prediction (from UC-021 or seeded directly)
5
- - The existing prediction's matcher context is semantically similar to a new observation
6
-
7
- **Steps**
8
-
9
- 1. Seed a prediction: `prediction_update(matcher="reviewing a PR", prediction="go through findings one at a time using a todo list", signal="create")`.
10
- 2. In the same or a new session, call `prediction_update(matcher="code review session", prediction="go through findings one at a time using a todo list", signal="create")`.
11
- 3. Call `prediction_update(matcher="code review session", prediction="go through findings one at a time using a todo list", signal="confirm")`.
12
- 4. Call `prediction_list` to inspect the model.
13
-
14
- **Expected**
15
- - Step 2: `findNearestPrediction` finds the existing prediction (cosine > 0.85). The tool returns `[linked]` (not `[created]`). The new matcher is linked via an edge. No duplicate prediction is created. Confidence is unchanged (create is confidence-neutral).
16
- - Step 3: Same prediction is found. The matcher edge already exists (ON CONFLICT DO NOTHING). Confidence is adjusted upward by the confirm signal. Returns `[confirm]` with updated confidence.
17
- - Step 4: `prediction_list` shows one prediction with two matchers ("reviewing a PR" and "code review session"), confidence reflecting one confirm, and provenance entries for both the create and confirm signals.
18
-
19
- _Automatable: yes — the create-on-existing path is tested in `tool-defs.test.ts` (prediction_update create on existing prediction links without disconfirming). The dedup + edge + confidence behavior is verified with assertions on the return value and prediction_list output._
@@ -1,23 +0,0 @@
1
- # UC-023: Prediction confidence and signal model
2
-
3
- **Preconditions**
4
- - An opencode or Claude Code / Cursor session with the prediction model seeded
5
-
6
- **Steps**
7
-
8
- 1. `prediction_update(matcher="X", prediction="Y", signal="create")` — seeds at p0 (0.50, 0 evidence).
9
- 2. `prediction_update(matcher="X", prediction="Y", signal="confirm")` — user confirmed.
10
- 3. `prediction_update(matcher="X", prediction="Y", signal="soft")` — user partially disagreed.
11
- 4. `prediction_update(matcher="X", prediction="Y", signal="disconfirm")` — user pushed back.
12
- 5. `prediction_list` to inspect confidence and evidence counts.
13
- 6. `prediction_query(context="X")` to query the model.
14
-
15
- **Expected**
16
- - Step 1: Returns `[created]`, confidence=0.50, counts (0/0).
17
- - Step 2: Returns `[confirm]`, confidence > 0.50. Formula: (1 + 5*0.5) / (1 + 0 + 5) = 0.583. Counts (1/0).
18
- - Step 3: Returns `[soft]`, confidence drops slightly. Soft adds 0.25 to disconfirm_count. Formula: (1 + 2.5) / (1 + 0.25 + 5) = 0.571. Counts (1/0.25).
19
- - Step 4: Returns `[disconfirm]`, confidence drops further. Formula: (1 + 2.5) / (1 + 1.25 + 5) = 0.524. Counts (1/1.25).
20
- - Step 5: `prediction_list` shows the prediction with accumulated provenance entries (create, confirm, soft, disconfirm) sorted newest-first.
21
- - Step 6: `prediction_query` returns the prediction with the current confidence and evidence count. Uses "you may prefer" for 0-evidence and "you tend to" for predictions with evidence. Threshold (0.45) filters out matchers below the relevance floor.
22
-
23
- _Automatable: yes — the confidence math and signal mapping are tested in `prediction.test.ts` (adjustConfidence confirm/disconfirm/soft/multiple) and `tool-defs.test.ts` (prediction_update confirm applies signal immediately)._
@@ -1,20 +0,0 @@
1
- # UC-024: Prediction delete and provenance inspection
2
-
3
- **Preconditions**
4
- - An opencode or Claude Code / Cursor session with predictions in the model
5
-
6
- **Steps**
7
-
8
- 1. Seed two predictions in the same store.
9
- 2. `prediction_list` to see both predictions with matchers, confidence, and provenance.
10
- 3. `prediction_delete(statement="first prediction text")` to remove one.
11
- 4. `prediction_list` to verify only one prediction remains.
12
- 5. `prediction_delete(statement="nonexistent prediction")` to test not-found handling.
13
-
14
- **Expected**
15
- - Step 2: Both predictions listed with confidence, evidence count, matchers (with weights), and provenance entries (signal type, detail, date).
16
- - Step 3: Returns `[deleted]` with the matched prediction's statement. Matching is semantic (cosine >= 0.85), not exact string match. Edges and provenance are cascade-deleted via FK ON DELETE CASCADE.
17
- - Step 4: Only the remaining prediction is listed. No orphaned edges or provenance entries.
18
- - Step 5: Returns "No prediction matching ... found" for a statement with no semantic match above threshold.
19
-
20
- _Automatable: yes — prediction_delete is tested in `tool-defs.test.ts` (found and not-found cases), and deletePrediction cascade is tested in `prediction.test.ts` (cascade to edges and provenance, non-existent ID)._