<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pedro Dias</title>
    <description>The latest articles on DEV Community by Pedro Dias (@pedro_dias).</description>
    <link>https://dev.to/pedro_dias</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3667154%2Fffc6cdb9-8399-4fad-a90e-ddbf5520b750.png</url>
      <title>DEV Community: Pedro Dias</title>
      <link>https://dev.to/pedro_dias</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pedro_dias"/>
    <language>en</language>
    <item>
      <title>Built an AI Terminal Assistant Because I Got Tired of Googling "Tar" Flags</title>
      <dc:creator>Pedro Dias</dc:creator>
      <pubDate>Wed, 17 Dec 2025 15:17:01 +0000</pubDate>
      <link>https://dev.to/pedro_dias/built-an-ai-terminal-assistant-because-i-got-tired-of-googling-tar-flags-dk8</link>
      <guid>https://dev.to/pedro_dias/built-an-ai-terminal-assistant-because-i-got-tired-of-googling-tar-flags-dk8</guid>
      <description>&lt;h3&gt;
  
  
  The Problem: Context Switching Kills Flow
&lt;/h3&gt;

&lt;p&gt;We've all been there. You're deep in a server debugging session, checking logs, and suddenly you need to construct a complex &lt;code&gt;sed&lt;/code&gt; command to filter a specific pattern. Or maybe you need to compress a directory but can't remember if it's &lt;code&gt;-czvf&lt;/code&gt; or &lt;code&gt;-xzvf&lt;/code&gt;.&lt;br&gt;
So you Alt-Tab, open a browser, Google it, copy the command, tab back, and paste it.&lt;br&gt;
This micro-context switch happens dozens of times a day. It breaks your flow. It's concise, but it adds up.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solution: An AI That Lives in Your Terminal
&lt;/h3&gt;

&lt;p&gt;I decided to solve this by building &lt;strong&gt;CLI Pal&lt;/strong&gt;, a server management platform with a twist: &lt;strong&gt;The AI Assistant lives directly inside your terminal interface.&lt;/strong&gt;&lt;br&gt;
It’s not just a chatbot. It’s a pair programmer for your infrastructure.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4nydvf1rasd54krlfz5g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4nydvf1rasd54krlfz5g.jpg" alt="Alt Text" width="800" height="482"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Screenshot of the split-pane interface)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works
&lt;/h3&gt;

&lt;p&gt;The interface is a split-pane view (&lt;code&gt;xterm.js&lt;/code&gt; on the right, AI Chat on the left). Here is why it's better than just using ChatGPT:&lt;/p&gt;

&lt;h4&gt;
  
  
  It Can "See" Your Screen
&lt;/h4&gt;

&lt;p&gt;When you ask for help, the AI (powered by LLMs) receives the last few lines of your terminal output as context. If you get a cryptic error message, you don't even have to copy-paste it. You just ask, &lt;em&gt;"Why did that fail?"&lt;/em&gt; and the AI already knows.&lt;/p&gt;

&lt;h4&gt;
  
  
  It Knows Your Server Specs
&lt;/h4&gt;

&lt;p&gt;The backend automatically injects system context into the prompt before sending it to the AI. The agent knows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Your OS and Version (e.g., Ubuntu 22.04)&lt;/li&gt;
&lt;li&gt;  CPU Architecture (x86_64 vs ARM)&lt;/li&gt;
&lt;li&gt;  Current RAM and Disk usage
This means if you ask &lt;em&gt;"How do I install Redis?"&lt;/em&gt;, it won't give you &lt;code&gt;yum&lt;/code&gt; commands for an Ubuntu server. It gives you &lt;code&gt;apt-get&lt;/code&gt;, tailored exactly to your environment.&lt;/li&gt;
&lt;li&gt;One-Click Execution
The AI responds with structured JSON that renders as Markdown. Code blocks come with a distinct "Run" button. You can review the command and execute it directly in the connected terminal socket with a single click. No copy-pasting required.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Under the Hood
&lt;/h4&gt;

&lt;p&gt;For the curious, here is the tech stack making this possible:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Frontend:&lt;/strong&gt; &lt;code&gt;xterm.js&lt;/code&gt; for the terminal emulator + &lt;code&gt;xterm-addon-fit&lt;/code&gt; for responsive resizing.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Backend:&lt;/strong&gt; A PHP WebSocket server (using &lt;code&gt;Ratchet&lt;/code&gt;) handles the persistent SSH stream.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;AI Layer:&lt;/strong&gt; A custom PHP &lt;code&gt;Agent&lt;/code&gt; class that constructs prompts with:

&lt;ul&gt;
&lt;li&gt;  System Context (OS, Hardware)&lt;/li&gt;
&lt;li&gt;  Terminal Buffer (The last N lines of output)&lt;/li&gt;
&lt;li&gt;  User Query&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Try It Out
&lt;/h3&gt;

&lt;p&gt;I built this primarily to scratch my own itch, but it's now open for others. If you want to stop Googling regex patterns and start just &lt;em&gt;doing&lt;/em&gt; them, check it out.&lt;/p&gt;

&lt;p&gt;Let me know what you think! Does having an AI in your terminal sound useful, or do you prefer the manual way?&lt;/p&gt;

</description>
      <category>devops</category>
      <category>ai</category>
      <category>productivity</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
