--- title: "I Deleted My Entire AI Project After One Comment — Then Rebuilt It From Scratch in Rust" author: "Darshan Vichhi" published: "2026-07-04T11:40:13.000Z" updated: "2026-11-04T05:01:23.067Z" url: "https://zyvop.com/i-deleted-my-entire-ai-project-after-one-comment-then-rebuilt-it-from-scratch-in-rust-o9g6j" canonical: "https://aarambhdevhub.medium.com/i-deleted-my-entire-ai-project-after-one-comment-then-rebuilt-it-from-scratch-in-rust-9df3d132fe80?source=rss-0811e9432b8e------2" tags: [] --- # I Deleted My Entire AI Project After One Comment — Then Rebuilt It From Scratch in Rust ![Cover image]() ![]() Three weeks ago I shipped Manas v1.0.0. It was a local-first AI memory system written in Rust. You could teach it facts from text files, ask it questions, and it would answer from a local source index. No cloud. No API key. No external LLM. I was proud of it. Then someone left a comment on LinkedIn that I couldn’t shake. > _“The hard part of a memory system is not storing facts — it is reconciling them over time. When a new fact contradicts an old one, you want provenance and an append-only history, not a silent overwrite. Memory you can trace beats memory that is merely fast.”_ > _—_ A comment on the Manas v1.0.0 LinkedIn post That comment made me go back and actually test v1 properly for the first time. I taught it a fact. Then I deleted the text sidecar file it used to answer questions. Then I asked again. ```typescript Not enough local memory to answer this yet. ``` Then it searched DuckDuckGo. For something I had literally just taught it. The neural network in v1 — all the backprop, all the neurons, all the importance scoring, all the protection levels — played **zero role** in answering questions. It was keyword search over a text file the whole time. The neural network was decoration. So I deleted the entire codebase and started over. ### The Real Question Before writing a single line of v2, I forced myself to answer one question clearly: > _Can a neural network learn a fact, store it directly in its own weights, and retrieve it from those weights alone — with no text file, no vector database, no cloud API, no GPU — running on a normal laptop CPU?_ This is called **continual learning** or **lifelong learning** in academic research. It is one of the hardest unsolved problems in AI. The big labs haven’t solved it cleanly either — they just brute-force around it by retraining from scratch on massive datasets. I wanted to build something small and honest that actually does it. ### What Was Wrong With v1 — In Detail To understand v2, you need to understand exactly how v1 failed. When you ran manas teach "A cat is a small animal" in v1, two things happened: 1. The text was saved to brain.manas.sources — a plain text file 2. The neural network was trained on next-token prediction — learning that “cat” is often followed by “is”, “is” by “a”, and so on When you ran manas ask "What is a cat?", v1 did this: ```sql search brain.manas.sources by token overlap with "cat"→ find the chunk with the most matching tokens→ return that chunk verbatim ``` The neural network was never consulted. It was an expensive decoration. The proof: ```markdown # teach a fact./manas teach "A cat is a small domesticated animal with fur and whiskers."./manas ask "What is a cat?"# → correct answer ✅# delete the text sidecarrm brain.manas.sources brain.manas.sourceindex# ask again - neural weights only./manas ask "What is a cat?"# → "Not enough local memory to answer this yet." # → falls back to DuckDuckGo web search ``` The network knew nothing. The file was everything. ### Starting From Scratch — The Architecture Decision When I decided to rebuild, I had one foundational decision to make: **Build from scratch in Rust, or use an existing ML framework like Candle or HuggingFace?** The answer was clear once I understood what Manas actually needed: - A network that grows new neurons when it cannot represent something - Per-neuron protection levels that are enforced at the gradient level - Content-addressed memory retrieval — neurons that fire based on input similarity - A freshness system that tracks knowledge staleness at the neuron level - A custom binary format that stores everything in one file **None of this exists in any framework.** Candle is excellent for transformer models. HuggingFace is excellent for working with pretrained weights. But neither gives you a “grow a new neuron when loss stays high” API. Neither has per-neuron protection built into apply\_gradients(). Neither can store a self-growing brain in a custom binary format with CRC32 integrity. These things had to be built from scratch because they are the invention. The matrix multiplication underneath them is maybe 200 lines of Rust. That is the easy part. ### The Core Problem: Catastrophic Forgetting Before building anything, I needed to prove the engine could work at all. The #1 enemy of continual learning is **catastrophic forgetting**. When a standard neural network learns something new (fact B), it overwrites the weights that stored fact A. This happens because standard backpropagation distributes error signals across all weights equally — it has no concept of “this weight is important, protect it.” I built a standalone proof in experiment.rs — a single file, no crates, no CLI, just the math: ```python // teach 5 anchor factsfor (input, target) in &anchors { for _ in 0..300 { network.backprop(&encode(input), &encode(target), lr); }}// measure similarity BEFORE new learninglet before = cosine(network.forward(&encode("cat")), encode("small animal"));println!("cat before: {:.4}", before); // 0.8432// teach 50 completely different factsfor _ in 0..200 { for (input, target) in &noise_facts { network.backprop(&encode(input), &encode(target), lr); }}// measure similarity AFTER new learninglet after = cosine(network.forward(&encode("cat")), encode("small animal"));println!("cat after: {:.4}", after); // 0.1204 - catastrophic forgetting ``` That 0.12 was the problem clearly visible. The network learned 50 new facts and completely forgot the first one. ### The Fix: Keyed Neurons + Gradient Orthogonalization The solution I arrived at combines two ideas: **1\. Keyed neurons** — instead of standard tanh(w·x + b) activation, a keyed neuron computes: ```toml activation = exp(-KEY_SHARPNESS × ||normalized_input - key||²) ``` This is a Gaussian RBF. The neuron fires strongly only when the input closely matches its stored key. It is content-addressed memory — like a biological neuron that responds to a specific stimulus pattern. **2\. Gradient orthogonalization** — after anchoring key neurons to specific facts, the open neurons have the anchor directions projected out of their weight gradients. This means new learning literally cannot interfere with anchor directions — the gradient space for new learning is orthogonal to the anchor space. The result in the proof: ```yaml cat before: 0.8432cat after: 0.8291 ← survived 50 new factsforgetting: 0.0141 ← delta under 0.15 ✅amazon after: 0.8847 ← new fact also learned well ✅ ``` Old knowledge preserved. New knowledge learned. Both strong simultaneously. ### The Architecture — 8 Crates The full v2 system is built across 8 Rust crates, each with a single responsibility: ### manas-core The neural network runtime. Neurons, layers, the network itself. Growth logic. The apply\_gradients() function where protection is enforced structurally: ```rust pub fn apply_gradients(&mut self, gradients: &[(u64, NeuronGradients)], lr: f32) { for (neuron_id, grad) in gradients { let neuron = self.find_neuron_mut(*neuron_id); match neuron.protection_level { ProtectionLevel::Frozen => continue, // zero update, always ProtectionLevel::Guarded => apply_clamped(neuron, grad, lr), ProtectionLevel::Open => apply_full(neuron, grad, lr), } }} ``` Frozen neurons never update. This is not a suggestion. It is structural — enforced in the one place where weights change. Nothing above this layer can bypass it. **Dependencies:** rand only. ### manas-store Custom binary persistence. The entire brain — weights, vocab, neuron metadata, protection levels, freshness categories, source tracking — lives in one .manas file. ```toml [MAGIC: MANS] [VERSION: 3] [HEADER][VOCAB SECTION] [LAYER + NEURON SECTION][CRC32 CHECKSUM] ``` No sidecars. No .sources. No .sourceindex. The checksum catches corruption on load. The format is append-friendly — adding a new neuron takes microseconds, not a full rewrite. **Dependencies:** none (pure std). ### manas-learn The learning engine. This is the most complex crate and where most of the interesting decisions live. **Tokenizer:** Character prefix n-grams with max length 4. “cat” becomes \["c", "ca", "cat", "#cat"\]. "cats" becomes \["c", "ca", "cat", "cats", "#cats"\]. They share 3 tokens — the model learns they are structurally related. Works for any language including Unicode. **Embedder:** Rotary-style positional embeddings — rotating the embedding vector using sin/cos per dimension pair. “cat eats dog” ≠ “dog eats cat”. Order matters. **Trainer:** Two learning paths depending on network state: - **Gradient descent path** — standard backprop with growth. Tries gradient updates first, grows a new neuron if loss stays above threshold. - **Bound memory path** — keyed neurons with analytical output fitting using ridge regression. Structurally prevents forgetting. **Decoder:** Two-path decoding. Primary path uses a packed answer codec — word IDs are stored directly in the output vector using a marker value and scaling. Fallback path uses cosine similarity against known word embeddings. **Query variants:** When you ask “Where is the Eiffel Tower?”, the system generates multiple query variants by stripping stopwords and relation words: \["eiffel tower", "eiffel", "tower", ...\]. The bound memory is queried with each variant. Best scoring readout wins. Phrasing variations find the right answer. ### manas-ingest Input pipeline. Converts text, files, and folders into clean chunks. Supports .txt, .md, .rs, .toml, .json, .csv. Chunking with overlap. Source metadata preserved per chunk. ### manas-agent Internet refresh. When a neuron’s freshness category marks it as stale — Realtime after 1 day, Fast after 30 days, Slow after 365 days — manas refresh fetches updated information via DuckDuckGo, grows a new neuron for the fresh version, and the query system automatically prefers the newer answer. The old frozen neuron is never touched. This is the reconciliation system Decebal described. ### manas-language Language generation from learned knowledge. manas generate "prompt" produces fluent text based on what the brain has been taught. ### manas-benches Benchmark suite covering tokenization, embedding, forward pass, backprop, save, load, and full learn cycles. ### manas-cli The user interface. Thin layer over everything above. All business logic lives in the crates — the CLI only routes and formats. ```python manas teach "fact" # raw textmanas teach notes.md # filemanas teach ./docs/ # foldermanas ask "question" # answered from neural weightsmanas generate "prompt" # language generationmanas inspect # full brain statemanas neurons # list all neurons with importance scoresmanas trace "question" # trace the forward passmanas forget # compress low-importance neuronsmanas refresh # re-fetch stale factsmanas reset # start fresh ``` ### The Neuron Lifecycle Every neuron moves through a lifecycle that directly controls the anti-forgetting system: ```sql Created (Open) → activation_count grows with use → importance_score = 0.40×freq + 0.30×recency + 0.20×magnitude + 0.10×age_grace → importance > 0.50Guarded → weight updates clamped to [-0.001, +0.001] → importance > 0.85Frozen → zero weight updates, ever → knowledge preserved structurally ``` The age\_grace component uses a smooth exponential decay: exp(-age\_days / 7). A neuron born 3 days ago scores higher than one born 10 days ago, but both score above zero. No cliff functions. ### The Freshness System Different knowledge goes stale at different rates. Every neuron has a freshness category: ```sql | Category | Stale after | Examples ||---|---|---|| Timeless | Never | Mathematical theorems, laws of physics || Slow | 365 days | Historical facts, biographies || Fast | 30 days | Software versions, news || Realtime | 1 day | Stock prices, live scores | ``` Detection is automatic. Teaching “Breaking news: the stock market fell today” assigns Realtime. Teaching “The Pythagorean theorem states that a²+b²=c²” assigns Timeless. When a stale answer is returned, a warning is appended: ```sql Answer Rust 1.70 was released in June 2023.Note This knowledge may be outdated (Fast, 47 days old). ``` ### The Demo That Matters This is the test v1 failed. Here is the actual terminal output from today: ```markdown # teach 22 facts./manas teach "A cat is a small domesticated animal with fur and whiskers."./manas teach "The Eiffel Tower is located in Paris France and was built in 1889."# ... 20 more facts ...# delete ALL text filesrm -f brain.manas.sources brain.manas.sourceindex brain.manas.seqrm -f brain.manas.transformer brain.manas.langmeta# ask - neural weights only./manas ask "What is a cat?" ``` ```typescript Answer small domesticated animal fur whiskersConfidence 1.00Answered from neural weights ``` ```bash ./manas ask "Where is the Eiffel Tower?" ``` ```typescript Answer located paris france built 1889Confidence 1.00Answered from neural weights ``` ```bash ./manas ask "What did Einstein develop?"./manas ask "What is the mitochondria?"./manas ask "When was Bitcoin created?" ``` All 5. Confidence 1.00. Neural weights only. Brain file: 82.8 KB. No text files. No internet. No GPU. An i3 laptop. ### What Manas Is and Is Not I want to be direct about this because AI project descriptions have a tendency toward overclaiming. **Manas v2.0.0 is:** - An experimental research project exploring continual learning - A proof that a neural network can store and retrieve facts from weights alone - A local-first system that runs entirely on CPU - Built from scratch in Rust with no external ML framework - Something genuinely different from vector databases, RAG systems, or local LLM wrappers **Manas v2.0.0 is not:** - A ChatGPT replacement - A production-ready AI system - A general-purpose language model - Something you should deploy in a real application today The honest claim: it works for the 22-fact demo. It answers from neural weights. The protection system prevents forgetting. The growth system scales with new knowledge. Whether it continues to work well at 10,000 facts or with more complex queries is still being explored. That is what experimental means. ### Why This Matters Beyond the Project Modern AI has a training problem that nobody talks about honestly. When a large language model needs to learn a new fact, the only option is retraining — on thousands of GPUs, consuming megawatts of power, requiring millions of liters of water for cooling, taking months of time. After all of that, you get a new model version. The old one is deprecated. This is wasteful in a way that is hard to overstate. If continual learning can be made to work reliably — even for small models — it changes what AI can be. A model that learns continuously from your own data, on your own machine, without ever needing a datacenter, is a fundamentally different kind of AI. Manas v2.0.0 is one small experiment in that direction. It is nowhere near solving the full problem. But it proves the core piece: knowledge can live in weights, not files, and the network can grow around what it learns without forgetting what came before. That is enough to build on. ### Getting Started **Install from release binary (Linux x86\_64):** ```bash curl -fsSL https://github.com/AarambhDevHub/manas/releases/latest/download/manas-linux-x86_64.tar.gz \ | tar -xz && sudo mv manas-linux-x86_64 /usr/local/bin/manasmanas --help ``` **Build from source:** ```bash git clone https://github.com/AarambhDevHub/manas.gitcd manascargo build --workspace --release./target/release/manas --help ``` **Requirements:** Rust stable (1.75+), any CPU, no GPU, no ML library. **Try the demo:** ```typescript manas teach "A cat is a small domesticated animal with fur and whiskers."manas teach "The Eiffel Tower is located in Paris France."manas ask "What is a cat?"manas inspect ``` ### What’s Next The immediate priorities for v2.x: - **More facts, more stability** — stress testing at 1,000+ facts across diverse domains - **Smarter growth decisions** — distinguishing between “network lacks capacity” and “needs more training iterations” - **Improved generation** — the manas generate output is functional but needs refinement - **macOS and Windows binaries** — currently Linux x86\_64 only - **crates.io publish** — individual crates for use as libraries The longer-term question is whether the bound memory architecture scales to more complex associative reasoning — connecting facts that were learned separately to answer questions that require combining them. That is the next hard problem. ### Links - **GitHub:** [github.com/AarambhDevHub/manas]() - **Release v2.0.0:** [github.com/AarambhDevHub/manas/releases/tag/v2.0.0]() - **v1 archive:** [github.com/AarambhDevHub/manas-v1-archive]() - **ARCHITECTURE.md:** full system design with binary format spec, data flow diagrams, and principle definitions - **ROADMAP.md:** full stage-by-stage build plan with mandatory tests per stage - **SELF\_LEARNING.md:** the research concepts behind what Manas is exploring, with recommended reading LinkedIn — systems programming, Rust, and ML: [https://www.linkedin.com/in/darshan-vichhi-rust-developer/]() YouTube — Aarambh Dev Hub (Rust tutorials and deep-dives): [https://www.youtube.com/@AarambhDevHub]() If this was useful, a star on the GitHub repo means more than you might think for an open-source project. It helps other developers find it. Thanks for reading and happy coding! ![]()