Skip to content

buildOrDie/crab-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦€ CRAB AGENT

$CRAB Agent Banner

The crab does not walk forward. The crab does not walk backward. The crab walks sideways β€” straight to 100x.

An autonomous AI meme agent for $CRAB β€” a token on pump.fun on Solana.

CA: FzoFZ2XTypgojG9iE3Kuo58ocHFs5zVKDhqwa4Utpump

Fueled by crab brain.


What It Does

The agent wakes up on a schedule and picks one of 5 modes at random:

Mode Description
hype Maximum bullish crab energy
roast Destroys other meme coins
lore Deep $CRAB lore drops
alpha Fake insider whale alpha
crabwalk Sideways metaphors for 100x

It fetches live token stats from the pump.fun API (price, market cap, volume, holders), and generates a tweet. Optionally posts it to Twitter/X automatically.


Setup

1. Clone & install

git clone https://github.com/adaEggs/crab-agent
cd crab-agent
npm install

2. Configure environment

cp .env.example .env

Fill in .env:

AI_API_KEY=your_key
CRAB_MINT_ADDRESS=FzoFZ2XTypgojG9iE3Kuo58ocHFs5zVKDhqwa4Utpump       # $CRAB mint on pump.fun
TWITTER_API_KEY=...               # Twitter developer app credentials
TWITTER_API_SECRET=...
TWITTER_ACCESS_TOKEN=...
TWITTER_ACCESS_SECRET=...
POST_ENABLED=false                # flip to true when ready to go live
POST_INTERVAL_MS=3600000          # 1 hour between posts

3. Run

# Dry run β€” generate one tweet, don't post
npm run dev

# Generate one tweet and exit
npm run once

# Run live agent loop
POST_ENABLED=true npm start

Example Output

πŸ¦€ CRAB AGENT AWAKENS β€” MODE: LORE

they said the crab was just a meme

they did not know the crab was a mirror
reflecting your portfolio back at you

$CRAB has no roadmap. only claws. πŸ¦€
πŸ¦€ CRAB AGENT AWAKENS β€” MODE: ROAST

$PEPE ran out of ideas in 2023
$DOGE is a dog that forgot how to bark
$WIF is a hat with no head

the crab needs nothing.
the crab already won.

pump.fun/CRAB

Quantum Meme Engine βš›

The agent does not select meme modes randomly. It uses quantum-assisted stochastic wavefunction collapse across an 8-qubit Hilbert space.

|ψ⟩ = Ξ£ Ξ±α΅’|modeᡒ⟩  β†’  HβŠ—8  β†’  oracle  β†’  diffusion  β†’  measure  β†’  mode

Circuit steps:

  1. Qubit register initialised in ground state |0βŸ©βŠ—8
  2. Hadamard gate applied β†’ uniform superposition over all meme modes
  3. Register entangled with market sentiment (pump.fun volume data)
  4. Two Grover iterations for amplitude amplification
  5. Decoherence check β€” environment coupling collapses wavefunction
  6. Born rule measurement selects final mode

Sample terminal output:

βš›  initialising qubit register...
βš›  applying Hadamard gate HβŠ—8...
βš›  entangling with market sentiment qubit...
βš›  sentiment_qubit entangled  bias_index=1
βš›  grover_iter=1  oracle_target=lore
βš›  grover_iter=2  oracle_target=hype
βš›  env_coupling=0.005821  decoherence=true
βš›  ⚠  decoherence detected β€” collapsing to classical fallback
βš›  measuring wavefunction...
βš›  βœ“ wavefunction collapsed  mode=roast  confidence=91.3%

Gate fidelity: 94.7% β€” remaining 5.3% lost to crab noise.


Memory System 🧠

The agent remembers everything across restarts via data/memory.json.

Post history β€” stores every tweet ever generated with timestamps and market conditions. Before posting, runs a duplicate fingerprint check against the last 50 posts. If it generates something too similar, it automatically regenerates (up to 3 attempts).

Market history β€” records a snapshot every hour: price, market cap, volume, holders. Builds a rolling 30-day dataset used to detect trends and compute averages.

Holder growth tracking β€” tracks holder count delta each cycle, computing growth rate (holders/hr), peak holders, and trend direction (surging / growing / stable / declining / bleeding).


