ce-tool 0.1.0__tar.gz

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.
Files changed (85) hide show
  1. ce_tool-0.1.0/.claude/settings.json +14 -0
  2. ce_tool-0.1.0/.claudeignore +28 -0
  3. ce_tool-0.1.0/.geminiignore +28 -0
  4. ce_tool-0.1.0/.github/workflows/ci.yml +15 -0
  5. ce_tool-0.1.0/AGENTS.md +56 -0
  6. ce_tool-0.1.0/CLAUDE.md +26 -0
  7. ce_tool-0.1.0/GEMINI.md +26 -0
  8. ce_tool-0.1.0/PKG-INFO +81 -0
  9. ce_tool-0.1.0/README.md +63 -0
  10. ce_tool-0.1.0/Screenshot 2026-03-20 112524.png +0 -0
  11. ce_tool-0.1.0/old_mds/CLAUDE.md +56 -0
  12. ce_tool-0.1.0/old_mds/SPEC_01_04_FIXES.md +294 -0
  13. ce_tool-0.1.0/old_mds/SPEC_05_06_revised.md +474 -0
  14. ce_tool-0.1.0/old_mds/SPEC_07_11_revised.md +785 -0
  15. ce_tool-0.1.0/old_mds/SPEC_12_16_revised.md +656 -0
  16. ce_tool-0.1.0/old_mds/Spec_Final_integration.md +153 -0
  17. ce_tool-0.1.0/old_mds/TASKS.md +39 -0
  18. ce_tool-0.1.0/pyproject.toml +34 -0
  19. ce_tool-0.1.0/settings.json +14 -0
  20. ce_tool-0.1.0/src/claude_efficient/__init__.py +1 -0
  21. ce_tool-0.1.0/src/claude_efficient/analysis/__init__.py +0 -0
  22. ce_tool-0.1.0/src/claude_efficient/analysis/cache_health.py +175 -0
  23. ce_tool-0.1.0/src/claude_efficient/analysis/telemetry.py +179 -0
  24. ce_tool-0.1.0/src/claude_efficient/analysis/waste_detector.py +160 -0
  25. ce_tool-0.1.0/src/claude_efficient/cli/CLAUDE.md +30 -0
  26. ce_tool-0.1.0/src/claude_efficient/cli/__init__.py +0 -0
  27. ce_tool-0.1.0/src/claude_efficient/cli/audit.py +65 -0
  28. ce_tool-0.1.0/src/claude_efficient/cli/ce_codex.py +9 -0
  29. ce_tool-0.1.0/src/claude_efficient/cli/ce_cursor.py +9 -0
  30. ce_tool-0.1.0/src/claude_efficient/cli/ce_gemini.py +9 -0
  31. ce_tool-0.1.0/src/claude_efficient/cli/ce_opencode.py +9 -0
  32. ce_tool-0.1.0/src/claude_efficient/cli/ce_router.py +9 -0
  33. ce_tool-0.1.0/src/claude_efficient/cli/ce_wrapper_core.py +348 -0
  34. ce_tool-0.1.0/src/claude_efficient/cli/commands.py +164 -0
  35. ce_tool-0.1.0/src/claude_efficient/cli/gains.py +77 -0
  36. ce_tool-0.1.0/src/claude_efficient/cli/helpers.py +86 -0
  37. ce_tool-0.1.0/src/claude_efficient/cli/init.py +175 -0
  38. ce_tool-0.1.0/src/claude_efficient/cli/main.py +39 -0
  39. ce_tool-0.1.0/src/claude_efficient/cli/session.py +410 -0
  40. ce_tool-0.1.0/src/claude_efficient/config/__init__.py +0 -0
  41. ce_tool-0.1.0/src/claude_efficient/config/defaults.py +61 -0
  42. ce_tool-0.1.0/src/claude_efficient/config/defaults.toml +31 -0
  43. ce_tool-0.1.0/src/claude_efficient/config/loader.py +114 -0
  44. ce_tool-0.1.0/src/claude_efficient/generators/.gitignore +109 -0
  45. ce_tool-0.1.0/src/claude_efficient/generators/CLAUDE.md +27 -0
  46. ce_tool-0.1.0/src/claude_efficient/generators/__init__.py +21 -0
  47. ce_tool-0.1.0/src/claude_efficient/generators/_legacy.py +121 -0
  48. ce_tool-0.1.0/src/claude_efficient/generators/backends.py +213 -0
  49. ce_tool-0.1.0/src/claude_efficient/generators/ci.yml +12 -0
  50. ce_tool-0.1.0/src/claude_efficient/generators/claude_md.py +193 -0
  51. ce_tool-0.1.0/src/claude_efficient/generators/claudeignore.py +51 -0
  52. ce_tool-0.1.0/src/claude_efficient/generators/extractor.py +183 -0
  53. ce_tool-0.1.0/src/claude_efficient/generators/fallbacks.py +55 -0
  54. ce_tool-0.1.0/src/claude_efficient/generators/mcp.py +46 -0
  55. ce_tool-0.1.0/src/claude_efficient/generators/orchestrator.py +69 -0
  56. ce_tool-0.1.0/src/claude_efficient/generators/prompt.py +62 -0
  57. ce_tool-0.1.0/src/claude_efficient/generators/selector.py +62 -0
  58. ce_tool-0.1.0/src/claude_efficient/generators/tasks_md.py +65 -0
  59. ce_tool-0.1.0/src/claude_efficient/prompt/__init__.py +0 -0
  60. ce_tool-0.1.0/src/claude_efficient/prompt/optimizer.py +142 -0
  61. ce_tool-0.1.0/src/claude_efficient/session/CLAUDE.md +23 -0
  62. ce_tool-0.1.0/src/claude_efficient/session/__init__.py +0 -0
  63. ce_tool-0.1.0/src/claude_efficient/session/compact_manager.py +148 -0
  64. ce_tool-0.1.0/src/claude_efficient/session/mcp_config.py +148 -0
  65. ce_tool-0.1.0/src/claude_efficient/session/mcp_pruner.py +71 -0
  66. ce_tool-0.1.0/src/claude_efficient/session/model_router.py +57 -0
  67. ce_tool-0.1.0/src/claude_efficient/session/subagent_planner.py +91 -0
  68. ce_tool-0.1.0/tests/CLAUDE.md +17 -0
  69. ce_tool-0.1.0/tests/__init__.py +0 -0
  70. ce_tool-0.1.0/tests/test_backends.py +15 -0
  71. ce_tool-0.1.0/tests/test_cache_health.py +42 -0
  72. ce_tool-0.1.0/tests/test_ce_wrappers.py +92 -0
  73. ce_tool-0.1.0/tests/test_claude_md.py +62 -0
  74. ce_tool-0.1.0/tests/test_claudeignore.py +38 -0
  75. ce_tool-0.1.0/tests/test_compact_manager.py +24 -0
  76. ce_tool-0.1.0/tests/test_init.py +237 -0
  77. ce_tool-0.1.0/tests/test_main_module.py +31 -0
  78. ce_tool-0.1.0/tests/test_mcp_config.py +26 -0
  79. ce_tool-0.1.0/tests/test_mcp_pruner.py +29 -0
  80. ce_tool-0.1.0/tests/test_model_router.py +18 -0
  81. ce_tool-0.1.0/tests/test_optimizer.py +102 -0
  82. ce_tool-0.1.0/tests/test_scaffold.py +23 -0
  83. ce_tool-0.1.0/tests/test_session.py +312 -0
  84. ce_tool-0.1.0/tests/test_tasks_md.py +73 -0
  85. ce_tool-0.1.0/tests/test_telemetry.py +85 -0
