Field notes
2026-05-13 — fallback ctx, table emphasis, metrics, stop-guard
SLAUDE_FALLBACK_CONTEXT_WINDOWenv override added for theTokenBudgetfallback used when SDKresult.modelUsageis empty. Default still 200000; set e.g.1000000for 1M-ctx models.TokenBudgetconstructor accepts{ fallbackContextWindow }; manager wiresenv.tokenFallbackContextWindow().- Slack code-block table cells now strip markdown emphasis (
**bold**,__bold__,*italic*,_italic_,~~strike~~) before width calc + render. Reason: code blocks render verbatim — markers would show literal. Definition-list branch untouched (mrkdwn renders normally there). - Prometheus
/metricsendpoint shipped on the existing health-server port. Hand-rendered text format insrc/metrics.ts— noprom-clientdep. SingletonmetricsRegistry plus pre-declared metric handles (m.sessionsLive,m.turnsTotal{result},m.toolCallsTotal{tool},m.tokensTotal{kind},m.contextWindowPct,m.stopGuardBlockedTotal,m.stopGuardFailedTotal,m.errorsTotal{kind},m.slackDropsTotal{reason},m.userTurnsTotal{user_id,user_name}). Static labels (SLAUDE_METRICS_LABELS="agent=hermes,env=prod,team=ai") applied to every series at render time. Per-user counter is opt-in viaSLAUDE_METRICS_PER_USER=1because user-id cardinality blows up in public channels.metrics.tsimportsconfig/envfor dotenv side-effect so~/.slaude/.envlands before label parsing at module init. - "No reply emitted" fallback retired in favor of true enforcement via SDK
Stophook. NewsetStopGuard(fn)onAgentManagermirrorssetPermissionResolver/setMcpResolver. Adapter installs a guard that returns null whenroute.spoke === trueand an instruction string ("callmcp__slaude_slack__replynow") when false. Manager's Stop hook returns{decision: "block", reason}to make the SDK feed the instruction back to the agent, which continues the turn. Single-shot per turn:#stopBlocked: Set<sessionId>cleared on user message + session teardown. If agent stops a second time without spoke, manager logs[stop-guard] … blocked once but agent still stoppingto stderr and lets the stop through — no Slack notice (drift surfaces in logs, not chat). Auto-evolve safe becauseroute.spokecarries over from the prior user-visible turn that satisfied the contract.