File size: 25,296 Bytes
f87a697
 
 
 
 
c8c4fc6
f87a697
 
 
 
 
 
2417033
c8c4fc6
 
2417033
f87a697
 
 
 
2417033
f87a697
 
2417033
f87a697
 
2417033
f87a697
c8c4fc6
61846f9
f87a697
 
c8c4fc6
f87a697
 
 
 
c8c4fc6
 
2417033
c8c4fc6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f87a697
 
 
 
 
 
 
f9be7e0
 
f87a697
 
f9be7e0
 
f87a697
 
 
 
 
f9be7e0
f87a697
 
 
f9be7e0
f87a697
 
f9be7e0
f87a697
f9be7e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f87a697
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f9be7e0
 
 
f87a697
 
 
 
f9be7e0
 
 
 
 
 
f87a697
 
f9be7e0
f87a697
f9be7e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f87a697
 
 
 
f9be7e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f87a697
 
f9be7e0
 
f87a697
f9be7e0
 
 
f87a697
f9be7e0
f87a697
f9be7e0
 
 
f87a697
 
f9be7e0
 
f87a697
f9be7e0
 
 
f87a697
f9be7e0
 
f87a697
 
 
f9be7e0
 
 
f87a697
f9be7e0
f87a697
f9be7e0
 
 
 
f87a697
 
 
f9be7e0
 
f87a697
 
 
f9be7e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f87a697
f9be7e0
f87a697
 
 
 
f9be7e0
f87a697
 
f9be7e0
f87a697
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f9be7e0
f87a697
f9be7e0
f87a697
 
 
 
 
 
 
 
 
 
 
f9be7e0
f87a697
f9be7e0
f87a697
f9be7e0
f87a697
 
 
 
 
 
 
 
 
 
 
 
f9be7e0
f87a697
f9be7e0
f87a697
 
 
 
 
 
 
f9be7e0
f87a697
 
 
 
 
 
 
f9be7e0
f87a697
f9be7e0
f87a697
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f9be7e0
 
 
 
 
 
 
 
 
 
 
 
f87a697
 
 
 
 
61846f9
f87a697
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="Converts plain English intents into safe, executable shell and terminal commands with safety guardrails and multi-OS support.">
  <meta name="keywords" content="SLM CLI Agent, shell automation, local AI, CPU inference, ONNX Runtime, Python, pip, offline execution, safety sandbox">
  <meta name="author" content="SLM Agents Community">
  <meta name="robots" content="index, follow">

  <!-- Open Graph / Facebook -->
  <meta property="og:type" content="article">
  <meta property="og:url" content="https://www.slmagents.ai/cli.html">
  <meta property="og:title" content="SLM CLI Agent: Natural Language to Safe Bash & Terminal Commands | SLMAgents">
  <meta property="og:description" content="Converts plain English intents into safe, executable shell and terminal commands with safety guardrails and multi-OS support.">
  <meta property="og:image" content="https://www.slmagents.ai/assets/preview.png">
  <meta property="og:site_name" content="SLM Agents">

  <!-- Twitter Card -->
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:url" content="https://www.slmagents.ai/cli.html">
  <meta name="twitter:title" content="SLM CLI Agent | Local CPU CLI Helper — SLM Agents">
  <meta name="twitter:description" content="Translate natural language requests into precise system shell commands locally on CPU. Security sandbox, parameters, and quick start guides.">
  <meta name="twitter:image" content="https://www.slmagents.ai/assets/preview.png">

  <!-- Canonical -->
  <link rel="canonical" href="https://www.slmagents.ai/cli.html">

  <title>SLM CLI Agent: Natural Language to Safe Bash & Terminal Commands | SLMAgents</title>
  <link rel="stylesheet" href="style.css?v=64.0">

  <!-- Structured Data -->
  <!-- Structured Data / Schema Markup -->
  <script type="application/ld+json">
  {
    "@context": "https://schema.org",
    "@type": "TechArticle",
    "headline": "SLM CLI Agent: Natural Language to Safe Bash & Terminal Commands | SLMAgents",
    "description": "Converts plain English intents into safe, executable shell and terminal commands with safety guardrails and multi-OS support.",
    "url": "https://www.slmagents.ai/cli.html",
    "mainEntityOfPage": "https://www.slmagents.ai/cli.html",
    "articleSection": "Productivity",
    "author": {
      "@type": "Organization",
      "name": "SLMAgents Community",
      "url": "https://github.com/t00114218-stack/SLMAgents"
    },
    "publisher": {
      "@type": "Organization",
      "name": "SLMAgents",
      "logo": {
        "@type": "ImageObject",
        "url": "https://www.slmagents.ai/flowchart.png"
      }
    }
  }
  </script>

  
