Bio-chip intelligence framework for Polar Bear Systems
Multi-sensor EEG + motion fusion · rig-core LLM cognitive inference · ECDSA-signed provenance
Built by Murtaza Ali Imtiaz · Technology Lead · Polar Bear Systems · July 2019–Present
Core component of the Polar Bear Systems superpower bio-chip intelligence platform: bridges neurotechnology with decentralised AI infrastructure.
Fuses real-time EEG brainwave data (δ θ α β γ) with 3-axis MEMS accelerometer readings into higher-order cognitive features, then routes them through a rig-core (ARC) LLM agent for classification. Every inference result is ECDSA-signed on secp256k1 for blockchain-grade, tamper-evident data provenance.
Demo mode: all operations run without an API key by default.
SetANTHROPIC_API_KEY(and optionally--features ai-agent) for live inference.
┌─────────────────────────────────────────────────────────────────────┐
│ polar-bear-biochip │
├──────────────────────────────────┬──────────────────────────────────┤
│ sensors layer │ provenance layer │
│ │ │
│ bci.rs δ θ α β γ bands │ ecdsa_signer.rs secp256k1 │
│ attention + med │ EcdsaSigner sign_result() │
│ accelerometer.rs 3-axis MEMS │ EcdsaVerifier from_hex() │
│ activity state │ SHA-256 payload hashing │
│ fusion.rs SensorFusion │ 64-byte r‖s compact signature │
│ cognitive_load │ → SignedOutput JSON on disk │
│ emotional_valence │ │
│ arousal_level │ │
├──────────────────────────────────┴──────────────────────────────────┤
│ agent layer (feature = ai-agent) │
│ │
│ biochip_agent.rs BioChipAgent │
│ ├── ai-agent feature ──► rig-core 0.37 · claude-sonnet-4-6 │
│ └── fallback ──► curl subprocess · same JSON payload │
└─────────────────────────────────────────────────────────────────────┘
| Band | Range (Hz) | Cognitive correlate |
|---|---|---|
| Delta | 0.5–4 | Deep sleep, unconscious processing |
| Theta | 4–8 | Drowsiness, creativity, memory encoding |
| Alpha | 8–12 | Relaxed alertness, idle visual cortex, flow states |
| Beta | 12–30 | Active thinking, focus, problem-solving |
| Gamma | 30–100 | High-level cognition, cross-cortical binding |
| Feature | Formula | Range |
|---|---|---|
| Attention index | β / (α + θ + ε) × 0.6 | [0, 1] |
| Meditation index | α / (β + γ + ε) × 4.0 | [0, 1] |
| Cognitive load | β / (α + θ + ε) × 0.5 + activity_boost | [0, 1] |
| Emotional valence | (α − 0.6·β) / total_power | [−1, +1] |
| Arousal level | (β + γ) / total_power | [0, 1] |
See docs/bci_math.md for full derivations and ICA pipeline notes.
| Step | Operation |
|---|---|
| 1 | canonical_json = serde_json::to_string(InferenceResult) |
| 2 | e = SHA-256(canonical_json) |
| 3 | Sample ephemeral k from CSPRNG |
| 4 | R = k·G; r = R.x mod n |
| 5 | s = k⁻¹(e + r·d) mod n |
| 6 | Signature = r‖s, 64 bytes → hex-encoded in SignedOutput.signature_hex |
// No private key required - public key embedded in SignedOutput.
let valid = EcdsaSigner::verify_signed(&signed_output)?;
// Or use the standalone verifier:
let verifier = EcdsaVerifier::from_hex(&signed_output.public_key_hex)?;
verifier.verify(&sha256_hash, &signed_output.signature_hex)?;| Tool | Version | Notes |
|---|---|---|
| Rust stable | ≥ 1.85.0 (MSRV) | rustup update stable |
curl |
any | for non-ai-agent live inference |
ANTHROPIC_API_KEY |
- | optional; demo mode if absent |
git clone https://github.com/murtazaai/polar-bear-biochip
cd polar-bear-biochip
cp .env.example .env # fill in ANTHROPIC_API_KEY for live inference
# Demo mode - no API key required
cargo run -- run --demo --cycles 5
# Live inference
cargo run --release -- run --cycles 10
# With rig-core backend
cargo run --release --features ai-agent -- run --cycles 5
# Verify a signed output file offline
cargo run -- verify signed_outputs/cycle_001.jsonUSAGE:
polar-bear-biochip run [OPTIONS]
polar-bear-biochip verify <FILE>
run options:
-c, --cycles <N> Inference cycles (0 = infinite) [default: 5]
-d, --demo Force demo mode (no API call)
-o, --output-dir <DIR> Signed JSON output directory [default: signed_outputs]
-m, --model <MODEL> Anthropic model [default: claude-sonnet-4-6]
cargo run --example sensors_demo # sensor fusion table (no key)
cargo run --example provenance_demo # ECDSA sign/verify/tamper (no key)
cargo run --example agent_demo # agent demo (demo fallback)
cargo run --example agent_demo --features ai-agent # live rig-core inference ╔═══════════════════════════════════════════════════╗
║ Polar Bear · Bio-Chip Intelligence Framework ║
║ Sensor Fusion · rig-core · ECDSA Provenance ║
╚═══════════════════════════════════════════════════╝
INFO Generating ECDSA keypair (secp256k1)...
INFO Public Key : 04d23257ac0b...261c583a6ad7
──────────────────────────────────────────────────────
CYCLE 001/005 | 2026-05-19T10:30:00.114Z
──────────────────────────────────────────────────────
[SENSORS] BCI α=11.5 β=19.2 θ=6.2 δ=2.3 γ=43.9 Hz
[SENSORS] Accel x=-0.05 y=+0.23 z=9.69 m/s² | Stationary
[SENSORS] Fused cogLoad=0.51 valence=-0.00 arousal=0.75 attn=0.62
[AGENT] Querying rig-core LLM agent...
[RESULT] Alert : ✅ Normal
[RESULT] Cognitive State: Balanced beta-alpha profile - focused, productive engagement
[RESULT] Recommendations:
• Readings within optimal range - maintain current activity
• Beta dominance confirms active problem-solving mode
• Schedule a 5-min micro-break within 45 minutes
[PROV] Hash : 1d588fa83a0d8d1a9ffb...
[PROV] Signature : a304cd96500e3c4c4a5a...
[PROV] ✓ ECDSA signature verified inline (secp256k1 / SHA-256)
[PROV] ✓ Signed output → signed_outputs/cycle_001.json
| Module | Tests | Coverage |
|---|---|---|
sensors/bci.rs |
3 | Band ranges, derived indices, Default |
sensors/accelerometer.rs |
4 | Gravity axis, magnitude, activity states, Default |
sensors/fusion.rs |
3 | Feature bounds, sequence_id, Default |
agent/biochip_agent.rs |
3 | Demo scenarios, Default, prompt builder |
provenance/ecdsa_signer.rs |
7 | Sign/verify, tamper, from_hex, verifier, geometry |
| File | Tests | Coverage |
|---|---|---|
tests/sensor_tests.rs |
12 | BCI bands, accel geometry, fusion boundaries, timestamps |
tests/provenance_tests.rs |
14 | ECDSA geometry, sign/verify, tamper detection, key ops |
Total: 46 tests
cargo test # run all 46 tests
cargo test sensors # sensor layer only
cargo test provenan # provenance layer only{
"inference_result": {
"timestamp": "2026-05-19T10:30:00.117Z",
"sequence_id": 1,
"fused_reading": {
"bci": { "alpha_hz": 11.5, "beta_hz": 19.2, "attention_index": 0.62, ... },
"accelerometer": { "x": -0.05, "z": 9.69, "activity_state": "Stationary", ... },
"cognitive_load": 0.51,
"emotional_valence": -0.0,
"arousal_level": 0.75
},
"cognitive_state": "Balanced beta-alpha profile - focused engagement",
"alert_level": "Normal",
"recommendations": [ "...", "...", "..." ]
},
"payload_hash_hex": "1d588fa83a0d8d1a9ffb...",
"signature_hex": "a304cd96500e3c4c4a5a...",
"public_key_hex": "04d23257ac0b...",
"signed_at": "2026-05-19T10:30:00.117Z"
}Tamper any field → SHA-256 hash changes → ECDSA signature invalidated.
// Without --features ai-agent (curl subprocess - same JSON payload as rig-core):
let agent = BioChipAgent::new("claude-sonnet-4-6", demo);
let result = agent.infer(fused).await?;
// With --features ai-agent (rig-core 0.37 backend - drop-in swap):
// src/agent/biochip_agent.rs rig_inference():
let client = anthropic::Client::from_env()?;
let agent = client.agent(model).preamble(PREAMBLE).max_tokens(512).build();
agent.prompt(build_prompt(reading)).awaitBoth paths produce identical InferenceResult structures.
Proprietary - © 2026 Murtaza Ali Imtiaz / Polar Bear Systems
See LICENSE-PBS for permitted use.
Murtaza Ali Imtiaz
- LinkedIn: LinkedIn
- GitHub: @murtazaai
- Portfolio: murtazai.com