fe7c146dc6
feat: Add Gitea MCP integration and project cleanup
...
## New Features
- **Gitea MCP Tools** (zero API cost):
- gitea_read_file: Read files from homelab repo
- gitea_list_files: Browse directories
- gitea_search_code: Search by filename
- gitea_get_tree: Get directory tree
- **Gitea Client** (gitea_tools/client.py): REST API wrapper with OAuth
- **Proxmox SSH Scripts** (scripts/): Homelab data collection utilities
- **Obsidian MCP Support** (obsidian_mcp.py): Advanced vault operations
- **Voice Integration Plan** (JARVIS_VOICE_INTEGRATION_PLAN.md)
## Improvements
- **Increased timeout**: 5min → 10min for complex tasks (llm_interface.py)
- **Removed Direct API fallback**: Gitea tools are MCP-only (zero cost)
- **Updated .env.example**: Added Obsidian MCP configuration
- **Enhanced .gitignore**: Protect personal memory files (SOUL.md, MEMORY.md)
## Cleanup
- Deleted 24 obsolete files (temp/test/experimental scripts, outdated docs)
- Untracked personal memory files (SOUL.md, MEMORY.md now in .gitignore)
- Removed: AGENT_SDK_IMPLEMENTATION.md, HYBRID_SEARCH_SUMMARY.md,
IMPLEMENTATION_SUMMARY.md, MIGRATION.md, test_agent_sdk.py, etc.
## Configuration
- Added config/gitea_config.example.yaml (Gitea setup template)
- Added config/obsidian_mcp.example.yaml (Obsidian MCP template)
- Updated scheduled_tasks.yaml with new task examples
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-18 20:31:32 -07:00
0271dea551
Add comprehensive structured logging system
...
Features:
- JSON-formatted logs for easy parsing and analysis
- Rotating log files (prevents disk space issues)
* ajarbot.log: All events, 10MB rotation, 5 backups
* errors.log: Errors only, 5MB rotation, 3 backups
* tools.log: Tool execution tracking, 10MB rotation, 3 backups
Tool Execution Tracking:
- Every tool call logged with inputs, outputs, duration
- Success/failure status tracking
- Performance metrics (execution time in milliseconds)
- Error messages captured with full context
Logging Integration:
- tools.py: All tool executions automatically logged
- Structured logger classes with context preservation
- Console output (human-readable) + file logs (JSON)
- Separate error log for quick issue identification
Log Analysis:
- JSON format enables programmatic analysis
- Easy to search for patterns (max tokens, iterations, etc.)
- Performance tracking (slow tools, failure rates)
- Historical debugging with full context
Documentation:
- LOGGING.md: Complete usage guide
- Log analysis examples with jq commands
- Error pattern reference
- Maintenance and integration instructions
Benefits:
- Quick error diagnosis with separate errors.log
- Performance monitoring and optimization
- Historical analysis for troubleshooting
- Automatic log rotation (max 95MB total)
Updated .gitignore to exclude logs/ directory
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-16 16:32:18 -07:00
50cf7165cb
Add sub-agent orchestration, MCP tools, and critical bug fixes
...
Major Features:
- Sub-agent orchestration system with dynamic specialist spawning
* spawn_sub_agent(): Create specialists with custom prompts
* delegate(): Convenience method for task delegation
* Cached specialists for reuse
* Separate conversation histories and focused context
- MCP (Model Context Protocol) tool integration
* Zettelkasten: fleeting_note, daily_note, permanent_note, literature_note
* Search: search_vault (hybrid search), search_by_tags
* Web: web_fetch for real-time data
* Zero-cost file/system operations on Pro subscription
Critical Bug Fixes:
- Fixed max tool iterations (15 → 30, configurable)
- Fixed max_tokens error in Agent SDK query() call
- Fixed MCP tool routing in execute_tool()
* Routes zettelkasten + web tools to async handlers
* Prevents "Unknown tool" errors
Documentation:
- SUB_AGENTS.md: Complete guide to sub-agent system
- MCP_MIGRATION.md: Agent SDK migration details
- SOUL.example.md: Sanitized bot identity template
- scheduled_tasks.example.yaml: Sanitized task config template
Security:
- Added obsidian vault to .gitignore
- Protected SOUL.md and MEMORY.md (personal configs)
- Sanitized example configs with placeholders
Dependencies:
- Added beautifulsoup4, httpx, lxml for web scraping
- Updated requirements.txt
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-16 07:43:31 -07:00
a8665d8c72
Refactor: Clean up obsolete files and organize codebase structure
...
This commit removes deprecated modules and reorganizes code into logical directories:
Deleted files (superseded by newer systems):
- claude_code_server.py (replaced by agent-sdk direct integration)
- heartbeat.py (superseded by scheduled_tasks.py)
- pulse_brain.py (unused in production)
- config/pulse_brain_config.py (obsolete config)
Created directory structure:
- examples/ (7 example files: example_*.py, demo_*.py)
- tests/ (5 test files: test_*.py)
Updated imports:
- agent.py: Removed heartbeat module and all enable_heartbeat logic
- bot_runner.py: Removed heartbeat parameter from Agent initialization
- llm_interface.py: Updated deprecated claude_code_server message
Preserved essential files:
- hooks.py (for future use)
- adapters/skill_integration.py (for future use)
- All Google integration tools (Gmail, Calendar, Contacts)
- GLM provider code (backward compatibility)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-15 09:57:39 -07:00
f018800d94
Implement self-healing system Phase 1: Error capture and logging
...
- Add SelfHealingSystem with error observation infrastructure
- Capture errors with full context: type, message, stack trace, intent, inputs
- Log to MEMORY.md with deduplication (max 3 attempts per error signature)
- Integrate error capture in agent, tools, runtime, and scheduler
- Non-invasive: preserves all existing error handling behavior
- Foundation for future diagnosis and auto-fixing capabilities
Phase 1 of 4-phase rollout - observation only, no auto-fixing yet.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-14 18:03:42 -07:00
0eb5d2cab4
Add Google Contacts integration and fix critical Windows issues
...
- Add People API integration with contact management tools (create, list, get)
- Fix OAuth flow: replace deprecated OOB with localhost callback
- Fix Ctrl+C handling with proper signal handlers for graceful shutdown
- Fix UTF-8 encoding in scheduled_tasks.py for Windows compatibility
- Add users/ directory to gitignore to protect personal data
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-14 15:12:01 -07:00
dc14baf426
Add Gmail and Google Calendar integration
...
Implements on-demand Google tools (not adapter) for email and calendar access via OAuth2.
Features:
- OAuth2 user consent flow with automatic token refresh
- 3 Gmail tools: send_email, read_emails, get_email
- 3 Calendar tools: read_calendar, create_calendar_event, search_calendar
- Lazy loading pattern for Google clients
- Secure token storage with file permissions
- Browser-based setup: python bot_runner.py --setup-google
Architecture:
- Tools-only approach (zero API calls when not in use)
- User-initiated actions only (no continuous polling)
- MIME message creation for emails with threading support
- HTML to text conversion for email parsing
- ISO 8601 timestamp handling for calendar events
Files added:
- google_tools/oauth_manager.py: OAuth2 flow and token management
- google_tools/gmail_client.py: Gmail API wrapper
- google_tools/calendar_client.py: Calendar API wrapper
- google_tools/utils.py: Email/MIME helpers
- config/scheduled_tasks.yaml: Example scheduled tasks config
Files modified:
- tools.py: Added 6 Google tool handlers with lazy initialization
- bot_runner.py: Added --setup-google command for OAuth authorization
- requirements.txt: Added Google API dependencies
- .gitignore: Added google_credentials.yaml and google_oauth_token.json
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-14 10:29:28 -07:00
8afff96bb5
Add API usage tracking and dynamic task reloading
...
Features:
- Usage tracking system (usage_tracker.py)
- Tracks input/output tokens per API call
- Calculates costs with support for cache pricing
- Stores data in usage_data.json (gitignored)
- Integrated into llm_interface.py
- Dynamic task scheduler reloading
- Auto-detects YAML changes every 60s
- No restart needed for new tasks
- reload_tasks() method for manual refresh
- Example cost tracking scheduled task
- Daily API usage report
- Budget tracking ($5/month target)
- Disabled by default in scheduled_tasks.yaml
Improvements:
- Fixed tool_use/tool_result pair splitting bug (CRITICAL)
- Added thread safety to agent.chat()
- Fixed N+1 query problem in hybrid search
- Optimized database batch queries
- Added conversation history pruning (50 messages max)
Updated .gitignore:
- Exclude user profiles (memory_workspace/users/*.md)
- Exclude usage data (usage_data.json)
- Exclude vector index (vectors.usearch)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-13 23:38:44 -07:00
a99799bf3d
Initial commit: Ajarbot with optimizations
...
Features:
- Multi-platform bot (Slack, Telegram)
- Memory system with SQLite FTS
- Tool use capabilities (file ops, commands)
- Scheduled tasks system
- Dynamic model switching (/sonnet, /haiku)
- Prompt caching for cost optimization
Optimizations:
- Default to Haiku 4.5 (12x cheaper)
- Reduced context: 3 messages, 2 memory results
- Optimized SOUL.md (48% smaller)
- Automatic caching when using Sonnet (90% savings)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-13 19:06:28 -07:00