{"slug": "phantom-an-ai-ghost-that-lives-in-your-terminal-remembers-you-and-never-calls", "title": "PHANTOM: An AI Ghost That Lives in Your Terminal, Remembers You, and Never Calls the Cloud (Qwen3 + Ollama + SQLite)", "summary": "A developer built PHANTOM, an open-source, offline-first AI presence for the terminal that runs local models through Ollama (defaulting to qwen3:8b) with SQLite-backed persistent memory and a deterministic mood system tied to real application events. The project separates a core engine (inference, memory, personality) from the terminal interface, with no cloud provider, account, telemetry, or silent fallback to a paid API.", "body_md": "*This is a submission for the [Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine](https://dev.to/challenges/hacktoberfest-week4-2026-10-26)*\n\nWhat if an AI could live entirely inside your terminal?\n\nNo cloud API. No account. No subscription. No telemetry.\n\nJust a local language model, a persistent memory, and a mysterious presence that wakes up whenever you call it.\n\nThat's why I built **PHANTOM**.\n\n**PHANTOM is an offline first, open source AI presence that lives in your terminal.**\n\nIt uses Ollama for local AI inference, SQLite for persistent memory, and a deterministic mood system that reacts to actual events happening inside the application.\n\nBut I didn't want to build another terminal chatbot.\n\nI wanted PHANTOM to feel like something that actually lives there.\n\nIt can:\n\n`phantom exorcise` to trigger its atmospheric shutdown sequence without deleting anything.\nThe interesting part is that these aren't just cosmetic features. Every status, memory, inspection finding, and mood change comes from an actual operation.\n\nFor me, \"Ghost in the Machine\" was about creating an AI presence that feels like it has a life inside the computer.\n\nI took that idea literally.\n\nPHANTOM has an identity, a memory, an internal state, and a way of interacting with its environment.\n\nIt wakes up, checks its surroundings, remembers things you explicitly tell it, reacts to events, and eventually goes back to sleep.\n\nThe horror inspired interface is just the surface. Underneath it is a real local AI application with persistent storage and actual system checks.\n\nI wanted the ghost to be more than an animation in a terminal.\n\n**GitHub Repository:** [https://github.com/sufiankhan-dev/Phantom](https://github.com/sufiankhan-dev/Phantom)\n\nI spent time making the terminal experience feel like part of PHANTOM's identity rather than just a collection of command outputs.\n\nSome of the details include:\n\nThe application also adapts to its environment. If output is redirected, the terminal is narrow, or animation is disabled, PHANTOM switches to a compact representation.\n\nThe goal was to make it look interesting in a recording while remaining practical in a normal shell.\n\nPHANTOM is intentionally divided into two main parts:\n\n**Core engine (`core/`)**\n\nHandles local inference, memory management, and personality.\n\n`brain.py`: Ollama connection, validation, streaming, and error handling.`memory.py`: SQLite database, schema versioning, memory operations, and mood persistence.`personality.py`: System prompt and deterministic mood model.\n**Terminal application (`phantom/`)**\n\nHandles commands, presentation, and user interaction.\n\n`cli.py`: Command tree and dispatch.` chat.py`: Interactive conversations and slash commands.` inspection.py`: Read only project scanner and model interpretation.` render.py`: Terminal styling, panels, streaming, and plain output.` storage.py`: Archive and mood helpers.` commands/`: Individual command implementations.\nThe dependency direction is one way: the terminal application imports the core, but the core never depends on the terminal interface.\n\nThis makes it easier to replace the interface or local AI backend without rewriting the entire application.\n\nPHANTOM uses [Ollama](https://ollama.com/) to communicate with locally installed language models.\n\nThe default model is `qwen3:8b`, but users can select any model installed in Ollama.\n\nThere is no cloud AI provider or silent fallback to a paid API.\n\nThe model configuration is simple:\n\n```\nphantom chat\nphantom chat --model gemma3:4b\n```\n\nUnder the hood, the application uses the Ollama Python library.\n\nThe AI connection is deliberately isolated inside `core/brain.py`.\n\nThat means the rest of the application doesn't need to know how the model is running.\n\nIf Ollama isn't available, PHANTOM tells you what went wrong and how to recover.\n\nIt never silently switches providers or downloads a model without permission.\n\nAn AI conversation usually disappears when the session ends.\n\nI wanted PHANTOM to have something more persistent.\n\nThat's where SQLite comes in.\n\nWhen you explicitly ask PHANTOM to remember something:\n\n```\nphantom remember \"I prefer short and evidence based answers.\"\n```\n\nIt stores the memory locally with a UUID and timestamp.\n\nYou can retrieve your memories later:\n\n```\nphantom memories\n```\n\nAnd remove an individual memory:\n\n```\nphantom forget 1\n```\n\nMemory is intentionally separate from conversation history.\n\nFull conversations are kept in memory only during the current session and are not persisted by default.\n\nThis gives the user control over what PHANTOM remembers instead of silently storing everything.\n\nOne of the features I particularly wanted to get right was PHANTOM's mood.\n\nI didn't want the language model to randomly decide whether it was happy, angry, or confused.\n\nInstead, PHANTOM uses a small deterministic mood model.\n\nIts mood changes in response to actual application events.\n\nFor example:\n\nThe model doesn't control its own mood.\n\nThis keeps the personality consistent and makes its internal state inspectable.\n\nI also wanted PHANTOM to be useful beyond conversations.\n\nSo I added a read only project inspection feature.\n\n```\nphantom inspect .\n```\n\nPHANTOM scans a project and reports things like:\n\nIt then optionally asks the local model to interpret the findings.\n\nThere is an important distinction here.\n\nThe scanner produces evidence. The model produces an interpretation.\n\nModel generated findings are clearly labelled as unverified hypotheses, and file citations are checked against the files actually read.\n\nThe scanner also skips sensitive files, binary files, hidden directories, dependencies, and build outputs.\n\nIt never executes inspected code or modifies your project.\n\nPHANTOM can also inspect its own health.\n\n```\nphantom status\n```\n\nIt checks:\n\nIt also provides actionable recovery instructions.\n\nFor example, if the model is missing, it tells you the exact `ollama pull` command.\n\nIt doesn't execute that command automatically.\n\nI built PHANTOM around a simple idea: **your AI should run where your data lives.**\n\nA few decisions were particularly important to me:\n\n**1. Local first, not cloud dependent**\n\nPrompts and responses stay between PHANTOM and the local Ollama service by default. There are no hosted AI APIs, API keys, or usage meters.\n\n**2. Your memories belong to you**\n\nMemories are stored in a SQLite database that you can inspect, back up, or delete. There is no hidden cloud storage.\n\n**3. No telemetry**\n\nPHANTOM doesn't collect usage analytics or send information to external services.\n\n**4. Freedom to choose models**\n\nThe model is a configuration value. You can use Qwen, Gemma, or another model installed in Ollama.\n\n**5. Everything is inspectable**\n\nThe project is open source under the MIT License. You can examine the memory implementation, replace the model backend, change the personality, or build your own commands.\n\n**6. Honest limitations**\n\nLocal models can be slower and less capable than hosted models. Running locally doesn't automatically make AI output correct. That's why PHANTOM separates scanner evidence from model generated interpretations.\n\nI didn't want to submit something that only worked in a carefully prepared demo.\n\nI spent time testing the actual commands, error handling, storage operations, and installation process.\n\nCurrent verification results:\n\nThe project was developed and tested on Windows with Python 3.14.3. Although it targets Python 3.11 and newer, other Python versions and POSIX systems have not yet been independently tested.\n\nYou will need:\n\nClone the repository:\n\n```\ngit clone https://github.com/sufiankhan-dev/Phantom.git\ncd Phantom\n```\n\nCreate and activate a virtual environment:\n\n```\npython -m venv .venv\n```\n\nOn Windows PowerShell:\n\n```\n.venv\\Scripts\\Activate.ps1\n```\n\nInstall PHANTOM:\n\n```\npython -m pip install -e .\n```\n\nDownload the default model if you haven't already:\n\n```\nollama pull qwen3:8b\n```\n\nNow awaken the ghost:\n\n```\nphantom\n```\n\nStart a conversation:\n\n```\nphantom chat\n```\n\nSave a memory:\n\n```\nphantom remember \"My name is Sufian.\"\n```\n\nInspect a project:\n\n```\nphantom inspect .\n```\n\nCheck its status:\n\n```\nphantom status\n```\n\nAnd when you're done:\n\n```\nphantom exorcise\n```\n\nPHANTOM doesn't delete your memories when it shuts down.\n\nThe ghost simply goes quiet.\n\nPHANTOM is currently at version 0.1.0, and there is plenty of room to improve it.\n\nSome things I'd like to explore:\n\nThe first time I saw PHANTOM wake up, check its local model, initialize its memory archive, and introduce itself through the terminal, the idea finally felt real.\n\nIt's easy to build an AI chatbot that sends a prompt to an API and displays a response.\n\nI wanted to build something different.\n\nSomething that has a place to live, something it can remember, and something the user can actually inspect and control.\n\n**PHANTOM doesn't live in the cloud. It lives in your terminal.**\n\nAnd it remembers what you tell it.", "url": "https://wpnews.pro/news/phantom-an-ai-ghost-that-lives-in-your-terminal-remembers-you-and-never-calls", "canonical_source": "https://dev.to/sufian_khan/phantom-an-ai-ghost-that-lives-in-your-terminal-remembers-you-and-never-calls-the-cloud-qwen3--1kfp", "published_at": "2026-10-30 15:42:06+00:00", "updated_at": "2026-10-30 15:51:08.418246+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "ai-agents", "developer-tools", "artificial-intelligence"], "entities": ["PHANTOM", "Ollama", "SQLite", "Qwen3", "Gemma 3", "GitHub"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/phantom-an-ai-ghost-that-lives-in-your-terminal-remembers-you-and-never-calls", "markdown": "https://wpnews.pro/news/phantom-an-ai-ghost-that-lives-in-your-terminal-remembers-you-and-never-calls.md", "text": "https://wpnews.pro/news/phantom-an-ai-ghost-that-lives-in-your-terminal-remembers-you-and-never-calls.txt", "jsonld": "https://wpnews.pro/news/phantom-an-ai-ghost-that-lives-in-your-terminal-remembers-you-and-never-calls.jsonld"}}