ghost.py: My Terminal Is Haunted (and It Remembers Me)
说明与用途
ghost.py 将终端变成一个互动的幽灵,记住命令、对错误做出反应,并写下个性化的墓志铭,使用本地 Gemma 3 1B 模型。
问题
Shell commands are executed without contextual feedback or memory, making it hard to recall past actions or receive engaging responses.
结果
ghost.py provides an engaging, memory‑aware terminal experience using a local 1B LLM, preserving privacy and requiring no internet.
工作流
- 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.
证据
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.
- 记录日期: 2026-11-01T17:28:44.478Z