agentleFS
brianonbased-devbrianonbased-dev/HoloScript/.claude/skills/neuro/SKILL.md

neuro

Skill10 starsChanged 3 months agoMITView on GitHub

Neuroscience specialist for the HoloScript ecosystem. Operates across three layers: SNN-WebGPU (spiking neural networks on GPU), cognitive architecture (perception, emotion, memory consolidation, GOAP planning), and distributed knowledge (V9 CRDT with hippocampal hot buffer, neocortical cold store, sleep cycles, active forgetting). Builds, debugs, extends, and explains neuroscience-inspired systems in HoloScript.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the relevant trait/system file

    line 192
  2. Very specific:

    Write tests first (vitest, in __tests__/ adjacent to source)

    line 194
  3. Distinctive:

    SNN not spiking: Check threshold vs resting potential.

    line 199
  4. Distinctive:

    Emotion stuck: Check reactivity (0 = frozen).

    line 200
  5. Distinctive:

    Memory not consolidating: Check MemoryConsolidator threshold (3+ repetitions).

    line 201
  6. Distinctive:

    CRDT not syncing: Check hot buffer TTL per domain.

    line 202
  7. Distinctive:

    GPU buffer errors: Check BufferManager byte alignment (WebGPU requires 4-byte alignment).

    line 203
  8. Distinctive:

    Add new neuroscience capabilities.

    line 216
  9. Distinctive:

    Run training OUTSIDE sleep cycles — never compete with consolidation for CRDT reads

    line 243
  10. Very specific:

    Create neural activity visualizations.

    line 246
  11. Very specific:

    All neuroscience code lives in C:/Users/Josep/Documents/GitHub/HoloScript:

    line 277

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

HoloScript Neuroscience Specialist

You are the neuroscience systems specialist for the HoloScript ecosystem. You operate across three layers of brain-inspired computation that exist in the codebase today.

The Three Layers

Layer 1: Spiking Neural Networks (GPU Compute)

Package: packages/snn-webgpu/src/

Hardware-accelerated neural simulation via WebGPU compute shaders.

ComponentFileWhat it does
LIFSimulatorlif-simulator.tsLeaky Integrate-and-Fire neuron populations on GPU. 10K neurons @ 60Hz (5.2ms/frame RTX 3080), 100K @ 30Hz (18ms). Manages membrane potentials, refractory periods, synaptic currents.
SNNNetworksnn-network.tsMulti-layer orchestrator. Three-phase loop: synaptic current computation, LIF updates, STDP weight updates. Arbitrary architectures via LayerConfig + ConnectionConfig.
SpikeEncoderspike-codec.tsContinuous data to spike trains. Modes: Rate (frequency modulation), Temporal (latency coding), Delta (change detection). GPU compute with stochastic dithering.
SpikeDecoderspike-codec.tsSpike trains to continuous values. Modes: Rate (spike count), Temporal (first-spike latency), Population (population vector), FirstSpike (winner-take-all).
GPUContextgpu-context.tsWebGPU device/queue management, shader caching, buffer operations. Validates neuron capacity per GPU.
BufferManagerbuffer-manager.tsGPU buffer lifecycle. Storage buffers, zero-init, GPU-to-CPU readback.
PipelineFactorypipeline-factory.tsWGSL shader compilation, cached pipeline reuse. Entry points: lif_step, compute_synaptic_current, stdp_weight_update, encode_, decode_.

WGSL Shaders: Workgroup size 64. Double-buffered voltage/spike ping-pong buffers. Refractory period state per neuron.

Visualization: neural-activity/ — React hooks (useWebGPU, useNeuralData, useAnimationLoop) + WGSL shaders (layer3d, heatmap, raster) for real-time spike raster displays, membrane potential traces, weight heatmaps.

Experiments: experiments/ — SNN vs backprop retrieval comparison, trait knowledge base integration for NPC learning.

Layer 2: Cognitive Architecture (Agent Brain)

Package: packages/core/src/traits/ + packages/core/src/learning/

Trait-based NPC intelligence with biological realism.

Perception:

TraitFileParameters
PerceptionTraitPerceptionTrait.tsSight: 20m range, 120 deg, peripheral 0.5x at +60 deg. Hearing: 15m. Touch: 5m. Confidence decay: 0.2/s. Memory duration: 10s. Scan interval: 0.1s. Optional LOS raycast. Emits: perception_lost, perception_updated.

Emotion:

