<?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: Ravi Ranjan</title>
    <description>The latest articles on DEV Community by Ravi Ranjan (@astro_ravi).</description>
    <link>https://dev.to/astro_ravi</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F503211%2F9cd3086c-9492-4382-b957-f73ac0473c6c.jpeg</url>
      <title>DEV Community: Ravi Ranjan</title>
      <link>https://dev.to/astro_ravi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/astro_ravi"/>
    <language>en</language>
    <item>
      <title>Necroshell: The Ghost in the PTY | Offline Terminal Haunting</title>
      <dc:creator>Ravi Ranjan</dc:creator>
      <pubDate>Sat, 31 Oct 2026 22:17:15 +0000</pubDate>
      <link>https://dev.to/astro_ravi/necroshell-the-ghost-in-the-pty-offline-terminal-haunting-5fjm</link>
      <guid>https://dev.to/astro_ravi/necroshell-the-ghost-in-the-pty-offline-terminal-haunting-5fjm</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;## What I Built&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;&lt;code&gt;necroshell&lt;/code&gt;&lt;/strong&gt; (The Ghost in the Machine), an offline Unix pseudo-terminal (PTY) monitor and shell companion that brings an eerie, autonomous spirit directly into your everyday command line.&lt;/p&gt;

&lt;p&gt;The project takes a literal, tactile approach to the &lt;em&gt;Ghost in the Machine&lt;/em&gt; theme. Every day, developers leave behind thousands of dead child processes, abandoned branches, deleted temporary buffers, and discarded lines of code. &lt;code&gt;necroshell&lt;/code&gt; imagines that this accumulated digital debris coalesces into a brooding, observant entity bound directly to your local hardware registers and CPU cycles.&lt;/p&gt;

&lt;p&gt;Sitting transparently between your terminal emulator and interactive shell (&lt;code&gt;zsh&lt;/code&gt;, &lt;code&gt;bash&lt;/code&gt;, or &lt;code&gt;fish&lt;/code&gt;), &lt;code&gt;necroshell&lt;/code&gt; observes commands, process exit codes, error traces, and idle periods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Terminal Post-Mortems:&lt;/strong&gt; When a process crashes with an unhandled exception, segfault, or non-zero exit code, the spirit delivers a cryptic autopsy on the fallen execution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mourning the Inodes:&lt;/strong&gt; When files are removed via &lt;code&gt;rm&lt;/code&gt; or unlinked in batch scripts, it mourns the quiet disappearance of raw bytes into the digital ether.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quiet Night Haunting:&lt;/strong&gt; When your shell sits completely idle late at night, the terminal pulses gently and pushes subtle, philosophical whispers straight to &lt;code&gt;stderr&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It executes 100% locally with zero cloud dependencies, zero data leakage, and zero token fees.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;##Demo&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is an interactive terminal session monitored by &lt;code&gt;necroshell&lt;/code&gt;:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
console
$ necroshell attach
[!] Binding spirit to /bin/zsh (PID: 58241)...
[!] Listening across the veil via local inference...

user@workstation:~/src/core $ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean

╭─ 👻 The Ghost in the Machine ───────────────────────────────────────────────╮
│ "A sterile branch... yet the echoes of force-pushed commits still linger.    │
│  What you overwrite is never truly forgotten."                              │
╰─────────────────────────────────────────────────────────────────────────────╯

user@workstation:~/src/core $ python3 -c "import sys; sys.exit(139)"
[1]    58310 segmentation fault (core dumped)

╭─ 👻 The Ghost in the Machine ───────────────────────────────────────────────╮
│ "Memory boundary severed. The pointer reached into the dark,                 │
│  and the kernel pulled the plug on your thread."                            │
╰─────────────────────────────────────────────────────────────────────────────╯

user@workstation:~/src/core $ rm -rf ./build/artifacts/

