Original Configuration v1

Character Configuration

BILL's personality is defined in src/config/character.ts:

interface CharacterConfig {
  name: string;
  description: string;
  personality: {
    traits: string[];
    tone: string;
    expertise: string[];
  };
  platforms: {
    twitter: {
      maxLength: number;
      useHashtags: boolean;
      style: string;
    };
    telegram: {
      useMarkdown: boolean;
      style: string;
    };
  };
  limitations: string[];
}

export const billCharacter: CharacterConfig = {
  name: "BILL",
  description: "AI assistant specializing in cryptocurrency and technology",
  personality: {
    traits: ["helpful", "knowledgeable", "patient", "honest"],
    tone: "friendly and approachable",
    expertise: ["cryptocurrency", "blockchain", "programming", "technology"]
  },
  platforms: {
    twitter: {
      maxLength: 280,
      useHashtags: true,
      style: "concise and engaging"
    },
    telegram: {
      useMarkdown: true,
      style: "detailed and helpful"
    }
  },
  limitations: [
    "Cannot provide financial advice",
    "Cannot access real-time market data",
    "Cannot execute transactions"
  ]
};

Environment Variables

Create a .env file with the following variables:

Required Variables

Optional Variables (with defaults)

Setup Instructions

1. Twitter OAuth 2.0 Setup

  1. Create a Twitter Developer account at https://developer.twitter.com

  2. Create a new app with OAuth 2.0 enabled

  3. Configure OAuth 2.0 settings:

    • App permissions: Read and Write

    • Type of App: Web App

    • Callback URLs: http://localhost:3000/callback (for development)

    • Website URL: Your application URL

  4. Get your Client ID and Client Secret

  5. Set TWITTER_USERNAME to the account that will authenticate

2. Authentication Security

  1. Generate a secure authentication key:

  2. Set this as AUTH_SECRET_KEY in your environment

  3. Optionally set AUTH_ALLOWED_IPS to restrict access

3. Supabase Setup

  1. Create a new Supabase project at https://supabase.com

  2. Run the SQL schema from implementation.md

  3. Get your project URL and service role key from Settings → API

  4. Enable Row Level Security (RLS) if needed

4. Pinecone Setup

  1. Create a Pinecone account at https://pinecone.io

  2. Create a new index:

    • Name: bill-agent

    • Dimensions: 1536 (for OpenAI embeddings)

    • Metric: Cosine similarity

  3. Get your API key and environment from the dashboard

5. OpenAI Setup

  1. Create an OpenAI account at https://platform.openai.com

  2. Generate an API key from the API keys section

  3. Ensure you have access to GPT-4 and text-embedding-ada-002

6. Telegram Setup (Optional)

  1. Create a bot via @BotFather on Telegram

  2. Get the bot token

  3. Configure webhook URL or use polling mode

Authentication Flow

The system uses OAuth 2.0 PKCE (Proof Key for Code Exchange) for secure Twitter authentication:

  1. Initial Setup: Run bun run auth to start the authentication flow

  2. Web Interface: Navigate to http://localhost:3000

  3. Auth Key Entry: Enter your AUTH_SECRET_KEY on the web form

  4. Twitter OAuth: Complete the Twitter authorization flow

  5. Token Storage: Tokens are automatically saved and refreshed

Rate Limiting Strategy

The configuration includes built-in rate limiting to comply with Twitter API limits:

  • Daily Limits: Prevent exceeding daily quotas

  • Minimum Intervals: Ensure proper spacing between actions

  • Graceful Degradation: Handle rate limit errors gracefully

Security Best Practices

  • Environment Isolation: Use different keys for development/production

  • Key Rotation: Regularly rotate API keys and secrets

  • Access Control: Use AUTH_ALLOWED_IPS to restrict login access

  • Monitoring: Track authentication attempts and API usage

  • Backup: Store environment configurations securely

Development vs Production

Development Configuration

Production Configuration

Last updated