Config System
Package matrix/neo/internal/config holds Neo's runtime configuration. Frozen spec defaults, runtime .kvx overlay, environment precedence, and knobs for the supervisor, swarm, Automatrix, Cassandra, and epistemic core.
Package matrix/neo/internal/config holds Neo's runtime configuration. The locked operational contract -- context-budget thresholds, loop discipline, and the execution surface -- comes from the frozen design spec at neo/neo.frozen.kvx and is encoded as Default() values. Deployment wiring (models, cortex location, the daemon URL used for core_execute delegation) is overlaid from an optional runtime .kvx file and then from environment variables, so a fresh checkout runs with zero config.
Source files: neo/internal/config/config.go, neo/internal/config/kvx.go.
Design decisions
Precedence: Default < runtime .kvx < environment. A fresh checkout runs with zero config. Deployment-specific values (models, cortex location, daemon URL) are overlaid without touching source.
Frozen spec defaults. The Default() function encodes the locked operational contract from neo.frozen.kvx. Changing these values changes the spec; they are not merely "sensible defaults."
Missing .kvx is non-fatal. Load("/nonexistent/neo.kvx") returns defaults with no error. This lets dev/CLI runs work unchanged.
Config struct
type Config struct {
// --- identity / runtime wiring ---
AgentName string // human label, "Morpheus" (the market identity)
CortexRoot string // root dir of the cortex brain
CortexActor string // actor scope for Neo's memory store
DaemonURL string // base URL of the MCL daemon
ManifestPath string // agent manifest declaring MCP servers
SkillsRoot string // skills corpus root
SelfModelGraph string // self-model graph path
// --- models (provider-qualified ids) ---
MainModel string // the conversational tool-calling loop
CheapModel string // compaction + summary validation + cheap relation-classify
ConsolidationModel string // durable-learning extraction (stronger than CheapModel)
EmbedModel string // semantic page-fault embeddings
CassandraModel string // cheap/fast Cassandra completeness auditor
CassandraEscalateModel string // stronger second-opinion for low-certainty audits
// --- memory budget (context window = RAM; cortex = disk) ---
ContextWindowTokens int // total model context window
SoftPct int // cooperative compaction threshold (default 80)
HardPct int // forced compaction threshold (default 92)
RetrievalTopK int // page-fault: top-K cortex records (default 8)
RetrievalBudgetTokens int // token ceiling for retrieved records (default 6000)
PinnedBudgetTokens int // pinned block ceiling (default 2000)
AmbientRetrievalTopK int // ambient memory seed per turn (0 = fully tool-driven)
FirstTurnRelevancePush bool // push relevance-matched memory on turn 1
WarmOnOpen bool // warm embedder + HNSW on first HTTP request
// --- loop discipline ---
StepBudget int // max tool-call iterations per turn (default 50)
StepBudgetMin int // adaptive floor (0 = adaptation disabled)
StepBudgetMax int // adaptive ceiling (defaults to StepBudget)
NoProgressStall int // identical-failing-call count that trips stall (default 4)
SemanticStallSimilarityPct int // word-overlap % for semantic stall detection (0 = disabled)
MaxRetriesPerTool int // recovery ladder rung 1 (default 3)
MaxAdaptAttempts int // recovery ladder rung 2 (default 2)
MaxGuidanceNudges int // consecutive system-guidance nudge cap (0 = unbounded)
// --- sub-agent swarm ---
MaxSubagents int // hard cap per spawn_subagents call
MaxConcurrentSubagents int // semaphore: how many run at once
SubagentStepBudget int // per-sub-agent step budget
// --- browser filmstrip ---
BrowserAutoshot bool // auto-capture after view-changing actions
BrowserAutoshotMax int // max captures per run
MediaRetentionHours int // media GC sweep age (0 = disabled)
// --- task supervisor ---
SuperviseTasks bool // master switch: wrap turns in persistent supervisor
TaskMaxWall time.Duration // hard wall-clock ceiling for one supervised task
TaskAttemptTimeout time.Duration // ceiling for a single supervised attempt
TaskMaxRespawns int // max fresh-agent respawns before honest partial
// --- self-model death consolidation ---
DeathConsolidateEvery int // cadence for self-authoring failure-pattern pass
// --- procedural memory guards ---
MinPatternSuccesses int // successes before a pattern is injected (default 3)
// --- cassandra 2.0 (silent-voice controller) ---
CassandraEnabled bool
CassandraMinStep int // first step a mod may fire (default 2)
CassandraMaxModsPerTurn int // total modifications per turn (default 3)
CassandraLoopThreshold int // repeat count that arms doubt side
CassandraCooldownSteps int // min steps between same-trigger mods (default 2)
// --- epistemic core ---
EpistemicPremises bool // premise ledger + check-before-act gate
EpistemicPredictions bool // prediction-carrying dispatch
EpistemicMismatchLimit int // consecutive mismatch count for revision (default 3)
EpistemicConvergenceWindow int // actions without evidence growth (default 4)
// --- heartbeat ---
HeartbeatInterval int // recurring-alarm interval in minutes (0 = disabled)
// --- MCP tool result cache + parallel dispatch ---
MCPCacheTTL time.Duration // TTL for idempotent-read cache (0 = disabled)
ToolDispatchConcurrency int // concurrent independent tool calls (0 = serial)
// --- automatrix (proactive surprise tasks) ---
AutomatrixEnabled bool
AutomatrixBaseIntervalMinutes int
AutomatrixJitterMinutes int
AutomatrixMaxTasksPerDay int
AutomatrixMinConfidence float32
NtfyServer string
NtfyTopic string
AppriseURL string
// --- execution surface ---
NaturalAllow []string // reversible actions
EscalateActions []string // money-moving actions
// --- LLM transport ---
GatewayURL string // optional metered gateway
ActorDID string // actor DID for gateway headers
}
Loading
cfg, err := config.Load(path) // path may be "" or missing
Precedence
Default()- frozen spec values- Runtime
.kvxfile, overlays defaults - Environment variables, highest precedence
Environment variables
| Variable | Overrides |
|---|---|
NEO_MAIN_MODEL | MainModel |
NEO_CHEAP_MODEL | CheapModel |
NEO_CONSOLIDATION_MODEL | ConsolidationModel |
NEO_EMBED_MODEL | EmbedModel |
NEO_CORTEX_ROOT | CortexRoot |
NEO_CORTEX_ACTOR | CortexActor |
NEO_DAEMON_URL | DaemonURL |
NEO_MANIFEST | ManifestPath |
NEO_SKILLS_ROOT | SkillsRoot |
NEO_ACTOR_DID | ActorDID |
MATRIX_GATEWAY_URL | GatewayURL (also NEO_GATEWAY_URL) |
NEO_CONTEXT_WINDOW_TOKENS | ContextWindowTokens |
NEO_STEP_BUDGET | StepBudget |
NEO_STEP_BUDGET_MIN | StepBudgetMin |
NEO_STEP_BUDGET_MAX | StepBudgetMax |
NEO_NO_PROGRESS_STALL | NoProgressStall |
NEO_MAX_SUBAGENTS | MaxSubagents |
NEO_MAX_CONCURRENT_SUBAGENTS | MaxConcurrentSubagents |
NEO_SUBAGENT_STEP_BUDGET | SubagentStepBudget |
NEO_SUPERVISE_TASKS | SuperviseTasks |
NEO_TASK_MAX_WALL | TaskMaxWall |
NEO_TASK_MAX_RESPAWNS | TaskMaxRespawns |
NEO_CASSANDRA_ENABLED | CassandraEnabled |
NEO_EPISTEMIC_PREMISES | EpistemicPremises |
NEO_HEARTBEAT_INTERVAL | HeartbeatInterval |
NEO_AUTOMATRIX_ENABLED | AutomatrixEnabled |
NEO_AUTOMATRIX_INTERVAL | AutomatrixBaseIntervalMinutes |
NEO_AUTOMATRIX_MAX_PER_DAY | AutomatrixMaxTasksPerDay |
NEO_MCP_CACHE_TTL_SECONDS | MCPCacheTTL |
NEO_TOOL_DISPATCH_CONCURRENCY | ToolDispatchConcurrency |
NEO_CONVERSATION_RETAINED_TURNS | retained-turn cap |
.kvx format
The Matrix .kvx convention (mirrors tachyon/internal/config/kvx.go):
# comment
[section]
key = "string" # double-quoted strings
num = 50 # bare ints
list = ["shell", "git"] # bracketed, comma-separated, quoted
[section.sub]
ref = "${ENV_VAR}" # ${ENV} interpolated from process env
Features:
- Comments stripped (respecting quoted strings)
- Later duplicate keys win
${ENV}interpolation- String values are ALWAYS double-quoted (Matrix
.mtxlexer convention)
Execution surface helpers
func (c Config) IsEscalateAction(action string) bool
Checks whether the named action crosses the wall into MCL (requires a user wallet signature).
func (c Config) SoftBudgetTokens() int // ContextWindowTokens * SoftPct / 100
func (c Config) HardBudgetTokens() int // ContextWindowTokens * HardPct / 100
Modifying config
| What to change | Where |
|---|---|
| Frozen spec defaults | config/config.go - Default() |
| New env variable | config/config.go - applyEnv() |
| New .kvx section/key | config/config.go - applyDoc() + kvx.go accessors |
| Execution surface lists | config/config.go - NaturalAllow, EscalateActions |
| Supervisor knobs | config/config.go - SuperviseTasks, TaskMaxWall, TaskMaxRespawns |
| Swarm knobs | config/config.go - MaxSubagents, MaxConcurrentSubagents, SubagentStepBudget |
| Automatrix knobs | config/config.go - AutomatrixEnabled, AutomatrixBaseIntervalMinutes, etc. |
| Cassandra knobs | config/config.go - CassandraEnabled, CassandraLoopThreshold, etc. |
| Epistemic knobs | config/config.go - EpistemicPremises, EpistemicPredictions, etc. |