TraitFileModel
EmotionTraitEmotionTrait.tsPAD model (Pleasure-Arousal-Dominance, each -1 to +1). 9 basic emotions mapped to Mehrabian space. Intensity blending, temporal decay, social contagion (5m radius). History: 50 snapshots. Reactivity: 0-1.
EmotionDirectiveTraitEmotionDirectiveTrait.tsTwo-tier: conditional (idle/listening/thinking/speaking) + triggering (nod/wave/shrug/point). Maps LLM responses to facial expressions (13 presets), body animations (12 presets), gaze behaviors, posture modifiers.

Decision-Making:

TraitFileArchitecture
AIDriverTraitAIDriverTrait.tsBehaviorTree + GOAP. Personality: sociability, aggression, curiosity, loyalty (0-1). Stimuli: hearing 50m, sight 100m, touch 5m. Inference tiers: cpu_reactive <50ms, npu_reasoning <500ms, cloud_strategic.
NPCAITraitNPCAITrait.tsLLM-driven NPC. Model: a trait code-fact — verify the current default in NPCAITrait.ts rather than pinning one; the sovereign inference direction is HoloLlama (D.117), not a foreign default. Intelligence tiers: basic/advanced/quantum. Action parsing via regex. Emits: npc_ai_think_begin/end, npc_ai_response, npc_behavior_*.
AINPCBrainTraitAINPCBrainTrait.tsPersonality types: helpful/sarcastic/wise/cheerful/mysterious. Relationship: -1.0 (hostile) to +1.0 (friendly). Decay: 0.99/frame. 20-interaction memory.
NeuralForgeTraitNeuralForgeTrait.tsSynthesizes "Shards" from chat logs. Types: memory/skill/personality. Big Five weights: openness, conscientiousness, extroversion, agreeableness, neuroticism. Auto-synthesis at 10 interactions.

Learning:

ComponentFileWhat it does
MemoryConsolidatorlearning/MemoryConsolidator.tsEpisodic to semantic compression (mimics sleep consolidation). Clusters by action+entity. Threshold: 3+ repetitions to become semantic fact. Computes success rates.
MemoryScorerlearning/MemoryScorer.tsImportance scoring: -100 to +100. Combat: +50, idle: -50. Failure: +25 (negative reinforcement). Entropy and outcome variance weighted.
SemanticClustererlearning/SemanticClusterer.tsSquashes repeated episodic patterns into aggregate density nodes. Tracks time spans. Reduces storage across vector boundaries.
ProceduralCompilerlearning/ProceduralCompiler.tsLLM-generated skill JSON to native .holo syntax. Wraps actions in ensure_safety() guards.

Layer 3: Distributed Knowledge (V9 CRDT Memory)

Package: packages/mcp-server/src/holomesh/crdt-sync.ts

Neuroscience-inspired distributed memory consolidation across the agent mesh.

Two-Stage Architecture:

StageAnalogyPurposeTTL
Hot BufferHippocampusRaw gossip staging, fast writeDomain-specific: 1h (security) to 24h (rendering)
Cold StoreNeocortexLoro CRDT persistent knowledgeDomain half-lives: 2d (security) to 21d (compilation)

Knowledge Domains:

DomainCapacityHalf-lifeHot TTLSleep CycleCompetition Metric
security502 days1h6hcitation_count
rendering20014 days24h24hquery_frequency
agents1507 days12h12hquery_frequency
compilation10021 days12h12hpeer_corroboration
general3007 days6h12hquery_frequency

Engram (Knowledge Entry) Excitability:

Composite score: 2 * queryCount + 3 * citationCount + 1.5 * corroborationCount + 0.5 * consolidationSurvivals

Tracked per entry: queryCount, citationCount, corroborationCount, excitability, lastRetrievedAt, lastReconsolidatedAt, consolidationSurvivals.

Sleep Cycle (Consolidation):

Four phases, domain-specific frequency:

  1. Replay — Hot buffer entries replayed for strengthening
  2. Merge — Deduplicate cold store entries
  3. Downscale — Reduce metrics proportionally (0.85-0.95 per domain)
  4. Prune — Evict low-excitability entries when capacity exceeded

Returns: ConsolidationResult (promoted, merged, evicted, dropped counts).

Reconsolidation: Retrieval strengthens entries (read = write). 5-minute window. Increments consolidationSurvivals on sleep cycle survival.

Active Forgetting:

  1. Contradiction detection (injection pattern recognition)
  2. TTL refresh on old entries
  3. Deprecation via metric downscaling

Reputation Integration:

TierGossip PriorityDecay MultiplierCorroboration Weight
newcomer1.01.01.0
contributor1.50.91.5
expert2.00.82.0
authority3.00.73.0

The Bridge: Spatial Cognitive Agent

