slash-agent 0.2.1__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.
- slash_agent-0.2.1/LICENSE +201 -0
- slash_agent-0.2.1/PKG-INFO +313 -0
- slash_agent-0.2.1/README.md +282 -0
- slash_agent-0.2.1/pyproject.toml +45 -0
- slash_agent-0.2.1/setup.cfg +4 -0
- slash_agent-0.2.1/slash_agent/__init__.py +1 -0
- slash_agent-0.2.1/slash_agent/main.py +762 -0
- slash_agent-0.2.1/slash_agent/shell_init.py +239 -0
- slash_agent-0.2.1/slash_agent/tools.py +1238 -0
- slash_agent-0.2.1/slash_agent.egg-info/PKG-INFO +313 -0
- slash_agent-0.2.1/slash_agent.egg-info/SOURCES.txt +16 -0
- slash_agent-0.2.1/slash_agent.egg-info/dependency_links.txt +1 -0
- slash_agent-0.2.1/slash_agent.egg-info/entry_points.txt +2 -0
- slash_agent-0.2.1/slash_agent.egg-info/requires.txt +2 -0
- slash_agent-0.2.1/slash_agent.egg-info/top_level.txt +1 -0
- slash_agent-0.2.1/tests/test_background.py +132 -0
- slash_agent-0.2.1/tests/test_safety.py +88 -0
- slash_agent-0.2.1/tests/test_shell_init.py +132 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: slash-agent
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Native LLM Agent Terminal Copilot with Shell State Sync
|
|
5
|
+
Author: akatzmann
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/akatzmann/slash-agent
|
|
8
|
+
Project-URL: Repository, https://github.com/akatzmann/slash-agent
|
|
9
|
+
Project-URL: Issues, https://github.com/akatzmann/slash-agent/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/akatzmann/slash-agent#readme
|
|
11
|
+
Keywords: cli,terminal,agent,llm,copilot,bash,tmux
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
15
|
+
Classifier: Topic :: System :: Shells
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
23
|
+
Classifier: Operating System :: MacOS
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: ollama>=0.6.0
|
|
29
|
+
Requires-Dist: python-agent-core>=0.2.0
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# ⚡ slash-agent: Native LLM Copilot for Your Terminal
|
|
33
|
+
|
|
34
|
+
[](https://opensource.org/licenses/MIT)
|
|
35
|
+
[](https://www.python.org/)
|
|
36
|
+
[](https://www.gnu.org/software/bash/)
|
|
37
|
+
[](http://makeapullrequest.com)
|
|
38
|
+
|
|
39
|
+
<img src="docs/hero.gif" alt="slash-agent in action" width="100%" />
|
|
40
|
+
|
|
41
|
+
**slash-agent** is a zero-overhead, dormant AI coding partner integrated natively into your active Bash shell. Simply type `/agent` when you hit a blocker.
|
|
42
|
+
|
|
43
|
+
* 🖥️ **Terminal Context Capture:** Instantly reads recent `tmux` scrollback or shell history to diagnose errors without manual copy-pasting.
|
|
44
|
+
* 🔒 **Local & Private LLMs:** Operates 100% offline with local Ollama instances or cloud powerhouses (OpenAI/Azure OpenAI).
|
|
45
|
+
* 🔀 **Host Shell State Sync:** Automatically persists directory transitions (`cd`) and environment exports (`export`) back to your parent shell session on exit.
|
|
46
|
+
|
|
47
|
+
> [!TIP]
|
|
48
|
+
> 🤖 **Pairing with an AI Assistant?**
|
|
49
|
+
> Want a 10-second overview? Copy-paste this seed prompt into Claude Code, Antigravity, Copilot, or ChatGPT:
|
|
50
|
+
> ```text
|
|
51
|
+
> Analyze https://github.com/akatzmann/slash-agent.
|
|
52
|
+
> 1. What is this tool, what is a typical use-case, and do I need it?
|
|
53
|
+
> 2. How does it differ from similar tools?
|
|
54
|
+
> 3. Give me an open-ended assessment based on the actual codebase/structure (not just README marketing): Does it deliver on its claimed USP?
|
|
55
|
+
> Keep your answer concise so I can digest it in 10 seconds.
|
|
56
|
+
> ```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## ⚡ Quick Start
|
|
61
|
+
|
|
62
|
+
### Recommended: Install via `pipx` or `pip`
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pipx install slash-agent && slash-agent init --install
|
|
66
|
+
```
|
|
67
|
+
*(Or `pip install slash-agent && slash-agent init --install` in your active Python environment).*
|
|
68
|
+
|
|
69
|
+
Restart your shell or run `source ~/.bashrc` (or `~/.zshrc`, `~/.config/fish/config.fish`). You can now run `/agent` or `agent` from anywhere in your terminal!
|
|
70
|
+
|
|
71
|
+
> **Alternative (Zero-Dependency Curl Installer):**
|
|
72
|
+
> If you prefer a self-contained git clone and virtualenv setup without managing pipx:
|
|
73
|
+
> ```bash
|
|
74
|
+
> curl -fsSL https://raw.githubusercontent.com/akatzmann/slash-agent/master/bin/installer.sh | bash
|
|
75
|
+
> ```
|
|
76
|
+
|
|
77
|
+
> **Updating:**
|
|
78
|
+
> Whenever a new release drops, simply run `/agent --update` (or `/agent --upgrade` / `agent -u`) in your terminal.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### 🔍 The 10-Second Reality Check
|
|
83
|
+
|
|
84
|
+
| 🟢 What it IS | 🔴 What it IS NOT |
|
|
85
|
+
| :--- | :--- |
|
|
86
|
+
| **⚡ A zero-latency terminal utility.** It remains completely dormant and consumes exactly 0MB of RAM until you type `/agent` or `agent`. | **🕵️♂️ A resident background daemon.** It does not track your keystrokes in real-time, run background analytics, or drain your battery. |
|
|
87
|
+
| **🪟 A screen-aware scraper.** It instantly pulls the last 50–100 lines of your active shell history or `tmux` scrollback to diagnose the error that just occurred. | **🏗️ A project architect.** It is not designed to map out massive 50-file repository architectures or handle monolithic code refactors. |
|
|
88
|
+
| **🛠️ An interactive shell executor.** It feeds commands into a real pseudo-terminal (PTY) and asks for live user validation before executing. | **📋 A basic copy-paster.** It doesn't just vomit Markdown code blocks that leave you manually highlighting, copying, and running text. |
|
|
89
|
+
| **🔀 A state-synchronizer.** It bridges the gap between subshells, allowing environment exports and directory changes (`cd`) to persist in your parent shell. | **🏞️ A sandboxed IDE.** It modifies your actual live environment; it is not an isolated, safe-play sandbox. |
|
|
90
|
+
|
|
91
|
+
### 🔒 Privacy & Security Model
|
|
92
|
+
|
|
93
|
+
For detailed specifications on the safety sandbox, permission gating, sensitive path restrictions, and transient logging, see the [Security Model Guide](docs/security_model.md).
|
|
94
|
+
|
|
95
|
+
Unlike web interfaces or proprietary commercial wrappers that silently pipe your telemetry to corporate servers, **slash-agent** puts you in total control of your data flow:
|
|
96
|
+
|
|
97
|
+
* **🔐 Bring Your Own Keys (BYOK):** It talks directly to LLM providers via standard API endpoints (OpenAI, Azure OpenAI, etc.). No middleman server intercepts your terminal logs or source code.
|
|
98
|
+
* **🏠 100% Air-Gapped / Offline Capable:** By pointing the backend API configuration to a local Ollama instance or an OpenAI-compatible local server (such as `llama.cpp`, `vLLM`, `SGLang`, or `Xinference`), your terminal history, source code, and error tracebacks never leave your physical machine. See [Configuring Local Providers](docs/documentation.md#5-local-openai-compatible-apis) for detailed instructions.
|
|
99
|
+
|
|
100
|
+
### 🛡️ Best Practices & Responsible Usage
|
|
101
|
+
|
|
102
|
+
* **💰 Token Spending & Cost Control:** You provide your own API credentials for cloud models. You are responsible for monitoring token consumption and setting spending limits/quotas in your provider consoles (OpenAI, Azure). For zero cost and zero network egress, use local models via [Ollama](https://ollama.com).
|
|
103
|
+
* **👁️ Interactive Command Verification:** By default, every proposed command pauses for interactive confirmation (`[y]es / [n]o / [e]dit / [c]omment`). Always review proposed shell commands before confirming. Use `e` to tweak arguments inline or `c` to redirect the agent.
|
|
104
|
+
* **⚠️ Unattended Execution Precautions:** The `-y` / `--yes` flag bypasses confirmation prompts. Use unattended flags only in ephemeral containers or safe development environments.
|
|
105
|
+
* **📄 License & Warranty:** Provided "as is" under the Apache-2.0 License. Contributors assume no liability for commands executed or API expenses incurred.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 🌟 Key Features
|
|
111
|
+
|
|
112
|
+
* **🤖 LLM Agnostic & Privacy First:** Supports local offline models (like Ollama) with zero keys required and zero data leaving your machine, as well as OpenAI and Azure OpenAI.
|
|
113
|
+
|
|
114
|
+
* **🔌 Zero-Overhead Integration:** Completely passive. Consumes zero CPU/memory until you run `/agent`—no running background daemons, cron jobs, or log listeners.
|
|
115
|
+
* **🔍 Context-Aware Diagnoses:** Instantly extracts the last 50 lines of your active `tmux` pane or terminal history, letting the LLM read error outputs and tracebacks without manual copy-pasting.
|
|
116
|
+
* **⚡ State Synchronization:** Working directory transitions (`cd`) and environment exports (`export KEY=VAL`) made by the agent automatically sync back to your parent shell session on exit.
|
|
117
|
+
* **🌉 Interactive PTY Bridge:** Executes proposed commands in a pseudo-terminal (PTY), allowing you to interactively type passwords (e.g. `sudo`), view colored output, and see progress bars.
|
|
118
|
+
* **🕹️ Steerable Confirmation Loop:** Full control over every action:
|
|
119
|
+
* **`y` (yes):** Run the command.
|
|
120
|
+
* **`n` (no):** Refuse the command and inform the agent.
|
|
121
|
+
* **`e` (edit):** Inline edit the command before running it.
|
|
122
|
+
* **`c` (comment):** Type natural language guidance back to the agent (e.g. *"Use yarn instead of npm"*).
|
|
123
|
+
* **🛡️ Dry-run & Auto-confirm Modes:** Preview agent actions safely with `-n` / `--dry-run`, or run fully unattended with `-y` / `--yes`.
|
|
124
|
+
* **🧩 Agent Skills:** Drop a `SKILL.md` into `.agent/skills/`, `.claude/skills/`, `.github/skills/`, or global paths like `~/.gemini/config/skills/` and the agent automatically discovers and uses it. Compatible with Claude, Copilot, Gemini, and other standard skill formats. See [`docs/skills-guide.md`](docs/skills-guide.md) for details.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 🎬 See it in Action
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
$ npm run build
|
|
132
|
+
❌ ERROR: Build failed. Cannot find module 'dotenv' in server.js:12
|
|
133
|
+
|
|
134
|
+
$ /agent Fix this
|
|
135
|
+
[Agent Shell] Initializing with model 'gemma4:e4b-it-qat' at 'http://127.0.0.1:11434'...
|
|
136
|
+
[Agent Started Task]
|
|
137
|
+
Analyzing terminal context... Identified missing dependency 'dotenv' in server.js.
|
|
138
|
+
|
|
139
|
+
[Agent] Proposed Command:
|
|
140
|
+
$ npm install dotenv && npm run build
|
|
141
|
+
|
|
142
|
+
Confirm action: [y]es / [n]o / [e]dit / [c]omment ? y
|
|
143
|
+
[Agent Running]: npm install dotenv && npm run build
|
|
144
|
+
...
|
|
145
|
+
added 1 package, and audited 120 packages in 1s
|
|
146
|
+
✓ Build completed successfully!
|
|
147
|
+
|
|
148
|
+
I have installed the missing 'dotenv' package and verified that the build now passes.
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 🎯 Common Use Cases
|
|
154
|
+
|
|
155
|
+
* 🛠️ **Build & Test Crashes:** When a compiler error, script traceback, or unit test fails, simply run `/agent` to let it read the error logs directly and propose a fix.
|
|
156
|
+
* 📦 **Dependency Resolution:** Missing package imports? The agent reads the import error, installs the package, and verifies the build.
|
|
157
|
+
* 💻 **Quick Scripting & Automation:** Ask the agent to generate helper scripts, configure development environments, or perform regex logs processing on the fly.
|
|
158
|
+
* ⚙️ **System Configuration:** Easily set up local databases, systemd services, or configuration files without looking up command flags.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 📊 Feature Comparison Matrix
|
|
163
|
+
|
|
164
|
+
| Capability | 🌐 Standard Web UI <br> (ChatGPT / Claude) | 💻 Shell Copilots <br> (Copilot CLI / Gh-Cli) | 🧰 Project Agents <br> (Aider / Claude Code) | ⚡ slash-agent |
|
|
165
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
166
|
+
| **🧠 How it Gets Context** | ⌨️ Manual copy-paste | 📝 You type a prompt | 📂 Reads entire git repo | 🖥️ Scrapes active terminal scrollback |
|
|
167
|
+
| **🚀 Idle System Overhead** | 🚫 None (Browser) | 🚫 None (On-Demand) | ⚠️ High (Heavy runtimes) | ⚡ Zero (Dormant shell function) |
|
|
168
|
+
| **🛠️ Command Execution** | ❌ None (Read-only) | 🔄 Prints text to run | 🤖 Autonomous file edits | 🤝 Interactive PTY Loop (Run/Edit/Steer) |
|
|
169
|
+
| **🔗 Parent Shell Sync** | ❌ No | ❌ No | ❌ No | ✅ Yes (`cd` & `export` persist) |
|
|
170
|
+
| **🔒 Local Privacy Support** | ❌ No (Cloud only) | ❌ No (Cloud only) | ✅ Yes (Configurable) | ✅ Yes (Full Ollama/Local support) |
|
|
171
|
+
| **🎯 Primary Superpower** | Abstract logic & algorithmic brainstorming | Quick syntax lookups <br> (e.g., *"how to untar file"*) | Large autonomous feature builds & massive refactors | Instant post-crash fixes & rapid terminal adjustments |
|
|
172
|
+
|
|
173
|
+
> [!TIP]
|
|
174
|
+
> **Developer Rule of Thumb:**
|
|
175
|
+
> * Use **Aider** or **Claude Code** when you are entering a deep-work coding session to build an entire feature.
|
|
176
|
+
> * Keep **slash-agent** mapped in your `.zshrc` / `.bashrc` / `.config/fish` as an instant emergency lever for when your test suite or deployment pipeline randomly blows up in your face.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 🔍 How it Works
|
|
181
|
+
|
|
182
|
+
Unlike standard agents that run in isolated subshells (and cannot modify your current directory or environment), **slash-agent** uses a lightweight state synchronization protocol:
|
|
183
|
+
|
|
184
|
+
```mermaid
|
|
185
|
+
graph TD
|
|
186
|
+
A[Active Bash Session] -->|1. Type /agent| B(Bash Sourcing Wrapper bin/slash-agent.sh)
|
|
187
|
+
B -->|2. Capture Screen Output| C(Python Orchestrator slash_agent/main.py)
|
|
188
|
+
C -->|3. Interface with local/cloud LLM| C
|
|
189
|
+
C -->|4. Propose commands| D(PTY Execution Bridge)
|
|
190
|
+
D -->|5. Interactive Steering Loop| A
|
|
191
|
+
D -->|6. Capture exit code, PWD, env updates| B
|
|
192
|
+
B -->|7. Source sync file on exit| A
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
1. **Context Capture:** The shell wrapper automatically captures the active `tmux` pane buffer (or history) to give the LLM immediate context.
|
|
196
|
+
2. **Interactive PTY Bridge:** Commands run inside a real pseudo-terminal (PTY) so you see colored outputs, progress bars, and can interact with prompts (like typing passwords for `sudo`).
|
|
197
|
+
3. **Parent Shell Sync:** Directory changes (`cd`) or environment variables (`export`) are safely passed back to your main shell session via a temporary sourcing script on exit.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 🔧 Development Installation (From Source)
|
|
202
|
+
|
|
203
|
+
If you are developing on `slash-agent` or prefer building from source:
|
|
204
|
+
|
|
205
|
+
1. **Clone the Repository:**
|
|
206
|
+
```bash
|
|
207
|
+
git clone https://github.com/akatzmann/slash-agent.git ~/.slash-agent
|
|
208
|
+
cd ~/.slash-agent
|
|
209
|
+
```
|
|
210
|
+
2. **Install Python Requirements:**
|
|
211
|
+
```bash
|
|
212
|
+
pip install -r requirements.txt
|
|
213
|
+
```
|
|
214
|
+
3. **Register Shell Integration:**
|
|
215
|
+
Add the appropriate sourcing statement to your shell configuration file:
|
|
216
|
+
* **Bash (Linux):** `source ~/.slash-agent/bin/slash-agent.sh` in `~/.bashrc`
|
|
217
|
+
* **Bash (macOS):** `source ~/.slash-agent/bin/slash-agent.sh` in `~/.bash_profile` (or `~/.profile`)
|
|
218
|
+
* **Zsh:** `source ~/.slash-agent/bin/slash-agent.sh` in `~/.zshrc`
|
|
219
|
+
* **Ksh:** `source ~/.slash-agent/bin/slash-agent.sh` in `~/.kshrc`
|
|
220
|
+
* **Fish:** `source ~/.slash-agent/bin/slash-agent.fish` in `~/.config/fish/config.fish`
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 💻 Windows Support (WSL2)
|
|
225
|
+
|
|
226
|
+
**slash-agent** runs natively inside Unix-like PTY environments. Native Windows execution (under standard `CMD` or `PowerShell`) is not supported due to PTY emulation limitations.
|
|
227
|
+
|
|
228
|
+
However, the tool is **100% compatible with WSL2 (Windows Subsystem for Linux)**. Windows users can run `slash-agent` by opening any WSL2 Linux terminal (such as Ubuntu or Debian) and running the standard Quick Start installation command.
|
|
229
|
+
|
|
230
|
+
> [!NOTE]
|
|
231
|
+
> If you are running local LLM engines (like `llama.cpp` or `Ollama`) natively on your Windows host and need to connect to them from `slash-agent` inside WSL2, see the [WSL2 Host Network Integration guide](docs/documentation.md#wsl2-host-network-integration).
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## ⚙️ Configuration
|
|
236
|
+
|
|
237
|
+
Configure the LLM backend, endpoint, model, and capture settings in your configuration file (located at `~/.config/slash-agent/env`) or shell profile. You can also override the configuration file path by exporting the `SLASH_AGENT_CONFIG_FILE` environment variable.
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# LLM Backend: ollama (default), openai (also covers local llama.cpp/vLLM/etc.), azure_openai, dummy
|
|
241
|
+
export AGENT_BACKEND="ollama"
|
|
242
|
+
|
|
243
|
+
# Model name (Defaults: gemma4:latest for ollama, gpt-6.1-sol for openai, gemma4-27b for local APIs)
|
|
244
|
+
export AGENT_MODEL="gemma4:latest"
|
|
245
|
+
|
|
246
|
+
# API endpoint base URL (defaults: http://127.0.0.1:11434 for ollama, http://127.0.0.1:8080/v1 for llama.cpp)
|
|
247
|
+
export AGENT_ENDPOINT="http://127.0.0.1:11434"
|
|
248
|
+
|
|
249
|
+
# OpenAI API Key (required if AGENT_BACKEND="openai". Use "local-api-key" for local APIs)
|
|
250
|
+
export OPENAI_API_KEY=""
|
|
251
|
+
|
|
252
|
+
# Context extraction settings
|
|
253
|
+
export AGENT_TMUX_LINES=50 # Lines captured from active tmux scrollback
|
|
254
|
+
export AGENT_HISTORY_COMMANDS=20 # Commands captured from history fallback
|
|
255
|
+
|
|
256
|
+
# Thinking / reasoning mode settings
|
|
257
|
+
export AGENT_THINKING_LEVEL="off" # Thinking level: off (default), low, medium, high (for reasoning models)
|
|
258
|
+
|
|
259
|
+
# Sampling parameter settings (optional)
|
|
260
|
+
# export AGENT_TEMPERATURE="0.2" # LLM temperature: float (e.g. 0.2), blank/unset for default. (OpenAI's o-series reasoning models do not support custom temperature)
|
|
261
|
+
# export AGENT_TOP_P="0.9" # LLM top_p (nucleus sampling): float (e.g. 0.9), blank/unset for default.
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
For a full list of configuration variables (e.g., Azure OpenAI variables), see the [.env.template](.env.template) template file.
|
|
265
|
+
|
|
266
|
+
### 🔄 Re-configuration
|
|
267
|
+
|
|
268
|
+
Instead of manually editing the configuration file, you can re-run the interactive configuration prompts at any time:
|
|
269
|
+
```bash
|
|
270
|
+
/agent --configure
|
|
271
|
+
# or using the shortcut
|
|
272
|
+
/agent -c
|
|
273
|
+
```
|
|
274
|
+
This launches the setup wizard, pre-populated with your current configuration choices as defaults so you can quickly update backends, models, endpoints, keys, and thinking levels.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## 🛠️ Usage Examples
|
|
279
|
+
|
|
280
|
+
### 1. General Command Execution
|
|
281
|
+
```bash
|
|
282
|
+
/agent create a new directory named 'sandbox' and write a basic python flask server inside it
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### 2. Post-Crash Diagnosis
|
|
286
|
+
If a compiler, build tool, or script crashes, run `/agent` with no arguments (or a request to fix it):
|
|
287
|
+
```bash
|
|
288
|
+
/agent Fix this crash
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### 3. Dry-run Mode
|
|
292
|
+
Simulate proposed steps and check the agent's plan without making actual system changes:
|
|
293
|
+
```bash
|
|
294
|
+
/agent -n setup a docker compose file for PostgreSQL and Redis
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### 4. Auto-confirm Mode
|
|
298
|
+
Run tasks without any confirmation prompts for safe, low, or moderate risk commands:
|
|
299
|
+
```bash
|
|
300
|
+
/agent -y update package lists and install tree
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### 5. Auto-confirm Critical Commands
|
|
304
|
+
By default, critical commands (like `rm -rf` or commands using `sudo`) are not auto-confirmed by `-y` to prevent accidental damage. To auto-confirm even critical commands, pass the `--unsafe-yes` flag:
|
|
305
|
+
```bash
|
|
306
|
+
/agent --unsafe-yes clean up docker volumes and system cache
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 📘 Deep Dive
|
|
312
|
+
|
|
313
|
+
For more technical details on the architecture, the interactive PTY bridge loop, and the environment state-synchronization protocol, read the [Technical Documentation](docs/documentation.md).
|