calm-cli 0.3.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.
calm_cli-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abhishek Bhattacharya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.4
2
+ Name: calm-cli
3
+ Version: 0.3.0
4
+ Summary: [C]alm [A]nswers via (local) [L]anguage [M]odels
5
+ Keywords: cli,llm,mlx,macos,terminal
6
+ Author: Abhishek Bhattacharya
7
+ Author-email: Abhishek Bhattacharya <babhishek21@yahoo.co.in>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: Other/Proprietary License
14
+ Classifier: Operating System :: MacOS :: MacOS X
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Utilities
23
+ Requires-Dist: mlx-lm>=0.31.0
24
+ Requires-Python: >=3.10
25
+ Project-URL: Homepage, https://github.com/quirkdom/calm
26
+ Project-URL: Repository, https://github.com/quirkdom/calm.git
27
+ Project-URL: Issues, https://github.com/quirkdom/calm/issues
28
+ Description-Content-Type: text/markdown
29
+
30
+ # calm
31
+
32
+ **C**alm **A**nswers via (local) **L**anguage **M**odels
33
+
34
+ `calm` is a CLI tool that answers simple questions using a local language model. `calm` runs and communicates with the `calmd` LM server daemon.
35
+
36
+ Currently, only running **MLX** models on **Apple Silicon Macs** is supported. Please open an issue on GitHub to request other model backends and platforms.
37
+
38
+ ## Quick Start
39
+
40
+ ### Installation
41
+
42
+ ```bash
43
+ brew install quirkdom/tap/calm # Recommended. Easy and straightforward.
44
+
45
+ # Package managers
46
+ pipx install calm-cli
47
+ uv tool install calm-cli
48
+ python -m pip install calm-cli
49
+ ```
50
+
51
+ The PyPI package name is `calm-cli`, but the installed commands are still `calm` and `calmd`.
52
+
53
+ ### First run
54
+
55
+ ```bash
56
+ calm "what's running on port 3567?"
57
+ ```
58
+
59
+ On first run `calm` will start `calmd` in the background, which will configure itself, load models and respond to your query. This may take a while depending on your system and network speed.
60
+
61
+ ### Examples
62
+
63
+ ```bash
64
+ calm -y "top 5 memory processes" # YOLO. Autoruns suggested command
65
+ calm -f "kill what's running on port 3567" # bypass dangerous command execution protection
66
+ ps aux | calm "largest memory users"
67
+ git diff | calm "summarize what changed"
68
+ ```
69
+
70
+ ### Steering and Guardrails
71
+
72
+ You can force a specific output type using the `-c` (`--command`) or `-a` (`--analysis`) flags:
73
+
74
+ - **Force Command**: `calm -c "what's on port 3000"` ensures the model suggests a runnable command.
75
+ - **Force Analysis**: `calm -a "install git"` ensures the model provides an explanation instead of a command.
76
+
77
+ These flags also act as strict guardrails; if the model provides a mismatched type, the CLI will error out and refuse the output.
78
+
79
+ ## What's under the hood?
80
+
81
+ Please read [ARCHITECTURE.md](ARCHITECTURE.md).
82
+
83
+ ## Appendix
84
+
85
+ ### Configuration
86
+
87
+ `calm` and `calmd` read `~/.config/calm/config.toml`.
88
+
89
+ `calmd` creates this file with defaults on first start if it does not exist.
90
+ Per-key precedence is: CLI flag > environment variable > config file > hardcoded default.
91
+
92
+ ```toml
93
+ [common]
94
+ socket_path = "~/.cache/calmd/socket"
95
+
96
+ [cli]
97
+ wait_timeout_secs = 300
98
+ shutdown_timeout_secs = 2
99
+
100
+ [daemon]
101
+ model_path = "mlx-community/Qwen3.5-9B-OptiQ-4bit"
102
+ use_fast_model = false # Default fast model is mlx-community/Qwen3.5-4B-OptiQ-4bit
103
+ verbose = false
104
+ skip_warmup = false
105
+ idle_offload_secs = 450
106
+
107
+ [backend]
108
+ disable_prefix_cache = false
109
+ max_kv_size = 4096
110
+ ```
111
+
112
+ For the full list of environment variable overrides, local development commands, and benchmark instructions, see [DEVELOPMENT.md](DEVELOPMENT.md).
113
+
114
+ ### `calmd` Auto-Start and Offload
115
+
116
+ #### Auto-start
117
+
118
+ `calm` auto-starts `calmd` if needed, preferring to start a managed service (Homebrew service or custom LaunchAgent) first. If neither managed option exists, `calm` may start an unmanaged `calmd` just to serve the request.
119
+
120
+ This unmanaged fallback can't be administered by `calm -d`. You can always ask `calm` to help terminate the unmanaged daemon later:
121
+
122
+ ```bash
123
+ > uv run calm 'terminate the calmd python daemon'
124
+ pkill -f "calmd"
125
+
126
+ Run this command? [y/N]
127
+ ```
128
+
129
+ #### Offload
130
+
131
+ `calmd` automatically offloads models after periods of inactivity to save memory. This can be configured with the `idle_offload_secs` config option.
132
+
133
+ You can also manually trigger an offload using the `offload` command:
134
+
135
+ ```bash
136
+ calm -d offload
137
+ ```
138
+
139
+ ### Running `calmd` as a login service
140
+
141
+ #### Homebrew-managed service
142
+
143
+ If installed via Homebrew, use Homebrew service management:
144
+
145
+ ```bash
146
+ brew services start calm
147
+ brew services stop calm
148
+ ```
149
+
150
+ When a Homebrew service is installed, plain `calm` queries will prefer that service. Use `brew services` to administer it.
151
+
152
+ #### Custom LaunchAgent managed by `calm -d`
153
+
154
+ If you installed via PyPI, `pipx`, `uv tool`, or another non-Homebrew path, you can install a per-user LaunchAgent:
155
+
156
+ ```bash
157
+ calm -d install
158
+ calm -d start
159
+ ```
160
+
161
+ Other useful commands:
162
+
163
+ ```bash
164
+ calm -d offload
165
+ calm -d stop
166
+ calm -d uninstall
167
+ ```
168
+
169
+ `calm -d install`, `start`, `stop`, and `uninstall` manage only the custom LaunchAgent created by `calm -d install`.
170
+ If a Homebrew service is installed, use `brew services` instead.
171
+
172
+ LaunchAgent logs are written to `~/Library/Logs/calmd/`.
173
+
174
+ For daemon startup diagnostics, set `CALM_DEBUG_DAEMON=1` before running `calm`. This prints `launchctl` timing and daemon start-path debug logs to stderr.
@@ -0,0 +1,145 @@
1
+ # calm
2
+
3
+ **C**alm **A**nswers via (local) **L**anguage **M**odels
4
+
5
+ `calm` is a CLI tool that answers simple questions using a local language model. `calm` runs and communicates with the `calmd` LM server daemon.
6
+
7
+ Currently, only running **MLX** models on **Apple Silicon Macs** is supported. Please open an issue on GitHub to request other model backends and platforms.
8
+
9
+ ## Quick Start
10
+
11
+ ### Installation
12
+
13
+ ```bash
14
+ brew install quirkdom/tap/calm # Recommended. Easy and straightforward.
15
+
16
+ # Package managers
17
+ pipx install calm-cli
18
+ uv tool install calm-cli
19
+ python -m pip install calm-cli
20
+ ```
21
+
22
+ The PyPI package name is `calm-cli`, but the installed commands are still `calm` and `calmd`.
23
+
24
+ ### First run
25
+
26
+ ```bash
27
+ calm "what's running on port 3567?"
28
+ ```
29
+
30
+ On first run `calm` will start `calmd` in the background, which will configure itself, load models and respond to your query. This may take a while depending on your system and network speed.
31
+
32
+ ### Examples
33
+
34
+ ```bash
35
+ calm -y "top 5 memory processes" # YOLO. Autoruns suggested command
36
+ calm -f "kill what's running on port 3567" # bypass dangerous command execution protection
37
+ ps aux | calm "largest memory users"
38
+ git diff | calm "summarize what changed"
39
+ ```
40
+
41
+ ### Steering and Guardrails
42
+
43
+ You can force a specific output type using the `-c` (`--command`) or `-a` (`--analysis`) flags:
44
+
45
+ - **Force Command**: `calm -c "what's on port 3000"` ensures the model suggests a runnable command.
46
+ - **Force Analysis**: `calm -a "install git"` ensures the model provides an explanation instead of a command.
47
+
48
+ These flags also act as strict guardrails; if the model provides a mismatched type, the CLI will error out and refuse the output.
49
+
50
+ ## What's under the hood?
51
+
52
+ Please read [ARCHITECTURE.md](ARCHITECTURE.md).
53
+
54
+ ## Appendix
55
+
56
+ ### Configuration
57
+
58
+ `calm` and `calmd` read `~/.config/calm/config.toml`.
59
+
60
+ `calmd` creates this file with defaults on first start if it does not exist.
61
+ Per-key precedence is: CLI flag > environment variable > config file > hardcoded default.
62
+
63
+ ```toml
64
+ [common]
65
+ socket_path = "~/.cache/calmd/socket"
66
+
67
+ [cli]
68
+ wait_timeout_secs = 300
69
+ shutdown_timeout_secs = 2
70
+
71
+ [daemon]
72
+ model_path = "mlx-community/Qwen3.5-9B-OptiQ-4bit"
73
+ use_fast_model = false # Default fast model is mlx-community/Qwen3.5-4B-OptiQ-4bit
74
+ verbose = false
75
+ skip_warmup = false
76
+ idle_offload_secs = 450
77
+
78
+ [backend]
79
+ disable_prefix_cache = false
80
+ max_kv_size = 4096
81
+ ```
82
+
83
+ For the full list of environment variable overrides, local development commands, and benchmark instructions, see [DEVELOPMENT.md](DEVELOPMENT.md).
84
+
85
+ ### `calmd` Auto-Start and Offload
86
+
87
+ #### Auto-start
88
+
89
+ `calm` auto-starts `calmd` if needed, preferring to start a managed service (Homebrew service or custom LaunchAgent) first. If neither managed option exists, `calm` may start an unmanaged `calmd` just to serve the request.
90
+
91
+ This unmanaged fallback can't be administered by `calm -d`. You can always ask `calm` to help terminate the unmanaged daemon later:
92
+
93
+ ```bash
94
+ > uv run calm 'terminate the calmd python daemon'
95
+ pkill -f "calmd"
96
+
97
+ Run this command? [y/N]
98
+ ```
99
+
100
+ #### Offload
101
+
102
+ `calmd` automatically offloads models after periods of inactivity to save memory. This can be configured with the `idle_offload_secs` config option.
103
+
104
+ You can also manually trigger an offload using the `offload` command:
105
+
106
+ ```bash
107
+ calm -d offload
108
+ ```
109
+
110
+ ### Running `calmd` as a login service
111
+
112
+ #### Homebrew-managed service
113
+
114
+ If installed via Homebrew, use Homebrew service management:
115
+
116
+ ```bash
117
+ brew services start calm
118
+ brew services stop calm
119
+ ```
120
+
121
+ When a Homebrew service is installed, plain `calm` queries will prefer that service. Use `brew services` to administer it.
122
+
123
+ #### Custom LaunchAgent managed by `calm -d`
124
+
125
+ If you installed via PyPI, `pipx`, `uv tool`, or another non-Homebrew path, you can install a per-user LaunchAgent:
126
+
127
+ ```bash
128
+ calm -d install
129
+ calm -d start
130
+ ```
131
+
132
+ Other useful commands:
133
+
134
+ ```bash
135
+ calm -d offload
136
+ calm -d stop
137
+ calm -d uninstall
138
+ ```
139
+
140
+ `calm -d install`, `start`, `stop`, and `uninstall` manage only the custom LaunchAgent created by `calm -d install`.
141
+ If a Homebrew service is installed, use `brew services` instead.
142
+
143
+ LaunchAgent logs are written to `~/Library/Logs/calmd/`.
144
+
145
+ For daemon startup diagnostics, set `CALM_DEBUG_DAEMON=1` before running `calm`. This prints `launchctl` timing and daemon start-path debug logs to stderr.
File without changes
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())