@@ -0,0 +1,14 @@
1
+ {
2
+ "hooks": {
3
+ "PreCompact": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "\"C:\\\\Python313\\\\python.exe\" -c \"from pathlib import Path; files = [('=== CRITICAL CONTEXT ===', Path('CLAUDE.md')), ('=== CURRENT TASKS ===', Path('TASKS.md'))]; [(print(title), print(path.read_text(encoding='utf-8', errors='replace'))) for title, path in files if path.exists()]\""
9
+ }
10
+ ]
11
+ }
12
+ ]
13
+ }
14
+ }
@@ -0,0 +1,28 @@
1
+ # Auto-generated by claude-efficient
2
+
3
+ .git/
4
+ *.log
5
+ .DS_Store
6
+ Thumbs.db
7
+ *.png
8
+ *.jpg
9
+ *.jpeg
10
+ *.gif
11
+ *.pdf
12
+ *.bin
13
+ *.safetensors
14
+ *.pt
15
+ *.onnx
16
+
17
+ # python
18
+ **/__pycache__/**
19
+ **/*.pyc
20
+ **/*.pyo
21
+ *.egg-info/
22
+ dist/
23
+ build/
24
+ .venv/
25
+ venv/
26
+ .ruff_cache/
27
+ .mypy_cache/
28
+ .pytest_cache/
@@ -0,0 +1,28 @@
1
+ # Auto-generated by claude-efficient
2
+
3
+ .git/
4
+ *.log
5
+ .DS_Store
6
+ Thumbs.db
7
+ *.png
8
+ *.jpg
9
+ *.jpeg
10
+ *.gif
11
+ *.pdf
12
+ *.bin
13
+ *.safetensors
14
+ *.pt
15
+ *.onnx
16
+
17
+ # python
18
+ **/__pycache__/**
19
+ **/*.pyc
20
+ **/*.pyo
21
+ *.egg-info/
22
+ dist/
23
+ build/
24
+ .venv/
25
+ venv/
26
+ .ruff_cache/
27
+ .mypy_cache/
28
+ .pytest_cache/
@@ -0,0 +1,15 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-22.04
8
+ steps:
9
+ - uses: actions/checkout@v4
10
+ - uses: actions/setup-python@v5
11
+ with:
12
+ python-version: "3.11"
13
+ - run: pip install -e ".[dev]"
14
+ - run: ruff check .
15
+ - run: pytest tests/ -x
@@ -0,0 +1,56 @@
1
+ # Codex-efficient
2
+
3
+ CLI tool that wraps Codex sessions to eliminate token waste. `ce` command.
4
+
5
+ ## Architecture
6
+ ```
7
+ cli/ # main.py (Click group), init.py, session.py, audit.py, commands.py
8
+ generators/ # claude_md.py, claudeignore.py, backends.py
9
+ session/ # model_router.py, compact_manager.py, mcp_config.py, subagent_planner.py
10
+ analysis/ # cache_health.py, waste_detector.py
11
+ prompt/ # optimizer.py
12
+ config/ # defaults.toml, schema.py
13
+ tests/ # mirrors src/ structure
14
+ ```
15
+
16
+ ## Key files
17
+ - `config/defaults.toml` — all thresholds; always_keep guards Codex-mem hooks
18
+ - `generators/backends.py` — GeminiBackend, OllamaBackend, LLMBackend, ClaudeBackend + detect_backend()
19
+ - `generators/claude_md.py` — ClaudeMdGenerator: scan, generate, write, @import tree, PreCompact hook
20
+ - `cli/main.py` — Click group; all commands registered here
21
+ - `session/model_router.py` — model selected ONCE at session start; inject_model_flag()
22
+ - `session/mcp_config.py` — advises on ENABLE_EXPERIMENTAL_MCP_CLI; never removes servers
23
+ - `analysis/cache_health.py` — detects prompt cache prefix violations before they happen
24
+
25
+ ## Specs (load the relevant one only — do NOT read all at once)
26
+ specs/SPEC_01_04_FIXES.md # architecture corrections for already-built code
27
+ specs/SPEC_05_06_revised.md # cache_health.py + updated ce init
28
+ specs/SPEC_07_11_revised.md # session layer: router, compact, mcp_config, optimizer, ce run
29
+ specs/SPEC_12_16_revised.md # audit, subagents, commands, packaging
30
+
31
+ ## Architecture constraints (non-negotiable)
32
+ - **Model routing is session-start-only.** Switching models mid-session invalidates the
33
+ prompt cache prefix — costing more than running Opus start-to-finish.
34
+ - **MCP servers are never removed mid-session.** Use ENABLE_EXPERIMENTAL_MCP_CLI=true
35
+ for on-demand schema loading. always_keep = ["claude_mem", "memory", "filesystem"].
36
+ - **claude_mem hooks are not user-invoked tools.** PostToolUse, SessionEnd fire passively.
37
+ Disabling the server kills the capture pipeline; that entire session produces zero memory.
38
+ - **Compact threshold: 45%.** Default action is /clear + fresh session, not /compact.
39
+ Two compactions in one session = task was scoped too large.
40
+
41
+ ## Run commands
42
+ ```bash
43
+ pip install -e ".[dev]"
44
+ ce --help
45
+ pytest tests/ -x
46
+ ruff check .
47
+ ```
48
+
49
+ ## Current phase
50
+ See TASKS.md
51
+
52
+ ## Output format
53
+ - Code only. No preamble. No "let me first check" narration.
54
+ - One file per response unless explicitly asked for multiple.
55
+ - Bash verification at the end only, never mid-write.
56
+ - Imports at top, no inline explanations inside code.
@@ -0,0 +1,26 @@
1
+ ```json
2
+ {
3
+ "project_digest_root": {
4
+ "old_mds": {},
5
+ "src": {
6
+ "claude_efficient": {
7
+ "cli": {},
8
+ "generators": {},
9
+ "session": {}
10
+ }
11
+ },
12
+ "tests": {},
13
+ "AGENTS.md": {},
14
+ "README.md": {},
15
+ "Screenshot 2026-03-20 112524.png": {},
16
+ "pyproject.toml": {},
17
+ "settings.json": {}
18
+ }
19
+ }
20
+ ```
21
+ ## Subdirectory context (auto-loaded by Claude Code)
22
+
23
+ @src/claude_efficient/cli/CLAUDE.md
24
+ @src/claude_efficient/generators/CLAUDE.md
25
+ @src/claude_efficient/session/CLAUDE.md
26
+ @tests/CLAUDE.md
@@ -0,0 +1,26 @@
1
+ ```json
2
+ {
3
+ "project_digest_root": {
4
+ "old_mds": {},
5
+ "src": {
6
+ "claude_efficient": {
7
+ "cli": {},
8
+ "generators": {},
9
+ "session": {}
10
+ }
11
+ },
12
+ "tests": {},
13
+ "AGENTS.md": {},
14
+ "README.md": {},
15
+ "Screenshot 2026-03-20 112524.png": {},
16
+ "pyproject.toml": {},
17
+ "settings.json": {}
18
+ }
19
+ }
20
+ ```
21
+ ## Subdirectory context (auto-loaded by Claude Code)
22
+
23
+ @src/claude_efficient/cli/GEMINI.md
24
+ @src/claude_efficient/generators/GEMINI.md
25
+ @src/claude_efficient/session/GEMINI.md
26
+ @tests/GEMINI.md
ce_tool-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: ce-tool
3
+ Version: 0.1.0
4
+ Summary: Token optimization wrapper for Claude Code sessions
5
+ Project-URL: Homepage, https://github.com/thedotmack/claude-efficient
6
+ Project-URL: Issues, https://github.com/thedotmack/claude-efficient/issues
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: click>=8.1
9
+ Requires-Dist: requests>=2.31
10
+ Requires-Dist: rich>=13.0
11
+ Requires-Dist: tomllib>=1.0; python_version < '3.11'
12
+ Provides-Extra: dev
13
+ Requires-Dist: build; extra == 'dev'
14
+ Requires-Dist: pytest-mock>=3.0; extra == 'dev'
15
+ Requires-Dist: pytest>=8.0; extra == 'dev'
16
+ Requires-Dist: ruff>=0.4; extra == 'dev'
17
+ Description-Content-Type: text/markdown
18
+
19
+ <div align="center">
20
+ <br />
21
+ <h1>Claude Efficient</h1>
22
+ <p>
23
+ <strong>Stop burning Claude Code tokens.</strong>
24
+ </p>
25
+ <p>
26
+ <code>ce</code> wraps every session with automatic optimizations to save you money and improve context quality.
27
+ </p>
28
+ </div>
29
+
30
+ ---
31
+
32
+ ## 🚀 Installation
33
+
34
+ `claude-efficient` is a Python package. Ensure you have Python 3.11+ installed.
35
+
36
+ ```bash
37
+ pip install claude-efficient
38
+ ```
39
+
40
+ This will install the `ce` command-line tool.
41
+
42
+ ## ✨ Quick Start
43
+
44
+ 1. **Initialize your project:**
45
+ ```bash
46
+ ce init
47
+ ```
48
+ This command sets up your project with a `CLAUDE.md`, `.claudeignore`, and other necessary configurations for optimal performance.
49
+
50
+ 2. **Run a task:**
51
+ ```bash
52
+ ce run "Your task description here. For example, build a FastAPI endpoint for user auth."
53
+ ```
54
+ This is the main command you'll use. It automatically optimizes your request, manages session context, and routes it appropriately.
55
+
56
+ 3. **Check your savings:**
57
+ ```bash
58
+ ce gains
59
+ ```
60
+ This command displays a detailed dashboard of your token savings across different operations.
61
+
62
+ ## 📋 Commands
63
+
64
+ `claude-efficient` provides a suite of commands to manage your workflow and optimize token usage.
65
+
66
+ | Command | Description |
67
+ | --------------- | ------------------------------------------------------------------------ |
68
+ | `ce init` | Initializes a new or existing project for use with `claude-efficient`. |
69
+ | `ce run [TASK]` | Runs a new coding session with the given task, applying optimizations. |
70
+ | `ce gains` | Displays the token savings dashboard. |
71
+ | `ce status` | Shows a health dashboard for the current project configuration. |
72
+ | `ce audit [LOG]`| Audits a session log to detect inefficiencies and suggest improvements. |
73
+ | `ce telemetry` | Shows before/after token savings from recorded sessions. |
74
+ | `ce mem-search` | Searches cross-session memory for relevant context from past tasks. |
75
+ | `ce scope-check`| Estimates the token requirements for a task before running a session. |
76
+ | `ce helpers` | Provides assistance with setting up helpers and integrations. |
77
+
78
+ ---
79
+ <div align="center">
80
+ <p>Made with ❤️ for efficient coding sessions.</p>
81
+ </div>
@@ -0,0 +1,63 @@
1
+ <div align="center">
2
+ <br />
3
+ <h1>Claude Efficient</h1>
4
+ <p>
5
+ <strong>Stop burning Claude Code tokens.</strong>
6
+ </p>
7
+ <p>
8
+ <code>ce</code> wraps every session with automatic optimizations to save you money and improve context quality.
9
+ </p>
10
+ </div>
11
+
12
+ ---
13
+
14
+ ## 🚀 Installation
15
+
16
+ `claude-efficient` is a Python package. Ensure you have Python 3.11+ installed.
17
+
18
+ ```bash
19
+ pip install claude-efficient
20
+ ```
21
+
22
+ This will install the `ce` command-line tool.
23
+
24
+ ## ✨ Quick Start
25
+
26
+ 1. **Initialize your project:**
27
+ ```bash
28
+ ce init
29
+ ```
30
+ This command sets up your project with a `CLAUDE.md`, `.claudeignore`, and other necessary configurations for optimal performance.
31
+
32
+ 2. **Run a task:**
33
+ ```bash
34
+ ce run "Your task description here. For example, build a FastAPI endpoint for user auth."
35
+ ```
36
+ This is the main command you'll use. It automatically optimizes your request, manages session context, and routes it appropriately.
37
+
38
+ 3. **Check your savings:**
39
+ ```bash
40
+ ce gains
41
+ ```
42
+ This command displays a detailed dashboard of your token savings across different operations.
43
+
44
+ ## 📋 Commands
45
+
46
+ `claude-efficient` provides a suite of commands to manage your workflow and optimize token usage.
47
+
48
+ | Command | Description |
49
+ | --------------- | ------------------------------------------------------------------------ |
50
+ | `ce init` | Initializes a new or existing project for use with `claude-efficient`. |
51
+ | `ce run [TASK]` | Runs a new coding session with the given task, applying optimizations. |
52
+ | `ce gains` | Displays the token savings dashboard. |
53
+ | `ce status` | Shows a health dashboard for the current project configuration. |
54
+ | `ce audit [LOG]`| Audits a session log to detect inefficiencies and suggest improvements. |
55
+ | `ce telemetry` | Shows before/after token savings from recorded sessions. |
56
+ | `ce mem-search` | Searches cross-session memory for relevant context from past tasks. |
57
+ | `ce scope-check`| Estimates the token requirements for a task before running a session. |
58
+ | `ce helpers` | Provides assistance with setting up helpers and integrations. |
59
+
60
+ ---
61
+ <div align="center">
62
+ <p>Made with ❤️ for efficient coding sessions.</p>
63
+ </div>
@@ -0,0 +1,56 @@
1
+ # claude-efficient
2
+
3
+ CLI tool that wraps Claude Code sessions to eliminate token waste. `ce` command.
4
+
5
+ ## Architecture
6
+ ```
7
+ cli/ # main.py (Click group), init.py, session.py, audit.py, commands.py
8
+ generators/ # claude_md.py, claudeignore.py, backends.py
9
+ session/ # model_router.py, compact_manager.py, mcp_config.py, subagent_planner.py
10
+ analysis/ # cache_health.py, waste_detector.py
11
+ prompt/ # optimizer.py
12
+ config/ # defaults.toml, schema.py
13
+ tests/ # mirrors src/ structure
14
+ ```
15
+
16
+ ## Key files
17
+ - `config/defaults.toml` — all thresholds; always_keep guards claude-mem hooks
18
+ - `generators/backends.py` — GeminiBackend, OllamaBackend, LLMBackend, ClaudeBackend + detect_backend()
19
+ - `generators/claude_md.py` — ClaudeMdGenerator: scan, generate, write, @import tree, PreCompact hook
20
+ - `cli/main.py` — Click group; all commands registered here
21
+ - `session/model_router.py` — model selected ONCE at session start; inject_model_flag()
22
+ - `session/mcp_config.py` — advises on ENABLE_EXPERIMENTAL_MCP_CLI; never removes servers
23
+ - `analysis/cache_health.py` — detects prompt cache prefix violations before they happen
24
+
25
+ ## Specs (load the relevant one only — do NOT read all at once)
26
+ specs/SPEC_01_04_FIXES.md # architecture corrections for already-built code
27
+ specs/SPEC_05_06_revised.md # cache_health.py + updated ce init
28
+ specs/SPEC_07_11_revised.md # session layer: router, compact, mcp_config, optimizer, ce run
29
+ specs/SPEC_12_16_revised.md # audit, subagents, commands, packaging
30
+
31
+ ## Architecture constraints (non-negotiable)
32
+ - **Model routing is session-start-only.** Switching models mid-session invalidates the
33
+ prompt cache prefix — costing more than running Opus start-to-finish.
34
+ - **MCP servers are never removed mid-session.** Use ENABLE_EXPERIMENTAL_MCP_CLI=true
35
+ for on-demand schema loading. always_keep = ["claude_mem", "memory", "filesystem"].
36
+ - **claude_mem hooks are not user-invoked tools.** PostToolUse, SessionEnd fire passively.
37
+ Disabling the server kills the capture pipeline; that entire session produces zero memory.
38
+ - **Compact threshold: 45%.** Default action is /clear + fresh session, not /compact.
39
+ Two compactions in one session = task was scoped too large.
40
+
41
+ ## Run commands
42
+ ```bash
43
+ pip install -e ".[dev]"
44
+ ce --help
45
+ pytest tests/ -x
46
+ ruff check .
47
+ ```
48
+
49
+ ## Current phase
50
+ See TASKS.md
51
+
52
+ ## Output format
53
+ - Code only. No preamble. No "let me first check" narration.
54
+ - One file per response unless explicitly asked for multiple.
55
+ - Bash verification at the end only, never mid-write.
56
+ - Imports at top, no inline explanations inside code.