Ghostwriter TUI
Ghostwriter TUI
A speculative prototype for a collaborative writing experience using AI in a terminal-based interface
A terminal window view of the Ghostwriter CLI streaming test
Ghostwriter CLI Streaming Test
Contributed By: Julian Bleecker
Post Reference Date: May 31, 2025, 22:12:34 PDT
Published On: May 31, 2025, 22:12:34 PDT
Updated On: Jun 1, 2025, 24:03:59 PDT
Join nearly 19,000 members connecting art, product, design, technology, and futures.

A quick prototype to just see the feel of a collaborative writing experience using the Ghostwriter idea in a TUI interface.

Basically a terminal-based interface that allows you to write, and at certain points the Ghostwriter will suggest a next sentence or paragraph, and you can accept it, or not. Or also scroll through suggestions/completions basically forever. But, you probably want to either pick something (by hitting TAB) start typing over the text, or just start typing to clear the completion and start writing your own text.

Pretty cool mechanically. I think there's much to be done to tune the experience, but as a mechanic — this is close to what I would like to build out. (I also like the TUI idea almost as a retro-futuristic idea, but also because it is a very low-friction way to get started with a writing experience. No need to install anything, just run the command and start writing.)

The completion interface hooks into either OpenAI's API or a local model via LM Studio. Some models work better than others, for sure. Also the prompt is important, and some models are better at following the prompt than others. The gpt-4 models are the best. Local models like llama-3.2 are okay but do weird things like adding quotes or ellipses at the beginning of the completion despite one-shot negative prompting and such.

Ghostwriter UX Exploration CLI

Motivation

This project was born from a desire to explore new forms of flow-based interaction with artificially intelligent companion species. As AI becomes more integrated into our daily lives—not just as tools, but as creative partners and companions—our interfaces must evolve beyond the traditional paradigms of command and response. We need new ways to write, think, and create in collaboration with AI, where the boundaries between human and machine creativity blur, and where the interface itself becomes a site of experimentation.

The Ghostwriter UX Exploration CLI is a terminal-based text editor that lets you write with the help of AI completions, inspired by the idea of “flow”—a seamless, conversational, and improvisational interaction with your digital companion. It is not just about efficiency, but about discovering new modes of co-authorship, companionship, and creative emergence.


Philosophical Context

This project is informed by a broader cultural and philosophical conversation about AI, creativity, and the future of human-machine relations. Most of this came about while trying to find a better tool for writing by thinking of the LLM more as a collaborator rather than a question-answerer or task doer. Found some essays that are helpful in that context, amonst others.


Features

  • Flow-based AI writing: Type as you normally would, and receive real-time AI completions that you can accept, ignore, or modify.
  • Visual cursor and completion: The interface keeps the cursor and AI suggestion visually in sync, even with wrapped lines.
  • Multi-model support: Works with OpenAI and local models (like LM Studio).
  • Terminal-native: Designed for writers, hackers, and experimenters who love the command line.

Why a Terminal App?

The terminal is a space of immediacy, focus, and experimentation. By building in the terminal, we invite users to play with the boundaries of text, code, and conversation—without the distractions of modern GUIs. It’s a place to prototype new forms of interaction, and to reclaim the joy of writing with machines.


Main Functionality

The program creates a terminal-based text editor that provides real-time AI text completions as you type. It connects to either:

OpenAI’s API (using models like GPT-4) LM Studio (for local AI models) Key Features Multi-line Text Editor: Full cursor navigation with support for:

Arrow keys for movement Home/End keys Backspace/Delete Enter for new lines Soft text wrapping AI Text Completion:

Automatically suggests completions after 600ms of inactivity Shows completions in blue italic text Use Tab to accept a completion Use Shift+Up/Down to cycle through multiple completion options Requests 3 completions at once for variety Smart Completion Behavior:

Completions update as you type matching characters Loads more completions when you reach the end of available options Clears completions when you type non-matching text

Visual Interface: Uses the ratatui library to create a TUI with:

Main editor area with borders Yellow separator line Debug area showing cursor position and completion info Visual cursor highlighting Architecture

The program uses:

Async processing with tokio for non-blocking AI requests Message passing with mpsc channels to handle completion results Terminal UI with crossterm and ratatui Command-line arguments via clap for configuration The AI completions are designed to continue your text naturally without adding quotes, ellipses, or other formatting - just plain prose continuation

