home / skills / openclaw / skills / neuralink-decoder

neuralink-decoder skill

/skills/aadipapp/neuralink-decoder

This skill simulates neural spike activity and decodes it into 2D cursor velocity for Brain-Computer Interface experiments.

npx playbooks add skill openclaw/skills --skill neuralink-decoder

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
654 B
---
name: neuralink-decoder
description: Simulates and decodes neural spike activity into cursor movement (BCI).
author: tempguest
version: 0.1.0
license: MIT
---

# Neuralink Decoder Skill

This skill simulates a Brain-Computer Interface (BCI).
It generates synthetic neural spiking data based on cosine tuning (motor cortex model) and uses a linear decoder to reconstruct cursor velocity.

## Features
- **Neural Simulator**: Generates realistic spike trains for 64 neurons.
- **Decoder**: Maps spike rates to 2D velocity ($v_x, v_y$).
- **Visualization**: Prints the decoded trajectory.

## Commands

- `decode`: Run the simulation and decoding loop.

Overview

This skill simulates a Brain-Computer Interface that decodes synthetic neural spike activity into 2D cursor movement. It generates cosine-tuned spike trains for a population of neurons and applies a linear decoder to reconstruct velocity. The output includes a printed trajectory for quick inspection.

How this skill works

The simulator creates spike trains for a fixed population (default 64 neurons) using cosine tuning relative to intended movement directions and firing-rate noise. Spike counts are converted into rate vectors which a precomputed linear mapping transforms into x/y velocity estimates. The tool runs a time-stepped loop that simulates spikes, decodes velocities, and reports the resulting cursor trajectory.

When to use it

  • Prototyping BCI decoding algorithms without real neural data
  • Teaching or demonstrating cosine tuning and population decoding concepts
  • Comparing simple linear decoders against more complex methods
  • Generating synthetic datasets for offline algorithm testing
  • Rapidly validating preprocessing and rate-to-velocity pipelines

Best practices

  • Normalize spike rates before applying the decoder to reduce bias from high-firing neurons
  • Run multiple simulation seeds to assess decoder variability under noise
  • Keep simulation time steps and bin sizes consistent with downstream processing
  • Visualize both true intended trajectories and decoded trajectories to spot systematic errors
  • Tune the number of neurons and tuning width to match your expected SNR

Example use cases

  • Simulate cursor-control trials for a research methods class
  • Validate a new Kalman filter by comparing its output to the linear decoder baseline
  • Create synthetic training data for a machine-learning decoder when neural recordings are limited
  • Quickly demonstrate how cosine tuning produces population-level direction encoding
  • Archive or reproduce prior decoding behavior for debugging or presentation

FAQ

How many neurons does the simulator model?

By default it simulates 64 neurons, but the population size can be adjusted in the code.

Does the decoder require real neural recordings?

No — it works on the synthetic spike trains generated by the cosine-tuning simulator, making it useful for prototyping and education.