Metadata-Version: 2.4
Name: neuralspace-ai
Version: 1.0.0
Summary: Cognitive Code Topology Engine - Self-evolving neural security scanner
Author-email: NeuralSpace Team <team@neuralspace.ai>
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch
Requires-Dist: watchdog
Requires-Dist: filelock
Requires-Dist: click
Requires-Dist: scipy
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: statsmodels
Dynamic: license-file

# 🧠 NeuralSpace – Cognitive Code Security Engine

[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![CI/CD](https://github.com/krishnakanthsharmat-cloud/NeuralSpace/actions/workflows/neuralspace-scan.yml/badge.svg)](https://github.com/krishnakanthsharmat-cloud/NeuralSpace/actions)

**NeuralSpace** is a next‑generation, self‑evolving security scanner that detects obfuscated malicious code using a **Covalent Tree topology** – a novel neural architecture that routes code through a fractal decision tree where each branch has its own specialized "neural atom."

Unlike traditional static scanners (SAST/NGAV) that rely on rigid rule sets or giant black‑box models, NeuralSpace learns the *semantic fingerprint* of your codebase and autonomously fractures into new branches when it encounters novel architectural patterns.

---

## 🔥 The Problem We Solve

| Current Tool | Limitation | NeuralSpace Advantage |
| :--- | :--- | :--- |
| **Traditional AV** | Relies on known signatures. | Blocks zero‑day obfuscated threats. |
| **SAST (SonarQube)** | 99.5% false positives. | Contextual detection (e.g., `requests.get` alone is safe; `requests.get + exec` is not). |
| **Transformer Models** | Huge, slow, cloud‑dependent. | Lightweight (~8 KB weights), runs instantly on CPU. |
| **File Watchers** | React to files, don't understand content. | Routes files dynamically into a living knowledge tree. |

---

## ✨ Key Features

- **🧬 Self‑Evolving Topology** – The Covalent Tree spawns new branches when it detects structural drift in your code (cosine similarity < 0.15). It doesn't just classify; it *organizes* your codebase.
- **🧠 Distributed Neural Atoms** – Each tree branch has its own `PureNeuralAtom` (512→4→4 network) initialized with a unique seed. This creates specialized "brains" for different code families (e.g., web scrapers vs. quant math vs. CLI tools).
- **🛡️ Obfuscation‑Resistant Tokenizer** – Engineered combination features (indices 490–495) catch multi‑stage evasions like `base64` + `exec` + `requests`, bypassing the neural network's natural struggle with long‑range dependencies.
- **🌍 Polyglot** – Scans **Python, JavaScript, TypeScript, Go, and Rust** (more coming soon).
- **⚡ Ultra‑Lightweight & Local** – Trains in under 1 minute on a standard CPU. No cloud, no GPU, no expensive API calls.
- **🔗 CI/CD Native** – Ships with a pre‑built GitHub Action that runs on every `push` and `pull_request`.
- **🌐 Federated Intelligence** – Shares anonymized threat signatures with a global network, creating a living immune system.

---

## 🏗️ How It Works

1. **Tokenization** – Raw source code is converted into a 512‑dimension vector using unigram hashing, byte trigrams, and hard‑coded combo indices (`requests+exec` → +8.0).
2. **Routing** – The vector descends the Covalent Tree. If it matches a child node (cosine similarity > 0.85), it dives deeper. Otherwise, it stops.
3. **Judgment** – The terminal node's `PureNeuralAtom` computes two scores:
   - **Sentinel (S)** – Threat probability (class 3).
   - **Logic (L)** – Safe probability (class 0).
4. **Enforcement** – If `S > 0.25` or `L < 0.2`, the file is quarantined (renamed/moved) and logged.
5. **Evolution** – If the file is allowed but deviates significantly from the parent's latent centroid, the tree spawns a new child node to capture this new architectural pattern.

---

## 🚀 Quick Start

### Installation

```bash
# Clone the repository
git clone https://github.com/krishnakanthsharmat-cloud/NeuralSpace.git
cd NeuralSpace

# Install in development mode (recommended)
pip install -e .	
