This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
For this week's Ghost in the Machine challenge, I built GhostWriter AI – Stories from the Shadows, an AI-powered horror and mystery story generator that brings imagination to life using open-weight AI.
The inspiration came from the mysterious atmosphere of Halloween, abandoned places, supernatural stories, and the idea that every forgotten place might have a story hidden within it.
I wanted to create something where users would not simply read horror stories but could become the creators of their own supernatural experiences.
GhostWriter AI allows users to customize their stories by selecting:
- Haunted Location: Choose from an abandoned railway station, an old mansion, a university hostel, a deserted village, or a fog-covered road.
- Main Character: Enter a character or an idea around which the story should develop.
- Atmosphere: Select between Suspense, Horror, and Mystery.
- Ending: Choose a shocking twist, an open ending, or a bittersweet revelation.
Based on these choices, the AI generates an original ghost story directly in the browser.
Users can read their generated stories and copy them to share with others.
The main idea behind this project is to combine creativity, storytelling, and open-source AI in one interactive experience.
Demo
Project Name: GhostWriter AI – Stories from the Shadows
GitHub Repository:
https://github.com/anushkasingh09507-cell/GhostWriter-AI-Stories-from-the-Shadows
How to experience the demo:
- Clone or download the GitHub repository.
- Open the project folder in Visual Studio Code.
- Install the Live Server extension.
- Run
index.htmlusing Live Server. - Select a haunted location, enter a character, and choose your preferred atmosphere.
- Click Generate my story and let the AI create your story.
The first launch requires an internet connection to download the AI model and its runtime. Once loaded, story generation takes place in the browser.
A publicly hosted live demo and video demonstration are not available yet.
Code
GitHub Repository:
GhostWriter AI – Stories from the Shadows
The project is developed using three main frontend files:
1. index.html
- Creates the structure of the website.
- Provides the input fields and story customization options.
- Displays the generated story.
2. style.css
- Creates the Halloween-inspired dark interface.
- Adds purple and pink visual effects.
- Makes the website responsive for different screen sizes.
3. script.js
- Integrates the open-weight AI model.
- Handles user selections and prompt creation.
- Loads the model using Transformers.js.
- Generates stories based on user input.
- Provides story copying functionality.
Additional file: README.md, containing project documentation, setup instructions, features, and technical details.
The repository includes the complete source code.
How I Built It
I built GhostWriter AI using simple web technologies and an open-weight language model.
My goal was to understand how a real AI model could be integrated into a website without depending on a paid, closed-source AI API.
Technology Stack
| Technology | How I used it |
|---|---|
| HTML5 | Website structure |
| CSS3 | Design and responsive styling |
| JavaScript | Application logic and user interactions |
| Hugging Face Transformers.js | Running the AI model in the browser |
| Qwen2.5-0.5B-Instruct | Generating original horror stories |
How the AI works
The most important part of this project is its AI integration.
I used Qwen2.5-0.5B-Instruct, an open-weight language model available in an ONNX-compatible format through the onnx-community repository.
I integrated it using Hugging Face Transformers.js, which allows the model to run directly in a compatible web browser.
The workflow is:
- The user selects a haunted location.
- The user enters a character or story idea.
- The user chooses the atmosphere and ending.
- JavaScript combines these choices into a customized prompt.
- Transformers.js loads the Qwen model and passes the prompt to it.
- The model generates an original story.
- The generated title and story are displayed on the website.
I also configured generation parameters such as temperature, top-p sampling, and repetition penalty to influence the creativity and variety of the generated stories.
Why I chose this approach
Instead of connecting the website to a hosted AI API, I wanted to experiment with running an open-weight model locally in the browser.
This helped me explore model integration, prompt engineering, browser-based inference, and the practical use of open AI technologies.
The project uses a small model to make browser-based experimentation more accessible, although performance depends on the user's hardware and available memory.
Why Does Open Innovation Matter?
Open innovation is one of the most important parts of this project.
I wanted GhostWriter AI to demonstrate that developers can build useful AI-powered applications without always depending on expensive commercial AI services.
Using open-weight AI made several things possible:
1. Privacy and Control
The story prompts are processed in the user's browser rather than being sent to a custom application backend or a hosted AI inference API.
This provides better control over the user's creative input.
2. No Paid Inference API
The project does not require a paid AI API key or a per-request inference subscription.
This makes experimenting with AI more accessible, especially for students and beginner developers.
3. Freedom to Experiment
Because the model is open-weight and the application uses an open-source runtime, developers can experiment with prompts, generation parameters, and compatible models.
The model can be changed through the MODEL_ID configuration in the JavaScript file.
4. Less Vendor Lock-in
The application is not dependent on one commercial AI provider's API, pricing structure, or service availability.
5. Learning and Accessibility
As someone exploring software development and artificial intelligence, this project gave me an opportunity to understand how open AI models can be integrated into real applications.
Where did open AI work better than a closed approach?
A closed hosted API could have made integration easier, but it would require an external inference service and could introduce API costs and additional data-sharing requirements.
With GhostWriter AI, the model performs inference in the browser. This means there is no per-story API charge and no need to send prompts to my own application server.
There is a trade-off: the initial model download requires internet access, and generation speed depends on the user's device. Fully offline use is not guaranteed in the current version.
For this project, the flexibility, privacy, and learning opportunities of open technology made it a worthwhile choice.
My Agent Session
GhostWriter AI currently uses direct AI model inference through Hugging Face Transformers.js rather than an autonomous AI agent or agent framework.
The model receives a customized prompt, generates a story, and returns the result to the website.
I have not used DevRelay or created a separate agent session for this project, so there is no agent session link to share.
The Spirit of It
The idea behind GhostWriter AI is that every abandoned place has a story waiting to be discovered.
Imagine standing alone at an abandoned railway station at midnight. The last train disappeared years ago, the clocks stopped working, and suddenly you hear someone calling your name.
Who is there?
What happened in that place?
Is it just your imagination, or is something trying to communicate with you?
These are the kinds of experiences I wanted users to create through GhostWriter AI.
I also wanted to explore how technology can bring imagination to life. Instead of simply consuming stories created by others, users can shape their own stories through AI.
For me, the most interesting part is that every combination of characters, locations, and moods can lead to a different experience.
The machine generates the story. Your imagination gives it a soul.
Prize Categories
This project is submitted under the Hacktoberfest Open-Source AI Challenge – Week 4: Ghost in the Machine.
Core open-source AI technologies used:
- Qwen2.5-0.5B-Instruct – Open-weight language model.
- Hugging Face Transformers.js – Open-source browser inference library.
Top comments (0)