Skip to content
← All work

P—01 Case study · AI & ML

Graph RAG AI Assistant

Role

AI Systems Engineer

Status

active

Started

May 2026

Last activity

Oct 2026

Stack

13 technologies

Graph RAG AI Assistant

Overview

Developed Graph RAG v2 around the needs of a general assistant across short-to-medium sessions. The memory backbone stores conversation history, tool results, preferences and dated commitments, including events and deadlines.

Reworked graph retrieval to search the actual question before following related interactions. Full-text search, optional vector retrieval and source references preserve the context behind recalled information. Facts track when a claim applies and when it was recorded.

Added a reusable assistant runner with validated tools, approval and recovery flows, persisted sessions and background memory maintenance. Library, CLI and authenticated HTTP interfaces use the same assistant core. Verified behavior through offline tests and source-retrieval evaluations.

It runs fully on my machine: the OpenAI SDK talks to a llama.cpp server hosting the model, and cloud models are an optional setting.

Outcomes

301

Offline checks passed

Impact

  1. 01Reworked Graph RAG retrieval around query-matched evidence and related interactions
  2. 02Built persistent assistant memory for conversations, tool results and dated commitments
  3. 03Added source-backed facts that preserve preference changes and historical validity
  4. 04Implemented validated tool execution with approvals, receipts and uncertain-outcome recovery
  5. 05Connected the assistant core to library, CLI and authenticated HTTP interfaces
  6. 06Added queued summaries and deletion across sources, derived memory and saved execution state

Features

01

Cross-session recall

Retrieves earlier conversations and tool results with references to the stored sources.

02

Query-driven graph retrieval

Searches the question first, then expands related interactions within scope and context limits.

03

Events and deadlines

Stores dated commitments with validity periods and source evidence for later retrieval.

04

Changing facts and preferences

Preserves corrections and earlier beliefs while separating current facts from historical claims.

05

Validated assistant tools

Checks tool arguments before execution and supports approval, receipts and explicit recovery.

06

Persistent sessions

Keeps messages and matched tool results through restart without duplicating conversation history.

07

Summaries and deletion

Queues source-backed summaries and removes deleted evidence from memory and saved execution state.

08

Reusable assistant interfaces

Shares the same assistant core across Python applications, a CLI and authenticated HTTP.

Architecture

01Library, CLI and HTTP02Assistant runner03Scoped session and recall04SQLite sources andinteraction graph05Full-text and optionalvector retrieval06Facts and validity dates07Tool validation andapprovals08Execution journal andreceipts09Summary and deletion jobs

Applications submit messages through the Python interface, CLI or FastAPI. The assistant runner loads the scoped session and adds quoted historical evidence to model context. SQLite stores the full conversation, tool-call/result links and source-backed facts. Retrieval searches the actual question, combines full-text and optional vector candidates, and follows relevant interaction links within a context budget. Facts use separate validity and recording times for corrections and dated commitments. Registered tools pass schema validation and policy checks before execution. A durable journal records intent, approvals and receipts, with reconciliation for uncertain outcomes. Explicit background jobs build summaries from source records. Coordinated deletion removes sources, invalidates dependent memory and prevents erased execution state from being replayed. Models are called through the OpenAI SDK against a local llama.cpp server; a cloud endpoint is an optional setting.

Stack

PythonSQLiteFTS5ChromaDBllama.cppOpenAI Agents SDKOpenAI SDKFastAPIUvicornPydanticHTTPXJSON SchemaKubernetes

Development log

  1. · Milestone

    Graph RAG v2 adds assistant-specific memory and tool recovery

    Developed an assistant memory backbone for conversation history, events, deadlines and tool results. Reworked query-driven graph retrieval and added persistent sessions, dated facts, validated tools, approvals and recovery. Connected the core to library, CLI and authenticated HTTP interfaces, with source-backed summaries and coordinated deletion.

  2. · Progress

    Local AI Agent System, Full Documentation & Portfolio Update

    Successfully documented and published the complete architecture of the Graph-Augmented Multi-Agent Orchestrator. The entire system runs 100% locally via LM Studio. Built a fully custom Graph RAG from scratch: SQLite, recursive CTE lineage traversal, cross-session linking, and token-budget-aware context assembly.

  3. · Progress

    Multi agent system, Metrics & Demo

    Final metrics published: average inference latency 320ms, token usage optimized to 1.2K per simple query, tool calling success rate 94%. Video demo and GitHub code release pending.

  4. · Progress

    Multi agent system

    Completed with the project along with final tests for latency, token usage, inference times and other metrics. Will post the metrics and related data and findings in github and a video demo in the future.

  5. · Progress

    Multi-agent system handles simple prompts

    Architecture behaviour for simple prompts is correct with no fetching of unwanted context but an error has occurred where the model is replying with its ability to answer a simple prompt but not the answer itself.

  6. · Progress

    Multi-agent system with chat, plan and refuse modes

    After a lot of work, I got more robust tool calling and three modes of operation: chat, plan and refuse. Chat will only have conversational capabilities while plan will be agentic system with tool calling and refuse mode as safety fall back. This lets me have conversation and direct memory retrieval and answering capabilities without having to trigger worker model.

  7. · Progress

    Local AI agent

    Successfully implemented the news agent with tool calling and WhatsApp interface for chat.

  8. · Progress

    Local Agent System Architecture

    Changing and improving orchestrator logic with better structured output support to reduce incompatibility errors. Also planned to implement Vectorless RAG inspired Graph/Reasoning based vector memory storage for faster and efficient context retrieval.

  9. · Started

    Security-oriented OpenClaw-style build with WhatsApp prompts and responses.

    Security-oriented OpenClaw-style build with WhatsApp prompts and responses. The original scope and idea is to have a news agent, an email summarizer agent and a calendar agent. Implementing the Google API and related architecture.