ThoughtDAG: Managing LLM Context via Editable Graphs
ThoughtDAG is an open-source tool designed to make LLM context visible and editable by replacing the traditional linear chat interface with a directed acyclic graph (DAG). By treating "wires as context," ThoughtDAG allows users to manually prune unrelated conversation branches and precisely control which upstream nodes are included in the model's request, preventing context pollution and improving response accuracy.
Explicit Context Control via Graph Topology
ThoughtDAG shifts the responsibility of context selection from hidden model memory or automated retrieval (RAG) to the user. In a standard chat interface, the entire history is typically sent to the model, which can lead to "polluted" summaries where unrelated detours (e.g., a side conversation about dinner) bleed into technical research summaries.
In ThoughtDAG, every question and answer is a node in a graph. When a user initiates a request from a specific node, only the nodes connected via upstream "wires" are included in the prompt. This mechanism provides several key capabilities:
- Context Pruning: Users can delete an edge (wire) to remove a specific branch of the conversation from the model's memory without deleting the message from the visualization.
- Reproducible Context: Because the context is explicitly defined by the graph's edges, users can regenerate answers with identical prompts but different context sets to observe how specific information changes the output.
- Token Inspection: The tool provides a preview of the source nodes, their order, and the total token count before the request is sent, removing the "hidden decision" aspect of LLM interactions.
Integration of Source Provenance and Clipping
Beyond conversation history, ThoughtDAG integrates external data through a clipping mechanism. Users can select specific passages or figures from a PDF and turn them into source-linked nodes. These clipped passages maintain their provenance (e.g., page numbers), and the user can "wire" these specific evidence nodes into the conversation flow. This prevents the model from being overwhelmed by entire documents when only a few specific facts are required for a particular reasoning chain.
Technical Implementation and Ecosystem
ThoughtDAG is built as a local-first application with the following technical specifications:
- Licensing: MIT License.
- Compatibility: Supports Ollama and OpenAI-compatible endpoints, enabling the use of both local and frontier models.
- Data Handling: Local-first architecture to ensure user data privacy.
- Features: Includes semantic zoom tiers and "weave/condense" features to manage the visual complexity of large graphs.
Community Feedback and Critical Analysis
Community discussion on Hacker News highlighted both the utility of the graph-based approach and potential implementation hurdles:
Workflow and UX Challenges
Some users noted that the interface can feel "janky," specifically citing issues with canvas panning and the visibility of included messages in the side panel. There is also a suggestion that for non-technical users, "edge deletion" might be too abstract; instead, a sidebar listing node references with remove buttons might be more intuitive.
Security Concerns
One reviewer identified a potential critical security vulnerability related to how the application handles PDF processing. Specifically, the use of execSync with pdftoppm combined with a server binding to 0.0.0.0 (all network interfaces) could potentially allow remote shell access to the host machine.
Conceptual Convergence
Several developers noted that ThoughtDAG converges with other emerging patterns for "context compilers" or tree-based decision logs. One user compared the approach to a "physarum slime mold," where a researcher branches out in all directions and then reinforces only the most promising paths while starving off irrelevant branches.
"The idea that removing a wire changes what the model actually sees might not be obvious. Consider when someone clicks a node, show a sidebar listing (node references) with remove buttons to reframe as 'what does this answer know about me' vs. 'edit of the graph'."
"I'm testing whether explicit context control is useful for long-running research, or whether most people would rather delegate memory selection to retrieval."
Sources
Related
- Project
- Project
- Project
- Project
- Dispatch