</head>
<body>

                  <!-- Top Engineering Header -->
  <header class="site-top-header web-only-nav">
    <div class="container nav-container">
      <div style="display: flex; align-items: center; gap: 10px;">
        <button class="sidebar-toggle" onclick="toggleSidebar()" aria-label="Toggle Sidebar">
          <svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16"/>
          </svg>
        </button>
        <a href="index.html" class="logo">
          <div class="logo-icon">
            <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
              <path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/>
            </svg>
          </div>
          <span>SLMAgents</span>
        </a>
      </div>

      <nav>
        <ul class="nav-links">
          <li><a href="index.html" id="topnav-home">Home</a></li>
          <li><a href="chat.html" id="topnav-chat">Chat Studio</a></li>
          <li><a href="playground.html" id="topnav-playground">Playground</a></li>
          <li><a href="blogs.html" id="topnav-blogs">Blogs</a></li>
          <li>
            <button type="button" onclick="openDownloadModal()" class="btn-nav-download">
              <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
              Download App
            </button>
          </li>
          <li>
            <a href="https://github.com/t00114218-stack/SLMAgents" target="_blank" class="btn-github-nav">
              <svg width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
                <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8"/>
              </svg>
              GitHub
            </a>
          </li>
        </ul>
      </nav>
    </div>
  </header>

  <div class="layout-container">
    <aside class="sidebar" id="sidebar">
      <div class="sidebar-group">
        <div class="sidebar-group-title">Active Libraries</div>
        <ul class="sidebar-list" id="sidebar-active-list"></ul>
      </div>
    </aside>

    <main class="main-content">
      <div class="doc-content-wrapper">
        <section class="doc-section" id="overview" style="margin-top: 0;">
          <div class="breadcrumb" style="font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.75rem;"><a href="index.html" style="color: var(--text-secondary); text-decoration: none;">Overview</a> <span style="margin: 0 6px;">/</span> <span>slm_cli_agent</span> <span style="margin: 0 6px;">/</span> <span style="color: var(--text-primary); font-weight: 600;">SLM CLI Agent</span></div>
          <div class="badge-pill">slm_cli_agent · Productivity & Shell · 10-Plane Pure-CPU Agent</div>
          <h1 style="font-size: 2.25rem; color: #0f172a; font-weight: 800; margin-bottom: 0.75rem;">SLM CLI Agent</h1>
          <p style="font-size: 1.05rem; color: #334155; line-height: 1.65; font-weight: 500; margin: 0;">Lightweight shell helper that translates natural language commands to safe, platform-specific shell scripts and executes them locally on CPU with built-in command security constraints.</p>
        </section>

                                                                        <nav class="doc-nav">
          <a href="#overview">01 / Overview</a>
          <a href="#install">02 / OS Installers &amp; CLI</a>
          <a href="#harness">03 / 10-Plane Harness</a>
          <a href="#git">04 / Git Checkout</a>
          <a href="#config">05 / API Reference</a>
        </nav>

                                                                        <!-- INSTALLATION & STANDALONE OS HARNESS INSTALLERS -->
        <section class="doc-section" id="install">
          <h2>02 / Standalone OS Harness Installers, CLI &amp; Python SDK</h2>
          <p>In <strong>SLMAgents 2.0</strong>, <strong>SLM CLI Agent</strong> executes inside the <strong>10-Plane Pure-CPU Agent Harness (<code>slm_harness</code>)</strong>. Download a self-extracting <strong>Individual Agent + Harness OS Installer</strong> for macOS, Windows, or Linux (bundling <code>slm_cli_agent</code> + <code>slm_harness</code> + the <code>./slm</code> CLI), install the full 26-agent desktop suite, or install via Python <code>pip</code>:</p>

          <h3>1. Individual SLM CLI Agent + 10-Plane Harness Installers (All OSes)</h3>
          <div class="subpage-installer-grid">
            <a href="/api/installers/download/agent-macos?agent=cli" class="subpage-installer-card">
              <div class="subpage-installer-title">
                <span>macOS Installer</span>
                <span class="subpage-installer-ext">.command</span>
              </div>
              <div class="subpage-installer-desc">Self-extracting macOS bundle with <code>slm_cli_agent</code> + <code>slm_harness</code> + <code>./slm</code> CLI</div>
            </a>
            <a href="/api/installers/download/agent-windows?agent=cli" class="subpage-installer-card">
              <div class="subpage-installer-title">
                <span>Windows Installer</span>
                <span class="subpage-installer-ext">.exe</span>
              </div>
              <div class="subpage-installer-desc">Native 64-bit Windows Setup with portable Python 3.11 + <code>slm_cli_agent</code> + <code>slm_harness</code></div>
            </a>
            <a href="/api/installers/download/agent-linux?agent=cli" class="subpage-installer-card">
              <div class="subpage-installer-title">
                <span>Linux Installer</span>
                <span class="subpage-installer-ext">.AppImage</span>
              </div>
              <div class="subpage-installer-desc">Standalone Linux AppImage with <code>slm_cli_agent</code> + <code>slm_harness</code> + <code>./slm</code> CLI</div>
            </a>
          </div>

          <h3>2. Full 26-Agent Studio &amp; Desktop OS Installers</h3>
          <div class="subpage-suite-links">
            <a href="/api/installers/download/macos-dmg" class="subpage-suite-link">macOS .dmg (280 MB)</a>
            <a href="/api/installers/download/windows" class="subpage-suite-link">Windows .exe (2.8 MB)</a>
            <a href="/api/installers/download/linux" class="subpage-suite-link">Linux .AppImage (3.4 MB)</a>
            <button onclick="openDownloadModal()" class="btn btn-primary" style="padding: 0.38rem 0.8rem; font-size: 0.76rem;">All OS Installers Modal</button>
          </div>

          <h3>3. 10-Plane Harness CLI (<code>./slm</code>) &amp; Python <code>pip</code> Installation</h3>
          <div class="code-panel" style="margin: 0.85rem 0;">
            <div class="code-header">
              <div class="code-dots"><div class="code-dot"></div><div class="code-dot"></div><div class="code-dot"></div></div>
              <div class="code-title">Terminal — 10-Plane Harness CLI &amp; Pip</div>
            </div>
            <div class="code-content" style="display:block;">
              <pre><span style="color:#64748b;"># Option A: Install via PyPI or editable source with the 10-Plane Harness</span>
