Cover image for I made LLM context editable: a graph where the wires are the prompt

Xia Chen

Most LLM interfaces present a conversation as a transcript.

That works until the conversation branches.

One branch contains useful research. Another is a discarded hypothesis. A third is an unrelated detour. The interface may show where they came from, but the user often cannot see exactly which branches will be included in the model's next request.

I wanted to make that state editable.

Wires are the context

I built an open-source prototype called ThoughtDAG.

Every question-and-answer exchange is a node on an infinite canvas. An edge is not merely a visual relationship: it determines which upstream nodes are included when the next request is constructed.

When a user asks from a node, ThoughtDAG walks its incoming graph, orders the relevant ancestors, and turns them into the message sequence sent to the selected model.

Delete an edge and regenerate the same prompt, and the deleted branch is no longer part of the model's context.

[Insert the edge-deletion GIF here]

Why a DAG?

I did not want an autonomous system that silently reorganized the user's ideas.

The graph is directed because context flows from earlier reasoning into later reasoning. It is acyclic because a node should not recursively include itself in its own history.

This makes three operations explicit:

  • branching: explore an alternative without modifying the original path;
  • merging: synthesize several selected branches;
  • pruning: remove irrelevant context before regenerating an answer.

The graph is therefore not an agent workflow. It is a visible, human-controlled representation of model memory.

Local-first by default

The canvas is stored in IndexedDB in the browser. There is no account or hosted database.

ThoughtDAG can connect to Ollama for local inference, or to an arbitrary OpenAI-compatible endpoint. PDFs remain on the user's machine; only extracted text is sent when a remote model is deliberately used.

The project is MIT licensed and built with React, TypeScript, React Flow, Zustand, Express, and the Vercel AI SDK.

Repo: https://github.com/chenxiachan/thoughtdag

The question I am testing now is whether people actually want to control context manually, or whether they would rather delegate memory selection to retrieval and agents.

I would be interested in critiques of that interaction model, especially from people building long-running LLM interfaces.