{"slug": "phantom-files-uncovering-the-machine-ghost-with-local-open-weight-ai", "title": "Phantom Files: Uncovering the Machine Ghost with Local Open-Weight AI", "summary": "A developer built Phantom Files, an open-source, local-first application that analyzes text files such as logs, READMEs and telemetry and generates fictional paranormal case dossiers grounded in verbatim excerpts from the source. The tool runs Qwen2.5 models via Ollama on consumer CPUs under 3 GB of RAM, and pairs a hardened file reader that rejects binaries and sanitizes prompt-injection delimiters with an evidence extractor that maps anomalies to exact line numbers so the model cannot fabricate quotes.", "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\n## \n  \n  \n  What I Built\n\n*\"Every file has a story. Some should never have been opened.\"*\n\n**Phantom Files** is an open-source, local-first paranormal forensic workbench that analyzes text files (`.txt`, `.log`, `.md`) and crafts fictional, suspenseful case dossiers inspired by their contents.\n\nComputing terminology is steeped in occult and supernatural lore: we spawn `daemons`, terminate `zombie` processes, diagnose `fatal` memory corruptions, and debug `deadlocks` at 03:33:00 UTC. For Week 4's **\"Ghost in the Machine\"** theme, Phantom Files takes this metaphor literally. It treats everyday technical failures, legacy documentation, and intercepted transmissions as potential digital hauntings—relics of an algorithmic spirit trapped in the machine.\n\n### \n  \n  \n  Key Capabilities:\n\n- \n**Three Investigation Personas:**  1. \n**Haunted Logs:** Analyzes server crashes and daemon monitors for techno-spectral residue.\n  2. \n**Cursed README:** Performs digital archaeology on abandoned documentation, deprecation warnings, and cryptic commit traces.\n  3. \n**Unknown Transmission:** Deciphers intercepted telemetry, signal drops, and cosmic radio static.\n- \n**Strict Evidence Grounding:** To avoid AI hallucinations masquerading as reality, the engine deterministically extracts verbatim substrings from the source file with exact line numbers. The narrative is forced to ground its paranormal theory in these verified facts.\n- \n**Horror Intensity Dial:** Ranges from*Mild Mystery* (subtle, twilight atmosphere) to*Atmospheric Horror* (creeping psychological dread) and*Dark Sci-Fi* (cosmic void / machine ghost).\n- \n**Retro-Terminal UI:** A nostalgic cathode-ray phosphor green and purple Streamlit interface complete with an ASCII ghost banner, side-by-side evidence inspection, and one-click dossier export (`.md` and`.txt` ).\n\n## \n  \n  \n  Demo\n\n## \n  \n  \n  Code\n\n### \n      Phantom Files: An Open-Source AI Haunted File Investigator for Hacktoberfest 2026\n    \n\n \n\n# 👻 Phantom Files\n\n*\"Every file has a story. Some should never have been opened.\"*\n\n**Phantom Files** is an open-source, local-first AI application that analyzes user-supplied text files (`.txt`, `.log`, `.md`) and generates fictional, atmospheric paranormal case dossiers grounded strictly in the factual text of the files.\n\nBuilt for the **Hacktoberfest 2026 DEV Open-Source AI Challenge, Week 4: “Ghost in the Machine”**.\n\n## 📸 Interface Preview\n\n \n \n## \n  \n  \n  How I Built It\n\nPhantom Files was built with a modular, security-hardened Python architecture:\n\n1. \n**Local Open-Weight Model (Qwen2.5):**  - Inference runs via **[Ollama](https://ollama.com)** using open-weight models such as**`qwen2.5:3b`** (or` qwen2.5:7b` ), released under the permissive**Apache 2.0 license** .\n  - With an active memory footprint under 3 GB RAM, the model runs smoothly on commodity consumer CPUs and laptops without requiring enterprise cloud GPUs.\n2. \n**Safe File Processing (`SafeFileReader`):**  - Strictly validates file extensions (`.txt` ,`.log` ,`.md` ), enforces a 1MB size ceiling, rejects binary null bytes (`\\x00` ), and sanitizes delimiters to neutralize prompt injection attacks.\n  - Files are treated strictly as inert, passive text strings—never executed or evaluated via `eval()` ,`exec()` , or shell subprocesses.\n3. \n**Verbatim Evidence Verification (`EvidenceExtractor`):**  - Scans the document using regex pattern heuristics for anomalous markers (e.g., segfaults, midnight time windows, orphan PIDs).\n  - Maps each anomaly to its exact line number and uses literal substring validation so the LLM cannot hallucinate false quotes.\n4. \n**Structured JSON Engine (`InvestigationEngine`):**  - Feeds evidence into mode-specific prompt templates with strict system guardrails.\n  - Enforces valid JSON outputs containing: `case_title` ,`case_summary` ,`noteworthy_events` ,`unusual_patterns` ,`paranormal_interpretation` ,`investigation_questions` , and`suspenseful_conclusion` .\n5. \n**Dossier Exporter (`ReportExporter`):**  - Generates downloadable GitHub-Flavored Markdown and retro-terminal formatted Plain Text dossiers with clear safety disclaimers separating fiction from fact.\n6. \n**Testing & Quality Assurance:**  - 22 automated unit tests using `pytest` cover file validation, prompt injection containment, evidence accuracy, and mocked Ollama responses—passing 100% offline.\n\n## \n  \n  \n  Why Does Open Innovation Matter?\n\nWhen dealing with application logs, system crashes, and internal project documentation, **privacy and trust are non-negotiable**.\n\nProduction logs regularly contain sensitive telemetry: internal hostnames, cluster IP addresses, database schemas, and stack traces. Uploading those logs to commercial, closed-source cloud APIs creates serious data exfiltration risks and vendor lock-in.\n\nOpen-weight models and local inference through Ollama make Phantom Files possible by providing:\n\n1. \n**Absolute Data Privacy:** File contents never leave the user's local machine or local loopback (`127.0.0.1` ).\n2. \n**Offline Resilience:** The application operates seamlessly in air-gapped server rooms, on flights, or during internet outages.\n3. \n**Zero Marginal Cost:** Developers and hobbyists can explore creative storytelling and file forensics without subscriptions or metered API tokens.\n4. \n**Transparency & Contributor Freedom:** Open models like Qwen under Apache 2.0 empower anyone to inspect, fine-tune, audit, and distribute AI applications freely.\n\n## \n  \n  \n  The Spirit of It\n\nThe moment this project truly landed was during testing on our own development logs:\n\nWhen `qwen2.5` analyzed those lines, it diagnosed PID 4040 not as a simple kernel race condition, but as an *orphaned digital ghost refusing to leave memory space, silently listening on loopback port 6660 for an instruction from an orchestrator that shut down years ago*.\n\nIt turned a mundane late-night debugging session into a spooky campfire story. It made staring at a crash dump fun again.\n\n## \n  \n  \n  Prize Categories\n\n- \n**Primary Track:** Hacktoberfest Open-Source AI Challenge — Week 4: \"Ghost in the Machine\"", "url": "https://wpnews.pro/news/phantom-files-uncovering-the-machine-ghost-with-local-open-weight-ai", "canonical_source": "https://dev.to/igotumayur/phantom-files-uncovering-the-machine-ghost-with-local-open-weight-ai-3c0j", "published_at": "2026-10-28 03:04:16+00:00", "updated_at": "2026-10-28 03:11:20.121946+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-tools", "generative-ai", "ai-safety"], "entities": ["Phantom Files", "Ollama", "Qwen2.5", "Streamlit", "Hacktoberfest", "DEV Community"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/phantom-files-uncovering-the-machine-ghost-with-local-open-weight-ai", "markdown": "https://wpnews.pro/news/phantom-files-uncovering-the-machine-ghost-with-local-open-weight-ai.md", "text": "https://wpnews.pro/news/phantom-files-uncovering-the-machine-ghost-with-local-open-weight-ai.txt", "jsonld": "https://wpnews.pro/news/phantom-files-uncovering-the-machine-ghost-with-local-open-weight-ai.jsonld"}}