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

104
.claude/SKILLS_README.md Normal file
View File

@@ -0,0 +1,104 @@
# Local Skills for Ajarbot
This project uses **local-only skills** for security - no public registries, no external dependencies.
## Available Skills
### `/adapter-dev` - Adapter Development Helper
Helps create, debug, and update messaging platform adapters.
**Usage:**
```
/adapter-dev create WhatsApp adapter
/adapter-dev debug Slack connection issues
/adapter-dev add file upload support to Telegram
```
**Location:** `.claude/skills/adapter-dev/`
## Creating Your Own Skills
### 1. Create skill directory
```bash
mkdir -p .claude/skills/my-skill
```
### 2. Create SKILL.md
```yaml
---
name: my-skill
description: What this skill does
user-invocable: true
disable-model-invocation: true
allowed-tools: Read, Grep
context: fork
---
Instructions for Claude when this skill runs...
```
### 3. Use the skill
```
/my-skill
/my-skill with arguments
```
## Security Configuration
**Restrict skill permissions** in `.claude/settings.json`:
```json
{
"permissions": {
"allow": [
"Skill(adapter-dev)",
"Skill(my-skill)"
]
}
}
```
**Per-skill tool restrictions** in SKILL.md frontmatter:
```yaml
allowed-tools: Read, Grep, Glob
```
This prevents skills from using `Bash`, `Edit`, `Write`, etc. unless explicitly allowed.
## Why Local Skills?
**No supply chain attacks** - All code is in your repo
**Version controlled** - Review skills in PRs
**Team-wide consistency** - Everyone uses same skills
**Fully auditable** - All code is visible
**Offline capable** - No registry lookups
## Skill Arguments
Pass arguments to skills:
```
/adapter-dev create Discord adapter
```
In SKILL.md, access with:
- `$ARGUMENTS` - All arguments as string
- `$0`, `$1`, `$2` - Individual arguments
## Best Practices
1. **Use `disable-model-invocation: true`** for security-sensitive skills
2. **Limit `allowed-tools`** to only what's needed
3. **Use `context: fork`** to isolate skill execution
4. **Document in examples/** directory
5. **Review all skills before committing**
## Documentation
- [Claude Code Skills Docs](https://code.claude.com/docs/en/skills.md)
- [Security Guide](https://code.claude.com/docs/en/security.md)

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