monix 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.
- monix-0.1.0/LICENSE +21 -0
- monix-0.1.0/PKG-INFO +216 -0
- monix-0.1.0/README.md +183 -0
- monix-0.1.0/monix/__init__.py +5 -0
- monix-0.1.0/monix/__main__.py +5 -0
- monix-0.1.0/monix/assistant.py +6 -0
- monix-0.1.0/monix/cli.py +1697 -0
- monix-0.1.0/monix/config/__init__.py +3 -0
- monix-0.1.0/monix/config/keystore.py +32 -0
- monix-0.1.0/monix/config/settings.py +110 -0
- monix-0.1.0/monix/core/__init__.py +3 -0
- monix-0.1.0/monix/core/assistant.py +245 -0
- monix-0.1.0/monix/llm/__init__.py +26 -0
- monix-0.1.0/monix/llm/client.py +211 -0
- monix-0.1.0/monix/llm/executor.py +144 -0
- monix-0.1.0/monix/llm/gemini.py +5 -0
- monix-0.1.0/monix/llm/masker.py +47 -0
- monix-0.1.0/monix/llm/prompts.py +51 -0
- monix-0.1.0/monix/llm/registry.py +153 -0
- monix-0.1.0/monix/llm/runner.py +166 -0
- monix-0.1.0/monix/llm/tests/__init__.py +0 -0
- monix-0.1.0/monix/llm/tests/test_client.py +235 -0
- monix-0.1.0/monix/llm/tests/test_executor.py +125 -0
- monix-0.1.0/monix/llm/tests/test_masker.py +50 -0
- monix-0.1.0/monix/llm/tests/test_prompts.py +38 -0
- monix-0.1.0/monix/llm/tests/test_registry.py +76 -0
- monix-0.1.0/monix/llm/tests/test_runner.py +243 -0
- monix-0.1.0/monix/llm/tests/test_trimmer.py +101 -0
- monix-0.1.0/monix/llm/trimmer.py +83 -0
- monix-0.1.0/monix/llm/types.py +59 -0
- monix-0.1.0/monix/mcp.py +95 -0
- monix-0.1.0/monix/monitor.py +43 -0
- monix-0.1.0/monix/picker.py +443 -0
- monix-0.1.0/monix/render.py +1180 -0
- monix-0.1.0/monix/safety/__init__.py +3 -0
- monix-0.1.0/monix/safety/policy.py +12 -0
- monix-0.1.0/monix/tools/__init__.py +18 -0
- monix-0.1.0/monix/tools/calling.py +276 -0
- monix-0.1.0/monix/tools/collect.py +160 -0
- monix-0.1.0/monix/tools/logs/__init__.py +51 -0
- monix-0.1.0/monix/tools/logs/_types.py +44 -0
- monix-0.1.0/monix/tools/logs/app.py +174 -0
- monix-0.1.0/monix/tools/logs/docker/__init__.py +19 -0
- monix-0.1.0/monix/tools/logs/docker/containers.py +155 -0
- monix-0.1.0/monix/tools/logs/nginx.py +126 -0
- monix-0.1.0/monix/tools/logs/registry.py +120 -0
- monix-0.1.0/monix/tools/notify/__init__.py +116 -0
- monix-0.1.0/monix/tools/notify/_types.py +17 -0
- monix-0.1.0/monix/tools/notify/config_store.py +32 -0
- monix-0.1.0/monix/tools/notify/discord.py +27 -0
- monix-0.1.0/monix/tools/notify/slack.py +24 -0
- monix-0.1.0/monix/tools/notify/webhook.py +46 -0
- monix-0.1.0/monix/tools/services.py +61 -0
- monix-0.1.0/monix/tools/system/__init__.py +38 -0
- monix-0.1.0/monix/tools/system/cpu.py +176 -0
- monix-0.1.0/monix/tools/system/disk.py +22 -0
- monix-0.1.0/monix/tools/system/disk_io.py +100 -0
- monix-0.1.0/monix/tools/system/docker_stats.py +127 -0
- monix-0.1.0/monix/tools/system/memory.py +66 -0
- monix-0.1.0/monix/tools/system/metrics.py +114 -0
- monix-0.1.0/monix/tools/system/network.py +126 -0
- monix-0.1.0/monix/tools/system/processes.py +60 -0
- monix-0.1.0/monix/tools/system/swap.py +62 -0
- monix-0.1.0/monix.egg-info/PKG-INFO +216 -0
- monix-0.1.0/monix.egg-info/SOURCES.txt +72 -0
- monix-0.1.0/monix.egg-info/dependency_links.txt +1 -0
- monix-0.1.0/monix.egg-info/entry_points.txt +3 -0
- monix-0.1.0/monix.egg-info/requires.txt +8 -0
- monix-0.1.0/monix.egg-info/top_level.txt +1 -0
- monix-0.1.0/pyproject.toml +51 -0
- monix-0.1.0/setup.cfg +4 -0
- monix-0.1.0/tests/test_docker_command.py +306 -0
- monix-0.1.0/tests/test_mcp.py +48 -0
- monix-0.1.0/tests/test_monitor.py +70 -0
monix-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 co-tox
|
|
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.
|
monix-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: monix
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Gemini-powered terminal assistant for server monitoring
|
|
5
|
+
Author: Monix
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/co-tox/monix
|
|
8
|
+
Project-URL: Repository, https://github.com/co-tox/monix
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/co-tox/monix/issues
|
|
10
|
+
Keywords: monitoring,terminal,cli,gemini,ai,server,devops
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: System :: Monitoring
|
|
23
|
+
Classifier: Topic :: System :: Systems Administration
|
|
24
|
+
Classifier: Topic :: Terminals
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
30
|
+
Provides-Extra: mcp
|
|
31
|
+
Requires-Dist: mcp>=1.0.0; python_version >= "3.10" and extra == "mcp"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# Monix
|
|
35
|
+
|
|
36
|
+
**[English](./README.md) | [한국어](./README.ko.md)**
|
|
37
|
+
|
|
38
|
+
## Overview
|
|
39
|
+
<img width="800" height="450" alt="Image" src="https://github.com/user-attachments/assets/e49b62f6-fdd6-4e33-b30d-987be4c2696b" />
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Monix is a terminal-native, **read-only** AI assistant for server monitoring. It pairs a slash-command CLI with a Gemini-backed conversational agent so operators can inspect CPU, memory, disk, processes, services, logs (plain files, Nginx, Docker), and webhook alerts without leaving the shell — and without ever issuing destructive commands.
|
|
43
|
+
|
|
44
|
+
- **Two interfaces, one mental model** — fast `/slash` commands for known intents, natural-language chat for everything else. Both share the same underlying tools.
|
|
45
|
+
- **Zero runtime dependencies** — standard library only (`urllib`, `json`, `inspect`, `subprocess`, …).
|
|
46
|
+
- **Cross-platform** — Linux (procfs) and macOS (vm_stat / sysctl).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
### Install
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
uv venv
|
|
56
|
+
uv pip install -e ".[dev]"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Launch the interactive REPL
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uv run monix
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
On first launch, Monix prompts for a Gemini API key (paste-friendly, hidden input). Skip with Enter to run in local-only mode.
|
|
66
|
+
|
|
67
|
+
### One-shot mode
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
uv run monix /stat cpu
|
|
71
|
+
uv run monix /log /var/log/syslog 100
|
|
72
|
+
uv run monix "why is memory so high?"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### MCP server
|
|
76
|
+
|
|
77
|
+
The MCP server is optional and uses the same read-only tool registry as the CLI.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
uv pip install -e ".[mcp]"
|
|
81
|
+
uv run monix-mcp
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### Examples
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
> /stat cpu
|
|
92
|
+
CPU 23.4% load 0.41 / 0.38 / 0.30
|
|
93
|
+
|
|
94
|
+
> /log @api --search timeout
|
|
95
|
+
[3 matches in last 500 lines]
|
|
96
|
+
2026-04-26 12:14:02 ERROR upstream timeout (10s) on /v1/orders
|
|
97
|
+
...
|
|
98
|
+
|
|
99
|
+
> show me containers using the most memory
|
|
100
|
+
→ tool: list_containers
|
|
101
|
+
→ tool: ... (correlates with snapshot)
|
|
102
|
+
Top container by RSS is `payments-api` (1.2 GB / 2 GB cap).
|
|
103
|
+
Recent restarts: 0. Suggested follow-up: /docker logs payments-api
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Slash Commands
|
|
109
|
+
|
|
110
|
+
### Snapshots and live monitoring
|
|
111
|
+
|
|
112
|
+
| Command | Purpose |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `/stat [cpu\|memory\|disk\|swap\|net\|io\|all]` | Current snapshot, or `/stat cpu 24h` for collected history |
|
|
115
|
+
| `/watch [metric] [sec]` | Real-time refreshing dashboard (Ctrl-C to stop) |
|
|
116
|
+
| `/cpu` `/memory` `/disk` `/swap` `/net` `/io` | Single-metric shortcuts |
|
|
117
|
+
| `/top [N]` | Top-N processes by CPU |
|
|
118
|
+
|
|
119
|
+
### Logs
|
|
120
|
+
|
|
121
|
+
| Command | Purpose |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `/log add @alias -app <path>` | Register an application log under an alias |
|
|
124
|
+
| `/log add @alias -nginx <path>` | Register an Nginx log |
|
|
125
|
+
| `/log add @alias -docker <name>` | Register a Docker container log |
|
|
126
|
+
| `/log list` | Show all registered aliases |
|
|
127
|
+
| `/log @alias [-n N]` | Tail a registered log |
|
|
128
|
+
| `/log @alias --search [pattern]` | Filter for errors / a regex pattern |
|
|
129
|
+
| `/log @alias --live` | Stream live |
|
|
130
|
+
| `/log /path [-n N] [--live]` | Direct path access (no registration) |
|
|
131
|
+
| `/log remove @alias` | Unregister |
|
|
132
|
+
| `/logs <path> [N]` | One-shot tail (legacy form) |
|
|
133
|
+
|
|
134
|
+
### Docker
|
|
135
|
+
|
|
136
|
+
| Command | Purpose |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| `/docker ps` | List running containers |
|
|
139
|
+
| `/docker add @alias <name>` | Register a container alias |
|
|
140
|
+
| `/docker @alias [-n N] [--search] [--live]` | Tail / search / stream |
|
|
141
|
+
| `/docker logs\|search\|live <name>` | Direct (no alias) |
|
|
142
|
+
| `/docker remove @alias` | Unregister |
|
|
143
|
+
|
|
144
|
+
### Notifications
|
|
145
|
+
|
|
146
|
+
| Command | Purpose |
|
|
147
|
+
| --- | --- |
|
|
148
|
+
| `/notify test [discord\|slack]` | Send a test alert to the configured webhook; sends to both if omitted |
|
|
149
|
+
| `/notify status` | Show webhook configuration, cooldown, metric toggles, and last sent state |
|
|
150
|
+
| `/notify help` | Show notification command and environment variable reference |
|
|
151
|
+
|
|
152
|
+
### Services and AI
|
|
153
|
+
|
|
154
|
+
| Command | Purpose |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| `/service <name>` | systemd service status |
|
|
157
|
+
| `/ask <question>` | Force routing to Gemini |
|
|
158
|
+
| `/clear` | Clear current conversation history |
|
|
159
|
+
| `/help` | Show full command reference |
|
|
160
|
+
| `/exit` | Quit |
|
|
161
|
+
|
|
162
|
+
### Background metrics collector
|
|
163
|
+
|
|
164
|
+
| Command | Purpose |
|
|
165
|
+
| --- | --- |
|
|
166
|
+
| `/collect set <interval> <retention> <folder>` | Start periodic snapshot collection (e.g. `1h 30d ./metrics`) |
|
|
167
|
+
| `/collect list` | Show config and run state |
|
|
168
|
+
| `/collect remove` | Disable and delete config |
|
|
169
|
+
|
|
170
|
+
### Webhook alert configuration
|
|
171
|
+
|
|
172
|
+
Monix can format threshold alerts for Discord and Slack webhooks. Repeated identical alerts are rate-limited with a local state file at `~/.monix/notify_state.json`.
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
export MONIX_DISCORD_WEBHOOK="https://discord.com/api/webhooks/..."
|
|
176
|
+
export MONIX_SLACK_WEBHOOK="https://hooks.slack.com/services/..."
|
|
177
|
+
export MONIX_NOTIFY_COOLDOWN=3600
|
|
178
|
+
|
|
179
|
+
# Per-metric notification toggles. Use 0, false, or no to disable.
|
|
180
|
+
export MONIX_NOTIFY_CPU=1
|
|
181
|
+
export MONIX_NOTIFY_MEM=1
|
|
182
|
+
export MONIX_NOTIFY_DISK=1
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Agent Conversation (Multi-Turn Internals)
|
|
188
|
+
|
|
189
|
+
Monix's conversational mode is a **two-dimensional multi-turn loop**, implemented in `monix/core/assistant.py` and `monix/llm/`.
|
|
190
|
+
|
|
191
|
+
| Dimension | Meaning | State |
|
|
192
|
+
| --- | --- | --- |
|
|
193
|
+
| **A. Conversation turns** | Successive user prompts, each carrying prior context | Caller-owned `history: list[dict]`, accumulated across REPL turns |
|
|
194
|
+
| **B. Tool-calling rounds** | Within one user prompt, the model may call tools repeatedly before answering | Loop inside `answer()` — bounded by `_MAX_TOOL_ROUNDS = 5` |
|
|
195
|
+
|
|
196
|
+
### Per-prompt loop
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
1. Take a fresh snapshot (CPU/mem/disk/processes/alerts) and
|
|
200
|
+
append it, plus the registered log alias table, to the user
|
|
201
|
+
text — gives the model a current "world view" up front.
|
|
202
|
+
|
|
203
|
+
2. Send working history + tool schemas → Gemini.
|
|
204
|
+
|
|
205
|
+
3. Inspect response parts:
|
|
206
|
+
• text only → terminal state, append (user, model)
|
|
207
|
+
to caller history and return.
|
|
208
|
+
• functionCall(s) → execute each via call_tool(),
|
|
209
|
+
append the model candidate (verbatim,
|
|
210
|
+
preserving thought_signature) and the
|
|
211
|
+
functionResponse parts to the working
|
|
212
|
+
history, then loop.
|
|
213
|
+
|
|
214
|
+
4. After 5 rounds the loop exits with a tools-disabled summary
|
|
215
|
+
call so the model is forced to answer with what it already saw.
|
|
216
|
+
```
|
monix-0.1.0/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Monix
|
|
2
|
+
|
|
3
|
+
**[English](./README.md) | [한국어](./README.ko.md)**
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
<img width="800" height="450" alt="Image" src="https://github.com/user-attachments/assets/e49b62f6-fdd6-4e33-b30d-987be4c2696b" />
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Monix is a terminal-native, **read-only** AI assistant for server monitoring. It pairs a slash-command CLI with a Gemini-backed conversational agent so operators can inspect CPU, memory, disk, processes, services, logs (plain files, Nginx, Docker), and webhook alerts without leaving the shell — and without ever issuing destructive commands.
|
|
10
|
+
|
|
11
|
+
- **Two interfaces, one mental model** — fast `/slash` commands for known intents, natural-language chat for everything else. Both share the same underlying tools.
|
|
12
|
+
- **Zero runtime dependencies** — standard library only (`urllib`, `json`, `inspect`, `subprocess`, …).
|
|
13
|
+
- **Cross-platform** — Linux (procfs) and macOS (vm_stat / sysctl).
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
### Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv venv
|
|
23
|
+
uv pip install -e ".[dev]"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Launch the interactive REPL
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uv run monix
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
On first launch, Monix prompts for a Gemini API key (paste-friendly, hidden input). Skip with Enter to run in local-only mode.
|
|
33
|
+
|
|
34
|
+
### One-shot mode
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv run monix /stat cpu
|
|
38
|
+
uv run monix /log /var/log/syslog 100
|
|
39
|
+
uv run monix "why is memory so high?"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### MCP server
|
|
43
|
+
|
|
44
|
+
The MCP server is optional and uses the same read-only tool registry as the CLI.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv pip install -e ".[mcp]"
|
|
48
|
+
uv run monix-mcp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Examples
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
> /stat cpu
|
|
59
|
+
CPU 23.4% load 0.41 / 0.38 / 0.30
|
|
60
|
+
|
|
61
|
+
> /log @api --search timeout
|
|
62
|
+
[3 matches in last 500 lines]
|
|
63
|
+
2026-04-26 12:14:02 ERROR upstream timeout (10s) on /v1/orders
|
|
64
|
+
...
|
|
65
|
+
|
|
66
|
+
> show me containers using the most memory
|
|
67
|
+
→ tool: list_containers
|
|
68
|
+
→ tool: ... (correlates with snapshot)
|
|
69
|
+
Top container by RSS is `payments-api` (1.2 GB / 2 GB cap).
|
|
70
|
+
Recent restarts: 0. Suggested follow-up: /docker logs payments-api
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Slash Commands
|
|
76
|
+
|
|
77
|
+
### Snapshots and live monitoring
|
|
78
|
+
|
|
79
|
+
| Command | Purpose |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `/stat [cpu\|memory\|disk\|swap\|net\|io\|all]` | Current snapshot, or `/stat cpu 24h` for collected history |
|
|
82
|
+
| `/watch [metric] [sec]` | Real-time refreshing dashboard (Ctrl-C to stop) |
|
|
83
|
+
| `/cpu` `/memory` `/disk` `/swap` `/net` `/io` | Single-metric shortcuts |
|
|
84
|
+
| `/top [N]` | Top-N processes by CPU |
|
|
85
|
+
|
|
86
|
+
### Logs
|
|
87
|
+
|
|
88
|
+
| Command | Purpose |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `/log add @alias -app <path>` | Register an application log under an alias |
|
|
91
|
+
| `/log add @alias -nginx <path>` | Register an Nginx log |
|
|
92
|
+
| `/log add @alias -docker <name>` | Register a Docker container log |
|
|
93
|
+
| `/log list` | Show all registered aliases |
|
|
94
|
+
| `/log @alias [-n N]` | Tail a registered log |
|
|
95
|
+
| `/log @alias --search [pattern]` | Filter for errors / a regex pattern |
|
|
96
|
+
| `/log @alias --live` | Stream live |
|
|
97
|
+
| `/log /path [-n N] [--live]` | Direct path access (no registration) |
|
|
98
|
+
| `/log remove @alias` | Unregister |
|
|
99
|
+
| `/logs <path> [N]` | One-shot tail (legacy form) |
|
|
100
|
+
|
|
101
|
+
### Docker
|
|
102
|
+
|
|
103
|
+
| Command | Purpose |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `/docker ps` | List running containers |
|
|
106
|
+
| `/docker add @alias <name>` | Register a container alias |
|
|
107
|
+
| `/docker @alias [-n N] [--search] [--live]` | Tail / search / stream |
|
|
108
|
+
| `/docker logs\|search\|live <name>` | Direct (no alias) |
|
|
109
|
+
| `/docker remove @alias` | Unregister |
|
|
110
|
+
|
|
111
|
+
### Notifications
|
|
112
|
+
|
|
113
|
+
| Command | Purpose |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| `/notify test [discord\|slack]` | Send a test alert to the configured webhook; sends to both if omitted |
|
|
116
|
+
| `/notify status` | Show webhook configuration, cooldown, metric toggles, and last sent state |
|
|
117
|
+
| `/notify help` | Show notification command and environment variable reference |
|
|
118
|
+
|
|
119
|
+
### Services and AI
|
|
120
|
+
|
|
121
|
+
| Command | Purpose |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `/service <name>` | systemd service status |
|
|
124
|
+
| `/ask <question>` | Force routing to Gemini |
|
|
125
|
+
| `/clear` | Clear current conversation history |
|
|
126
|
+
| `/help` | Show full command reference |
|
|
127
|
+
| `/exit` | Quit |
|
|
128
|
+
|
|
129
|
+
### Background metrics collector
|
|
130
|
+
|
|
131
|
+
| Command | Purpose |
|
|
132
|
+
| --- | --- |
|
|
133
|
+
| `/collect set <interval> <retention> <folder>` | Start periodic snapshot collection (e.g. `1h 30d ./metrics`) |
|
|
134
|
+
| `/collect list` | Show config and run state |
|
|
135
|
+
| `/collect remove` | Disable and delete config |
|
|
136
|
+
|
|
137
|
+
### Webhook alert configuration
|
|
138
|
+
|
|
139
|
+
Monix can format threshold alerts for Discord and Slack webhooks. Repeated identical alerts are rate-limited with a local state file at `~/.monix/notify_state.json`.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
export MONIX_DISCORD_WEBHOOK="https://discord.com/api/webhooks/..."
|
|
143
|
+
export MONIX_SLACK_WEBHOOK="https://hooks.slack.com/services/..."
|
|
144
|
+
export MONIX_NOTIFY_COOLDOWN=3600
|
|
145
|
+
|
|
146
|
+
# Per-metric notification toggles. Use 0, false, or no to disable.
|
|
147
|
+
export MONIX_NOTIFY_CPU=1
|
|
148
|
+
export MONIX_NOTIFY_MEM=1
|
|
149
|
+
export MONIX_NOTIFY_DISK=1
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Agent Conversation (Multi-Turn Internals)
|
|
155
|
+
|
|
156
|
+
Monix's conversational mode is a **two-dimensional multi-turn loop**, implemented in `monix/core/assistant.py` and `monix/llm/`.
|
|
157
|
+
|
|
158
|
+
| Dimension | Meaning | State |
|
|
159
|
+
| --- | --- | --- |
|
|
160
|
+
| **A. Conversation turns** | Successive user prompts, each carrying prior context | Caller-owned `history: list[dict]`, accumulated across REPL turns |
|
|
161
|
+
| **B. Tool-calling rounds** | Within one user prompt, the model may call tools repeatedly before answering | Loop inside `answer()` — bounded by `_MAX_TOOL_ROUNDS = 5` |
|
|
162
|
+
|
|
163
|
+
### Per-prompt loop
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
1. Take a fresh snapshot (CPU/mem/disk/processes/alerts) and
|
|
167
|
+
append it, plus the registered log alias table, to the user
|
|
168
|
+
text — gives the model a current "world view" up front.
|
|
169
|
+
|
|
170
|
+
2. Send working history + tool schemas → Gemini.
|
|
171
|
+
|
|
172
|
+
3. Inspect response parts:
|
|
173
|
+
• text only → terminal state, append (user, model)
|
|
174
|
+
to caller history and return.
|
|
175
|
+
• functionCall(s) → execute each via call_tool(),
|
|
176
|
+
append the model candidate (verbatim,
|
|
177
|
+
preserving thought_signature) and the
|
|
178
|
+
functionResponse parts to the working
|
|
179
|
+
history, then loop.
|
|
180
|
+
|
|
181
|
+
4. After 5 rounds the loop exits with a tools-disabled summary
|
|
182
|
+
call so the model is forced to answer with what it already saw.
|
|
183
|
+
```
|