Inspiration

I was inspired by Hex’s Notebook Agent and its approach of treating context as first-class infrastructure rather than an afterthought. I wanted to explore how analytical reasoning could remain explorable, auditable, and grounded, even in complex notebooks.

What it does

Context Thread Agent tracks all notebook cells, outputs, assumptions, and dependencies. Users can ask questions like:

“Why did we filter out Q4?”

“What assumptions does this chart rely on?”

“Which downstream cells are affected by this change?”

The agent answers strictly from accumulated context—no hallucinations, only grounded reasoning.

How we built it

Context Extraction: Each cell (code, markdown, SQL) is indexed with content, outputs, intent, and dependencies.

Vector Database: FAISS/Chroma stores embeddings of context units for fast retrieval.

Retrieval Engine: Multi-stage search prioritizes relevant cells, dependencies, and recent changes.

LLM Reasoner: Receives only retrieved context, formats answers with citations to cells.

Frontend: Built with Gradio/Next.js to showcase interactive querying.

Challenges we ran into

Dependency Tracking: Capturing implicit links between cells was tricky; needed a reliable way to expand context upstream.

Answer Conciseness: Ensuring the LLM only used context without hallucinating required iterative prompt design.

Context Window Limits: Balancing how much history to feed into the model while maintaining performance.

Accomplishments that we're proud of

A fully functional prototype that answers context-based questions in real time.

Successfully demonstrated auditable reasoning, with cell-level citations.

Prototype shows agentic context reasoning applicable to real analytical workflows, aligning with Hex’s vision.

What we learned

Explicit context modeling improves trust in AI reasoning.

Step-aware retrieval is crucial for multi-cell notebooks.

UX for context-driven agents must balance clarity and completeness.

What's next for Context Thread Agent

Add permissions-aware context threads for team collaboration.

Integrate real notebook APIs to handle live data.

Support multi-user reasoning and sharing of context threads.

Explore change impact visualization to highlight downstream effects.

Built With

Share this project:

Updates