@@ -53,7 +53,7 @@ def test_install_claude_hooks(mock_home, tmp_path):
5353 settings_file = mock_home / ".claude" / "settings.json"
5454
5555 assert (project_hooks_dir / "ledgermind_before_prompt.sh" ).exists ()
56- assert (project_hooks_dir / "ledgermind_after_interaction .sh" ).exists ()
56+ assert (project_hooks_dir / "ledgermind_stop .sh" ).exists ()
5757 assert settings_file .exists ()
5858
5959 # Verify settings.json points to the project hooks and has the new matcher format
@@ -65,11 +65,10 @@ def test_install_claude_hooks(mock_home, tmp_path):
6565 assert ups [0 ]["matcher" ] == "*"
6666 assert ups [0 ]["hooks" ][0 ]["command" ] == str (project_hooks_dir / "ledgermind_before_prompt.sh" )
6767
68- # Check PostToolUse
69- ptu = settings ["hooks" ]["PostToolUse" ]
70- assert isinstance (ptu , list )
71- assert ptu [0 ]["matcher" ] == "*"
72- assert ptu [0 ]["hooks" ][0 ]["command" ] == str (project_hooks_dir / "ledgermind_after_interaction.sh" )
68+ # Check Stop
69+ stop = settings ["hooks" ]["Stop" ]
70+ assert isinstance (stop , list )
71+ assert stop [0 ]["hooks" ][0 ]["command" ] == str (project_hooks_dir / "ledgermind_stop.sh" )
7372
7473 # Verify content
7574 before_content = (project_hooks_dir / "ledgermind_before_prompt.sh" ).read_text ()
@@ -104,10 +103,6 @@ def test_install_cursor_hooks(mock_home, tmp_path):
104103 assert '--cli "cursor"' in before_content
105104 assert ".ledgermind" in before_content
106105
107- with open (hooks_file ) as f :
108- config = json .load (f )
109- assert config ["beforeSubmitPrompt" ] == str (project_hooks_dir / "ledgermind_before.sh" )
110-
111106def test_install_gemini_hooks (mock_home , tmp_path ):
112107 project_path = tmp_path / "project"
113108 project_path .mkdir ()
@@ -133,11 +128,12 @@ def test_bridge_context_cli(tmp_path):
133128
134129 # Record a decision first so we have context
135130 from ledgermind .core .api .memory import Memory
136- mem = Memory (vector_model = "v5-small-text-matching-Q4_K_M.gguf" , storage_path = str (memory_path ))
131+ # Use fallback if no real model, but search_decisions should still work via FTS5
132+ mem = Memory (vector_model = "non_existent.gguf" , storage_path = str (memory_path ))
137133 mem .record_decision (title = "Test Rule" , target = "test" , rationale = "Important decision for testing hooks" )
138134
139- # Use a low threshold to ensure context injection regardless of exact similarity score
140- result = run_cli (["bridge-context" , "--path" , str (memory_path ), "--prompt" , "Test Rule" , "--threshold" , "0.1 " ])
135+ # Use a 0.0 threshold to ensure context injection regardless of exact similarity score (FTS5 match)
136+ result = run_cli (["bridge-context" , "--path" , str (memory_path ), "--prompt" , "Test Rule" , "--threshold" , "0.0 " ])
141137 if result .returncode != 0 :
142138 sys .__stderr__ .write (f"STDERR: { result .stderr } \n " )
143139 assert result .returncode == 0
0 commit comments