neuromod
A generalized Rust library for spiking neural networks (SNNs), centered on biologically grounded neuron models, neuromodulation, and plasticity.
neuromod is designed to be a reusable core: topology-neutral at initialization, dynamically sizable at runtime, and strict about input shape validation.
Highlights
- Dynamic network sizing with
SpikingNetwork::with_dimensions(...) - Backward-compatible default constructor:
SpikingNetwork::new() - Strict step contract:
Result<Vec<usize>, StepError> - Neutral initialization (blank synaptic weights; no hardcoded domain topology)
- Generic neuromodulators: dopamine, serotonin, acetylcholine, norepinephrine
GenericRewardtrait for domain-specific reward shaping in downstream crates- Canonical neuron models included:
- Lapicque
- LIF
- GIF (Generalized Integrate-and-Fire)
- Izhikevich
- FitzHugh-Nagumo
- Hodgkin-Huxley
- Classical Hebbian STDP utilities and reward-modulated learning components
Installation
[]
= "0.5.0"
Quick Start
use ;
Dynamic Dimensions
use ;
Step Errors (Shape Validation)
step validates that stimuli.len() == num_channels and returns an error on mismatch.
use ;
Neuromodulators
NeuroModulators supports direct control, signal-derived initialization via SignalProfile, and generic reward shaping.
use ;
For legacy hardware-calibrated signal mapping, use SignalProfile::hardware_calibrated().
Included Components
SpikingNetwork,StepErrorNeuroModulators,SignalProfile,Observation,GenericReward,UnitRewardapply_neuromodulation- Neuron models:
LifNeuronGifNeuronIzhikevichNeuronLapicqueNeuronFitzHughNagumoNeuronHodgkinHuxleyNeuron
- Learning/plasticity:
apply_classical_stdp,StdpParams,HebbianIzhikevichNetworkEligibilityTrace,RmStdpConfig
Architecture & Boundaries
neuromod is the core library layer for neuron dynamics, generic neuromodulation, and foundational plasticity primitives.
See the full planning documents:
- Org Modularization Standards — workstream index (#35–#43), cross-cutting git/build/beads standards, and audit commands.
- neuromod Boundary Matrix — runtime/deployment role, owns/does-not-own, allowed/forbidden dependencies vs. limbic-critic, brainstem-daemon, axon-encoder, synaptic-mesh, silicon-bridge, Spikenaut-Hardware, plasticity-lab, etc. (LIM-9).
- ADR 001: Shared traits live in neuromod — why traits are hosted here.
Examples
Run included examples:
Development
# Coverage (matches CI; see codecov.yml)
# HTML report: cargo llvm-cov --all-features --html
# Full CI-like validation
Observability
neuromod publishes test coverage to Codecov and release metadata to Sentry.
Codecov
- Configuration:
codecov.yml - Workflow:
.github/workflows/coverage.yml
Local coverage (also listed under Development):
# HTML report: cargo llvm-cov --all-features --html
- View the dashboard at Codecov.
- Open
target/llvm-cov/html/index.htmlafter running the HTML report locally. - CI runs the
coverage.ymlworkflow on every PR and push tomain.
Sentry releases
- Workflow:
.github/workflows/sentry-release.yml
A Sentry release is created automatically when a v* tag is pushed and can be triggered manually via workflow_dispatch. The release name follows neuromod@{version}.
To enable Sentry at runtime, use the optional sentry feature:
[]
= { = "0.5.0", = ["sentry"] }
SENTRY_DSN=...
See examples/sentry.rs. The feature is optional and is not included in the default build.
View releases and issues in the linked Sentry project. The organization and auth token come from repository secrets; SENTRY_PROJECT is set to rust in .github/workflows/sentry-release.yml.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE-2.0 or [http://www.apache.org/licenses/LICENSE-2.0])
- MIT license (LICENSE-MIT or [http://opensource.org/licenses/MIT])
at your option.
CI & Automation
This repository uses a comprehensive CI setup for speed, quality, security, and observability:
- Core CI (
.github/workflows/ci.yml):fmt,clippy, build, tests (viacargo-nextest), feature-matrix testing (cargo-hack), domain-agnostic docs check. UsesSwatinem/rust-cacheanddorny/paths-filterto keep most PR feedback fast. - Qodana (
.github/workflows/qodana_code_quality.yml): JetBrains code-quality scans on every PR/push tomainandreleases/*; results are published to Qodana Cloud. - Codecov (
.github/workflows/coverage.yml):cargo-llvm-cov+ Test Analytics (stable JUnit via pinned nextest). See Observability for local usage and report links. - Sentry Releases (
.github/workflows/sentry-release.yml): Automatic releases onv*tags + manualworkflow_dispatchtrigger. See Observability for runtime usage and viewing releases. - reviewdog (
.github/workflows/reviewdog.yml): Inline PR comments for clippy and rustfmt. - Security scanning:
- CodeQL (
.github/workflows/codeql.yml) rustsec/audit-check+ Trivy (.github/workflows/audit.yml)
- CodeQL (
- Dependencies: Dependabot (
.github/dependabot.yml) for Cargo, GitHub Actions, Docker. - Docker (
.github/workflows/docker.yml,Dockerfile): Reproducible builds. Local usage:# Runtime image (example binaries only — no cargo toolchain) # Run tests inside the builder stage (has Rust + source)
Links
- Crates.io: https://crates.io/crates/neuromod
- Docs.rs: https://docs.rs/neuromod
- Repository: https://github.com/Limen-Neural/neuromod