# Afterlight: Ghost in the Machine 👻

> Source: <https://dev.to/rhythm_gupta_8b5b33317d95/afterlight-ghost-in-the-machine-52a>
> Published: 2026-10-27 07:10:54+00:00

*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).*

**Afterlight is a browser-based supernatural storytelling studio powered by open-weight AI.**

The idea came from the thought that some stories never really disappear. They stay with us as memories, old photographs, forgotten places, and stories passed down through generations.

I wanted to build something that combined that feeling with AI. Afterlight lets users create atmospheric ghost stories by choosing a premise, selecting a mood, and adjusting the story length.

It also includes a feature called **Keep a Memory Glowing**, which lets users incorporate a meaningful detail, song, or memory into a fictional remembrance-inspired story.

I designed the interface around the atmosphere of the project: dark colours, moonlight-inspired accents, subtle textures, and a quiet, cinematic layout.

The project focuses on three things:

An offline-first supernatural story studio. It runs as a static website and uses Transformers.js to load the open-weight `Xenova/flan-t5-small` model directly in the browser. No Python, Flask, Ollama, API key, or backend server is required.

`file://`)

```
py -m http.server 8000
```

VS Code users can also use the Live Server extension and click **Go Live**.

The browser needs internet access on the first run to download Transformers.js and the model files. The first load can take a while. After the files are cached, inference runs in your browser; exact offline behavior depends on whether all assets have been cached and your browser settings.

If the model fails to load or your device cannot…

The application is designed to run as a static website. After the required model files have been downloaded, the model can perform inference in the browser.

The first run requires an internet connection to download the AI library and model. If model loading fails, the application switches to a built-in fallback story generator so users can still explore the interface.

**GitHub repository:** [Add your public GitHub repository URL here]

The project uses a simple, accessible structure:

`index.html` — the user interface and application layout`static/styles.css` — visual design, responsive layout, and animations`static/app.js` — story generation, browser model integration, and fallback handling`README.md` — installation instructions and project documentation
The code is structured so that the interface and model integration can be modified independently.

I built Afterlight using HTML, CSS, and JavaScript. Instead of creating a Python backend or depending on a hosted AI API, I used **Transformers.js** to run text generation directly in the browser.

The application is configured to use the `Xenova/flan-t5-small` model package. This allows the browser to load model files and perform inference on the user's device, rather than sending each prompt to a remote inference service.

The main workflow is straightforward:

I also added suggested story premises, a copy-to-clipboard feature, loading feedback, and responsive styling to make the application feel like a finished creative tool rather than a bare text-generation demo.

The goal was to keep the project easy to understand, run, and extend.

For me, open innovation is about having more control over the tools we build with.

When an application relies entirely on a closed, hosted AI service, its functionality can depend on API availability, pricing, usage limits, and decisions made by an external provider.

Afterlight explores a different approach.

By using a browser-based model, the application can perform inference on the user's device without requiring a paid inference API key. Prompts are processed locally by the application, rather than being sent to a hosted model endpoint.

This approach offers several advantages:

There are trade-offs, too. Browser inference depends on the device's available memory and processing power. The first model download requires internet access, and the quality of generated stories depends on the selected model.

Afterlight is a small experiment, but it demonstrates why open models and accessible tooling can make creative AI development more flexible.

Afterlight uses a browser-based text-generation pipeline rather than a separate agent framework.

The generation workflow takes the user's premise, mood, and length preference and combines them into a prompt. An optional remembrance detail can be included as creative context.

The application then attempts inference through Transformers.js. If the model cannot be loaded or returns an unusable result, the fallback logic takes over.

This keeps the application simple and makes the distinction between model-generated output and fallback-generated output visible to the user.

**Agent session recording:** Not applicable to this implementation; no separate agent-session recording is included.

The idea behind Afterlight is that a ghost does not always have to be frightening.

Sometimes, the things that linger are memories, places we miss, or stories that deserve to be remembered.

I wanted the application to capture both sides of that idea: the eerie atmosphere of a supernatural story and the warmth of remembering something meaningful.

The remembrance feature is deliberately framed as fiction. AI can help people express a feeling or build a story around a memory, but it should not pretend to contact the dead or claim to know what a real person would say.

For me, that balance is what makes this project fit the theme. The machine creates the words, but the meaning comes from the person who brings the story to life.

**Partner-specific prize categories:** None selected yet.

I will add any applicable categories after checking the official challenge's partner requirements and confirming that the project meets their eligibility criteria.

**Submission type:** Individual project.

Afterlight is being prepared as an individual submission. No teammate credits are required.

Thanks for reading! 👻

If you try Afterlight, experiment with an unusual premise, change the atmosphere, and see what kind of story emerges.

Sometimes the most interesting part of AI isn't the answer it gives us. It's the possibility it helps us imagine.
