This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
HiPAI (Highly Personalized AI) is a framework for building personalized AI chatbot experiences. It includes two Streamlit-based chat applications backed by a vector memory store, exposed via MCP (Model Context Protocol) servers.
# Install dependencies (uses uv)
uv sync
# Run the personal AI assistant chatbot
streamlit run web/hipai_assistant.py
# Run the AI clone chatbot (mimics the user)
streamlit run web/hipai_clone.py
# Run the local MCP server standalone
python hipai/tools.py
# Seed the memory store from a text file of facts (one per line)
python scripts/build_memory_db.py <path/to/facts.txt>Linting uses ruff (configured in pyproject.toml): line length 120, target Python 3.9+.
The aimu package (local editable install from ../aimu) provides the core abstractions used throughout:
aimu.models:OllamaClient,HuggingFaceClient,AisuiteClient— unified LLM interface with tool-use supportaimu.tools.client:MCPClient— connects Streamlit apps to MCP serversaimu.tools.servers: MCP server exposingsearch_memoriesandadd_memoriestools (backed byaimu.memory)aimu.memory:MemoryStore— vector memory persistenceaimu.history:ConversationManager— persists conversation history as JSON
Two MCP servers are used:
-
aimu.tools.servers(from theaimupackage) — the primary memory server, providingsearch_memoriesandadd_memoriestools to LLMs. Both Streamlit apps connect to this server. -
hipai/tools.py(local FastMCP server) — utility server providingget_current_date_and_timeonly. Memory tools were migrated to theaimupackage.
Both servers are launched as subprocesses by MCPClient when a Streamlit app starts.
Both apps share identical structure — the only differences are the system message and sidebar title:
web/hipai_assistant.py— AI friend persona ("Bruce"), importsMCPClientfromaimu.tools.clientweb/hipai_clone.py— User clone persona, importsMCPClientfromaimu.tools
Both apps save chat history to output/chat_history.json.
App initialization flow:
- On first render, create model client + MCP client, load last conversation from
ConversationManager - If no prior messages exist, stream an AI-generated greeting
- Sidebar allows switching model client type (Ollama/HuggingFace/Aisuite) and model — switching creates a new client instance and calls
st.rerun() - "Reset chat" creates a new
ConversationManagerconversation and clears session state
Centralized path constants: root, data, tests, package, output. All file I/O should use these rather than hardcoded paths.
All runtime artifacts go to output/ (gitignored): memory_store/ (vector store written by MemoryStore), chat_history.json. This directory must exist before running the apps.