<span style="color:#34d399;">$</span> pip install slm-cli-agent
<span style="color:#34d399;">$</span> pip install -e ./slm_harness -e ./slm_cli_agent

<span style="color:#64748b;"># Option B: Run directly through the Unified 10-Plane Pure-CPU Harness CLI (./slm)</span>
<span style="color:#34d399;">$</span> ./slm ask "Find all .log files modified in the last 7 days and count ERROR lines"
<span style="color:#34d399;">$</span> ./slm chat   <span style="color:#64748b;"># Interactive Rich TUI with 18 slash commands (/trace, /models, /arena, /undo)</span>
<span style="color:#34d399;">$</span> ./slm serve  <span style="color:#64748b;"># 100% Offline Web AI Studio + OpenAI /v1 API at http://127.0.0.1:7860</span></pre>
            </div>
          </div>
        </section>

        <!-- 10-PLANE PURE-CPU HARNESS ARCHITECTURE -->
        <section class="doc-section" id="harness">
          <h2>03 / 10-Plane Pure-CPU Harness Integration (<code>slm_harness</code>)</h2>
          <p>Rather than executing as an isolated prompt wrapper, <strong>SLM CLI Agent</strong> is natively orchestrated by the <strong>SLMAgents 2.0 10-Plane Pure-CPU Harness</strong> (via <code>slm_harness.runtime.legacy_bridge</code> and <code>CascadeRouter</code>). Every call benefits from hybrid <code>llama.cpp</code> GGUF (<code>Q4_K_M</code>) + Quantized INT4/INT8 CPU execution, watermarked LRU memory governance, grammar-constrained decoding, and deterministic verification at <strong>$0 API cost</strong>:</p>
          <table class="param-table">
            <thead>
              <tr><th>Harness Plane</th><th>Subsystem</th><th>How It Powers SLM CLI Agent on Pure CPU</th></tr>
            </thead>
            <tbody>
              <tr>
                <td><strong>Plane 6</strong></td>
                <td><code>CascadeRouter</code> (&lt;35ms)</td>
                <td>Stage 2 (POSIX / Shell Intent Signature) & Stage 3 (1024-d Embedding Margin)</td>
              </tr>
              <tr>
                <td><strong>Plane 2 &amp; 5</strong></td>
                <td><code>MemoryArena</code> &amp; Hybrid CPU Runtime</td>
                <td>Specialist Role: <code>coding (Qwen2.5-Coder-1.5B INT4 / Qwen3-4B GGUF Q4_K_M)</code>. Managed inside Watermark LRU <code>MemoryArena</code> (<code>lite</code> 2.6 GB / <code>balanced</code> 4.7 GB / <code>power</code> 8.2 GB) with zero-copy session sharing and automatic OOM tier step-down (<code>8B -&gt; 4B -&gt; 3B -&gt; 0.8B</code>).</td>
              </tr>
              <tr>
                <td><strong>Plane 7 &amp; 8</strong></td>
                <td>Deterministic Verifier &amp; Governance</td>
                <td>Plane 8 Governance Risk Lattice (L0_PURE to L4_SYSTEM_OR_NET), Destructive Pattern Blocker, POSIX rlimit Sandbox & ApprovalBroker</td>
              </tr>
              <tr>
                <td><strong>Plane 1, 3 &amp; 4</strong></td>
                <td>Kernel, Artifact Scratchpad &amp; 4-Tier Memory</td>
                <td>SQLite WAL <code>CheckpointStore</code> (<code>/fork</code>, <code>/rewind</code>, <code>/undo</code>), content-addressed <code>artifact://&lt;sha12&gt;</code> handles to prevent prompt bloat, and hybrid SQLite FTS5 BM25 + HNSW vector memory.</td>
              </tr>
            </tbody>
          </table>
        </section>

        <!-- GIT CHECKOUT -->
        <section class="doc-section" id="git">
          <h2>04 / Source Checkout (Git Sparse-Checkout)</h2>
          <p>Clone this agent alongside the <strong>10-Plane Pure-CPU Harness (<code>slm_harness</code>)</strong> from the monorepo using Git sparse-checkout — no need to download all 26 agents:</p>

          <h3>Option 1 — Sparse Checkout with 10-Plane Harness (Recommended)</h3>
          <div class="code-panel" style="margin: 0.85rem 0;">
            <div class="code-header">
              <div class="code-dots"><div class="code-dot"></div><div class="code-dot"></div><div class="code-dot"></div></div>
              <div class="code-title">Terminal — Git Sparse Checkout</div>
            </div>
            <div class="code-content" style="display:block;">
              <pre><span style="color:#64748b;"># 1. Create and enter a new directory</span>
