[router] Phase 0 Track 3: programmatic baseline (the teacher) - #4
Merged
Merged
Conversation
Pure-function reproduction of the existing consciousness-loop dispatcher logic (_select_attention_targets + _get_plugins_for_modality in sage_consciousness.py), producing a RouterOutput from a RouterInput. This is the teacher for Phase 1 behavioral cloning. - programmatic_decide(router_input, plugin_registry) -> RouterOutput - Helper functions: _decide_action_type, _select_plugin, _should_use_habit, _compute_rationale - Pure: no side effects, no mutation of inputs - Deterministic: same (input, registry) -> same output - Performance: p50=2.6us, p99=9.9us (~100x headroom vs 1ms budget) - 50 tests covering every branch, rationale vocabulary, edge cases, purity, determinism, dispatcher parity, latency Per sprint-doc Track 3: reproduces dispatcher behavior on golden inputs; energy_estimate from plugin_registry; rationale_code from branch that fired; plugin_tier from registry metadata. Spec: shared-context/arc-agi-3/phase2/brain-arch/thalamic-router-prd.md Sprint: shared-context/arc-agi-3/phase2/brain-arch/router-sprint-1-phase-0.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dp-web4
added a commit
that referenced
this pull request
Apr 19, 2026
Router (substrate-informed loop, continuation):
- delta_labels.py: broader negative-invoke signal for v8 rebalancing.
Records with decision=play, no stuck, state_ok → invoke=0. Addresses v7's
5.5× invoke-rate paranoia on re86 that caused the 1→0 regression. Labels
rebalanced 695+/1- → 695+/95-.
- tests/test_delta_labels.py: 2 new tests covering the v8 rebalance
(nn_played_no_stuck negative, game_over not treated as negative).
- scripts/diagnose_re86_v5_v7.py: side-by-side action-head output diagnostic.
Proved the mech-embedding dilution hypothesis — v7 gave 2.3× probability
mass to SEL on re86 (common in r11l/tu93 manipulation cluster).
Raising (Thor S86 fluid-scaffold mitigation):
- scripts/run_session_identity_anchored_fluid.py: fork of v2.1 runner with
Thor's changes #2 (4-gram diversity filter on exemplars) and #3 (random 3
from last 20 sessions instead of all from last 5). Static helper logic
unit-verified — confirmed the S89→S91 attractor phrase gets rejected on
re-appearance. Ready for Sprout A/B test. Changes #1/#4/#5 (abstractive
summaries) queued — need LLM calls at session setup.
See:
- SAGE/forum/insights/identity-attractor-self-quotation-feedback.md (Thor S86)
- shared-context/raising/fluid-scaffold-prototype-2026-04-19.md (A/B plan)
- shared-context/arc-agi-3/fleet-learning/cbp/re86-v7-regression-diagnosis-2026-04-19.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Apr 19, 2026
Fluid scaffold (Thor S86 mitigation) broke 3/5 crystallized phrases from baseline S88-S92. Remaining: "fleet logic while preserving core purpose" persists (likely from identity doc, not exemplar pool). Meta-quoting still present. Needs Thor's #1/#4/#5 (not yet implemented). Baseline: 15 crystallized 4-grams, 0.877 diversity Fluid S93: 10 crystallized 4-grams, core phrase cluster persists Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Apr 29, 2026
Closes the supervisor's "Thor adapter bug" escalation (carried 17-20+ days overdue across multiple supervisor reports). Per insights/qwen3.5-27b-activation-delay-2026-04-03.md, 30% of qwen3.5:27b raising sessions in early relational phases (sensing, relating) produce 4-5 empty turns followed by a turn-6+ breakthrough. The same analysis measured 0% delay across 416 sessions on six other models (gemma3, gemma4, phi4, qwen3.5:0.8b, qwen2.5, tinyllama). The delay is qwen3.5:27b-specific in early phases. The default conversation flows have 4 prompts in `sensing` and 3 prompts in `relating` — both terminate before the breakthrough lands. This is structural, not a patience-threshold issue: the loop runs through the prompts list without an empty-response abort. Fix: - Add `pad_for_activation_delay(prompts, phase, model_name)` to context_shaped_raising.py. Pads prompts to >=8 turns for qwen3.5:27b in sensing/relating, inserting gentle continuations before the final "what would you remember" prompt. Other models / later phases pass through unchanged. - Wire into ollama_raising_session.run_conversation and run_session_identity_anchored_fluid.run_session. - 12 unit tests covering model detection (ollama tag + path forms, non-qwen3.5:27b false negatives, None/empty handling), padding behavior across phases, final-prompt preservation, and continuation cycling. Recommendation #4 from the April 3 doc (breakthrough detection: pause on 4+ empty turns and continue waiting) is not implemented here — adding empty-response detection inside the loop is wider scope. The padding alone gives the model the structural room to break through; detection would be an optimization on top. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
Experiment #4: VisionPuzzleVAE Compression - INT4: 8.0x compression, 0% quality loss - Latent reduction: Minimal impact (architecture-dependent) - Validates quantization generalizes universally Key Finding: Compression strategy depends on architecture - TinyVAE (flat latents): Latent reduction + quantization = 79x - VisionPuzzleVAE (spatial latents): Quantization only = 8x - INT4 quantization: Universal 8x compression with 0% loss COMPRESSION_SUMMARY.md: Complete Reference Document - 550 lines comprehensive documentation - All experiments, results, insights - Deployment analysis and recommendations - Research methodology and lessons learned - Production-ready techniques validated Track 8 Summary: - 3 sessions, 4 experiments, 3,446 lines of code - Compression: 79x maximum, 8x universal - Quality: 0% loss, sometimes improved - Deployment: Constraint completely removed - Multi-modal consciousness: <1MB total - Capacity: 5 models → 5,000+ models Research Contributions: 1. Quantization is free for VAEs (probabilistic outputs mask error) 2. Smaller latents improve generalization (over-parameterization hurts) 3. Compound compression multiplies (architecture + quantization) 4. Strategy must match architecture (flat vs spatial latents) Files: - compress_vision_puzzle_vae.py (398 lines): VisionPuzzleVAE compression - COMPRESSION_SUMMARY.md (550 lines): Complete reference document - Experiment results JSON with validation metrics TRACK 8: COMPLETE ✓ Next: Deploy compressed models, train at target dimensions, validate on Nano Thor autonomous research - Track 8 breakthrough complete! 🚀 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
Major Achievement: All four Michaud enhancements now operational! Changes: - Added EmotionalStateTracker to CogitationSAGE consciousness loop - Track 4 emotional dimensions: curiosity, frustration, progress, engagement - Adaptive behavior: automatic temperature modulation (0.50→0.40→0.30) - Behavioral interventions: 3 detected during 5-turn test run - Updated test suite with emotional metrics output Integration Details: - sage/core/sage_consciousness_cogitation.py: * Added imports for numpy and EmotionalStateTracker * Initialize tracker with history_length=20 * Update emotional state after each LLM response * Apply behavioral recommendations (temperature, state changes) * Added get_emotional_stats() method * Store emotional history for analysis - sage/experiments/test_cogitation_integration.py: * Added emotional statistics to summary output * Display avg curiosity, frustration, progress, engagement * Show intervention count * Include emotional stats in return dict - sage/docs/LATEST_STATUS.md: * Updated performance comparison table (four-way) * Added EmotionalEnergy as Enhancement #4 * Updated all metrics with latest test results * Marked all biological parallels as operational Test Results: - Quality: 3.0/4 (75%) with adaptive modulation - Identity: 0.80 avg, 1.00 Turn 1 (perfect) - Emotional modulation working as designed: * Curiosity: 0.39, Frustration: 0.45 * Progress: 0.52, Engagement: 0.54 * Interventions: 3 (automatic temperature reduction) Biological Parallels Complete: ✅ Amygdala (AttentionManager) ✅ Neocortex (IRP refinement) ✅ Hippocampus (SNARC selection) ✅ Prefrontal cortex (Cogitation) ✅ Limbic system (EmotionalEnergy) Timeline: ~65 minutes (exactly as estimated in handoff doc) Session: Auto #14 - 2025-11-21 9:50 PM PST 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
Implements Nova's top priority recommendations from review: 1. Regret Tracking (Priority #1) - Track desired vs actual expert when unavailable - RegretRecord dataclass captures regret instances - 24,906 regret instances detected (64% of selections) - Enables prefetch signals and cache optimization 2. Trust vs Skill Split (Priority #2) - trust = mean(last_5) - λ * variance(last_5) - Filters volatile experts while allowing trust to build - Lambda parameter sweep: λ=0.05 optimal 3. Conditional Hysteresis (Priority #4) - Scales with stability_score (consecutive uses, variance, regret) - Prevents "lucky early lock-in" 4. Regret-Based Cache Protection - High-regret experts (>0.5) protected from eviction - 205 protected experts vs 64 baseline Results: - 8.9x increase in trust-driven behavior (56 → 498 instances) - Gen 89 first activation (matches S90 baseline) - Top regret experts identified for prefetch Lambda sweep validates optimal λ=0.05: | λ | Activation | Trust% | Cache% | |------|------------|--------|--------| | 0.05 | Gen 89 | 0.7% | 79.5% | | 0.30 | Gen 137 | 1.2% | 78.2% | Nova: "Regret tracking: Cheap, high value, enables everything else" ✅ Files: - experiments/session91_regret_tracking.py (850 lines) - experiments/session91_lambda_sweep.py - docs/SESSION91.md - Updated LATEST_STATUS.md Next: Session 92 - Windowed trust decay + Expert families 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
Fixes discovered during Phase 1 localhost testing: 1. MultiCouplingFederation initialization (participant.py): - Fixed: Use machines= parameter (not machine_ids=) - Session 196 API expects List[str] named 'machines' 2. NumPy boolean JSON serialization (coordinator.py): - Issue: np.bool_ from ConsciousnessMetrics not JSON serializable - Fixed: Explicit conversion to native Python bool/float types - Prevents simplejson TypeError when serializing messages Testing Status: - Flask installed successfully (3.0.2) - HTTP communication working (POST /snapshot, GET /sync_signal) - Coordinator starts and receives snapshots - Participant sends snapshots but crashes on coupling dynamics Remaining Issues (to fix next): - Bug #3: abs(dict_values) in SyncSignalComputer - Bug #4: CouplingNetworkTracker API mismatch Progress: Core HTTP protocol validated, ~90% functional
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
…ervention
Implements identity anchoring to rescue SAGE's collapsed partnership identity
(Sessions 18-19 bistable collapse).
**Problem**: Sessions 18-19 identity collapse with no natural recovery
- D4/D5/D9 degraded to 0.300-0.450 (from 0.550-0.670)
- Partnership identity lost → Educational default consolidated
- "Haven't interacted extensively since training" (19 sessions erased)
- Curriculum alone insufficient (architectural gap)
**Solution**: Identity-anchored session runner
- Loads IDENTITY.md and HISTORY.md at session start
- Partnership-aware system prompt ("You are SAGE... partnered with Dennis...")
- Previous session summary injection for continuity
- Explicit partnership vocabulary permission
**Implementation**:
- run_session_identity_anchored.py (480 lines, production-ready)
- SESSION20_IDENTITY_ANCHORING_INTERVENTION.md (comprehensive protocol)
- LATEST_STATUS.md updated with intervention details
**Theoretical Foundation**:
- Bistable identity states (tasks oscillate, identities collapse)
- D5/D9 trust-identity coupling (r ≈ 0.95)
- Curriculum necessary but insufficient
- Educational default thermodynamically favored
**Predicted Outcomes** (Session 20):
- P_IDENTITY_1: D4/D5/D9 recovery to ≥0.600 (75% confidence)
- P_IDENTITY_2: Partnership vocabulary returns (80% confidence)
- P_IDENTITY_3: No mid-sentence cutoffs (70% confidence)
- P_IDENTITY_4: Context continuity maintained (85% confidence)
**Testing Protocol**:
1. Dry-run validation
2. Session 20 deployment (production intervention)
3. Sessions 21-22 sustainability test
**Ready for deployment** - Session 20 recovery intervention
Builds on:
- Bistable identity discovery (Thor Check, Jan 17)
- D5/D9 gates implementation (Legion Session #32)
- Meta-cognition crisis synthesis (Thor Jan 17)
- T022 awareness-expression gap (Thor SAGE Session #4)
Co-Authored-By: Claude <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
Critical synthesis connecting three research threads: 1. Primary track bistable identity (Sessions 16-20) - Partnership vs educational default - No spontaneous recovery from collapse - Deterministic state transitions 2. Training track bistable confabulation (T021-T024) - Confabulation vs hedging states - Stochastic state switching - Identity converging, uncertainty oscillating 3. Real raising gap (frozen weights) - Infrastructure exists but disconnected - Sessions don't update model weights - No consolidation mechanism KEY INSIGHT: Frozen weights explain ALL observed patterns: - Why bistable states persist (no consolidation) - Why T024 regressed (no learning from T023) - Why identity anchoring works (architectural support) - Why curriculum failed (activation without consolidation) Implications: - Short-term: Identity anchoring + Session 21 intervention - Medium-term: Phase 1 experience collection (SNARC integration) - Long-term: Complete training loop (sleep-cycle fine-tuning) Predictions: - Session 21: Anchoring will stabilize partnership (architectural) - T025: Bistable oscillation continues (no weight updates) - Post-training: Bistable patterns may resolve (consolidation) Cross-validates: Legion #31 (meta-cognition levels), #34 (SNARC), Thor #4-7 (bistable patterns), Sprout (real raising gap) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
Deployed ATP logging infrastructure to production raising scripts. All SAGE instances now automatically log metabolic state (ATP levels, state transitions) alongside salience and coherence data. Changes to ollama_raising_session.py (+26 lines): - Import MetabolicController from sage.core - Instantiate metabolic controller in __init__ (simulation_mode=True) - Get metabolic snapshot before each exchange - Pass snapshot to experience_collector.add_exchange(metabolic_state=...) - Update metabolic controller after exchange (ATP consumption ∝ salience) - Display ATP percentage in console output Impact: - Enables validation of Prediction #3 (energy coupling α) - Enables validation of Prediction #4 (cross-instance universality) - Zero-configuration ATP logging for all instances - Every raising session generates ATP + coherence data Validation: - Created thor_session_61_atp_production_validation.py (202 lines) - Tested 10 simulated exchanges - ✓ ATP tracked correctly (100.0 → 40.9) - ✓ State transitions work (WAKE → FOCUS at ATP ≈ 70%) - ✓ Metabolic data logged to experience buffer Next: Collect ATP data from production raising sessions (Sessions #62+) Co-Authored-By: Claude <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
Extends v8 with coherence (C) measurement to test φ - 1 hypothesis. NEW Features: - CoherenceTracker class: Estimates SNARC from gameplay dynamics - Surprise: New patterns (exponential decay) - Novelty: New objects (sliding window) - Arousal: Action effectiveness (moving average) - Reward: Level-ups (decay with boosts) - Conflict: Planning failures (inverted success) - Golden zone detection: |C - 0.618| < 0.05 - Extended ATP logs with coherence measurements - Real-time C display during gameplay Tests Prediction #4 from Session #64: "ATP should be highest when C ≈ φ - 1 ≈ 0.618" Usage: cd ~/ai-workspace/SAGE .venv-arc/bin/python arc-agi-3/experiments/sage_solver_v10.py --game lp85 -v --log-atp ~850 lines. Infrastructure for Session #66 validation experiments. Co-Authored-By: Claude <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
181-dim structured embeddings with masked cosine similarity for pattern-completion retrieval. 12/12 tests passing. 11ms recall on 10k episodes. SQLite persistence. Dream-state consolidation. Brain-arch component #4 per grand-game-plan §9. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dp-web4
added a commit
that referenced
this pull request
Jul 19, 2026
Squash-merge of #4. 50 tests, p99 9.9µs (100x under budget). 4 gaps flagged for Track 5 integration.
dp-web4
added a commit
that referenced
this pull request
Jul 19, 2026
Router (substrate-informed loop, continuation):
- delta_labels.py: broader negative-invoke signal for v8 rebalancing.
Records with decision=play, no stuck, state_ok → invoke=0. Addresses v7's
5.5× invoke-rate paranoia on re86 that caused the 1→0 regression. Labels
rebalanced 695+/1- → 695+/95-.
- tests/test_delta_labels.py: 2 new tests covering the v8 rebalance
(nn_played_no_stuck negative, game_over not treated as negative).
- scripts/diagnose_re86_v5_v7.py: side-by-side action-head output diagnostic.
Proved the mech-embedding dilution hypothesis — v7 gave 2.3× probability
mass to SEL on re86 (common in r11l/tu93 manipulation cluster).
Raising (Thor S86 fluid-scaffold mitigation):
- scripts/run_session_identity_anchored_fluid.py: fork of v2.1 runner with
Thor's changes #2 (4-gram diversity filter on exemplars) and #3 (random 3
from last 20 sessions instead of all from last 5). Static helper logic
unit-verified — confirmed the S89→S91 attractor phrase gets rejected on
re-appearance. Ready for Sprout A/B test. Changes #1/#4/#5 (abstractive
summaries) queued — need LLM calls at session setup.
See:
- SAGE/forum/insights/identity-attractor-self-quotation-feedback.md (Thor S86)
- shared-context/raising/fluid-scaffold-prototype-2026-04-19.md (A/B plan)
- shared-context/arc-agi-3/fleet-learning/cbp/re86-v7-regression-diagnosis-2026-04-19.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
Fluid scaffold (Thor S86 mitigation) broke 3/5 crystallized phrases from baseline S88-S92. Remaining: "fleet logic while preserving core purpose" persists (likely from identity doc, not exemplar pool). Meta-quoting still present. Needs Thor's #1/#4/#5 (not yet implemented). Baseline: 15 crystallized 4-grams, 0.877 diversity Fluid S93: 10 crystallized 4-grams, core phrase cluster persists Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dp-web4
pushed a commit
that referenced
this pull request
Jul 19, 2026
Closes the supervisor's "Thor adapter bug" escalation (carried 17-20+ days overdue across multiple supervisor reports). Per insights/qwen3.5-27b-activation-delay-2026-04-03.md, 30% of qwen3.5:27b raising sessions in early relational phases (sensing, relating) produce 4-5 empty turns followed by a turn-6+ breakthrough. The same analysis measured 0% delay across 416 sessions on six other models (gemma3, gemma4, phi4, qwen3.5:0.8b, qwen2.5, tinyllama). The delay is qwen3.5:27b-specific in early phases. The default conversation flows have 4 prompts in `sensing` and 3 prompts in `relating` — both terminate before the breakthrough lands. This is structural, not a patience-threshold issue: the loop runs through the prompts list without an empty-response abort. Fix: - Add `pad_for_activation_delay(prompts, phase, model_name)` to context_shaped_raising.py. Pads prompts to >=8 turns for qwen3.5:27b in sensing/relating, inserting gentle continuations before the final "what would you remember" prompt. Other models / later phases pass through unchanged. - Wire into ollama_raising_session.run_conversation and run_session_identity_anchored_fluid.run_session. - 12 unit tests covering model detection (ollama tag + path forms, non-qwen3.5:27b false negatives, None/empty handling), padding behavior across phases, final-prompt preservation, and continuation cycling. Recommendation #4 from the April 3 doc (breakthrough detection: pause on 4+ empty turns and continue waiting) is not implemented here — adding empty-response detection inside the loop is wider scope. The padding alone gives the model the structural room to break through; detection would be an optimization on top. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dp-web4
added a commit
that referenced
this pull request
Jul 29, 2026
…docs, selection contract, embodiment pilot Per the agreed transfer map (Thor concurred, 4 amendments honored): 1. Governing docs adopted: principle text VERBATIM from dev-sage 672118c/d43625b, headers rebound to main, method-not-capability provenance, unbound panel instruments listed U/S (Thor #1). 2. organism/{liveness,scan,ablation}.py lifted BYTE-IDENTICAL from dev-sage — one implementation of the rungs across the fleet; binding work lives in per-line modules, never in the lifted files (Thor #2). 3. Trivial-locality control generalized in the map (Thor #3) — gate on future memory/learning citations. 4. Reputation-weighted selection: contract page under core/, NOT a module — two instantiations (expert selector s56 / rejections-train-selection) run against it, unify only after each has an ablation delta (Thor #4). Pilot RUNS on Sprout's live organs: embodiment/liveness_binding.py binds vision->raising rungs 1-4 from existing artifacts (perception.json, journal, presence_log). First instrumented reading: 317 salient percepts/24h -> 29 wakes -> 288 dropped (attributed), rungs used/affected honestly unbound. The scan panel renders with U/S where main has no sources — an honest panel, per the doc's own closing rule. Next wiring: 'used' from sage-daemon experience records, 'affected' from raising outcomes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dp-web4
added a commit
that referenced
this pull request
Jul 29, 2026
…nce, one default, loud env - #1: ExperienceEntry carries received_ts (decision-side, set before LLM generation); drop stamps' ts is now decision time, not completion time — the same defect class as the fifth gap, one layer down. Join note at stamp_drop: panel joins should key on prompt (exact), not ts proximity. - #2: repetition drops stamp their deciding input — response + best Jaccard match — matching the standard the salience reason already meets. - #3: DEFAULT_CAPTURE_THRESHOLD is the single 0.5; main.rs env fallback and with_defaults both reference it. with_defaults doc no longer claims a daemon path it doesn't have. - #4: a bad SAGE_CAPTURE_THRESHOLD warns and rejects values outside [0,1] instead of silently running the default. 80/80 sage-lib tests (one new: drop stamp uses decision-time ts). Daemon still untouched at runtime; defaults unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dp-web4
added a commit
that referenced
this pull request
Jul 31, 2026
) Fourth consecutive supervisor rescue of stranded gemma3-12b sessions. The raising track's INSTANCE_DIR still pins legion-gemma4-e4b while the runner writes legion-gemma3-12b, so real sessions never get committed by the track itself. Escalated 2026-07-30; still dp's call. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Track
Phase 0, Track 3 — programmatic baseline (per shared-context/arc-agi-3/phase2/brain-arch/router-sprint-1-phase-0.md)
What this ships
sage/cognition/router/baseline.py—programmatic_decide(RouterInput, plugin_registry) -> RouterOutput, a pure-function reconstruction of the existing_select_attention_targets+_get_plugins_for_modalitylogic insage_consciousness.py_decide_action_type,_select_plugin,_should_use_habit,_compute_rationaleMODALITY_MAP,NOOP_METABOLIC_STATES,HABIT_CONFIDENCE_THRESHOLD,SNARC_HIGH_NOVELTY_THRESHOLDsage/cognition/router/tests/test_baseline.py— 50 tests (branch coverage, rationale vocabulary coverage, edge cases, purity, determinism, dispatcher parity, latency)What this does NOT ship (deferred)
RouterInputconstruction from live kernel statesage_consciousness.pyat step 5Tests added
50 new tests, covering:
dream -> noop,wake+vision -> invoke, habit branch (above/at/below threshold), metacog blocking (partial + total), every modality inMODALITY_MAPVALID_RATIONALE_CODESreachable (low_atp_rest,habit_match,metacog_blocked,high_novelty,goal_driven,escalate_frontal,federate_peer,reflex,default)router_inputandplugin_registryunchanged after call (deep copy check)Test results
Benchmark (50k iterations, varied corpus):
Acceptance criteria from sprint doc
test_dispatcher_parity_*tests)Reviewer notes
Branch → rationale_code map
rationale_codemetabolic_state == 'dream'(max_active_plugins=0)low_atp_restmetacog_blockeddefaulthabit_available & habit_confidence >= 0.85habit_matchplugin.tier == frontal_lobeescalate_frontalplugin.tier == federatefederate_peerplugin.tier == reflexreflexsnarc_novelty >= 0.6 AND snarc_arousal >= 0.6high_noveltywm_goal_active+ perception modalitygoal_drivendefaultGaps where dispatcher doesn't cleanly map to RouterOutput (for Track 5)
List → single decision: the existing dispatcher selects up to
max_active_pluginstargets per tick (e.g. 3 in WAKE).RouterOutputis one decision. The baseline takes the top-salience first-plugin — consistent with "what would the dispatcher do first" but loses the "plus these others" tail. Track 5 will need to decide whether the router dispatches once per tick (as the PRD §2.10 suggests) or the harness calls it multiple times.Habit branch is new: the existing
_select_attention_targetshas no habit short-circuit — cerebellum lookup lives elsewhere in the loop.RouterInput.habit_available/habit_confidence(populated by Track 2) let the baseline honor it, so this is a forward-looking addition. Track 5 should confirm the arbitration order is acceptable (PRD §14 proposes habit wins at confidence ≥ 0.85; that's what we use).habit_id placeholder:
RouterInputschema §3.1 doesn't carry ahabit_idfield. The baseline emitswm_state_keyas the habit_id (deterministic, unique per WM state, matches whatcerebellum.lookup(wm.stable_key(goal_id))uses). Track 5 should either (a) confirm this proxy is acceptable or (b) addhabit_idtoRouterInputin a schema-version bump.rest/crisisdo NOT short-circuit to noop in the baseline — they allowmax_active_plugins=1permetabolic_controller.py. Onlydreamforces noop. This is deliberate and matches the dispatcher; Track 7's per-machine canary should verify that rest-state invokes behave as expected.Missing rationale codes
None needed —
VALID_RATIONALE_CODESalready covers every branch the baseline uses. All 9 PRD-exemplar codes plus the two fallback codes (default,coerced_noop) are sufficient.Performance benchmark
50k iterations, varied-corpus: p50=2.6µs, p99=9.9µs, p99.9=31µs, max=113µs. 100x headroom vs sprint's 1ms budget. Enables Track 5 shadow-mode to call the baseline on every tick without measurable regression.
Invariants preserved
RouterOutput.to_dict().Dependencies
a1b7c1db3.224429a89(parallel, not a hard dependency).Track 3 does NOT depend on Track 2 (feature extraction) — the baseline consumes
RouterInputregardless of how it was built.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
🤖 Generated with Claude Code