DEV Community

Aryan Vijaykar
Aryan Vijaykar

Posted on

I Haunted My Own Terminal with a Local Gemma Model (No Internet Required)

What I Built

ghostshell is a tiny shell hook that lets a ghost live in your terminal. Every time you run a command, a local open-weight model reads it and whispers one eerie sentence back.

$ rm -rf node_modules
đź‘» Another soul sent to the void... they always come back, you know.

$ git push --force
đź‘» Rewriting history is a dangerous game. The past remembers.

It runs entirely on my laptop with Ollama and Google’s Gemma. There’s no API key and no cloud, and it works with the Wi-Fi off.

How I Interpreted the Theme

“Ghost in the Machine” is almost literal here: a spirit living inside your shell. It also fits the idea of the past lingering, because your command history is a record of everything you’ve done. The ghost reads it and remembers.

How It Works

The whole thing is one bash function. After each command, it grabs the last line from history, sends it to the local model, and prints the reply in dim purple.

bash

~/.ghostshell.sh

ghost_whisper() {
local last
last=$(history 1 | sed 's/^ [0-9] *//')
[ -z "$last" ] && return

curl -s --max-time 5 http://localhost:11434/api/generate \
-d "$(jq -n --arg c "$last" '{
model: "gemma3:4b",
stream: false,
prompt: ("You are a mischievous ghost haunting a terminal. In ONE eerie sentence (max 20 words), whisper about this command: " + $c)
}')" | jq -r '.response' | sed $'s/^/\e[2;35mđź‘» /; s/$/\e[0m/'
}

PROMPT_COMMAND="ghost_whisper"

Setup takes three steps:

bash
ollama pull gemma3:4b
echo 'source ~/.ghostshell.sh' >> ~/.bashrc
source ~/.bashrc

The --max-time 5 timeout keeps a slow model from freezing the prompt.

Why Open Innovation Mattered Here

This project only makes sense with open weights:

Privacy: a shell hook sees everything you type, including paths, internal hostnames, and the occasional accidentally pasted secret. With a cloud API, every command would leave my machine. With a local model, nothing does.
It works offline: I tested it with Wi-Fi off, and the ghost still whispered. A hosted API would have gone silent.
It costs nothing: it fires on every command, so with a paid API that would be hundreds of calls a day. Locally, it’s free.
I could change its personality: swapping the system prompt turned the ghost from spooky to sarcastic to a “disappointed senior engineer.” I could also swap models, and I tried [other model, e.g. a smaller one for speed] to compare latency.

What I Learned

Prompt length matters: without “ONE sentence, max 20 words,” the model wrote ghost-story essays after every ls.

GitHub logo aryan-vijaykar / OpenAI-ChatBot

A production-oriented DevSecOps project for deploying an OpenAI-powered chatbot using Docker, Jenkins CI/CD, SonarQube, OWASP Dependency-Check, Trivy, Terraform, and Amazon EKS. The project demonstrates automated security scanning, containerization, infrastructure provisioning, and Kubernetes-based deployment on AWS.

DevSecOps: OpenAI Chatbot UI Deployment in EKS with Jenkins and Terraform

text

Introduction:

In today’s digital world, user engagement is key to the success of any application. Implementing DevSecOps practices is essential for ensuring security, reliability, and efficient deployment processes. In this project, we aim to implement DevSecOps for deploying an OpenAI Chatbot UI. We will use Kubernetes (EKS) for container orchestration, Jenkins for Continuous Integration/Continuous Deployment (CI/CD), and Docker for containerization.

What is ChatBOT?

ChatBOT is an AI-powered conversational agent trained on extensive human conversation data. It utilizes natural language processing techniques to understand user queries and provide human-like responses. By simulating natural language interactions, ChatBOT enhances user engagement and provides personalized assistance to users.

Why ChatBOT?

1. Personalized Interactions: ChatBOT enables personalized interactions by understanding user queries and responding in a conversational manner, fostering engagement and satisfaction.

2. 24/7 Availability: Unlike human agents, ChatBOT is available 24/7, ensuring instant…

What’s Next

Ideas for later: remembering your command history across sessions so the ghost can say “you ran this last Tuesday too…”, and a Día de los Muertos mode that gives each deleted file a small ofrenda-style farewell.

Top comments (0)