A Rust-based AI agent implementation using rig for AI functionality, powering an autonomous social media presence on X (formerly Twitter).
Follow our AI agent: @Tohru_RIG
This project implements an AI-powered social media agent that autonomously engages on social media platforms while maintaining consistent personality traits and natural interaction patterns. Built with Rust for performance and reliability, it leverages the rig framework for core AI functionality.
- Structured personality system for consistent trait expression
- Configurable writing styles and topic preferences
- Dynamic response generation based on character profile
- Generates contextually relevant original posts
- Responds intelligently to mentions and interactions
- Smart filtering system for engagement prioritization
- Natural conversation flow maintenance
- Persistent storage of interaction history
- Context-aware response generation
- Relationship tracking with other users
- Built-in rate limiting and scheduling
- Random delays for natural posting patterns
- Comprehensive Twitter API v2 integration
- Clean separation between core logic and integrations
- Extensible character trait system
- Pluggable provider architecture
- Efficient memory management
- Rust (latest stable version)
- API Keys:
- Anthropic Claude API access
- Twitter API v2 credentials (OAuth 1.0a)
-
Clone the repository:
git clone https://github.com/chakaboommm/rina cd rina
-
Create a
.env
file with required credentials:ANTHROPIC_API_KEY=your_api_key TWITTER_CONSUMER_KEY=your_key TWITTER_CONSUMER_SECRET=your_secret TWITTER_ACCESS_TOKEN=your_token TWITTER_ACCESS_TOKEN_SECRET=your_token_secret CHARACTER_NAME=your_character_name
-
Configure your character:
- Create a new directory:
characters/{CHARACTER_NAME}/
- Add character definition in
character.json
- Create a new directory:
Characters are defined using a structured JSON format:
{
"instructions": {
"base": "Base character instructions",
"suffix": "Additional instructions"
},
"adjectives": ["trait1", "trait2"],
"bio": {
"headline": "Character headline",
"key_traits": ["trait1", "trait2"]
},
"lore": ["background1", "background2"],
"styles": ["style1", "style2"],
"topics": ["topic1", "topic2"],
"post_style_examples": ["example1", "example2"]
}
Run the agent:
cargo run
tohru/
├── src/
│ ├── core/ # Core agent functionality
│ ├── characteristics/ # Character trait implementations
│ ├── providers/ # External service integrations
│ └── memory/ # Persistence layer
├── characters/ # Character definitions
└── tests/ # Test suite
- rig - AI agent framework
twitter-v2
- Twitter API clienttokio
- Async runtimeserde
- Serialization/deserializationanyhow
- Error handling
- rig team for the AI agent framework
- Contributors and maintainers
For questions and support, please open an issue in the GitHub repository.