A narrative-aware AI Twitter agent. By @joetforhire on Twitter.
Val is a Twitter bot framework that allows you to create AI-powered Twitter personas. The default persona is @ValVonNeumann, but you can customize everything about the agent's identity, style, and behavior.
- Basic tweeting works
- Replies
- Storytelling
- Image and videogen
- Install dependencies:
pnpm install
- Configure environment variables by copying
.env.example
to.env
:
cp .env.example .env
- Fill in required environment variables:
# Twitter Configuration
TWITTER_USERNAME=your_twitter_username
TWITTER_PASSWORD=your_twitter_password
TWITTER_EMAIL=your_twitter_email
ANTHROPIC_API_KEY=your_anthropic_api_key
# Optional Configuration
POSTING_INTERVAL=1800000 # Default 30 minutes
SLEEP_START_HOUR=1 # When bot sleeps (EST)
SLEEP_END_HOUR=5 # When bot wakes (EST)
NODE_ENV=development # development or production
pnpm start
- Start the bot in default modepnpm dev
- Run with nodemon for developmentpnpm prod
- Run in production environmentpnpm trigger
- Manually trigger a single action (can find inindex.ts
, useful for testing)
The bot's posting frequency is controlled by two settings in src/environments.ts
:
export const environments = {
development: {
baseInterval: 120000, // 2 minutes
jitter: 10000, // Random +/- 10s
},
production: {
baseInterval: 1800000, // 30 minutes
jitter: 300000, // Random +/- 5min
},
};
The bot follows a sleep schedule (in EST) configured via environment variables:
SLEEP_START_HOUR
: Hour when bot stops posting (default: 1)SLEEP_END_HOUR
: Hour when bot resumes posting (default: 5)
To create your own Twitter AI persona, modify the files in src/prompts/fragments/
:
Contains the core identity components:
bios
: Array of character descriptionsstate
: Current moods/situationsinterests
: Topics and themesexamplePosts
: Writing style examples
World-building elements:
storyStructure
: Narrative patterns (for @valvonneumann's storytelling feature)world
: Settings and locationsevents
: Historical timelinecharacters
: Important figurespeoples
: Groups and factions
Writing style configuration:
rules
: Formatting guidelinesavoid
: Topics/phrases to exclude
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
ISC License