This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
GhostFrame is a visually stunning, privacy-focused AI ghost story generator. It transforms simple user prompts into atmospheric, personalized tales of horror, mystery, and the supernatural.
I interpreted the "Ghost in the Machine" theme both literally and metaphorically. The "machine" is the user's own local hardware, and the "ghost" is the emergent, haunting narrative that materializes from text prompts using open-weight AI models. The project was inspired by gothic architecture, abandoned libraries, midnight forests, and the tactile feel of reading an ancient, forbidden manuscript. The goal was to build an interface that feels like a premium, cinematic creative writing tool, while strictly respecting user privacy and operating entirely on the user's terms.
Demo
The application is designed to be instantly accessible. It features a built-in "Atmospheric Demo" mode that weaves together procedural narrative fragments, allowing anyone to generate a unique, coherent ghost story immediately in their browser without needing any backend setup. For the full experience, it seamlessly connects to a local Ollama instance to generate dynamic, AI-driven stories based on granular user inputs like fear intensity, atmosphere, and custom story seeds.
Code
GhostFrame is built using pure, semantic HTML, modern CSS (utilizing CSS variables, glassmorphism, and lightweight, hardware-accelerated animations), and vanilla JavaScript. It avoids heavy frameworks, build tools, or external dependencies. The codebase is organized into clear, modular sections covering state management, UI utilities, story generation logic, Ollama API integration, and local storage management, ensuring it is highly readable and easy to audit.
How I Built It
GhostFrame is built around local inference using Ollama and open-weight models (defaulting to qwen2.5:3b). The architecture is deliberately transparent and user-centric:
Dual-Mode Generation Engine:
Local AI Mode: Connects directly to the user's local Ollama instance via the chat API. It constructs a structured, detailed system prompt based on the user's selected parameters, then securely renders the generated narrative.
Atmospheric Demo Mode: A procedural generation engine built directly into the JavaScript. It ensures the app is fully functional, entertaining, and usable offline, even without an AI backend running.
State & Storage: All user preferences and saved stories are stored securely in the browser's localStorage, creating a persistent "Story Vault" that users can search, filter, and manage.
Security: AI output is treated as untrusted text and inserted safely into the DOM using textContent to prevent any injection vulnerabilities.
Why Does Open Innovation Matter?
For a creative and introspective tool like a story generator, privacy is paramount. Closed, commercial APIs require sending your personal prompts, fears, and creative ideas to third-party servers.
Open innovation makes the following possible with GhostFrame:
True Privacy: Your story seeds and saved manuscripts never leave your device unless you explicitly choose to query your own local AI.
No Vendor Lock-In: Users can swap the default model for llama3, mistral, or any other compatible local model simply by changing a text field in the settings.
Offline Potential: Once the application is loaded and a local model is running, the entire workflow functions without an internet connection.
Transparent Architecture: The code is open for any developer to read, audit, and learn from. There are no hidden black boxes or proprietary algorithms governing the user's creativity.
My Agent Session
This project was developed in partnership with an AI coding assistant. I provided the high-level design direction, UX requirements, and architectural constraints (vanilla JS, privacy-first, dual-mode generation), and the AI helped rapidly prototype the CSS glassmorphism effects, the procedural narrative logic, and the Ollama fetch integration. This kept me in the driver's seat as the creative director while accelerating the implementation.
The Spirit of It
There is a distinct, eerie magic in testing a local AI ghost story generator late at night. Typing in a simple seed like "An abandoned railway station outside a forgotten village, and a pocket watch that ticks backward" and watching a genuinely chilling, perfectly paced gothic narrative materialize on the screen is a powerful experience.
The realization that this story was generated entirely on local hardware, with no cloud server logging the prompt, no API key tracking usage, and no corporate terms of service governing the creativity, captures the true spirit of open-source AI. It feels like real magic.
Prize Categories
Best Use of Local AI
Best Privacy-Focused Application
Best UI/UX Design
Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)