cd /news/artificial-intelligence/i-built-an-ai-reading-companion-with… Β· home β€Ί topics β€Ί artificial-intelligence β€Ί article
[ARTICLE Β· art-37081] src=dev.to β†— pub= topic=artificial-intelligence verified=true sentiment=↑ positive

I Built an AI Reading Companion with Tree-Structured Conversations

A developer built pi-tree, a self-hosted AI reading companion that uses tree-structured conversations to allow branching and backtracking during reading sessions. Unlike typical RAG-based tools, pi-tree gives the AI precise, on-demand access to content via tools like process_book and search_papers, and supports customization through skills, session profiles, and plugins.

read4 min views9 publishedJun 24, 2026

AI makes you productive where you already understand. It confuses you where you don't.

I've been reading non-fiction with AI assistants for a while, and I kept hitting the same wall: 30 messages into a conversation about a dense book chapter, the AI starts losing the thread. I'd branch into a tangent β€” "how does this connect to what Kahneman said about System 1?" β€” and suddenly the entire chat context is polluted. No way to get back to where I was.

So I built pi-tree β€” a self-hosted AI reading companion where the conversation

When you think through complex material, your mind doesn't work linearly. You branch β€” "wait, how does this relate to X?" β€” explore for a bit, then come back. But every AI chat tool forces you into a flat thread where everything piles up.

Tree-structured conversations fix this at the architecture level:

Here's what a reading session looks like:

πŸ“– Reading: Thinking, Fast and Slow (Kahneman)

Root
β”œβ”€β”€ What is System 1 vs System 2?
β”‚   β”œβ”€β”€ How does this relate to cognitive biases?
β”‚   β”‚   └── Anchoring bias deep-dive
β”‚   └── Real-world examples in decision making
β”œβ”€β”€ Chapter 3: The Lazy Controller
β”‚   └── Why do we avoid effortful thinking?
└── Comparison with Nassim Taleb's ideas
    β”œβ”€β”€ Black Swan connection
    └── Antifragility and heuristics

And here's the actual UI β€” tree sidebar on the left, conversation in the center, table of contents on the right:

Most "chat with your documents" tools use RAG β€” chunk your content into embeddings, then retrieve what seems relevant. The problem: retrieval is approximate. The AI gets semantically similar chunks, not necessarily the right context.

Pi-tree takes an agentic approach: the AI has tools that give it precise, on-demand access to your content β€” more like grep

than vector search. It can look up a specific chapter, fetch a paper's methodology section, or scan today's RSS feeds. The context is exact, structural, and requested when needed β€” not pre-computed and hoped for.

Each source type gets purpose-built tools:

process_book

parses EPUB/MOBI/PDF, extracts chapter structure, builds a navigable outlineget_latest_rss

, search_rss

crawl your feeds, find trends across sourcessearch_papers

, get_paper_info

query arXiv, fetch and contextualize researchget_youtube_transcript

extracts transcripts for segment-level discussionThe AI's behavior is then shaped by skills β€” markdown instruction files that define how to read, not just what to retrieve.

Here's a news session β€” the AI scanned RSS feeds and produced a digest with trends:

Everything is customizable at three levels:

1. Skills (Markdown files) β€” Change how the AI reads by editing a .md

file. No code.

2. Session Profiles (YAML) β€” Map source types to different skills, extensions, and models:

name: book.reading
skills:
  - interactive-reading
extensions:
  - book
exclude_tools:
  - bash
  - edit

3. Full Plugins (TypeScript) β€” Build new source types with the plugin SDK:

import { definePiTreeExtension } from "@pi-tree/plugin-sdk";

export default definePiTreeExtension((pi, services) => {
  pi.registerTool({
    name: "my_custom_tool",
    description: "Does something useful",
    execute: async (args) => {
      const source = await services.sources.get(args.sourceId);
      // your logic here
    }
  });
});

There's also an MCP bridge β€” connect external MCP servers (web search, academic databases, translation APIs) by dropping a JSON config file. Same format as Claude Desktop.

cp .env.example .env   # add your API key

docker run -d --name pi-tree \
  --env-file .env \
  -p 3847:3847 \
  -v ~/.local/share/pi-tree:/data \
  ghcr.io/shuowu/pi-tree:latest

Open http://localhost:3847. That's it.

Works with any OpenAI-compatible API β€” cloud providers (DeepSeek, Gemini, Claude, OpenAI) or fully offline with Ollama / LM Studio. Reading doesn't need frontier models β€” a 12B parameter model works well.

Pi-tree ChatGPT / Claude NotebookLM Obsidian + AI
Focus
Comprehension & exploration General-purpose Q&A Document Q&A Note-taking
Conversations
🌳 Tree β€” branch, explore, return Linear chat Linear chat Linear chat
AI approach
Agentic β€” tools & skills over local data Prompt + context window RAG over uploads Plugins over local vault
Sources
Books, papers, news feeds, YouTube File uploads, web Multi-doc notebooks Markdown vault
Extensibility
Skills, plugins, MCP bridge GPTs (cloud-hosted) None Community plugins
Model choice
BYOK β€” any provider or local Vendor-locked Google only Plugin-dependent
Data
Local-first, self-hosted Cloud Cloud Local

License: AGPL-3.0 β€” fully open source.

I'd love feedback on:

Built on the Pi SDK for tree-structured agent sessions.

── more in #artificial-intelligence 4 stories Β· sorted by recency
── more on @pi-tree 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/i-built-an-ai-readin…] indexed:0 read:4min 2026-06-24 Β· β€”