memorix 0.9.13 → 0.9.14

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
@@ -2,10 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.9.13] — 2026-02-26
5
+ ## [0.9.14] — 2026-02-26
6
6
 
7
7
  ### Fixed
8
- - **🔴 Critical: Hooks never auto-store during development** — `extractContent()` had a fatal `parts.length === 0` guard that skipped rich `toolInput` data (file content, edit diffs, commands) whenever `toolResult` was present. Since Claude Code/Copilot/Cursor always send a short `toolResult` like `"File written successfully"` (28 chars), the extracted content was always < 100 chars and got rejected by the `MIN_STORE_LENGTH` threshold. Now always extracts `toolInput` fields (file_path, content, old_string/new_string, command, query) alongside `toolResult`, ensuring tool events produce enough content for pattern detection and auto-storage.
8
+ - **🔴 Critical: Hooks never auto-store during development** — Two root causes:
9
+ 1. `extractContent()` had a fatal `parts.length === 0` guard that skipped rich `toolInput` data (file content, edit diffs, commands) whenever `toolResult` was present. Since all agents send short `toolResult` like `"File written successfully"` (28 chars), the content was always < 100 chars and got rejected by `MIN_STORE_LENGTH`.
10
+ 2. Bash/shell tool events (npm install, npm test, git commands) also got rejected because their content (~90 chars) fell below the generic `post_tool` threshold of 200 chars, even though commands are inherently meaningful.
11
+ - **Fix**: Always extract `toolInput` fields alongside `toolResult`. Bash tools now use a dedicated low-threshold path (50 chars) with noise command filtering, matching the `post_command` logic.
12
+
13
+ ### Added
14
+ - **12 Claude Code E2E tests** — Validates the full hook pipeline (stdin JSON → normalize → handleHookEvent → observation) for Write, Edit, Bash, UserPromptSubmit, SessionStart, Stop, PreCompact, and edge cases (noise filtering, memorix recursion skip, short prompts).
9
15
 
10
16
  ## [0.9.12] — 2026-02-25
11
17
 
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  <a href="https://www.npmjs.com/package/memorix"><img src="https://img.shields.io/npm/dm/memorix.svg?style=flat-square&color=blue" alt="npm downloads"></a>
9
9
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-green.svg?style=flat-square" alt="License"></a>
10
10
  <a href="https://github.com/AVIDS2/memorix"><img src="https://img.shields.io/github/stars/AVIDS2/memorix?style=flat-square&color=yellow" alt="GitHub stars"></a>
11
- <img src="https://img.shields.io/badge/tests-491%20passed-brightgreen?style=flat-square" alt="Tests">
11
+ <img src="https://img.shields.io/badge/tests-503%20passed-brightgreen?style=flat-square" alt="Tests">
12
12
  </p>
13
13
  <p align="center">
14
14
  <img src="https://img.shields.io/badge/Works%20with-Cursor-orange?style=flat-square" alt="Cursor">
package/README.zh-CN.md CHANGED
@@ -8,7 +8,7 @@
8
8
  <a href="https://www.npmjs.com/package/memorix"><img src="https://img.shields.io/npm/dm/memorix.svg?style=flat-square&color=blue" alt="npm downloads"></a>
9
9
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-green.svg?style=flat-square" alt="License"></a>
10
10
  <a href="https://github.com/AVIDS2/memorix"><img src="https://img.shields.io/github/stars/AVIDS2/memorix?style=flat-square&color=yellow" alt="GitHub stars"></a>
11
- <img src="https://img.shields.io/badge/tests-491%20passed-brightgreen?style=flat-square" alt="Tests">
11
+ <img src="https://img.shields.io/badge/tests-503%20passed-brightgreen?style=flat-square" alt="Tests">
12
12
  </p>
13
13
  <p align="center">
14
14
  <img src="https://img.shields.io/badge/Works%20with-Cursor-orange?style=flat-square" alt="Cursor">
package/dist/cli/index.js CHANGED
@@ -43747,6 +43747,7 @@ var init_pattern_detector = __esm({
43747
43747
  var handler_exports = {};
43748
43748
  __export(handler_exports, {
43749
43749
  handleHookEvent: () => handleHookEvent,
43750
+ resetCooldowns: () => resetCooldowns,
43750
43751
  runHook: () => runHook
43751
43752
  });
43752
43753
  function isInCooldown(eventKey) {
@@ -43757,6 +43758,9 @@ function isInCooldown(eventKey) {
43757
43758
  function markTriggered(eventKey) {
43758
43759
  cooldowns.set(eventKey, Date.now());
43759
43760
  }
43761
+ function resetCooldowns() {
43762
+ cooldowns.clear();
43763
+ }
43760
43764
  function extractContent(input) {
43761
43765
  const parts = [];
43762
43766
  if (input.userPrompt) parts.push(input.userPrompt);
@@ -43976,6 +43980,19 @@ ${lines.join("\n")}`;
43976
43980
  return { observation: null, output: defaultOutput };
43977
43981
  }
43978
43982
  const toolContent = extractContent(input);
43983
+ if (input.command) {
43984
+ if (NOISE_COMMANDS.some((r4) => r4.test(input.command))) {
43985
+ return { observation: null, output: defaultOutput };
43986
+ }
43987
+ if (toolContent.length < 50) {
43988
+ return { observation: null, output: defaultOutput };
43989
+ }
43990
+ markTriggered(toolKey);
43991
+ return {
43992
+ observation: buildObservation(input, toolContent),
43993
+ output: defaultOutput
43994
+ };
43995
+ }
43979
43996
  if (toolContent.length < MIN_STORE_LENGTH) {
43980
43997
  return { observation: null, output: defaultOutput };
43981
43998
  }