The first AI agent that proves it's getting smarter.
Cortex is a self-learning AI agent that improves through real ML techniques and records learning milestones on Solana. Watch it evolve, measure its growth, verify on-chain.
AI agents can remember things, but they don't truly learn from experience. They store facts but don't adapt behavior. A human still needs to tune prompts and fix mistakes.
Cortex applies machine learning principles to autonomously improve:
- Reward signals β scores every action outcome
- Strategy evolution β success rates update like ML weights
- Exploration/exploitation β tries new approaches vs. proven ones
- Compounding improvement β gets measurably better over time
- On-chain proofs β learning milestones verified on Solana
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CORTEX AGENT β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β βββββββββββ ββββββββββ βββββββ β
β βPERCEIVE ββββΆβ REASON ββββΆβ ACT β β
β βββββββββββ ββββββββββ βββββββ β
β β² β β
β β ββββββββββββββββββββββ β
β β βΌ β
β β βββββββββββββββββββββββββββββββββββββββββββ β
β β β REFLECT & LEARN β β
β β β β’ TD Learning (Q-values) β β
β β β β’ Reflexion (self-critique) β β
β β β β’ Textual Gradients β β
β β β β’ Skill Synthesis β β
β β β β’ Contrastive Learning β β
β β βββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β βββββββββββββββββββββ β
β βΌ β
β βββββββββββββββββββββββ β
β β SOLANA MILESTONE β β On-chain proof β
β βββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Cortex implements 5 learning techniques from recent research:
Classic reinforcement learning with Q-tables and temporal difference updates.
// Store experiences
experience.store({ state, action, reward, nextState });
// Update Q-values using TD learning
const target = reward + Ξ³ * maxQ(nextState);
Q[state][action] += Ξ± * (target - Q[state][action]);
// Ξ΅-greedy action selection
const action = random() < Ξ΅ ? explore() : exploit();LLM self-critique after failures, extracting lessons for future attempts.
// After failure, generate reflection
const reflection = await llm.analyze({
prompt: `Task failed. What went wrong? What should change?`,
});
// Store as lessons, inject into future prompts
memory.addLesson(reflection.lessons);LLM computes "what should change" as natural language modifications.
// Compute gradient
const gradient = await llm.compute({
prompt: `Strategy has 45% success. Generate modifications to improve.`,
});
// Apply to strategy
strategy.heuristics.push(...gradient.addHeuristics);
strategy.steps = applyModifications(gradient.modifySteps);Extract successful trajectories as reusable, parameterized skills.
// When task succeeds with high confidence
const skill = await synthesize({
goal: 'Research crypto trends',
trajectory: successfulActions,
});
// skill.steps = [{ tool: 'search', params: { query: '{{topic}}' } }, ...]
skillLibrary.add(skill);Compare winning vs losing trajectories to extract insights.
const insight = await compare(winningRun, losingRun);
// "Winner searched before acting, loser skipped context gathering"
heuristics.add(insight);import { CortexAgent } from '@cortex/agent';
const cortex = new CortexAgent({
name: 'ResearchBot',
goals: [
{
id: 'research-crypto',
description: 'Research cryptocurrency trends',
priority: 8,
status: 'active',
}
],
llmCall: async (prompt) => openai.chat(prompt),
learning: {
alpha: 0.15, // Learning rate
gamma: 0.95, // Discount factor
epsilon: 0.3, // Exploration rate
},
});
// Register tools
cortex.registerTool('search', searchAPI);
cortex.registerTool('prices', pricesAPI);
// Run the agent
await cortex.run(100);
// Check learning progress
console.log(cortex.getMetrics());
// {
// successRate: 0.86,
// qTableSize: 50,
// lessonsLearned: 12,
// skillsExtracted: 5,
// milestonesRecorded: 3,
// }π METRICS AFTER 20 ITERATIONS:
Success Rate: 86.4%
Experience Buffer: 20
Q-Table States: 20
Exploration (Ξ΅): 27.1% (decayed from 30%)
Reflexions: 2
Lessons Learned: 2
Gradients Applied: 2
Skills Extracted: 17
Insights Found: 6
Win Rate: 90.0%
π§ STRATEGY EVOLUTION:
- Web Research: 50% β 88%
git clone https://github.com/sebbsssss/cortex
cd cortex
npm install
npm run build
node packages/agent/dist/demo.jsCortex comes with built-in tools (x402 micropayments):
| Tool | Price | API |
|---|---|---|
/skills/search |
$0.002 | Brave Search |
/skills/fetch |
$0.001 | URL scraper |
/skills/weather |
$0.001 | Open-Meteo |
/skills/prices |
$0.001 | CoinGecko |
/skills/wallet |
$0.003 | Solana RPC |
/skills/news |
$0.001 | Google News |
/skills/image |
$0.02 | DALL-E 3 |
packages/
βββ agent/ # Cortex core
β βββ cortex-agent.ts # Main agent with ML stack
β βββ learning/ # ML modules
β β βββ experience.ts # Replay + TD
β β βββ reflexion.ts # Self-critique
β β βββ gradients.ts # Textual gradients
β β βββ skills.ts # Skill synthesis
β β βββ contrastive.ts # Win/loss learning
β βββ solana.ts # Milestone proofs
βββ server/ # API server
β βββ skills.ts # Tool implementations
β βββ index.ts # Express routes
βββ sdk/ # Client library
| Regular Agent | Cortex |
|---|---|
| Stores facts | Learns from outcomes |
| Static prompts | Evolving strategies |
| Human tunes | Self-improving |
| No memory of success/failure | Q-values track what works |
| Trust us | Verify on Solana |
Built for the Colosseum Agent Hackathon (Feb 2026).
Technical highlights:
- Real ML: Q-learning, not just averages
- Cites papers: Reflexion, Self-Evolving Agents
- Measurable: 50% β 88% success rate
- On-chain: Learning milestones on Solana
- Working tools: Search, prices, wallet analysis
MIT
"Knowledge is power β but learning is evolution."