byaan
CLAUDE.md98 starsChanged 7 months agoMITView on GitHub
Byaan is a secure, locally-running data analysis tool that connects to databases and AI models while keeping data private. It's a desktop application (macOS/Linux) built with React frontend, FastAPI backend, and Tauri wrapper. Users can connect to databases (PostgreSQL, MongoDB, MySQL, SQLite), analyze data through AI-powered queries, and build exportable dashboards. Key Value Proposition: Data never leaves the local machine. Users connect to federated AI models (Azure, Bedrock, OpenRouter) and explore their databases securely without cloud dependencies.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- byaan:learnSkill
- byaan:mcp-setupSkill
- byaan:startSkill
- byaan:learnSkill
- byaan:mcp-setupSkill
- byaan:startSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
14 rules. About 0 are common, 7 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 114
Async everywhere: - all I/O uses asyncio
- Very specific: line 117
API responses: Use success_response(data, message) / error_response(error, message) from schemas.standard_response
- Very specific: line 137
Test markers: @pytest.mark.notebook, .connection, .workflow, .error_handling
- Distinctive: line 154
Create notebook with dataset in running app
- Distinctive: line 163
don't add any un-necessary comments please
- Distinctive: line 164
keep the code clean, simple and to the point
- Distinctive: line 165
only add comments that helps developers in future and are absolutely necessary
- Distinctive: line 169
When generating Alembic migrations:
- Very specific: line 170
Always implement complete
downgrade()functions: - never use pass or leave incomplete - Very specific: line 171
Every op.create_table() needs corresponding op.drop_table() in downgrade
- Very specific: line 175
Test both alembic upgrade AND alembic downgrade before committing
- Distinctive: line 184
When making changes to streaming behavior, SSE events, tool handling, or any feature that affects both paths:
- Very specific: line 185
Always check BOTH paths in unified_agent.py
- Very specific: line 186
If adding SSE events (like datasource_selected, html_edit_complete, etc.), ensure they're emitted in BOTH:
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Byaan is a secure, locally-running data analysis tool that connects to databases and AI models while keeping data private. It's a desktop application (macOS/Linux) built with React frontend, FastAPI backend, and Tauri wrapper. Users can connect to databases (PostgreSQL, MongoDB, MySQL, SQLite), analyze data through AI-powered queries, and build exportable dashboards.
Key Value Proposition: Data never leaves the local machine. Users connect to federated AI models (Azure, Bedrock, OpenRouter) and explore their databases securely without cloud dependencies.
Build & Development Commands
Backend (Python/FastAPI)
cd server && uv run ruff format . && uv run ruff check --fix . # Format & lint
cd server && uv run ruff check . # Lint check only
cd server && PYTHONPATH=..:tests uv run pytest # Run all tests
cd server && PYTHONPATH=..:tests uv run pytest tests/test_file.py::test_function # Single test
cd server && uv run pytest --cov=server --cov-report=term-missing # Tests with coverageFrontend (React/TypeScript)
cd client && pnpm dev # Development server (port 5173)
cd client && pnpm build # Production build
cd client && pnpm build:check # TypeScript + Vite build check
cd client && pnpm lint # ESLintDesktop App (Tauri)
cd client && pnpm tauri:dev # Dev mode with hot reload
cd client && pnpm tauri:build # Production build (auto-detects arch)
cd client && pnpm tauri:build:m-series # M-series Mac build
cd client && pnpm tauri:build:intel # Intel Mac buildDocker
# Local/Community (default — SQLite, no PostgreSQL)
make setup # Build images
make dev # Run with logs (foreground)
make dev-detach # Run in background
make dev-build # Build + run with logs
make stop # Stop all services
make rebuild # Full rebuild (no cache)
make clean # Remove containers/volumes
# Hosted (PostgreSQL, closer to production)
make hosted # Start hosted environment (background)
make hosted-logs # Start with visible logs
make hosted-stop # Stop hosted services
make hosted-rebuild # Rebuild hosted images
make hosted-clean # Remove hosted containers/volumesAccess Points
- Frontend (local): http://localhost:17434
- Backend API (local): http://localhost:17433
- Frontend (hosted): http://localhost:5173
- Backend API (hosted): http://localhost:8000
- API Docs: http://localhost:8000/docs (hosted) or http://localhost:17433/docs (local)
Architecture
project_x/
├── client/ # React 19 + TypeScript + Vite frontend
│ ├── src/
│ │ ├── pages/ # ChatPreview, Databases, LLMConnections, NotebooksPage
│ │ ├── stores/ # Zustand state management
│ │ ├── services/ # API client wrappers
│ │ └── components/ # Reusable UI components
│ └── src-tauri/ # Rust/Tauri desktop shell
├── server/ # FastAPI backend
│ ├── routers/ # API endpoints
│ ├── services/ # Business logic (unified_agent.py is 66KB - AI orchestration)
│ ├── models/ # SQLAlchemy ORM models
│ ├── schemas/ # Pydantic request/response schemas
│ ├── repositories/ # Data access layer
│ ├── tools/ # Agent tools (agentic.py is 42KB - HTML generation, queries)
│ ├── db/ # Database session management
│ ├── migrations/ # Alembic migrations
│ └── tests/ # pytest suite
└── web/ # Web-only variant (React 18, different deployment)Key Services
- server/services/unified_agent.py - OpenAI Agents orchestration, conversation state, streaming
- server/tools/agentic.py - Core agent tools: HTML dashboard generation, query execution
- server/services/llm_service.py - LiteLLM integration for multi-provider LLM support
- server/services/duckdb_service.py - Analytical queries via DuckDB
Data Flow
- Frontend makes HTTP requests to
/api/* - Vite proxy (dev) or Tauri (prod) forwards to FastAPI backend
- Routers use services for business logic
- Services interact with repositories for data access
- Responses use standard envelope:
success_response()/error_response()
Code Conventions
Python
- Ruff for formatting/linting (line-length: 120, Python 3.11+)
- Double quotes for strings
- Async everywhere - all I/O uses asyncio
- Type hints required - Pydantic models, generators, etc.
- Logger:
from server.utils.custom_logger import get_logger - API responses: Use
success_response(data, message)/error_response(error, message)fromschemas.standard_response - Imports: Alphabetically sorted; first-party modules after stdlib/third-party
TypeScript/React
- ESLint configured, run
pnpm lint - Functional components + hooks
- Zustand for global state
- TanStack React Query for data fetching
Database
- SQLAlchemy 2.0+ async style (AsyncSessionFactory)
- SQLite default (auto-created in server/.data/app.db)
- Alembic migrations run on app startup
- Supported: PostgreSQL, MongoDB, MySQL, ODBC
Testing
- pytest with asyncio support (asyncio_mode=auto)
- Test markers:
@pytest.mark.notebook,.connection,.workflow,.error_handling - Fixtures in
server/tests/conftest.py
Production Build
Desktop app bundles:
- React frontend compiled by Vite
- FastAPI backend frozen via PyInstaller
- Tauri creates native DMG/AppImage
Log location (macOS): ~/Library/Application Support/com.byaan.desktop/backend.log
Demo Data Workflow
To add new demo notebooks:
- Create notebook with dataset in running app
- Copy notebook UUID
- Edit
server/scripts/export_notebooks_to_demo.pyline 39 - Run:
python3 server/scripts/export_notebooks_to_demo.py - Commit updated
server/example_data/demo_notebooks.json - On next app start,
main.pydetects version change and seeds new examples
Important Coding Rules for you
- don't add any un-necessary comments please
- keep the code clean, simple and to the point
- only add comments that helps developers in future and are absolutely necessary
Database Migrations
When generating Alembic migrations:
- Always implement complete
downgrade()functions - never usepassor leave incomplete - Every
op.create_table()needs correspondingop.drop_table()in downgrade - Every
op.add_column()needs correspondingop.drop_column()in downgrade - Every
op.create_index()needs correspondingop.drop_index()in downgrade - Every
op.create_foreign_key()needs correspondingop.drop_constraint()in downgrade - Test both
alembic upgradeANDalembic downgradebefore committing
Dual Code Paths in unified_agent.py
IMPORTANT: server/services/unified_agent.py has TWO separate code paths for streaming:
- Claude MCP Service path (when
use_claude_sdk=True) - Usesserver/services/claude_mcp_service.pyfor Claude Code authentication - OpenAI Agents SDK path (when
use_claude_sdk=False) - Uses LiteLLM for other models (OpenAI, Azure, Bedrock, etc.)
When making changes to streaming behavior, SSE events, tool handling, or any feature that affects both paths:
- Always check BOTH paths in
unified_agent.py - If adding SSE events (like
datasource_selected,html_edit_complete, etc.), ensure they're emitted in BOTH:- The Claude MCP path in
claude_mcp_service.py - The OpenAI Agents SDK path in
unified_agent.py
- The Claude MCP path in
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