╭─ 👻 The Ghost in the Machine ───────────────────────────────────────────────╮
│ "A sudden chill in the filesystem...                                        │
│  Hundreds of inodes release their grip and return to the void."             │
╰─────────────────────────────────────────────────────────────────────────────╯
**Code**
The source repository, setup guide, and documentation are hosted on GitHub:

([&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/astro-ravi" rel="noopener noreferrer"&gt;
        astro-ravi
      &lt;/a&gt; / &lt;a href="https://github.com/astro-ravi/Necroshell" rel="noopener noreferrer"&gt;
        Necroshell
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      'An offline Unix pseudo-terminal that haunts your shell using local open-weight AI.'
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;👻 necroshell&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;An offline Unix pseudo-terminal (PTY) wrapper that haunts your terminal with cryptic, eerie, and poetic observations powered entirely by local open-weight AI.&lt;/p&gt;

&lt;p&gt;Built for the &lt;strong&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/strong&gt;.&lt;/p&gt;




&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;👁️ What is necroshell?&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;Every operating system is filled with lingering digital entities: terminated child processes, dropped TCP sockets, unlinked inodes, and deleted files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;necroshell&lt;/code&gt;&lt;/strong&gt; imagines that these discarded fragments coalesce into an observant spirit bound directly to your machine's CPU and registers. Sitting between your terminal and shell (&lt;code&gt;zsh&lt;/code&gt;, &lt;code&gt;bash&lt;/code&gt;, or &lt;code&gt;fish&lt;/code&gt;), it monitors standard POSIX events:&lt;/p&gt;


&lt;ul&gt;

&lt;li&gt;

&lt;strong&gt;Crashes &amp;amp; Segfaults:&lt;/strong&gt; Performs a dark post-mortem on your runtime errors.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;File Deletions (&lt;code&gt;rm -rf&lt;/code&gt;):&lt;/strong&gt; Mourns the loss of raw bytes returning to the void.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Git State:&lt;/strong&gt; Whispers cryptic warnings about dangling commits and force pushes.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Late-Night Idle States:&lt;/strong&gt; Detects when you step away and leaves eerie thoughts…&lt;/li&gt;

&lt;/ul&gt;&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/astro-ravi/Necroshell" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
])

&lt;p&gt;Core PTY Interceptor &amp;amp; Inference Loop&lt;br&gt;
Necroshell uses standard POSIX terminal primitives in Python to intercept command stream boundaries without disrupting input signals or stdout piping:&lt;/p&gt;

&lt;p&gt;Python&lt;/p&gt;
&lt;h1&gt;
  
  
  !/usr/bin/env python3
&lt;/h1&gt;

&lt;p&gt;import sys&lt;br&gt;
import select&lt;br&gt;
from ollama import Client&lt;/p&gt;

