CLAUDE.md - Agentic System Guide
Serves as the master orientation file for an agentic AI system with Python backend and React frontend, defining environment detection, development workflows, and deployment procedures.
What this file does
Serves as the master orientation file for an agentic AI system with Python backend and React frontend, defining environment detection, development workflows, and deployment procedures.
When to use it
- Onboarding a new AI agent to understand the codebase structure and operational contexts
- Setting up local development or production deployment on a Jetson Nano
- Creating new agents or tools following the defined patterns
- Debugging WebRTC voice system or database issues
Assumes this stack
CLAUDE.md - Agentic System Guide
Last Updated: 2025-12-07 For: Future Claude instances working on this codebase
š Quick Start
New to this project? Start here:
- Quick Start Guide - Get running in 5 minutes
- Operational Context - Understand your environment (Local Dev vs Production)
- Documentation Index - Complete documentation map
Table of Contents
- Essential Context
- Project Overview
- Architecture
- Development Guides
- System Components
- Deployment
- Quick Reference
Essential Context
Detect Your Environment First
hostname && pwd
Two operational contexts exist:
- Local Development (VS Code) - Direct code editing, localhost URLs
- Jetson Production - Voice assistant, systemd services, HTTPS URLs
š See: OPERATIONAL_CONTEXT.md for complete context guide.
ā ļø CRITICAL: Node.js Environment Differences
Local Development (uses NVM):
~/.nvm/versions/node/v22.21.1/bin/npm start
Jetson Production (uses Conda):
export PATH=/home/rodrigo/miniconda3/envs/agentic/bin:$PATH
npm run build
Note: Never use bare npm or node commands - always use full paths or set PATH first.
Project Overview
An agentic AI system with Python backend (FastAPI + AutoGen) and React frontend.
Key Features
- Multi-agent coordination - Nested team agents with orchestration
- Multimodal vision agents - Interpret images from tool responses
- Voice assistant - OpenAI Realtime API with WebRTC bridge
- Mobile voice interface - Smartphone as wireless microphone
- Claude Code integration - Live code self-editing
- Memory management - ChromaDB + MongoDB storage
- Screenshot workflows - Automated UI development
Tech Stack
Backend:
- Python 3.x, FastAPI, AutoGen
- ChromaDB 0.4.24, MongoDB 3.6+, SQLite
- OpenAI API, Anthropic API
Frontend:
- React 18, Material-UI
- WebSocket + WebRTC
- Feature-based architecture
Architecture
Directory Structure
/home/rodrigo/agentic/
āāā backend/ # Python FastAPI server
ā āāā main.py # FastAPI entry point
ā āāā agents/ # Agent JSON configurations
ā āāā tools/ # Custom tool implementations
ā āāā core/ # Agent execution engine
ā āāā api/ # Voice & Claude Code controllers
ā āāā config/ # Configuration & schemas
ā āāā utils/ # Utility modules
ā āāā tests/ # Test suite
ā
āāā frontend/ # React application
ā āāā src/features/ # Feature-based organization
ā āāā agents/ # Agent management
ā āāā tools/ # Tool management
ā āāā voice/ # Voice assistant
ā
āāā debug/ # Screenshot & export tools
āāā docs/ # Documentation
āāā CLAUDE.md # This file
Data Flow
User Input ā WebSocket ā FastAPI ā Agent Factory ā Agent Execution
ā Tool Execution ā WebSocket Stream ā Frontend ā UI Display
Important URLs
Local Development:
- Backend:
http://localhost:8000 - Frontend:
http://localhost:3000/agentic/
Production (Jetson):
- Backend:
https://192.168.0.200/api/ - Frontend:
https://192.168.0.200/agentic/
Development Guides
Agent Development
Agent Types:
looping- Single agent with tool loopnested_team- Multi-agent coordinationmultimodal_tools_looping- Vision-capable agentdynamic_init_looping- Custom initialization logic
Create New Agent:
- Create JSON in
backend/agents/YourAgent.json - Configure tools, LLM, prompts
- Test via frontend
š Complete Guide: Creating New Agents (see full CLAUDE.md)
Tool Development
Tool Structure:
# tools/my_tool.py
from autogen_core.tools import FunctionTool
def my_tool(param: str) -> str:
"""Tool description for LLM"""
return f"Result: {param}"
my_tool_func = FunctionTool(
func=my_tool,
name="my_tool",
description="Brief description"
)
tools = [my_tool_func]
š Complete Guide: Creating New Tools (see full CLAUDE.md)
Voice System
WebRTC Bridge Architecture:
Browser (WebRTC) ā Backend (aiortc) ā OpenAI Realtime API (WebRTC)
Start Interactive Session:
# Terminal 1
./start-backend.sh
# Terminal 2
./start-frontend.sh
# Browser: http://localhost:3000/agentic/voice
š Complete Guides:
- Voice Quick Start - 1-minute setup
- Voice Interactive Guide - Full walkthrough
- Voice System Overview - Testing guide
Mobile Voice Interface
Purpose: Use smartphone as wireless microphone
Access: http://[YOUR_IP]:3000/agentic/mobile-voice
š Complete Guide: docs/guides/MOBILE_VOICE_GUIDE.md
System Components
Database & Memory
Two Systems:
- MongoDB - Structured data (Database agent, 10 tools)
- ChromaDB - Vector memory (Memory agent, 8 tools)
š Complete Setup: docs/guides/DATABASE_AND_MEMORY_SETUP.md
Debugging Tools
Screenshot Automation:
~/.nvm/versions/node/v22.21.1/bin/node debug/screenshot.js http://localhost:3000/agentic/voice
Voice Conversation Export:
python3 debug/export_voice_conversations.py
š Complete Guide: Debugging Tools & Workflows (see full CLAUDE.md)
Claude Code Integration
Self-editing capabilities via voice:
- Voice model calls:
send_to_claude_code({text: "Add feature"}) - Claude Code executes with
bypassPermissionsmode - Events stream back via WebSocket
š Complete Guide: Claude Code Self-Editor (see full CLAUDE.md)
Deployment
Jetson Nano Production
Server: 192.168.0.200 (ARM64, Ubuntu 18.04.6 LTS)
Quick Access:
# SSH
ssh rodrigo@192.168.0.200
# HTTPS
https://192.168.0.200/agentic/
Environment: Miniconda3 with agentic conda environment (Python 3.11, Node 20.17)
Common Tasks:
# Set PATH for conda environment (required for non-interactive SSH)
export PATH=/home/rodrigo/miniconda3/envs/agentic/bin:$PATH
# Deploy frontend update
cd ~/agentic/frontend
npm install # if new dependencies
npm run build
sudo kill -HUP $(cat ~/nginx.pid)
# Restart backend
sudo systemctl restart agentic-backend
# View logs
sudo journalctl -u agentic-backend -f
š Complete Guide: docs/deployment/JETSON_DEPLOYMENT_GUIDE.md
Quick Reference
Common Commands
# Start services (local dev)
cd backend && source venv/bin/activate && uvicorn main:app --reload
cd frontend && ~/.nvm/versions/node/v22.21.1/bin/npm start
# Run tests
cd backend && pytest tests/ -v
# Take screenshot
~/.nvm/versions/node/v22.21.1/bin/node debug/screenshot.js http://localhost:3000/agentic/voice
# Export voice data
python3 debug/export_voice_conversations.py
# List agents/tools
curl http://localhost:8000/api/agents
curl http://localhost:8000/api/tools
WebRTC Voice Commands
# Test WebRTC (no network)
pytest tests/integration/test_backend_webrtc_integration.py -v
# Check active sessions
curl http://localhost:8000/api/realtime/conversations
# Stop voice bridge
curl -X DELETE http://localhost:8000/api/realtime/webrtc/bridge/{conversation_id}
# Monitor logs
tail -f logs/backend.log | grep -E "(webrtc|openai)"
File Locations
| Purpose | Location |
|---|---|
| Agent configs | backend/agents/*.json |
| Tool implementations | backend/tools/*.py |
| Voice controller | backend/api/realtime_voice_webrtc.py |
| OpenAI WebRTC client | backend/api/openai_webrtc_client.py |
| Frontend voice | frontend/src/features/voice/pages/ |
| Screenshot tool | debug/screenshot.js |
| Voice DB exports | debug/db_exports/voice_conversations/ |
| Documentation | docs/ |
Best Practices
Development Workflow
- Always Use TodoWrite - Track multi-step tasks
- Read Before Write - Understand context before changes
- Test Changes - Screenshots for UI, exports for backend
- Screenshot Before/After - Visual verification for UI changes
UI Development
# 1. Screenshot before
node debug/screenshot.js http://localhost:3000/agentic/voice before.png
# 2. Make changes
# 3. Wait for hot reload
sleep 3
# 4. Screenshot after
node debug/screenshot.js http://localhost:3000/agentic/voice after.png
# 5. Read and verify
Agent Development
- Design agent purpose - What specific task?
- Choose agent type - Looping or nested team?
- Select tools - What capabilities needed?
- Write system prompt - Clear instructions + examples
- Test iteratively - Start simple, add complexity
Troubleshooting
Backend Issues
# Port conflict
lsof -i :8000
# Dependencies
cd backend && pip install -r requirements.txt
# MongoDB not running
sudo systemctl start mongodb
Frontend Issues
# Always use nvm path!
export NODE_PATH=~/.nvm/versions/node/v22.21.1/bin
# Port conflict
lsof -i :3000
# Reinstall dependencies
cd frontend && $NODE_PATH/npm install
WebRTC Issues
# Check browser console for ICE state
# Expected: new ā checking ā connected ā completed
# Backend logs
tail -f logs/backend.log | grep -i webrtc
# Verify OPENAI_API_KEY
grep OPENAI_API_KEY backend/.env
Documentation Index
Core Documentation
- QUICK_START.md - Get started in 5 minutes
- OPERATIONAL_CONTEXT.md - Context-specific behavior
- DOCUMENTATION_INDEX.md - Complete doc map
Feature Guides
- DATABASE_AND_MEMORY_SETUP.md - MongoDB & ChromaDB
- MULTIMODAL_AGENT_GUIDE.md - Vision agents
- MOBILE_VOICE_GUIDE.md - Smartphone microphone
Voice System
- Voice System Overview - Architecture & integration
- Voice Quick Start - 5-minute setup
- Voice Interactive Guide - Complete walkthrough
- Voice Commands - Command reference
- Voice Troubleshooting - Debug guide
Voice Technical Details
- Backend Implementation - WebRTC bridge (coming soon)
- Frontend Implementation - React components (coming soon)
- Nested Agents Integration - Agent orchestration
- Audio Fixes Log - Historical audio issues & fixes
Deployment
- JETSON_DEPLOYMENT_GUIDE.md - Production server
- TV_WEBVIEW_FIX_SUMMARY.md - TV compatibility
Architecture
- REFACTORING_SUMMARY.md - Backend structure
- FRONTEND_REFACTORING.md - Frontend structure
Recent Changes
Interactive Session Setup (2025-12-04)
- Created helper scripts:
start-backend.sh,start-frontend.sh,start-webrtc-session.sh - Added comprehensive WebRTC testing guides
- Dual logging (console +
/tmp/agentic-logs/)
WebRTC Bridge Migration (2025-12-04)
- Migrated from Pipecat to pure WebRTC bridge
- Direct OpenAI Realtime API connection
- Comprehensive unit and integration tests
Documentation Reorganization (2025-12-04)
- Extracted detailed content to focused guides
- Created QUICK_START.md for immediate setup
- Streamlined CLAUDE.md with references
NVM Node Path Enforcement (2025-12-04)
- Critical instructions for using full nvm paths
- System node may be outdated/incompatible
Database & Memory System (2025-12-02)
- MongoDB + ChromaDB fully operational
- Memory banks migrated from git history
- Comprehensive setup documentation
End of CLAUDE.md
For detailed information on any topic, see the documentation links above.
Last updated: 2025-12-04
What's inside
12 sections covering quick start, architecture, development guides, system components, deployment, and troubleshooting with 15+ code examples
Change this for your project
- Replace
/home/rodrigo/agentic/with your project root path - Replace
rodrigoin SSH commands and paths with your username - Replace
192.168.0.200with your production server IP - Replace
agenticconda environment name with your environment name
Where it goes
Save in docs/ or the repository root. Gives agents and new contributors a map of the codebase.
Worth borrowing
- Environment detection via
hostname && pwdbefore any command execution - Separate operational contexts (local dev vs production) with distinct PATH and URL configurations
- Screenshot-based UI verification workflow with before/after comparison
Related Documents
PCB Design Sources for Industry-Scale Testing
Lists GitHub repos and communities where you can download real PCB designs for testing optimization at scale.
Design Document: BharatSeva AI
Describes a 10-agent AWS system that helps India's informal workers access government schemes via voice-first, serverless architecture.
OpenClaw Enterprise Transformation Plan
Transforms a single-user AI agent into a dual-mode platform supporting both viral open-source and Fortune 500 enterprise deployments through phased security, IAM, audit, multi-tenancy, and Kubernetes features.
Qwen Image and Edit: Open-sourcing and Local GGUF Generations with Lightning
Documents the Qwen-Image and Qwen-Image-Edit models, covering architecture, training, benchmarks, ComfyUI setup, and prompting techniques for local GGUF deployment.