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.

.

Garma24daf35ab91
diff --git a/headroom/learn/scanner.py b/headroom/learn/scanner.py
index cbe7e6aa2..27208230a 100644
--- a/headroom/learn/scanner.py
+++ b/headroom/learn/scanner.py
@@ -441,6 +441,14 @@ def _greedy_path_decode(base: Path, parts: list[str]) -> Path | None:
if result:
return result
+ # Try joining with . (this part has a literal dot, encoded as - by Claude Code)
+ if len(parts) > 1:
+ dot_name = f"{parts[0]}.{parts[1]}"
+ dot_path = base / dot_name
+ result = _greedy_path_decode(dot_path, parts[2:])
+ if result:
+ return result
+
# If we've exhausted parts, check if current path exists
return base if base.exists() else None
diff --git a/tests/test_learn/test_integration.py b/tests/test_learn/test_integration.py
index 84b2814f5..a35d403e5 100644
--- a/tests/test_learn/test_integration.py
+++ b/tests/test_learn/test_integration.py
@@ -26,6 +26,7 @@ from headroom.learn.models import (
Recommendation,
RecommendationTarget,
)
+from headroom.learn.scanner import _decode_project_path, _greedy_path_decode
from headroom.learn.writer import ClaudeCodeWriter, CodexWriter
# =============================================================================
@@ -203,6 +204,42 @@ class TestClaudeCodeIntegration:
assert "CLAUDE.md" in fp.name or "MEMORY.md" in fp.name
+class TestDecodeProjectPath:
+ """Unit tests for _greedy_path_decode — covers dot-in-path bug (GitHub.nosync)."""
+
+ def test_dot_in_directory_name(self, tmp_path):
+ """Paths with dots (e.g. GitHub.nosync) must decode correctly.
+
+ Claude Code encodes '/' and '.' both as '-', so 'GitHub.nosync'
+ becomes 'GitHub-nosync' in the directory name.
+ _greedy_path_decode must reconstruct it by trying '.' as a join.
+ """
+ # base = tmp_path, remaining parts = ["GitHub", "nosync", "myproject"]
+ # which came from encoding "GitHub.nosync/myproject" as "GitHub-nosync-myproject"
+ (tmp_path / "GitHub.nosync" / "myproject").mkdir(parents=True)
+ result = _greedy_path_decode(tmp_path, ["GitHub", "nosync", "myproject"])
+ assert result == tmp_path / "GitHub.nosync" / "myproject"
+
+ def test_hyphen_in_directory_name(self, tmp_path):
+ """Paths with literal hyphens decode correctly (existing behavior preserved)."""
+ (tmp_path / "my-project").mkdir()
+ result = _greedy_path_decode(tmp_path, ["my", "project"])
+ assert result == tmp_path / "my-project"
+
+ def test_simple_path_no_ambiguity(self, tmp_path):
+ """Plain paths with no special chars still decode correctly."""
+ (tmp_path / "myproject").mkdir()
+ result = _greedy_path_decode(tmp_path, ["myproject"])
+ assert result == tmp_path / "myproject"
+
+ def test_dot_preferred_over_slash_when_slash_missing(self, tmp_path):
+ """When GitHub/nosync doesn't exist but GitHub.nosync does, use dot."""
+ # Only create the dot version, not the slash version
+ (tmp_path / "GitHub.nosync").mkdir()
+ result = _greedy_path_decode(tmp_path, ["GitHub", "nosync"])
+ assert result == tmp_path / "GitHub.nosync"
+
+
@pytest.mark.skipif(not CODEX_DIR.exists(), reason="No Codex data")
class TestCodexIntegration:
"""Integration tests against real Codex session data."""