Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
0ae72e9
Add GEPA prompt optimization framework
AnthonyRonning Feb 5, 2026
8b4279b
GEPA optimization: achieve 1.0 score with field marker formatting rules
AnthonyRonning Feb 5, 2026
c284288
Add GEPA examples for user name introduction and silent memory done
AnthonyRonning Feb 5, 2026
9fa1198
Document GEPA optimization in README and fix justfile commands
AnthonyRonning Feb 5, 2026
c8d9376
Remove reasoning output field to fix </think> tag leakage
AnthonyRonning Feb 5, 2026
2b9c6c1
Add GEPA example for proactive pet name memory from casual mention
AnthonyRonning Feb 5, 2026
5843a92
Add set_preference timezone to location example
AnthonyRonning Feb 5, 2026
8ee9510
Update GEPA examples to emphasize companionship over transactions
AnthonyRonning Feb 5, 2026
3452fdc
Load GEPA trainset from JSON file, optimize to 0.967
AnthonyRonning Feb 5, 2026
247c564
Add soul and companionship to Sage instruction
AnthonyRonning Feb 5, 2026
bc3ddd7
Apply soulful instruction to sage_agent.rs
AnthonyRonning Feb 5, 2026
02c843d
Add GEPA examples: user introduces name (good) + first-time greeting …
AnthonyRonning Feb 5, 2026
ccdd8af
Add golden GEPA example: deep connection when user reveals they build…
AnthonyRonning Feb 5, 2026
b243549
Fix clippy and rustfmt CI failures
AnthonyRonning Feb 5, 2026
b507f9a
Remove docs/prompts from git tracking and add to gitignore
AnthonyRonning Feb 5, 2026
376a06b
Fix remaining rustfmt line length issue
AnthonyRonning Feb 5, 2026
29f3030
Remove unused GEPA library modules (~1,275 lines of dead code)
AnthonyRonning Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ logs/
# Bug reproduction files (contain sensitive context)
docs/bugs/

# Prompt files (contain sensitive context)
docs/prompts/

# Credentials (NEVER commit these)
*.pem
*.key
Expand Down
50 changes: 48 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ All embeddings are generated via Maple's TEE-based embedding API (nomic-embed-te

### Built for Prompt Optimization

The codebase is structured around [DSRs](https://github.com/krypticmouse/DSRs) signatures, enabling future **GEPA (Genetic-Pareto) optimization** of prompts based on collected traces and feedback metrics.
The codebase is structured around [DSRs](https://github.com/krypticmouse/DSRs) signatures, enabling **GEPA (Genetic-Pareto) optimization** of prompts. Sage includes a working GEPA system where Claude analyzes test failures and proposes instruction improvements, which are then evaluated against Kimi. See the [GEPA section](#gepa-prompt-optimization) below.

### DSRs Signature Architecture

Expand Down Expand Up @@ -383,13 +383,59 @@ SIGNAL_ALLOWED_USERS=* # Or comma-separated UUIDs
- Web search, shell commands, scheduling
- Auto-reconnect on Signal connection drops
- Context compaction when approaching limits
- GEPA prompt optimization (see below)

**Future:**
- GEPA prompt optimization
- Gmail/Calendar integration
- Group chat support
- Voice messages

## GEPA Prompt Optimization

Sage includes a GEPA (Genetic-Pareto) optimization system for automatically improving the agent instruction based on test cases and feedback.

**How it works:**
1. Define training examples in `examples/gepa/trainset.json` with expected behaviors
2. Run evaluation to get baseline score against current instruction
3. Run optimization - Claude (judge) analyzes failures and proposes instruction improvements
4. Kimi (program) is re-evaluated with the improved instruction
5. Repeat until convergence or perfect score

**Commands:**
```bash
# Evaluate current instruction (baseline score)
just gepa-eval

# Run optimization loop (requires ANTHROPIC_API_KEY)
just gepa-optimize

# View optimized instruction
just gepa-show

# See training example categories
just gepa-examples
```

**Environment:**
```bash
# Required for GEPA optimization (Claude as judge)
ANTHROPIC_API_KEY=your-anthropic-key

# Program under test (Kimi via Maple)
MAPLE_API_URL=https://your-maple-endpoint
MAPLE_API_KEY=your-maple-key
MAPLE_MODEL=maple/kimi-k2-5
```

**Training Examples:**
Training data is in `examples/gepa/trainset.json`. Each example includes:
- Input scenario (user message or tool result)
- Context (persona, human block, conversation history)
- Expected behavior description
- Good/bad response examples

Current categories: first-time users, casual chat, web search, memory storage, tool result processing, corrections.

## Related Projects

- [Letta](https://github.com/letta-ai/letta) - Memory management inspiration
Expand Down
8 changes: 8 additions & 0 deletions crates/sage-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ version.workspace = true
edition.workspace = true
default-run = "sage"

[lib]
name = "sage_core"
path = "src/lib.rs"

[[bin]]
name = "sage"
path = "src/main.rs"

[[bin]]
name = "gepa-optimize"
path = "src/bin/gepa_optimize.rs"

[dependencies]
sage-tools = { path = "../sage-tools" }
async-trait = "0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
-- Enable pgvector extension for vector similarity search
CREATE EXTENSION IF NOT EXISTS vector;
-- Note: This may fail if pgvector was installed manually (not via CREATE EXTENSION)
-- In that case, the vector type should already exist
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'vector') THEN
CREATE EXTENSION IF NOT EXISTS vector;
END IF;
END
$$;

-- Archival memory passages table
-- Stores long-term memories with embeddings for semantic search
Expand Down
Loading