ghost.py: My Terminal Is Haunted (and It Remembers Me)
Description and use
ghost.py turns your terminal into an interactive ghost that remembers commands, reacts to failures, and writes personalized epitaphs, powered by a local Gemma 3 1B model.
Problem
Shell commands are executed without contextual feedback or memory, making it hard to recall past actions or receive engaging responses.
Outcome
ghost.py provides an engaging, memory‑aware terminal experience using a local 1B LLM, preserving privacy and requiring no internet.
Workflow
- Run ghost.py with a chosen ghost persona via environment variable or flag.
- ghost.py executes the user command with subprocess and prints output.
- It builds a prompt including persona, current mood, and past session memories.
- Sends the prompt to the local Ollama /api/chat endpoint and streams the reply token‑by‑token with a typewriter delay.
- On exit, ghost.py asks for an epitaph, appends it to ~/.ghost/graveyard.md, and saves recent commands to ~/.ghost/memory.json for the next session.
Evidence
ghost.py possesses your shell. You run commands through it as usual, and after each one a ghost whispers back about what you just did.
It remembers you. Close the terminal, come back tomorrow, and the ghost greets you by recalling commands from your last visit.
Every failed command raises the haunting intensity, from calm to uneasy to furious. At full fury the screen flickers.
One Python file, standard library only, talking to Ollama's local /api/chat endpoint.
- Record date: 2026-11-01T17:28:44.478Z