<span style="color:#34d399;">$</span> mkdir slm_cli_agent_workspace &amp;&amp; cd slm_cli_agent_workspace

<span style="color:#64748b;"># 2. Initialise empty git repo and add remote</span>
<span style="color:#34d399;">$</span> git init
<span style="color:#34d399;">$</span> git remote add origin https://github.com/t00114218-stack/SLMAgents.git

<span style="color:#64748b;"># 3. Enable sparse-checkout for both slm_harness and slm_cli_agent</span>
<span style="color:#34d399;">$</span> git sparse-checkout init --cone
<span style="color:#34d399;">$</span> git sparse-checkout set slm_harness slm_cli_agent

<span style="color:#64748b;"># 4. Pull the 10-Plane Harness and agent source</span>
<span style="color:#34d399;">$</span> git pull origin main</pre>
            </div>
          </div>

          <h3>Option 2 — Full Repository Clone</h3>
          <div class="code-panel" style="margin: 0.85rem 0;">
            <div class="code-header">
              <div class="code-dots"><div class="code-dot"></div><div class="code-dot"></div><div class="code-dot"></div></div>
              <div class="code-title">Terminal — Full Clone</div>
            </div>
            <div class="code-content" style="display:block;">
              <pre><span style="color:#34d399;">$</span> git clone https://github.com/t00114218-stack/SLMAgents.git