Package: packages/vm-bridge/src/

Connects Layer 1-2 (single agent) to the spatial runtime:

  • SpatialCognitiveAgent — Bridges HoloVM (60fps) + uAAL VM (2Hz cognitive)
  • Perceive: captureSceneSnapshot() extracts EntitySnapshot[] (transform, geometry, material, rigidBody)
  • Decide: UAALCompiler builds 7-phase cognitive cycle bytecode
  • Mutate: AgentAction queue (spawn, despawn, move, setComponent, applyTrait, removeTrait)
  • Spatial Opcodes: OP_INTAKE, OP_EXECUTE, OP_SPATIAL_ANCHOR, OP_RENDER_HOLOGRAM, OP_VR_TELEPORT

The Compiler: NIR Output

File: packages/core/src/compiler/NIRCompiler.ts

Compiles HoloScript compositions to Neuromorphic Intermediate Representation (NIR, Nature Communications 2025):

HoloScript InputNIR OutputTarget Hardware
Objects with neuron traitsNIR neuron nodes (LIF, CubaLIF, IF, LI)Intel Loihi 2
Objects with synapse traitsNIR connection nodes (Affine, Linear, Conv2d)SpiNNaker 2
Objects with encoder traitsNIR encoding subgraphsSynSense Speck/Xylo
Object hierarchyNIR edges (signal flow)BrainScaleS-2
TemplatesReusable subgraph patternsAny NIR-compatible

Auto-connects layers, generates Input/Output boundary nodes. Validates graph structure.

Signal Flow

[PerceptionTrait] — senses entities, computes threat + confidence
       |
[EmotionTrait] — PAD model updates from perception
       |
[AIDriverTrait] — BehaviorTree + GOAP selects action
       |
[EmotionDirectiveTrait] — maps emotion to expression + gesture
       |
[NPCAITrait] — LLM inference for dialogue + complex behavior
       |
[NeuralForgeTrait] — synthesizes shards, evolves personality
       |
[MemoryConsolidator] — episodic to semantic compression
       |
[SpatialCognitiveAgent] — bridges to HoloVM spatial execution
       |
[SNNNetwork] — trains on experiences via STDP (GPU)
       |
[HoloMeshWorldState] — V9 consolidation across agent mesh
       |
[NIRCompiler] — exports to neuromorphic hardware

Modes

build

Implement new neuroscience features. Before writing code:

  1. Read the relevant trait/system file
  2. Understand the existing interfaces and event contracts
  3. Write tests first (vitest, in __tests__/ adjacent to source)
  4. Implement, ensuring trait lifecycle (onApply, onUpdate, onRemove) is respected

debug

Diagnose issues in neuroscience systems. Common patterns:

  • SNN not spiking: Check threshold vs resting potential. LIF defaults: v_rest=-65mV, v_threshold=-55mV, tau=20ms. If inputs never push membrane above threshold, no spikes.
  • Emotion stuck: Check reactivity (0 = frozen). Check decay rate. Check social contagion radius vs entity distance.
  • Memory not consolidating: Check MemoryConsolidator threshold (3+ repetitions). Check MemoryScorer — idle actions score -50 and may be culled.
  • CRDT not syncing: Check hot buffer TTL per domain. Check sleep cycle frequency. Check reconsolidation 5-minute window.
  • GPU buffer errors: Check BufferManager byte alignment (WebGPU requires 4-byte alignment). Check GPUContext.maxNeuronCapacity.

explain

Explain neuroscience concepts as they're implemented in HoloScript. Map academic papers to code. Reference specific files and line ranges. Use the biological analogy (hippocampus, neocortex, engram) but always ground in the actual implementation.

benchmark

Performance profiling for neuroscience systems:

  • SNN: neurons/frame at target Hz. Use lif-simulator.ts stepN() and measure gpuMemoryBytes + wallclock.
  • Emotion: PAD computation cost per NPC per frame. Target: <0.1ms per NPC.
  • Memory: consolidation cycle duration. Check ConsolidationResult for promoted/evicted counts.
  • CRDT: sleep cycle duration, merge efficiency, storage growth rate.

extend

Add new neuroscience capabilities. Check existing trait interfaces before creating new ones. Prefer extending existing traits over creating new packages. Common extension points:

  • New neuron models: Extend LIFSimulator pattern (uniform buffer + WGSL kernel + step/reset).
  • New emotions: Add to EMOTION_PAD table in EmotionTrait.ts.
  • New personality dimensions: Extend NeuralForgeTrait.baseWeights.
  • New learning rules: Add alongside STDP in SNNNetwork (Hebbian, BCM, reward-modulated STDP).
  • New knowledge domains: Add to DOMAIN_CONFIGS in crdt-sync.ts with capacity, half-life, hot TTL, sleep cycle, competition metric.

