Per-agent model selection lives in JSON. Global defaults at
~/.substrate-net/config.json; per-project overrides at
<project>/.substrate-net/config.json. Per-project values
deep-merge over global.
{
"concurrency": 8, // max concurrent agent (LLM) calls; 1 = serial
"agentBackends": {
"<name>": { "kind": "ollama|openai-compatible|cursor-agent|anthropic",
"endpoint": "<url>",
"apiKeyEnv": "<ENV_VAR>", // name of the env var holding the key
"apiKey": "<key>" } // OR an inline key (plaintext)
},
"agents": {
"<agent-name>": {
"model": "<backend>:<model>",
"fallback": "<backend>:<model>",
"windowTokens": 2000
}
},
"research": { "kind": "none" }, // or "search-api" (opt-in external lookups)
"transcriptRoots": {
"cursor": "~/.cursor/projects",
"claudeCode": "~/.claude/projects",
"codex": "~/.codex/sessions"
},
"ingest": {
"maxSessions": 200,
"sinceDays": 365,
"maxFactsPerWindow": 8,
"preTriageDedupe": true,
"clusterBatch": true
},
"analyze": {
"tier": "standard",
"maxFilesPerRun": 500,
"skipGlobs": []
}
}
| Kind | What it speaks | Auth |
|---|---|---|
ollama | Ollama HTTP API (/api/chat, /api/embeddings) | none |
openai-compatible | OpenAI Chat Completions + Embeddings shape (works with OpenAI, Together, Groq, OpenRouter, ...) | apiKeyEnv (env-var name) or apiKey (inline) |
cursor-agent | Cursor SDK (@cursor/sdk) — runs heavy reasoning via your Cursor subscription (higher-tier models, no per-token billing). Sandboxed: local one-shot against an empty temp dir, no tools/file access. | CURSOR_API_KEY (env) |
anthropic | (placeholder) | not yet implemented |
local (Ollama), openrouter (flash),
and frontier (Cursor SDK). Agents route by the work they do:
bulk classify/group/summarize → a cheap flash model;
heavy reasoning (domain/architecture modeling, linking, RCA,
wisdomSynthesizer) → frontier:composer-2.5
(subscription-billed, no per-token cost); embeddings → local. Every
agent declares a fallback chain, so when a backend has no key it
falls through to the next tier and ultimately to local Ollama — a zero-key
run always works. Set OPENROUTER_API_KEY and/or
CURSOR_API_KEY (plus npm install @cursor/sdk) to
light up the higher tiers.
apiKeyEnv vs apiKey.
apiKeyEnv is the name of an environment variable, not the
key — the backend reads process.env[apiKeyEnv]. Pasting a raw key
(sk-…) into apiKeyEnv resolves to an undefined env
var and fails with "requires apiKey". To paste a key directly, use the
apiKey field. Prefer apiKeyEnv to keep secrets out
of the config file.
Backends are referenced from agent specs by name:
{
"agentBackends": {
"local": { "kind": "ollama", "endpoint": "http://localhost:11434" },
"openrouter": { "kind": "openai-compatible",
"endpoint": "https://openrouter.ai/api/v1",
"apiKeyEnv": "OPENROUTER_API_KEY" }
}
}
Each agent gets one spec. The model string is
"<backend>:<model>"; the first colon splits, so model
names with colons (e.g. llama3.1:8b) are fine. The shipped
default is flash-first and tiered (see frontier routing);
the block below is a fully-local variant — useful with no API
keys. Set a per-agent fallback to keep runs resilient.
{
"agents": {
"triage": { "model": "default:qwen3:4b-instruct", "windowTokens": 2000 },
"dedupe": { "model": "default:qwen3-embedding:0.6b" },
"decision": { "model": "default:qwen2.5:14b" },
"businessLogic": { "model": "default:qwen2.5:14b" },
"intent": { "model": "default:qwen3:4b-instruct" },
"problemSolution": { "model": "default:qwen2.5:14b" },
"clusterer": { "model": "default:qwen3:4b-instruct" },
"summarizer": { "model": "default:qwen2.5:14b" },
"technicalProfiler": { "model": "default:qwen2.5:14b" },
"domainModeler": { "model": "default:qwen2.5:14b" },
"industryClassifier": { "model": "default:qwen2.5:14b" },
"industryEnricher": { "model": "default:qwen2.5:14b" },
"linker": { "model": "default:qwen2.5:14b" },
"verifier": { "model": "default:qwen2.5:14b" },
"skillSynthesizer": { "model": "default:qwen2.5:14b" }
}
}
The L2.5 enrichment agents — technicalProfiler,
domainModeler, industryClassifier,
industryEnricher, domainAnalyzer — plus the
code-analysis agents (fileAnalyzer,
architectureAnalyzer) and the global profileWriter
are the portfolio / skill-view additions. Route them to a frontier backend for best
results; they read across the whole project, not single windows.
| Role | Pick | Why |
|---|---|---|
| Classifier (triage, intent, clusterer) | qwen3:4b-instruct~2.5 GB |
Top of MTEB-adjacent JSON-strict benchmarks at 4B; cheap, fast. |
| Extractor (decision, businessLogic, summarizer, linker, verifier) | qwen2.5:14b~9 GB Q4 |
Strongest structured extraction at this scale (≈ 94% vs ≈ 87% Llama on entity-extraction tests). |
| Embeddings (dedupe) | qwen3-embedding:0.6b~1 GB |
#1 on MTEB at this size, 32K context. |
Combined hot footprint ≈ 12.5 GB. Leaves ~10 GB headroom on a 24 GB machine for macOS, Cursor, browser.
| RAM budget | Suggested classifier | Suggested extractor | Notes |
|---|---|---|---|
| 8 GB | phi4-mini:3.8b | (skip — use classifier for everything) | Quality suffers but the pipeline runs. |
| 16 GB | qwen3:4b-instruct | llama3.1:8b or qwen2.5:7b | Acceptable on most workloads. |
| 24 GB (M-series) | qwen3:4b-instruct | qwen2.5:14b | Recommended default. |
| 32 GB+ | qwen3:4b-instruct | qwen2.5:32b or remote frontier | Best local quality. |
Route the agents that benefit most from a strong model — extractors, the
L2.5/L2.6 modeling agents, the linker, and the L6
wisdomSynthesizer — to a frontier or cloud backend, while
embeddings and cheap classifiers stay local or on flash. A full example ships
as frontier.config.example.json in the repo.
{
"concurrency": 8,
"agentBackends": {
"local": { "kind": "ollama", "endpoint": "http://localhost:11434" },
"openrouter": { "kind": "openai-compatible",
"endpoint": "https://openrouter.ai/api/v1",
"apiKeyEnv": "OPENROUTER_API_KEY" }
},
"agents": {
"dedupe": { "model": "local:nomic-embed-text" },
"triage": { "model": "openrouter:google/gemini-2.5-flash" },
"intent": { "model": "openrouter:google/gemini-2.5-flash" },
"clusterer": { "model": "openrouter:google/gemini-2.5-flash" },
"clustererBatch": { "model": "openrouter:google/gemini-2.5-flash" },
"domainFuser": { "model": "openrouter:google/gemini-2.5-flash" },
"industryFuser": { "model": "openrouter:google/gemini-2.5-flash" },
"summarizer": { "model": "openrouter:google/gemini-2.5-flash" },
"decision": { "model": "openrouter:anthropic/claude-sonnet-4" },
"businessLogic": { "model": "openrouter:anthropic/claude-sonnet-4" },
"problemSolution": { "model": "openrouter:anthropic/claude-sonnet-4" },
"technicalProfiler": { "model": "openrouter:anthropic/claude-sonnet-4" },
"domainModeler": { "model": "openrouter:anthropic/claude-sonnet-4" },
"industryClassifier": { "model": "openrouter:anthropic/claude-sonnet-4" },
"industryEnricher": { "model": "openrouter:anthropic/claude-sonnet-4" },
"linker": { "model": "openrouter:anthropic/claude-sonnet-4" },
"verifier": { "model": "openrouter:google/gemini-2.5-flash" },
"skillSynthesizer": { "model": "openrouter:google/gemini-2.5-flash" },
"wisdomSynthesizer": { "model": "openrouter:anthropic/claude-sonnet-4",
"fallback": ["frontier:composer-2.5", "local:qwen2.5:14b"] }
}
}
The shipped default routes the reasoning agents (modelers, linker,
wisdomSynthesizer) to frontier:composer-2.5 instead —
subscription-billed, so heavy synthesis carries ~no per-token cost — with a
flash → local fallback. The L6 wisdom layer always has a deterministic offline
fallback, so it renders even with no LLM backend.
The fallback field is reserved for runtime fallback on backend
errors. If agents return nothing, check agent_runs for errors
(a wrong model slug 400s; a missing/misplaced key fails with "requires
apiKey") — see the key gotcha above.
Cost-control knobs for the refactored pipeline. See workflow-refactor.md for rationale.
| Key | Default | Effect |
|---|---|---|
ingest.maxSessions | 200 | Cap sessions ingested per run (session filter). |
ingest.sinceDays | 365 | Skip sessions older than N days (by mtime). |
ingest.maxFactsPerWindow | 8 | Anchor gate cap after extract. |
ingest.preTriageDedupe | true | Embed-dedupe windows before triage LLM. |
ingest.clusterBatch | true | Batch ambiguous cluster decisions (clustererBatch). |
analyze.tier | standard | lean skips analyze; standard tier-1 files; deep all pending (capped). |
analyze.maxFilesPerRun | 500 | Upper bound on fileAnalyzer calls per run. |
Standard enrich uses domainFuser + industryFuser
(flash-first). Deep profile (subnet update --deep) uses the
legacy domainModeler / technicalProfiler / … stack.
Hidden subnet ingest honors SUBNET_PROFILE=lean|standard|deep.
If your AI agent stores transcripts in a non-default location, override the root:
{
"transcriptRoots": {
"cursor": "/Volumes/data/cursor-projects",
"claudeCode": "~/work/.claude/projects"
}
}
Agent runs are cached in knowledge.db / agent_runs by
(agent.name, model, input_hash, prompt_version). To force
a re-run for an agent:
promptVersion in the agent source — invalidates the cache for that agent on next ingest.DELETE FROM agent_runs WHERE agent_name='triage';
Use subnet verify --invalidate-triage-days 30 to invalidate
triage runs older than 30 days so the next ingest re-triages stale
windows.