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.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
fix(init): normalize Windows hook paths to forward slashes (#788)
Shengbo_Wang6ea6e31f0984
diff --git a/headroom/cli/init.py b/headroom/cli/init.pyindex 84342a3c7..a9b5d9da9 100644--- a/headroom/cli/init.py+++ b/headroom/cli/init.py@@ -53,6 +53,9 @@ _STARTUP_READY_TIMEOUT_SECONDS = 15def _command_string(parts: list[str]) -> str:if os.name == "nt":+ # Normalize backslash paths to forward slashes so hook commands+ # work when Claude Code executes them via Git Bash (#724).+ parts = [p.replace("\\", "/") for p in parts]return subprocess.list2cmdline(parts)return shlex.join(parts)diff --git a/tests/test_cli/test_init_cli.py b/tests/test_cli/test_init_cli.pyindex 32fc99557..7cd76f28b 100644--- a/tests/test_cli/test_init_cli.py+++ b/tests/test_cli/test_init_cli.py@@ -336,6 +336,30 @@ def test_command_string_and_matcher_on_windows(monkeypatch) -> None:assert init_cli._powershell_matcher() == "Bash|PowerShell"+def test_command_string_normalizes_backslashes_on_windows(monkeypatch) -> None:+ """Backslash paths must become forward slashes so Git Bash hooks work (#724)."""+ init_cli, _ = _load_init_module(monkeypatch)+ monkeypatch.setattr(init_cli, "os", SimpleNamespace(name="nt"))++ result = init_cli._command_string(+ ["C:\\Users\\user\\.local\\bin\\headroom.exe", "init", "hook", "ensure"]+ )+ assert "\\" not in result+ assert "C:/Users/user/.local/bin/headroom.exe" in result+++def test_command_string_quotes_spaces_after_normalization(monkeypatch) -> None:+ """Paths with spaces must stay properly quoted after backslash normalization (#724)."""+ init_cli, _ = _load_init_module(monkeypatch)+ monkeypatch.setattr(init_cli, "os", SimpleNamespace(name="nt"))++ result = init_cli._command_string(+ ["C:\\Program Files\\headroom\\headroom.exe", "init", "hook", "ensure"]+ )+ assert "\\" not in result+ assert '"C:/Program Files/headroom/headroom.exe"' in result++def test_json_file_handles_missing_empty_and_non_mapping(monkeypatch, tmp_path: Path) -> None:init_cli, _ = _load_init_module(monkeypatch)missing = tmp_path / "missing.json"