<span style="color:#34d399;">$</span> cd SLMAgents
<span style="color:#34d399;">$</span> ./slm doctor</pre>
            </div>
          </div>

          <p style="margin-top: 1.25rem; font-size: 0.86rem; color: var(--text-secondary); border-left: 2px solid #09090b; padding-left: 1rem;">
            <strong>Note:</strong> After checkout, install the harness and agent in editable mode with <code>pip install -e ./slm_harness -e ./slm_cli_agent</code> or download the pre-packaged OS Harness Installer above.
          </p>
        </section>

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        
        

        <section class="doc-section" id="config">
          <h2>05 / Configuration &amp; API Reference</h2>
          <h3>Constructor Parameters</h3>
          <table class="param-table">
            <thead><tr><th>Parameter</th><th>Type / Default</th><th>Description</th></tr></thead>
            <tbody>
              <tr><td>model_path</td><td>str | None</td><td>Explicit path to GGUF (Q4_K_M) or quantized ONNX model directory. Defaults to zero-copy sharing via the 10-Plane Harness MemoryArena.</td></tr>
              <tr><td>cache_dir</td><td>str | None</td><td>HF model directory path. Also settable via <span class="env-tag">SLM_CLI_AGENT_CACHE_DIR</span>.</td></tr>
              <tr><td>n_ctx</td><td>int | 2048</td><td>Context window size in tokens. Also settable via <span class="env-tag">SLM_CLI_AGENT_N_CTX</span>.</td></tr>
              <tr><td>n_threads</td><td>int | 4</td><td>CPU threads for the 10-Plane Pure-CPU Harness (auto-tuned to physical P-cores). Also settable via <span class="env-tag">SLM_CLI_AGENT_N_THREADS</span>.</td></tr>
                          <tr><td>system_prompt</td><td>str | None</td><td>Optional custom system prompt instructions overriding the default template.</td></tr>
              <tr><td>user_input</td><td>str | None</td><td>Optional additional user-supplied target parameters or variables.</td></tr>
</tbody>
          </table>

          <h3>generate_command() Parameters</h3>
          <table class="param-table">
            <thead><tr><th>Parameter</th><th>Type / Default</th><th>Description</th></tr></thead>
            <tbody>
              <tr><td>query</td><td>str</td><td><strong>Required.</strong> Natural language description of what you want to achieve.</td></tr>
              <tr><td>stream</td><td>bool | False</td><td>If True, enables token streaming of the model's explanation and thinking process. Returns a Python generator.</td></tr>
                          <tr><td>system_prompt</td><td>str | None</td><td>Optional custom system prompt instructions overriding the default template.</td></tr>
              <tr><td>user_input</td><td>str | None</td><td>Optional additional user-supplied target parameters or variables.</td></tr>
</tbody>
          </table>

          <div class="code-panel" style="margin: 0.85rem 0;">
            <div class="code-header"><div class="code-dots"><div class="code-dot"></div><div class="code-dot"></div><div class="code-dot"></div></div><div class="code-title">Python Quick Start</div></div>
            <div class="code-content" style="display:block;">
              <pre><code><span class="keyword">from</span> slm_cli_agent.cli_agent <span class="keyword">import</span> SLMCLIAgent
 
agent = <span class="function">SLMCLIAgent</span>()
 
<span class="comment"># Generate command from query</span>
cmd, explanation = agent.<span class="function">generate_command</span>(<span class="string">"find all files ending with .py in current folder"</span>)
<span class="function">print</span>(cmd)
<span class="comment"># Output: find . -name "*.py"</span></code></pre>
            </div>
          </div>

          <h3>Unified Command Execution (<code>run()</code>)</h3>
          <p>For convenience, you can translate and execute shell instructions in a single method call:</p>
          <div class="code-panel" style="margin: 0.85rem 0;">
            <div class="code-header"><div class="code-dots"><div class="code-dot"></div><div class="code-dot"></div><div class="code-dot"></div></div><div class="code-title">Unified Execution</div></div>
            <div class="code-content" style="display:block;">
              <pre><code>result = agent.<span class="function">run</span>(<span class="string">"list directory contents in clean format"</span>)