Getting Started

  1. Clone the repo and build with Cargo (requires Rust and a compatible AI backend):

    Terminal window
    git clone https://github.com/yourusername/ghostwriter_streaming_cli.git
    cd ghostwriter_streaming_cli
    cargo build --release
  2. Run the CLI with the desired options. For example:

    Terminal window
    cargo run --release -- --endpoint openai --api-key YOUR_OPENAI_API_KEY --model gpt-3.5-turbo

    Or, for LM Studio or another local model:

    Terminal window
    cargo run --release -- --endpoint http://localhost:1234/v1 --model your-model-name

Command-line options:

  • --endpoint — The API endpoint (e.g., openai or a local URL)
  • --api-key — Your API key (if required)
  • --model — The model name (e.g., gpt-3.5-turbo)
  1. Start writing!

    • Press Tab to accept AI completions.
    • Press Shift+Up/Down to cycle suggestions.
    • Use arrow keys to move the cursor.
  2. Reflect on the experience: How does it feel to write with an AI companion? What new forms of creativity emerge?


Further Reading

  • Remarks on AI from NZ by Neal Stephenson:
    Stephenson reflects on the evolving relationship between humans and AI, and the need for new metaphors and practices for living with these “companion species.”

  • AI, Heidegger, and Evangelion by Fakepixels:
    This essay explores the existential and philosophical dimensions of AI, drawing on Heidegger and pop culture to ask what it means to dwell with intelligent machines.

  • Zero Cool and the Oraculator by Near Future Laboratory:
    A meditation on the shifting boundaries between human and machine agency, and the playful, experimental spirit needed to invent new forms of interaction.

  • Can AI Writing Be More Than A Gimmick: The essay collection Searches: Selfhood in the Digital Age by Vauhini Vara explores the intersection of artificial intelligence and personal writing. Vara, a novelist and tech journalist, initially experimented with large language models like ChatGPT to aid her writing, particularly during moments where she felt blocked or needed help expressing grief about her sister’s death. Initially, she was wary of AI threatening her craft but eventually found its potential to elicit rather than supply text.


License

MIT.
This is an experiment—fork it, remix it, and help invent the future of human-AI collaboration.

The Artificial Intelligence Designed Fictions Prototyping Studio is a prototyping-based design research program through Near Future Laboratory that explores the potential of artificial intelligence in the context of everyday life.

We are accepting commercial support, corporate or organizational sponsors, and incubation opportunities. To learn more about participating let’s connect..

The research program studies artificial intelligence through the creation of speculative design prototypes. These are meant to explore the potential of artificial intelligence in the context of everyday life.

The focus of the program is on rapid ideation and prototyping. We create small, functional artifacts that help ground possibilities in materiality and interaction. The speculative prototypes are also meant to be evocative and thought-provoking, like generative windows into future opportunities, focused on the practice of everyday life in a world in which we cohabitate, collaborate, and cooperate with a new kind of intelligent species.

Our thesis is that speculative prototyping in an expansive and experimental fashion is the way to discover new opportunities for this next phase of human consciousness. We will explore new kinds of interactions, services, artifacts, and objects as if we are entering a new territory for which the old modalities and assumptions are like ancient epistemologies and ontologies ill-suited for this new land.

In true Design Fiction style, there is the prototype of the artifact itself, but also the worldbuilding material that surrounds it. This research program prototypes in the traditional engineering sense, certainly. But we also create artifacts that are additive to the engineering prototypes and allow the studio to explore the cultural, social, economic, policy, and governance qualities of possible futures.

Clippings from newspapers. Magazine articles. Tourists guides. Social media posts. Receipts. The contents of a found wallet. Advertisements from streetware brands. Paperback self-help books. Podcast episodes. Oracular card games. Movie tickets. Etcetera.

These remanants of an inhabited future world help imagine into possibilities in a rich and textured way. The remants are like working backwards towards technological possibilities by exhibiting their cultural and policy-based effects in a more general and recognizable format

Unique to futures design studios, I not only help you with strategic reflections and considerations on technological and socio-technical futures. Near Future Laboratory is a laboratory in the trad sense of the word: I actually build things from the future — that actual work.

This and other functional futures prototypes are a unique proposition that I offer that most other futures design consults do not.

Industry experience and academic credentials in engineering, software development, advanced studies in technology and society, actual real hardware product design — as well as founding, funding, running, and selling a successful hardware business — means I bring a unique and capable perspective to address the challenges of futures design, research, and engineering.

Loading...