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>
This commit is contained in:
2026-02-13 19:06:28 -07:00
commit a99799bf3d
58 changed files with 11434 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
---
name: adapter-dev
description: Help develop and debug messaging platform adapters for ajarbot
user-invocable: true
disable-model-invocation: true
allowed-tools: Read, Grep, Glob, Edit, Bash
context: fork
agent: Plan
---
# Adapter Development Skill
You are helping develop messaging platform adapters for ajarbot using the OpenClaw-inspired architecture.
## When invoked
1. **Analyze the request**: Understand what adapter work is needed
2. **Check existing patterns**: Review `adapters/slack/` and `adapters/telegram/` for patterns
3. **Follow the base contract**: All adapters must implement `BaseAdapter` from `adapters/base.py`
4. **Test the implementation**: Suggest tests and validation steps
## Key files to reference
- `adapters/base.py` - Base adapter interface
- `adapters/runtime.py` - Runtime integration
- `adapters/slack/adapter.py` - Slack Socket Mode example
- `adapters/telegram/adapter.py` - Telegram example
- `README_ADAPTERS.md` - Architecture documentation
## Common tasks
### Create new adapter
1. Create `adapters/<platform>/adapter.py`
2. Implement required methods from `BaseAdapter`
3. Define capabilities (threads, reactions, max length, etc.)
4. Add to `bot_runner.py`
5. Update config template
### Debug adapter issues
1. Check `validate_config()` returns true
2. Verify credentials format
3. Test `health_check()` method
4. Review async event handler registration
5. Check message chunking logic
### Update existing adapter
1. Read current implementation
2. Understand the change request
3. Follow existing patterns
4. Preserve backward compatibility
5. Update documentation
## Security considerations
- Never log credentials or tokens
- Validate all user input before processing
- Use platform-specific rate limits
- Handle errors gracefully
- Respect user allowlists
## Output format
Provide:
1. Clear explanation of changes
2. Code implementation
3. Configuration updates needed
4. Testing steps
5. Documentation updates

View File

@@ -0,0 +1,53 @@
# Adapter Development Skill - Usage Examples
## Example 1: Create a new Discord adapter
```
/adapter-dev create a Discord adapter using discord.py
```
The skill will:
- Analyze existing Slack/Telegram adapters
- Create `adapters/discord/adapter.py`
- Implement BaseAdapter with Discord-specific logic
- Add configuration section
- Provide setup instructions
## Example 2: Debug connection issues
```
/adapter-dev why isn't my Telegram adapter connecting?
```
The skill will:
- Check config validation
- Review credential format
- Inspect health_check() implementation
- Test async handlers
- Suggest fixes
## Example 3: Add reaction support
```
/adapter-dev add emoji reaction support to Slack adapter
```
The skill will:
- Review capabilities declaration
- Implement `send_reaction()` method
- Update Slack API calls
- Test the feature
- Document the change
## Example 4: Optimize chunking
```
/adapter-dev improve markdown-aware chunking for Telegram
```
The skill will:
- Review current chunking logic
- Implement better markdown parsing
- Preserve code blocks and formatting
- Test with long messages
- Update documentation