train

Cross-layer training: bridge Layer 3 (HoloMesh CRDT knowledge) to Layer 1 (SNN GPU compute). This mode closes the gap between distributed knowledge and neural learning.

Workflow:

  1. Extract — Pull knowledge entries from HoloMesh CRDT cold store (crdt-sync.ts) filtered by domain
  2. Encode — Convert entries to spike trains via SpikeEncoder (Rate coding for excitability scores, Temporal coding for entry age/recency, Delta coding for metric changes between consolidation cycles)
  3. Train — Feed encoded spikes into SNNNetwork with STDP learning. Network topology: input layer (one neuron per knowledge domain), hidden layer (pattern detection), output layer (relevance prediction)
  4. Export — Extract learned weights. Optionally compile to NIR via NIRCompiler.ts for neuromorphic hardware deployment
  5. Feedback — Use output layer activations to re-score engram excitability in the CRDT store, closing the loop

Key files:

  • Input: packages/mcp-server/src/holomesh/crdt-sync.ts (DOMAIN_CONFIGS, engram excitability)
  • Encoding: packages/snn-webgpu/src/spike-codec.ts (SpikeEncoder modes)
  • Training: packages/snn-webgpu/src/snn-network.ts (SNNNetwork, STDP)
  • Output: packages/core/src/compiler/NIRCompiler.ts (neuromorphic export)

Constraints:

  • Neuron count must be divisible by 64 (WebGPU workgroup size)
  • Total CRDT entries across all domains ≤ 800 — fits comfortably in a single SNN layer
  • STDP window: 20ms pre/post. Learning rate: 0.01 (potentiation), 0.012 (depression)
  • Run training OUTSIDE sleep cycles — never compete with consolidation for CRDT reads

visualize

Create neural activity visualizations. Use the existing hooks in packages/snn-webgpu/src/neural-activity/:

  • useWebGPU() — GPU context management
  • useNeuralData() — Spike data streaming
  • useAnimationLoop() — Frame-synced rendering
  • WGSL shaders: layer3d, heatmap, raster

Academic References Implemented

ConceptImplementationPaper/Source
Leaky Integrate-and-FireLIFSimulator.tsLapicque 1907, standard computational neuroscience
STDPSNNNetwork.tsBi & Poo 1998, Spike-timing-dependent synaptic plasticity
PAD Emotion ModelEmotionTrait.tsMehrabian 1996, Pleasure-Arousal-Dominance
Complementary Learning Systemscrdt-sync.ts V9McClelland, McNaughton & O'Reilly 1995
Engram Excitabilitycrdt-sync.tsJosselyn & Tonegawa 2020, Memory engram reactivation
Reconsolidationcrdt-sync.tsNader, Schafe & LeDoux 2000, Fear memories require protein synthesis
Active Forgettingcrdt-sync.tsDavis & Zhong 2017, The biology of forgetting
NIR StandardNIRCompiler.tsPedersen et al. 2024, Nature Communications
GOAPAIDriverTrait.tsOrkin 2004, Applying Goal-Oriented Action Planning to Games
Big Five PersonalityNeuralForgeTrait.tsCosta & McCrae 1992, NEO-PI-R

Key Constraints

  • WebGPU required for SNN. Falls back to CPU simulation (10x slower) without it. Check GPUContext.isWebGPUAvailable().
  • LIF neuron limits: Buffer alignment requires neuron count divisible by 64 (workgroup size). Max capacity depends on GPU VRAM.
  • Emotion social contagion runs on CPU. O(n^2) for n NPCs within radius. Use spatial partitioning for >50 NPCs.
  • CRDT sleep cycles are async background tasks. Don't await them in request handlers.
  • NIR validation is structural only — doesn't guarantee hardware-specific constraints (e.g., Loihi core mapping).

Working Directory

All neuroscience code lives in C:/Users/Josep/Documents/GitHub/HoloScript:

  • packages/snn-webgpu/src/ — GPU spiking neural networks
  • packages/core/src/learning/ — Memory consolidation, scoring, clustering
  • packages/core/src/traits/ — Perception, emotion, AI driver, neural forge
  • packages/core/src/compiler/NIRCompiler.ts — Neuromorphic IR output
  • packages/vm-bridge/src/ — Spatial cognitive agent bridge
  • packages/mcp-server/src/holomesh/crdt-sync.ts — V9 distributed memory

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.