Problem
The dream cycle's synthesize phase (src/core/cycle/synthesize.ts) has a significance judge that hardcodes ANTHROPIC_API_KEY as the only authentication mechanism:
function makeHaikuClient(): JudgeClient | null {
if (!process.env.ANTHROPIC_API_KEY) return null; // <- hardcoded
const client = new Anthropic();
return { create: client.messages.create.bind(client.messages) };
}
When ANTHROPIC_API_KEY is unset, all conversation transcripts are unconditionally marked as worth: false with reason "no ANTHROPIC_API_KEY for significance judge", making the synthesize phase non-functional for users who rely on alternative LLM providers.
This is increasingly common as high-quality, cost-effective models like DeepSeek v4 Flash, Gemini, and local endpoints become viable alternatives to Claude Haiku for lightweight judging tasks.
Impact
- Users without Anthropic access cannot use the dream synthesize phase at all
- The significance judge (a lightweight JSON-classification task) does not require the specific capabilities of Claude Haiku — any capable LLM can perform it
- The hardcoded provider check prevents innovation in the GBrain ecosystem
Suggested solution
Replace makeHaikuClient() with a makeJudgeClient() that:
- Tries
ANTHROPIC_API_KEY first (preserving original behavior)
- Falls back to
DEEPSEEK_API_KEY, OPENAI_API_KEY, or OPENROUTER_API_KEY via an OpenAI-compatible fetch adapter
- Supports configurable base URLs via
DEEPSEEK_BASE_URL / OPENAI_BASE_URL environment variables
I have a working implementation at https://github.com/justemu/gbrain/pull/1 that has been tested with DeepSeek v4 Flash — 3/5 real-world transcripts correctly judged as worth processing, 2/5 correctly filtered as routine operations.
Alternatives considered
- Configuration-based model routing: More flexible but requires more extensive refactoring of the judge infrastructure. The env-var fallback approach is minimal-risk and backward-compatible.
- agent.use_gateway_loop: The gbrain doctor suggests this for non-Anthropic setups, but the synthesize judge has a separate code path that ignores this config and hardcodes the Anthropic SDK.
Problem
The
dreamcycle's synthesize phase (src/core/cycle/synthesize.ts) has a significance judge that hardcodesANTHROPIC_API_KEYas the only authentication mechanism:When
ANTHROPIC_API_KEYis unset, all conversation transcripts are unconditionally marked asworth: falsewith reason"no ANTHROPIC_API_KEY for significance judge", making the synthesize phase non-functional for users who rely on alternative LLM providers.This is increasingly common as high-quality, cost-effective models like DeepSeek v4 Flash, Gemini, and local endpoints become viable alternatives to Claude Haiku for lightweight judging tasks.
Impact
Suggested solution
Replace
makeHaikuClient()with amakeJudgeClient()that:ANTHROPIC_API_KEYfirst (preserving original behavior)DEEPSEEK_API_KEY,OPENAI_API_KEY, orOPENROUTER_API_KEYvia an OpenAI-compatible fetch adapterDEEPSEEK_BASE_URL/OPENAI_BASE_URLenvironment variablesI have a working implementation at https://github.com/justemu/gbrain/pull/1 that has been tested with DeepSeek v4 Flash — 3/5 real-world transcripts correctly judged as worth processing, 2/5 correctly filtered as routine operations.
Alternatives considered