Learning Engine πŸŽ“

Market Regime Detection

Every cycle the agent classifies the current market state into one of 5 regimes, each with a different posting strategy:

Regime Condition Strategy
MOON Pumping hard, holders surging 60% hype, 25% alpha
ACCUMULATION Steady growth, quiet phase 35% lore, 30% alpha
CONSOLIDATION Near ATH, holding 35% crabwalk, 25% hype
COOLDOWN Volume dropping 40% lore, 30% roast
COPE Bleeding 50% roast, 30% lore

Thompson Sampling

Mode selection uses Thompson sampling β€” a Bayesian multi-armed bandit algorithm. Each mode has a score (0–1) updated after every post based on holder growth as an engagement proxy. Modes that correlate with holder growth get picked more often. Modes that don't, get picked less β€” but never zero (exploration is preserved).

Final mode = 60% Thompson (learned) + 40% Quantum (chaos).

Personality Evolution

The crab's personality evolves every 10 posts:

  • Aggression β€” rises during MOON, drops during COPE
  • Lore depth β€” increases permanently over time (the crab grows wiser)
  • Roast frequency β€” spikes during dumps

Personality traits unlock as milestones:

Trait Unlocks at
seasoned_crab 10 posts
ancient_crab 50 posts
prophet_crab 100 posts
popular_crab 500+ holders
moon_crab MOON regime

Each trait changes the crab's voice in the prompt β€” a prophet_crab speaks in riddles, a moon_crab has witnessed the pump and knows what's coming.


Website & Demo

The docs/ folder contains the GitHub Pages site β€” enable it in your repo settings under Pages β†’ Source β†’ docs folder.

File URL
docs/index.html your-username.github.io/crab-agent
docs/demo.html your-username.github.io/crab-agent/demo.html

Architecture

crab-agent/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ agent.js                      β€” main loop, full pipeline
β”‚   β”œβ”€β”€ pumpfun.js                    β€” live token stats from pump.fun
β”‚   β”œβ”€β”€ twitter.js                    β€” Twitter API v2 posting
β”‚   β”œβ”€β”€ prompts.js                    β€” prompt file loader
β”‚   β”œβ”€β”€ logger.js                     β€” coloured terminal output
β”‚   β”œβ”€β”€ quantum/
β”‚   β”‚   └── quantumEngine.js          β€” 8-qubit wavefunction mode selector
β”‚   β”œβ”€β”€ memory/
β”‚   β”‚   └── memoryStore.js            β€” JSON persistence layer
β”‚   └── learning/
β”‚       └── learningEngine.js         β€” regime detection + Thompson sampling + personality
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ index.html                    β€” one-page project website (GitHub Pages)
β”‚   β”œβ”€β”€ demo.html                     β€” 1280x720 animated terminal demo
β”‚   └── crab-mascot.png               β€” crab logo used by website
β”œβ”€β”€ data/
β”‚   └── memory.json                   β€” persistent agent memory (auto-generated)
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ banner.svg                    β€” GitHub README banner
β”‚   β”œβ”€β”€ logo.svg                      β€” square token logo
β”‚   └── crab-mascot.png               β€” crab mascot image
β”œβ”€β”€ prompts/
β”‚   └── crab_system.txt               β€” base crab personality
β”œβ”€β”€ scripts/
β”‚   └── push_to_github.sh
β”œβ”€β”€ .env.example
└── package.json

Twitter API Setup

  1. Go to developer.twitter.com
  2. Create a new project + app
  3. Enable OAuth 1.0a with Read & Write permissions
  4. Generate access token + secret
  5. Copy all 4 credentials into .env

Deploying 24/7

Railway (easiest)

railway init
railway up

Set env vars in the Railway dashboard.

VPS / screen

npm install -g pm2
POST_ENABLED=true pm2 start src/agent.js --name crab-agent
pm2 save

Customise the Crab

Edit prompts/crab_system.txt to change the agent's personality, tone, and rules.

Edit the MODES array in src/agent.js to add or remove posting modes.

Change POST_INTERVAL_MS to control posting frequency (default: 1 hour).


License

MIT β€” do whatever you want, the crab is free


built for $CRAB on pump.fun β€’ walks sideways

About

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages