---
title: "Building Ghostwriter Chat"
description: "Ghostwriter Chat embeds an LLM-powered assistant directly in the Replit IDE, using file context, chat history and program output so users never copy-paste into a separate tool."
url: "https://swe.quest/articles/building-ghostwriter-chat-cdc3d6aa03870bc4"
canonical: "https://replit.com/blog/ghostwriter-building"
source: "Replit"
published: "2023-03-27"
difficulty: "easy"
kind: "Case study"
reading_minutes: 5
tags: ["ai-coding","llms","developer-tools"]
---

# Building Ghostwriter Chat

A post on [Replit](https://swe.quest/sources/replit.md), published 2023-03-27, 5 min read, Case study. Original: [https://replit.com/blog/ghostwriter-building](https://replit.com/blog/ghostwriter-building)

## Summary

Ghostwriter Chat embeds an LLM-powered assistant directly in the Replit IDE, using file context, chat history and program output so users never copy-paste into a separate tool. Streaming generated tokens keeps time-to-first-token under 500 ms and lets users abort unhelpful answers. A generic prompt-construction layer gathers context from varied sources and renders it for different model APIs. To fit token limits, it drops older chat messages, caps user messages at 500 characters, and favors recently edited source files over noise like .venv, linter and CI configs.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)

## Prerequisites

- LLM basics ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- tokens and context windows

## Keywords

Ghostwriter Chat, Ghostwriter Debugger, Replit

## Related posts

- [AI Agent Code Execution API](https://swe.quest/articles/ai-agent-code-execution-api-8f63888d403b81a8.md): Replit · 2023-09-19 · Medium · 4 min read · AI agents, Sandboxing & isolation, LLMs, Serverless, Python
  Replit offers sandboxed code execution so LLM agents can run untrusted generated code, contrasting a stateless model (like Bard's implicit code execution for math) with a stateful, session-long project environment (like ChatGPT).
- [Building Ghostwriter Chat](https://swe.quest/articles/building-ghostwriter-chat-1b8d2c338765451d.md): Replit · 2023-03-24 · Easy · 4 min read · AI for coding, LLMs, Developer tools
  Ghostwriter Chat is an LLM-powered pair programmer built into Replit's IDE and shipped in about 6-8 weeks after a January Hackweek.
- [Ghostwriter AI & Complete Code Beta](https://swe.quest/articles/ghostwriter-ai-complete-code-beta-eb4c500f5fc252eb.md): Replit · 2022-09-08 · Medium · 9 min read · AI for coding, Inference & serving, LLMs, Developer tools
  Replit's Ghostwriter adds AI code completion, generation, transformation, explanation and semantic search to its IDE, with Complete Code starting in closed beta.
- [Build Your Own AI-Driven Code Analysis Chatbot for Developers with the GenAI Stack](https://swe.quest/articles/build-your-own-ai-driven-code-analysis-chatbot-for-developers-with-the-genai-062f35bb279ec41b.md): Docker · 2024-06-06 · Medium · 10 min read · RAG & retrieval, LLMs, AI for coding, Containers, Python
  Code Explorer, a winning Docker AI/ML Hackathon project, is a RAG chatbot that answers questions about a local codebase by parsing source files, chunking them with LangChain's RecursiveCharacterTextSplitter (5000 characters with 500 overlap), and storing embeddings in a Neo4j vector store.
- [ToolGrad: Efficient tool-use dataset generation with textual "gradients"](https://swe.quest/articles/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients-6d6804c563cc5125.md): Google Research · 2026-09-10 · Hard · 6 min read · Model training, AI agents, LLMs, Evaluation
  ToolGrad generates synthetic tool-use training data answer-first: it builds a verified API chain iteratively, then has an LLM write the matching user query, instead of inventing a query and searching for a solution with a DFS agent as ToolBench and ToolACE do.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