<span class="function">print</span>(f<span class="string">"Executed Command: {result['command']}"</span>)
<span class="function">print</span>(f<span class="string">"Success: {result['success']}"</span>)
<span class="function">print</span>(f<span class="string">"Output:\n{result['stdout']}"</span>)</code></pre>
            </div>
          </div>
        </section>

        <section class="doc-section" id="execution">
          <h2>Safe Command Execution</h2>
          <p>The CLI Agent provides a safe command execution API that screens script blocks for destructive patterns prior to invoking them in the local environment.</p>

          <div class="code-panel" style="margin: 0.85rem 0;">
            <div class="code-header"><div class="code-dots"><div class="code-dot"></div><div class="code-dot"></div><div class="code-dot"></div></div><div class="code-title">Executing Command</div></div>
            <div class="code-content" style="display:block;">
              <pre><code>code, stdout, stderr = agent.<span class="function">execute_command</span>(<span class="string">"echo 'Hello CLI Agent'"</span>)
<span class="function">print</span>(f<span class="string">"Return code: {code}"</span>)
<span class="function">print</span>(f<span class="string">"Stdout: {stdout}"</span>)</code></pre>
            </div>
          </div>

          <div class="warn-box">
            <strong>⚠ Dry-Run Checks:</strong> Destructive patterns (e.g. <code>rm -rf /</code>, <code>mkfs</code>, <code>dd if=</code>, <code>shutdown</code>) are caught by the protection engine, resulting in a return code of <code>-1</code> and an error returned to prevent command-line accidents.
          </div>
        </section>

        <section class="doc-section" id="pipeline">
          <h2>Complex Command Pipelines</h2>
          <p>The CLI Agent handles complex natural language requirements involving multiple nested operations, pipes, file redirections, and limits:</p>
          
          <div class="code-panel" style="margin: 0.85rem 0;">
            <div class="code-header"><div class="code-dots"><div class="code-dot"></div><div class="code-dot"></div><div class="code-dot"></div></div><div class="code-title">Pipeline Example</div></div>
            <div class="code-content" style="display:block;">
              <pre><code>query = (
    <span class="string">"Find all files in /var/log ending with .log modified in the last 7 days, "</span>
    <span class="string">"search them for the term 'ERROR' case-insensitively, count the matching "</span>
    <span class="string">"lines for each file, sort the count descending, and output the top 5 records "</span>
    <span class="string">"while ignoring permission denied errors."</span>
)
result = agent.<span class="function">run</span>(query)
<span class="function">print</span>(result[<span class="string">"command"</span>])</code></pre>
            </div>
          </div>

          <div class="tip-box">
            <strong>Resulting Bash Pipeline:</strong><br>
            <code>find /var/log -type f -name "*.log" -mtime -7 2>/dev/null | xargs grep -io "ERROR" 2>/dev/null | cut -d: -f1 | sort | uniq -c | sort -rn | head -n 5</code>
          </div>
        </section>

        <section class="doc-section" id="security">
          <h2>Security &amp; Hardening</h2>
          <div class="security-box">
            <strong>🔒 Restricted Access:</strong> While the agent blocks common destructive commands, always review the generated script before execution. It is highly recommended to run the agent in environment profiles with restricted write access and minimal administrative rights.
          </div>
        </section>

        <footer>
          <div class="footer-row">
            <div><strong style="color: var(--text-primary);">SLMAgents 2.0</strong> · Powered by the 10-Plane Pure-CPU Agent Harness (<code>slm_harness</code>) · MIT License</div>
            <div class="footer-links">
              <a href="index.html">Home</a>
              <a href="index.html#os-installers">OS Installers</a>
              <a href="chat.html">Chat Studio</a>
              <a href="playground.html">Playground</a>
              <a href="blogs.html">Blogs</a>
              <a href="https://github.com/t00114218-stack/SLMAgents" target="_blank">GitHub</a>
            </div>
          </div>
        </footer>
      </div>
    </main>
  </div>

  <script src="app.js?v=100.0"></script>
</body>
</html>