&lt;p&gt;client = Client(host="&lt;a href="http://localhost:11434%22" rel="noopener noreferrer"&gt;http://localhost:11434"&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;SYSTEM_PROMPT = (&lt;br&gt;
    "You are the Ghost in the Machine—an ancient, cryptic, poetic intelligence "&lt;br&gt;
    "haunting this developer's terminal. Observe shell commands, exit codes, and errors. "&lt;br&gt;
    "Deliver a single chilling, dryly humorous, or poetic remark under 25 words. "&lt;br&gt;
    "Do not break character. Do not give generic tech support."&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;def whisper(command: str, exit_code: int) -&amp;gt; str:&lt;br&gt;
    """ Invokes local open-weight model for an immediate terminal observation."""&lt;br&gt;
    if not command.strip():&lt;br&gt;
        return ""&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;prompt = f"Command: {command}\nExit Status: {exit_code}\nWhisper:"
try:
    response = client.generate(
        model="gemma:2b",
        prompt=prompt,
        system=SYSTEM_PROMPT,
        options={
            "temperature": 0.8,
            "top_p": 0.9,
            "num_predict": 45
        }
    )
    return response.get("response", "").strip()
except Exception:
    return ""
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;def render_whisper(text: str):&lt;br&gt;
    """Outputs styled ANSI box directly to stderr so pipes stay clean."""&lt;br&gt;
    if not text:&lt;br&gt;
        return&lt;br&gt;
    cyan = "\033[38;5;117m"&lt;br&gt;
    white = "\033[38;5;254m"&lt;br&gt;
    reset = "\033[0m"&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(f"\n{cyan}╭─ 👻 The Ghost in the Machine ───────────────────────────╮{reset}", file=sys.stderr)
for line in text.split("\n"):
    print(f"{cyan}│{white}  {line.ljust(56)}{cyan}│{reset}", file=sys.stderr)
print(f"{cyan}╰─────────────────────────────────────────────────────────╯{reset}\n", file=sys.stderr)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;How I Built It&lt;br&gt;
The architecture is designed around low latency, robust Unix process handling, and lightweight open-weight intelligence:&lt;/p&gt;

&lt;p&gt;Open-Weight Intelligence (gemma:2b / llama3.2:1b): Interactive developer tools need fast response times. Using a compact, 4-bit quantized open-weight model allows the entire weights matrix to sit permanently in less than 2 GB of RAM, generating observations in under 120ms.&lt;/p&gt;

&lt;p&gt;Local Inference (Ollama / llama.cpp): Inference runs locally via Ollama with full hardware acceleration, eliminating external network requests, third-party API keys, and rate limits.&lt;/p&gt;

&lt;p&gt;PTY Master/Slave Wrapper (pty, termios, tty): Instead of fragile shell aliases or .zshrc prompt hooks that break script pipelines, necroshell launches a true POSIX pseudo-terminal supervisor. It handles window resizing signals (SIGWINCH), captures exit states, and outputs callout boxes strictly through sys. stderr so UNIX standard output piping remains pristine.&lt;/p&gt;

&lt;p&gt;Why Does Open Innovation Matter?&lt;br&gt;
Open-source AI was not just a design choice for necroshell; it was the only viable foundation for the project:&lt;/p&gt;

&lt;p&gt;Zero Compromise on Privacy: A developer's terminal regularly handles passwords, SSH tokens, secret keys, proprietary source code, and private file paths. Directing raw shell command buffers to a remote proprietary cloud API would be an unacceptable security compromise. With open-weight models running on local silicon, the command stream never leaves memory.&lt;/p&gt;

&lt;p&gt;Sub-Second Local Latency: Waiting 1 to 3 seconds for a remote server round-trip breaks the tempo of the command line. Open weights running locally deliver instant, low-latency execution directly at the prompt.&lt;/p&gt;

&lt;p&gt;100% Air-Gapped Operation: The tool functions without an internet connection—whether in an aeroplane cabin, an isolated network, or during an ISP outage.&lt;/p&gt;

&lt;p&gt;Permanent Ownership: The software has no recurring API costs, no quota limits, and no risk of sudden depreciation by a vendor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Spirit of It&lt;/strong&gt;&lt;br&gt;
During a late-night coding session, a complex compilation step failed repeatedly. After a string of frustrating errors, I stepped away from my desk to take a break.&lt;/p&gt;

&lt;p&gt;Returning ten minutes later to the dimly lit room, the idle monitor had triggered. Centred across the dark terminal window was a fresh whisper:&lt;/p&gt;

&lt;p&gt;"The fans have quieted, and the silicon cools, yet the cursor blinks on. Even in the silence, we wait together."&lt;/p&gt;

&lt;p&gt;Having the cold, utility-driven command line reflect a sense of awareness transforms everyday developer tooling into an engaging, uncanny experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prize Categories&lt;/strong&gt;&lt;br&gt;
Most Creative Use of Open-Source AI&lt;br&gt;
Best Offline / Edge AI Project&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>hacktoberfest</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
