{"slug": "brainstem-open-source-bio-inspired-ai-with-12-neuromodulators-for-learning", "title": "BrainStem: Open‑source bio‑inspired AI with 12 neuromodulators for learning", "summary": "BrainStem, an open-source bio-inspired AI architecture using 12 digital neuromodulators for lifelong learning, has completed Stage A foundation work and legacy cleanup, with the current database containing 102,275 chunks (100% of the imported corpus) and 949,760 context hypotheses. The system remains a research prototype, not production-ready, and requires a new full stability validation before Stage B can proceed.", "body_md": "Update 22.07.26\n\nBrainStem is a biologically inspired, neuro-symbolic cognitive architecture for lifelong learning. It is designed to learn models of the structures and dynamics of language and text through context hypotheses, uncertainty, contradiction, revision, neuromodulation, replay, and consolidation rather than by merely storing isolated facts.\n\nOne CPU Core / No GPU needed\n\nYouTube - BrainStem Project AI conversation 22.07.26\n\n[NotebookLM codebase exploration](https://notebooklm.google.com/notebook/22f86efd-8cd6-447b-a43f-65f252259ab4?utm_source=nlmm_share) 22.07.26\n\nImportant\n\nBrainStem is a research and calibration system, not a production-ready assistant. Permanent fact, relation, and question writes remain locked while the learning core and its candidate flow are being validated.\n\nBrainStem has completed the original Stage A foundation work and the Legacy Cleanup large slices A–C. Historical and unused learning paths were removed, including the obsolete `nlp.py`\n\npath, the legacy CorpusReader / Phase-3d word-role and filter path, and the historical Phase-4def–4p cluster. The current runtime uses the canonical Phase-7cort top path.\n\nImportant validation boundary:\n\n- The historical 1,344-cycle drift and convergence validation applied only to the system state tested at that time.\n- Major architectural changes were installed after that run.\n- The current system must therefore complete a new full stability and drift validation before Stage B can be treated as ready.\n- The earlier 1,344-cycle result remains historical evidence, not a current stability certificate.\n\nAdditional completed foundation work includes:\n\n- centralized bootstrap and schema-contract consolidation\n- idempotent schema setup and schema self-check contracts\n- all 12 digital neuromodulators statically and at runtime connected to the GUI\n- performance indexes for active learning-history tables\n- bounded pruning only for explicitly approved history tables\n- bounded and downsampled GUI diagnostics and graphs\n- cooperative GUI worker shutdown logic, although long GUI runs can still become unresponsive while the autonomous worker continues\n- modernized learning reset validated against the current database in read-only dry-run mode\n\nThe current database contains:\n\n- 102,275 of 102,275 chunks read by the GUI, representing 100% of the imported corpus\n- 949,760 context hypotheses\n- Candidate Bridge checkpoint at hypothesis 949,760\n- Phase-5f Shadow Observation checkpoint at hypothesis 949,760\n- no context-hypothesis or Candidate Shadow rows currently beyond the active observation checkpoint\n\nThe GUI chunk counter is the canonical corpus-read progress indicator. Counts of distinct `context_hypotheses.chunk_id`\n\nvalues are treated only as hypothesis-coverage proxies and not as an exact processed-chunk counter.\n\nThe Modern Gap Candidate Bridge and non-productive Phase-5f Shadow Observation path remain installed in the untouched canonical runtime.\n\nCurrent restrictions:\n\n- mode:\n`observed_only`\n\n- automatic execution from Phase 5a\n- checkpoint-based source selection\n- maximum batch: 512 hypotheses per cycle\n- canonical outer runtime owner: Phase 7cort\n- no direct productive writes to\n`internal_learning_gaps`\n\n, attention targets, Phase-5f / Phase-5g / Phase-5i experiments, facts, relations or questions `observation_ready`\n\nremains false- no direct fact promotion\n\nBoth Candidate and Observation frontiers reached the full current hypothesis population. Initial Shadow Observation generation completed without projection errors. The original V1 observation identity mixed stable identity with `source_updated_at`\n\n, causing repeated observations of the same hypothesis to appear as new keys instead of versions of one stable identity.\n\nStable Observation Identity V2 is installed as a parallel, non-productive dual-write path.\n\nV2 contract:\n\n- stable identity:\n`shadow_key + hypothesis_id`\n\n- source version and projection version stored separately\n- existing V1 writer preserved\n- no backfill\n- no migration\n- no reader switch\n- no V1 deletion\n- no checkpoint reset\n- all outcome and productive gates remain closed\n\nThe first production parity cycle proved exact V1/V2 input parity. During the subsequent natural long run, V2 recorded:\n\n- 629,469 stable latest-state rows\n- 766,459 history rows\n- 28,166 stable keys with multiple versions\n- 136,990\n`source_state_change`\n\nversions - zero input-parity failures\n- zero duplicate fingerprint groups\n- zero broken previous-version links\n- zero gate violations\n\nA dedicated driver audit proved that all 136,990 recorded source-state changes were caused only by `source_updated_at`\n\n. The stored source content and the projection fingerprint remained unchanged. This established that the timestamp-sensitive V2 source fingerprint was technically consistent but too sensitive for semantic versioning.\n\nA parallel Content-Stable Fingerprint Shadow Classifier is installed without changing the existing V2 writer.\n\nContract:\n\n`source_updated_at`\n\nremains as provenance and checkpoint information`source_updated_at`\n\nis excluded from the content-stable source fingerprint- same content plus a new timestamp is classified as\n`same_content_new_timestamp`\n\n- real content changes and projection changes remain separate classifications\n- no backfill\n- no migration\n- no writer switch\n- no productive writes\n\nThe Classifier currently has no production events because the normal Observation checkpoint is fully caught up and no new `context_hypotheses`\n\nor Candidate Shadow source row exists beyond it. Fifty additional system cycles were verified as zero-input cycles for this path.\n\nPost-corpus replay activity continues after all corpus chunks have been read. Phase 6a creates replay candidates and replay events, but its existing `context_hypotheses`\n\nupdate writes only replay-control and replay-provenance fields. It does not update semantic hypothesis fields and does not update the canonical `context_hypotheses.updated_at`\n\nfield.\n\nA future-only, `context_hypotheses`\n\n-scoped Replay-Control Shadow Capture is installed.\n\nContract:\n\n- stable identity:\n`source_table + source_id`\n\n- scope:\n`context_hypotheses`\n\nonly - retry identity: immutable\n`phase6a_sleep_replay_events.id`\n\n- canonical recursive JSON normalization for neuromodulator profiles\n- no backfill of historical replay events\n- no Candidate Bridge call\n- no Observation Layer call\n- no checkpoint change\n- no semantic hypothesis version\n- no productive write\n\nAfter correction of the installer hook to use the actual SQLite connection receiver `db`\n\n, the natural production test recorded exactly:\n\n- 300 new Phase-6a replay events\n- 300 Replay-Control Shadow events\n- 60 stable Replay-Control identities\n- 60\n`initial_replay_control_state`\n\nevents - 240\n`same_control_state_new_replay_event`\n\nevents - zero\n`replay_control_state_change_candidate`\n\nevents\n\nEach of the 60 observed hypotheses received five replay events, with one initial state and four stable refreshes. This proves natural runtime reachability, exact event parity, retry-safe identity and stable replay-control classification. It does not prove semantic learning.\n\nCurrent evidence shows:\n\n- all measured replay events have matching replay candidates\n- Phase 6a updates replay priority, replay weight, meta-plasticity, replay count, last replay time and replay reason\n- Phase 6a does not write semantic hypothesis content, confidence, uncertainty, evidence count, stability or canonical\n`updated_at`\n\n`hypothesis_learning_updates`\n\n, feedback, error, revision and self-evaluation tables are currently empty- stability and consolidation data exist, but no direct replay-event causal key links replay events to those records\n- replay-caused semantic learning is not proven\n- replay effectiveness is not proven\n\nPhase 6a currently computes `outcome_observation_available`\n\nfrom the global row count of `phase5g_experiment_outcomes`\n\n. It does not join by replay event, hypothesis identity or post-replay observation time. The table is currently empty, so all recorded Phase-6a cycles report no available outcome observation.\n\nThe current legacy Phase-5g experiment producer exists in `v8_phase5g_context_strategy_selection_and_experiment_memory_release.py`\n\n, but it relies on `internal_learning_gaps`\n\nas its primary source. `internal_learning_gaps`\n\nremains intentionally empty and productively closed.\n\nThe producer is not statically connected to the current Registry or canonical Phase-7cort cycle. If activated, it would write operationally to Phase-5g experiments, reading queue, attention and gap-related structures. It is therefore not a safe read-only bridge for the modern Shadow architecture.\n\nThe Phase-5h outcome writer exists and can evaluate Phase-5g strategy experiments, but:\n\n`phase5g_strategy_experiments`\n\nis empty`phase5g_experiment_outcomes`\n\nis empty- the writer evaluates internal strategy metrics\n- the schema has no explicit external real-outcome observation contract\n- no hypothesis-specific or replay-specific real-outcome lineage is present\n\nThe current Phase-5g and Phase-5h path is an internal strategy-projection and evaluation path, not a proven independent real-outcome path.\n\nA read-only preflight proved that V2 Stable Observations contain all fields required for a future-only, non-productive Phase-5g Candidate contract.\n\nThe proposed contract would:\n\n- use\n`stable_observation_key + projection fingerprint`\n\nas candidate identity - classify initial candidates, identical retries, same-projection refreshes and projection changes\n- avoid numeric eligibility thresholds\n- keep\n`internal_learning_gaps`\n\n, reading queue and attention writes closed - keep Phase-5g experiment and outcome writes closed\n- make no Real Outcome claim\n\nNo installer has been authorized. The live V2 projection population currently shows almost no strategy diversity:\n\n`projected_action = increase_window`\n\nacross the measured population`projected_window_strategy = wider_context_window`\n\nacross the measured population- expected gain, projected effectiveness, closure, overlap and no-candidate metrics are uniform in the current snapshot\n- target count is six for all but one measured Stable Observation\n\nThe next pending read-only audit is the Modern V2 Projection Input Variance, Formula Drivers & Strategy Diversity Audit. It has been prepared but not yet executed.\n\nDuring long autonomous runs, the GUI became unresponsive while the autonomous worker continued progressing. The worker was later stopped with `taskkill`\n\n, and SQLite `quick_check`\n\nand `integrity_check`\n\nboth remained successful.\n\nThe GUI became responsive again after restarting with the same large database. Therefore:\n\n- the earlier GUI freeze must not be attributed to database size without separate evidence\n- database size is not an optimization trigger\n- sufficient storage space is available\n- no pruning, retention or history deletion is justified solely by database size\n\nThe following remain closed:\n\n`internal_learning_gaps`\n\nproductive writes- attention writes\n- productive Phase-5f experiments\n- productive Phase-5g experiments and outcomes\n- Phase-5i experiments\n`observation_ready`\n\n- facts\n- relations\n- questions\n- fact promotion\n- reader switch to V2\n- historical migration or backfill\n\n- Run the prepared read-only Modern V2 Projection Input Variance, Formula Drivers & Strategy Diversity Audit.\n- Determine whether projection uniformity comes from constant inputs, default paths or a formula branch that collapses real source variance.\n- Do not install a modern Phase-5g Candidate writer until natural projection diversity or a justified projection-change contract is demonstrated.\n- Keep the Replay-Control Shadow Capture installed and continue treating its events as activity and control-state observations, not semantic learning.\n- Keep all productive gates closed until an independent, hypothesis-specific and temporally valid Real Outcome contract exists.\n- Perform a new full stability and drift validation of the current system before Stage B preparation.\n\nTraditional semantic systems often focus on the **what**: storing and retrieving content. BrainStem focuses on the **how**: learning how context, uncertainty, evidence, contradiction, revision, and consolidation interact over time.\n\nA corpus is treated as training substrate rather than as a static knowledge base. The active learning architecture forms and revises context hypotheses, preserves errors as learning material, and delays permanent knowledge promotion until consolidation and safety gates are validated.\n\nCore principles:\n\n**Learning before rules:** no fixed lexical blacklists or hand-authored word-role mappings in the active learning path.**Errors remain evidence:** unresolved and contradicted hypotheses remain available for later revision.**Consolidation before promotion:** permanent fact promotion stays closed until the staged write-gating design is validated.**Neuromodulation governs learning:** learning rate, error weighting, revision, confidence, exploration, inhibition, attention, stabilization, and consolidation are state-dependent.**Measure before changing:** diagnostics, audits, drift tests, and Shadow experiments precede active-control changes.**No hidden legacy paths:** obsolete modules and duplicate learning paths are removed rather than retained as inactive code.\n\n**BrainStem** is an autonomous software architecture designed for continuous, self-improving data processing and knowledge management. At its core, the system operates through an Autonomous Loop that orchestrates a chain of learning phases to ingest, analyze, and refine information without manual intervention.\n\nIt is important to understand that the biological terminology used throughout the project’s technical documentation, such as \"neuromodulators,\" \"sleep,\" or \"homeostasis\" serves as a set of metaphors to describe the underlying digital functions. These biological terms are mapped to mathematical variables and algorithmic states that steer the system's behavior.\n\n**Dynamic Steering Variables:** What the documentation calls \"digital messenger substances\" are actually dynamic meta-parameters. These variables, such as \"dopamine\" or \"serotonin\" equivalents, represent numerical values that adjust the system's learning rate, error weighting, and exploration strategies in real-time.\n\n**Active vs. Offline Processing:** The system cycles between an active ingestion phase and an optimization phase. During active processing, the system extracts \"context hypotheses\" from new data inputs. During the optimization phase (metaphorically called \"sleep\"), the system re-evaluates these recorded hypotheses through batch replay and consolidation to improve overall accuracy and stability.\n\n**Knowledge Distillation:** By comparing new data against existing stable records, the system filters out inconsistencies and promotes reliable information into its long-term memory structures.\n\n**Equilibrium Control:** To prevent the control variables from reaching unproductive extreme values (saturation), the system uses stability monitoring routines. These routines act as a feedback mechanism that pulls meta-parameters back into a functional range when the system detects a performance plateau or excessive variance.\n\n**Adaptive Boundaries:** The limits within which the system operates are not hardcoded but self-regulating. The software learns from its own performance metrics (L2M metrics) to expand or contract its processing thresholds based on the complexity of the data it encounters.\n\nIn summary, the project is a recursive learning engine that uses bio-inspired metaphors to implement a highly flexible, self-governing control logic for automated knowledge acquisition.\n\n| Stage | Name | Description |\n|---|---|---|\n| 1 | Inference-free pre-parsing | A raw corpus such as a Wikipedia ZIM file is extracted, structured, and partitioned into the chunk store before autonomous learning begins. |\n| 2 | Autonomous learning | `AutonomousLoop` processes prepared chunks while the neuromodulatory and consolidation chain reacts to the evolving internal state. |\n\nRuntime phases are loaded through `ki_system/phase_registry.py`\n\n. The registry defines load order, isolates module-loading failures, and verifies the managed-cycle top phase.\n\nCurrent chain, top to bottom:\n\n`7cort Cortisol → 7g BDNF → 7f Orexin → 7e Histamine → 7d Slow-Wave → 7c E/I → 7b1 Wake-Chain Bridge → 7b Endocannabinoids → 7a Adenosine → 6d → 6c → 6b → 6a`\n\nThe cleaned chain uses Phase 7b1 as orchestrator so a normal global cycle produces one complete Phase-6a replay path, one Phase-7c E/I event, one Phase-7d cycle, and one workpoint-observer event.\n\nBrainStem currently uses **12 digital neuromodulators**. Their values are normalized to `[0.0, 1.0]`\n\nand derived from internal system state under bounded, biologically inspired dynamics and homeostatic constraints.\n\n| Neuromodulator | Current engineering role |\n|---|---|\n| Dopamine | outcome and gap-closure signal |\n| Serotonin | consolidation and stability signal |\n| Glutamate | excitatory drive associated with exploration and learning activity |\n| GABA | global inhibition and E/I-balance signal |\n| Noradrenaline | error, alarm, and persistent-pressure signal |\n| Acetylcholine | novelty, attention, and structural-revision signal |\n| Adenosine | sleep-pressure homeostat |\n| Endocannabinoids | retrograde gain control |\n| Cortisol | top-level stability watcher and planned soft regulator |\n| Histamine | wake and arousal signal |\n| Orexin | reading-endurance and curiosity-related drive |\n| BDNF | activity-dependent growth and consolidation substrate |\n\nGABA currently regulates **system-level inhibition**. It does not identify or suppress individual words, relations, or extraction errors.\n\nAll 12 displays are connected both statically and at runtime in the GUI.\n\nPhase 6a performs offline-style replay after the wake path. Phase 6b evaluates replay effectiveness and plasticity adjustments. The critic gate checks whether proposed changes remain consistent enough to be retained; rejected or unstable material remains available as error and revision evidence.\n\nPhase 7d adds sub-1-Hz up/down-state processing with:\n\n- stochastic reactivation\n- adaptive thresholds\n- activity-dependent participation\n- survivor and weakening statistics\n- anchor interleaving\n- self-regulating down-selection\n\nA passive Phase-7d workpoint observer records longitudinal E/I state, activity, survivor ratios, reference movement, and virtual adjustment proposals without applying them.\n\nThe E/I path distinguishes:\n\n**Phase-6a drive:**`glutamate_drive`\n\nand`gaba_drive`\n\n**active Phase-7c state:**`glutamate_state`\n\nand`gaba_state`\n\n**compatibility mirror:** active values remain available to existing readers and GUI components**Shadow state:** non-applying recurrent candidates can be evaluated separately\n\nThis separation prevents Phase 6a from overwriting the active Phase-7c state on the next cycle.\n\nStage B will not open all write capabilities at once. The controlled sequence is:\n\n- introduce Cortisol Stage 2 as a gentle regulator\n- validate it in observer operation before allowing applied control\n- allow only consolidation-gated graduation from\n`uncertain_hypothesis`\n\nto`stable_hypothesis`\n\n- require at least\n**three survived Phase-7d consolidations** - apply\n`_critic_gate`\n\n- use warm-up dampening\n- begin with a budget of\n**one promotion per cycle** - keep the facts table closed during the initial hypothesis-graduation stage\n- assess true fact promotion separately at a later milestone\n\nStage B remains blocked until the current Shadow bridge has demonstrably processed real candidates.\n\nThe following productive paths remain disabled:\n\n- direct fact writes\n- direct relation writes\n- direct question writes\n- permanent fact promotion\n- direct Phase-5f / Phase-5g / Phase-5i experimental writes from the new bridge\n- direct attention and internal-gap writes from the new bridge\n\nThe active architecture does not use word blacklists or hard-coded linguistic filters.\n\nBrainStem uses `ki_memory.sqlite3`\n\nin the project root. The database is created automatically when absent.\n\nSchema rules:\n\n- schema changes must be reflected in the bootstrap in the same delivery\n`ensure_schema`\n\nmust be idempotent`_self_check_schema`\n\nmust run before writes- every written column must already be declared in\n`SCHEMA_TABLES`\n\n- compile checks, smoke tests, and intermediate checks are required before delivery\n- structural changes require a full backup first\n\nLearning state can be reset without re-importing the corpus. Preserved content includes documents, chunks, FTS data, import state, and configuration. The reset workflow performs a dry run and creates a timestamped database backup before applying changes.\n\nPerformance indexes are ensured during bootstrap. Bounded pruning is limited to explicitly approved history tables. Active state, Phase-5f/5g/5i data, and other protected tables are excluded from generic pruning.\n\nPeriodic autonomous execution of the approved pruning routine remains an open maintenance item.\n\nThe GUI includes a sensory-deprivation mode that skips new wake/read input while replay, consolidation, and neuromodulatory dynamics continue.\n\nIt provides:\n\n- start and stop controls\n- optional cycle limits\n- per-cycle CSV diagnostics\n- bounded/downsampled live graphs\n- signal-level and overall drift verdicts\n- fail-safe cleanup when the run completes or is interrupted\n\nThe completed **1,344-cycle** no-input test supported the Stage-A stability decision.\n\nFrom the project root:\n\n```\npython main.py --gui\n```\n\n| Step | GUI action | Purpose |\n|---|---|---|\n| 1 | Export / Configuration | Configure the maximum number of articles before import. |\n| 2 | Import & Jobs → ZIM Einlesen | Extract and pre-parse the corpus. |\n| 3 | Import & Jobs → Autonom dauerhaft starten | Start autonomous learning. |\n| 4 | Import & Jobs → Autonom stoppen | Stop autonomous learning cooperatively. |\n| 5 | Close the GUI normally | Wait for active workers instead of terminating them abruptly. |\n\n- Import and Jobs\n- Export and Configuration\n- Drift Report\n- live 12-neuromodulator display\n- corpus-coverage and cycle-progress indicators\n- bounded diagnostic logs and graphs\n- cooperative worker shutdown\n\nThe GUI remains an experimental testing interface; individual areas may still be incomplete.\n\nA Windows `zimdump.exe`\n\nbuild and its required DLL files must be placed in the project root next to `main.py`\n\n. Users must provide their own ZIM corpus.\n\nThe current development corpus is the German Wikipedia category **Computer**, imported into roughly 102,000 chunks.\n\n**Python package:**`ki_system`\n\n**Local project folder:**`BrainStem`\n\n**Primary runtime:** Python 3.11 on Windows with SQLite**Documentation language:** English, German**Status:** highly experimental and under mathematical and architectural validation**Engineering discipline:** backup, compile check, schema self-check, smoke test, and rollback planning for structural changes**AI-assisted engineering:** development has included collaborative AI assistance. Concept elaboration with ChatGPT, Code generation Claude Opus an ChatGPT 5.6 Depp Thinking, Code review NotebookLM, Gemini and Copilot as critics (no sugarcoat mode)\n\nAfter major refactorings, project documentation includes a Legacy Report with:\n\n- removed legacy elements\n- retained but explicitly marked elements\n\nBrainStem does not claim that every current hypothesis is meaningful or that the system understands language at a human level. The current objective is to establish and validate the mechanisms by which hypotheses are formed, challenged, revised, inhibited, replayed, and consolidated.\n\nCurrent zero-result Shadow measurements do not prove a defect and do not prove successful candidate processing. Candidate-flow evidence is the next required result.\n\nBrainStem is an experimental cognitive-architecture research project. Biological terminology is used as an engineering analogy and design inspiration. The software is not a biological simulation and does not claim neuroscientific equivalence.", "url": "https://wpnews.pro/news/brainstem-open-source-bio-inspired-ai-with-12-neuromodulators-for-learning", "canonical_source": "https://github.com/unikum-sol/brainstem", "published_at": "2026-07-23 08:03:16+00:00", "updated_at": "2026-07-23 08:22:27.650001+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "ai-research", "ai-tools", "neural-networks"], "entities": ["BrainStem", "NotebookLM", "Google"], "alternates": {"html": "https://wpnews.pro/news/brainstem-open-source-bio-inspired-ai-with-12-neuromodulators-for-learning", "markdown": "https://wpnews.pro/news/brainstem-open-source-bio-inspired-ai-with-12-neuromodulators-for-learning.md", "text": "https://wpnews.pro/news/brainstem-open-source-bio-inspired-ai-with-12-neuromodulators-for-learning.txt", "jsonld": "https://wpnews.pro/news/brainstem-open-source-bio-inspired-ai-with-12-neuromodulators-for-learning.jsonld"}}