Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

fix(learn): run the claude-cli analysis with hooks disabled (#3926)

gglucass2a4d34c47676
diff --git a/headroom/learn/analyzer.py b/headroom/learn/analyzer.py
index ab9f84f5e..799aec7d7 100644
--- a/headroom/learn/analyzer.py
+++ b/headroom/learn/analyzer.py
@@ -67,6 +67,11 @@ _MIN_DIGEST_TOKENS = 10_000
# verify things keeps streaming, so the idle cap never fires and the run dies
# at the hard cap with nothing written. Both flags are needed: --tools "" alone
# leaves the MCP servers' tools.
+# --settings '{"disableAllHooks":true}' turns off hooks from settings and
+# plugins alike. A blocking Stop hook otherwise forces a second turn whose reply
+# replaces the analysis as the final result, so learn finds no rules and reports
+# "No actionable patterns found" with no error. The user's own settings still
+# load (env routing, auth), which --bare would not do: it skips OAuth.
_CLI_BACKENDS: list[tuple[str, str, list[str]]] = [
(
"claude",
@@ -81,6 +86,8 @@ _CLI_BACKENDS: list[tuple[str, str, list[str]]] = [
"--tools",
"",
"--strict-mcp-config",
+ "--settings",
+ '{"disableAllHooks":true}',
],
),
("gemini", "gemini-cli", ["gemini", "-p"]),
diff --git a/tests/test_learn/test_analyzer.py b/tests/test_learn/test_analyzer.py
index 1215fc907..51a203c85 100644
--- a/tests/test_learn/test_analyzer.py
+++ b/tests/test_learn/test_analyzer.py
@@ -795,6 +795,8 @@ class TestCallCliLlm:
"--tools",
"",
"--strict-mcp-config",
+ "--settings",
+ '{"disableAllHooks":true}',
]
def test_claude_cli_progress_callback_is_throttled(self):