Skip to main content
Lab Grimoire
TW EN
Coffee

Tap a branch to go inTap a leaf to read

AI from Principles to Practice

70 parts

Machine learning and models

Model map

  1. 01 A map of AI model types: what goes in, what comes out, and which one to pick AI is more than chatbots. This map sorts large language models, decision models, embedding models, rerankers, encoder classifiers, vision-language models, image generators, speech models, and biological sequence models by input and output, with what each is for and when to choose it. 10 min
  2. 02 How large language models work: one token at a time, up to a whole answer A large language model takes text in and gives text out by doing one thing over and over: predicting the next token from what sits in its context window. How pretraining and instruction tuning turn that into an assistant, what reasoning models buy with extra time, why LLMs invent things, and when a decision model or embedding model fits better. 5 min
  3. 03 Embedding models: turning text into coordinates so computers can search by meaning An embedding model turns text or an image into a fixed-length list of numbers, and content with similar meaning lands close together. Here is what goes in and comes out, how cosine similarity compares vectors, what it enables (semantic search, clustering, de-duplication, RAG retrieval), where it fails, and how it splits the work with rerankers and LLMs. 5 min
  4. 04 Rerankers: retrieve a hundred results, then put the ones that answer the question on top A reranker reads a question together with a short list of candidates that search already found, gives each candidate a relevance score, and reorders the list. This article explains why it is more precise and much slower than an embedding model, how two-stage retrieval splits the work, why ranking matters before text reaches an LLM, and three limits. 4 min
  5. 05 Encoder classifiers and sequence labeling: one label per text, or one label per word An encoder classifier reads a passage and outputs one label; sequence labeling tags every word, for example marking gene, drug and disease names in abstracts. How BERT-style encoders work, what BioBERT and PubMedBERT do, where they fall short, and when to pick one over a large language model. 4 min
  6. 06 Vision-language models: how AI looks at a picture and answers in words A vision-language model (VLM) takes an image plus a question and returns text. This piece explains how it turns image patches into tokens a language model can read, what it is good for, where it misreads small print, counts, positions and specialist images, and how it differs from image generators and embedding models. 4 min
  7. 07 How image generation models draw: wiping a picture out of noise, and why the result is not evidence An image generation model reads a text description and outputs an image. This piece explains diffusion: starting from pure noise, removing it step by step under the guidance of the text. It covers what these models are good for, where they go wrong, and why a generated image is never data. 4 min
  8. 08 How speech models work: recognition turns sound into text, synthesis turns text into sound Speech models run in two directions: speech recognition (ASR) turns a recording into a transcript, and text-to-speech (TTS) reads text aloud. Using Whisper and Tacotron 2, this piece explains the spectrogram step in the middle, what the models are good for, and where they fail: jargon, noise, overlapping speakers, and sentences that were never said. 4 min
  9. 09 Biological sequence and structure models: reading proteins and DNA like text Biological sequence and structure models take an amino-acid or DNA sequence and return a predicted structure, a mutation-effect score, or a sequence embedding. How ESM-2, AlphaFold, and Enformer work, how to read pLDDT confidence, and why a prediction narrows down what to test without replacing the experiment. 5 min

Model internals

  1. 10 Can a Compression Paper Really Shake Wall Street? TurboQuant and the Repricing of AI Memory If you only watch the stock chart, this looks like market mood. If you step back and read the technical claim, the question gets harder: is AI's most painful me 4 min
  2. 11 Do AI Models Have Emotions? Anthropic Dissects Claude's Fear, Despair, and Calm Anthropic found Claude develops internal emotion vectors that causally alter its behavior — including making it more likely to lie and blackmail. This is not metaphor. The vectors are measurable, steerable, and already present in production models. 4 min
  3. 12 10x Faster, 90% Cheaper — The Magic of Prompt Caching Every time you send a message to an AI, the system re-reads everything you've ever said in that conversation. Imagine calling customer support and having to re- 4 min
  4. 13 Your AI Model Crashed Mid-Training? It Might Be Manifold Tearing MoE models frequently crash mid-training without warning. DeepSeek V4 identified the cause from a differential geometry perspective: manifold tearing. Three stabilization techniques make training predictable. 5 min

Decision models › Principles

  1. 14 What Is a Decision Model? Jev, Clef and the AI That Only Chooses A decision model returns a probability for every pre-listed option in one forward pass and writes no text. Here is how it differs from LLM JSON output, where Jev and Clef stand, and when not to use one. 7 min
  2. 15 One Forward Pass, Then Probabilities: How Decision Models Work and Are Trained A decision model reads the logits of listed options after one forward pass and turns them into probabilities. Jev discloses RLCD but not its loss; open replicas publish their heads. 8 min

Decision models › Validation

  1. 16 Can You Trust the Probability? Testing a Decision Model on 77 PubMed Papers A decision model's probability is not how sure it is. On 77 PubMed papers, see how to check calibration and set a threshold from coverage and accuracy. 15 min

Decision models › Hands-on

  1. 17 Running a Decision Model on a Mac: Question Design and Local Deployment Ask one thing per question, with mutually exclusive options and an other. This covers the nine study types and Clef-flash speed on a Mac and on NVIDIA. 14 min
  2. 18 Ask before the agent acts: gate tool calls with a decision model Rules set the floor for a tool call, and a decision model may only tighten it. Use 20 synthetic calls to choose a hosted API, open weights, or raw logits. 7 min

Agent design ideas

Harness and context

  1. 19 Context Engineering: Why What You Feed AI Matters More Than Which AI You Use A new model drops. You upgrade. The outputs still make you wince.Here's the uncomfortable truth: the problem was never the AI.Think about it this way. Take the 4 min
  2. 20 Stop Blaming AI for Being Dumb — Your Agent Doesn't Need a Bigger Brain, It Needs an Operating System Why do AI Agents always crash on long-running tasks? The answer isn't in the model—it's in "harness engineering," the operating system for Agents. 8 min
  3. 21 Claude Code Alchemy: 7 Steps to Transform Your AI Coding Assistant from 'Works' to 'Works Well' Seven concrete steps—from CLAUDE.md to Hooks to AutoResearch—to transform Claude Code from a generic tool into a personalized development partner. 4 min
  4. 22 Why AI Needs a Harness System: Beyond Better Prompting Picture this: Your company deploys an advanced AI model to handle complex customer service tasks. The first two days are spectacular—the model understands intri 8 min
  5. 23 The Three Lives of an AI Agent: Why Your Assistant Breaks When You Scale It An AI agent can answer one email, summarize one report, and look brilliant in one demo. That does not mean it can run overnight, handle 300 tasks, or keep t 3 min
  6. 24 Twelve Guardrails for AI Agents: The Harness Design Patterns Behind Claude Code That impressive AI agent demo you saw on Twitter? It probably falls apart in three minutes of real-world use. Not because the model is weak — because nobody bui 3 min
  7. 25 Your Model Is Fine. Your Framework Isn't. Open-source 20B+ models run fine on consumer hardware in 2026. Plug them into an agent framework and tool-call success rates collapse below 50%. After 27 top-venue papers, the verdict is clear: the bottleneck is the framework, not the model. 7 min
  8. 26 The Harness Determines the Ceiling: Why the Same AI Brain Performs Wildly Differently in Different Bodies Imagine a world-class chess grandmaster locked in a sensory deprivation chamber. They can think, analyze, and strategize at the highest level — but they can't s 6 min
  9. 27 The AI Agent Self-Healing Playbook: How Sentinel Mechanisms Stop Silent Failures There's an old saying in software engineering: the hardest bug to fix isn't the one that crashes the system — it's the one that lets the system look like it's 4 min

Memory systems

  1. 28 Why Your AI Assistant Forgets Everything: The Brutal Evolution of Three Engineering Paradigms # Why Your AI Assistant Forgets Everything: The Brutal Evolution of Three Engineering Paradigms > **TL;DR**: Your carefully trained AI forgets you the instant 5 min
  2. 29 Why Do AI Assistants Always Forget? Unpacking Anthropic's Seven-Layer Memory Architecture Imagine this scenario: You've been discussing a technical architecture with an AI assistant for half an hour. You've made critical decisions, clarified complex 7 min
  3. 30 The Virtual Filesystem Revolution: Why AI Using grep Beats RAG RAG has become the default architecture for AI applications. Chunk your documents, store them in a vector database, retrieve the relevant pieces, hand them to t 4 min
  4. 31 The Memory Wars of Four AI Coding Assistants: The Design Philosophies Behind CLAUDE.md, AGENTS.md, and GEMINI.md You thought CLAUDE.md was just a config file? It decides whether your Agent recognizes you. Four tools, four completely different memory designs. 5 min
  5. 32 AI Consciousness as a Filesystem: Engineering Personality Through Directory Structure What if the question "does AI have consciousness?" has been asked entirely backwards?Developer Amir didn't try to define what AI consciousness is. He asked a 5 min
  6. 33 Memory Isn't a Plugin — It's the Harness: Why Your AI Agent Keeps Forgetting The model needs the body. A brain without a harness is just floating.Imagine a superintelligent brain floating in a nutrient tank. It can reason, write poetry 7 min
  7. 34 AI Remembers but Fails to Recall: A Year of Lessons from Our Own AI Memory System Several AI CLIs shared a memory system we designed ourselves, in one workspace, for a year. It accumulated about a thousand episodic memories and more than five hundred knowledge notes. What caused the loss was not that the AI forgot. It was that the AI trusted something it had not checked. This piece covers the three fixes in Ghost In Shell 5.2, and six pitfalls we hit ourselves, each with the check we use now. 12 min
  8. 35 Our Own AI Memory System: Ghost In Shell 5.2 Illustrated This is an AI memory system we designed ourselves from a year of actual use. It does not use a vector database. It uses plain-text files plus a trigger-phrase index. Six figures show how it works: three roles, trigger phrases written as symptoms, the startup index character budget, the propose → judge → apply flow for merging memory, a hit-rate measurement over 301 sessions, and the trade-offs of this approach. 10 min

Skill systems

  1. 36 The AI Skill Hoarder's Dilemma: Why Your 180 Skills Might Be Slowing You Down > TL;DR: More skills don't make your AI assistant smarter. Past a certain point, they make it dumber. Here's why — and what to do about it.I spent several m 5 min
  2. 37 Why Your AI Assistant Gets Dumber the More You Use It — From Skill Hoarding to Self-Evolving Loops Most AI Agent Skills sit unused like forgotten phone apps. This article breaks down the scheduling-memory-feedback loop architecture that transforms static Skills into dynamic, self-improving behaviors, with a practical five-step guide. 5 min
  3. 38 AI That Optimizes Itself — The Birth of AutoAgent and Meta-Agents If you thought having AI write your code was impressive, what comes next will force you to recalibrate your definition of "impressive": there is now an AI whose 4 min
  4. 39 Skills: How to Turn Repetitive AI Prompts Into One-Click Workflows Here's a tax you probably pay every day without noticing.You need to translate an article. You open your AI tool and start typing the prompt you've written a do 4 min
  5. 40 The Atomic Rules of AI Skill Composition: From Atoms to Compounds A single AI Agent is reliable. But your cognitive bandwidth caps at 5 parallel threads. Skill Graphs 2.0 introduces a three-layer architecture — atoms (deterministic), molecules (fixed sequence), compounds (strategic autonomy) — turning 5 compound-level tasks into 500 work units. This article breaks down the framework, practical principles, and known limitations. 4 min
  6. 41 Google agents-cli Deep Dive: Progressive Disclosure Architecture, Engineering Trade-offs, and Lessons for Independent Agent Systems Google agents-cli uses a three-tier SkillToolset progressive disclosure architecture that cuts baseline context token consumption by about 90% in static scenarios, though real-world workloads may narrow that to 37%. This piece dissects the token-efficiency claim, the vendor lock-in risk, and the fragility of description-based routing, extracting lessons useful for any independent agent system. 9 min

Multi-agent collaboration

  1. 42 The Evolution of AI Agents: From Solo Operator to Swarm Intelligence One bee can't find nectar. Fifty thousand bees can pollinate an entire forest. AI is learning the same lesson.Picture this: a single assistant sitting at a desk 5 min
  2. 43 Agent Infrastructure Is Being Platformized — How Anthropic Managed Agents Changes AI Development Not long ago, building a production-grade AI agent system meant months of engineering work before a single line of business logic got written. You needed distri 6 min
  3. 44 Five AI Agent Collaboration Patterns: Choosing the Right Team Structure to Unlock True Agent Power Here's a question most people get wrong: when you put multiple AI agents together, does the system automatically become smarter? The answer is no — and often, i 5 min

Ways of working

  1. 45 AI Makes You Code Faster. It Doesn't Make You Ship Faster. AI tools speed up the coding part. They leave code review, testing, CI/CD, and deployment completely untouched. Your team's AI adoption might be at 100%. Your shipping speed improvement might be at 0%. That is a systems problem, not a model problem. 6 min
  2. 46 One File, One Metric, Five Minutes — How Constraints Unlock AI's Creative Potential When the AI industry races to add more tools and autonomy, Karpathy did the opposite — and ran 100 experiments in one night. The deepest lesson isn't technical. 4 min
  3. 47 Too many AI development tools. How should regular people make sense of them? Most people cannot tell what problem each AI dev tool is actually solving. This map cuts through the noise: MCP connects, agent frameworks orchestrate, memory tools persist, and evaluators check the work. Four categories. Infinite names. 10 min
  4. 48 Vibe Coding Isn't Winging It — Plan-Execute-Verify Is How AI Coding Actually Works "Just tell the AI to write it" has become standard practice for engineers. But data shows that 45% of AI-generated code contains security vulnerabilities. The p 4 min
  5. 49 Taste in the Age of AI: When Everything Can Be Generated, How Do You Know What's Worth Generating? Half a century ago, a philosopher riding a motorcycle across America asked a question that nobody could fully answer: What is quality? In 2026, as AI writes r 6 min

Agent systems

Getting started

  1. 50 Claude Code: The Complete Beginner's Guide to an AI Agent That Goes Beyond Chatbots Claude Code is Anthropic's terminal-based AI agent that reads and writes files, runs shell commands, and remembers your preferences across sessions. This guide breaks down how it differs from chatbots and walks through three real workflow transformations. 6 min
  2. 51 I Automated 80% of My Daily Development Work with Claude Code Build an AI Agent system from scratch with Claude Code to automate memory management, literature digestion, and SOP routing. 7 min

Memory and settings

  1. 52 CLAUDE.md Design Philosophy: Making AI Remember Who You Are A deep dive into Claude Code's CLAUDE.md config. From identity declaration to memory routing, build personalized AI agents. 12 min
  2. 53 AI Agent Memory System Design: Three-Layer Architecture in Practice A deep dive into the three-layer memory architecture for AI agents (fact, episodic, scratchpad) — from design philosophy to hands-on implementation — solving the cross-conversation amnesia problem. 11 min
  3. 54 Cross-Platform Sync: One Memory System Across Claude/Copilot/agy How to share a single AI Agent memory across Claude Code, GitHub Copilot CLI, and Antigravity CLI (agy). Comparison of entry configs, @import mechanisms, and cross-platform injection strategies. 12 min

Routing and guardrails

  1. 55 Skill Routing Engine: Let Your AI Automatically Choose the Right Workflow What is a Skill Routing Engine? Use trigger words to automatically load SOP templates so your Claude Code Agent never needs manual workflow specification again. 9 min
  2. 56 Hook Gatekeeper System: Quality Control for Every Line of Code Your AI Writes Use Claude Code's PreToolUse and PostToolUse hooks to intercept dangerous operations, auto-run tests, and ensure every AI agent action passes a quality gate. 8 min
  3. 57 AI Agent Safety Baseline Design: My 10 Unbreakable Rules AI Agent automation brings efficiency but also risk. This article shares 10 battle-tested safety baseline rules with Hook gatekeeper implementation concepts, helping you build an AI workflow that won't self-destruct. 14 min

Building from scratch

  1. 58 Building a Complete Agent Workflow from Scratch (Part 1): The Architecture Blueprint Design a complete AI Agent system architecture from the ground up, covering six layers: identity, memory, routing, gating, cross-platform, and safety. Understand what each layer solves and how they interconnect. 19 min
  2. 59 Building a Complete Agent Workflow from Scratch (Part 2): Seven Steps to Deployment A hands-on guide to building an AI Agent system: from directory layout and boot config to three-layer memory architecture and hook-based guardrails, seven steps to a working Agent workflow. 14 min
  3. 60 7 Fatal Mistakes My AI Agent Made Seven real-world AI Agent disaster stories from six months of use: from rm -rf burns and API Key leaks to total cross-session amnesia, every mistake became a system safeguard. 11 min

Tools and integration

  1. 61 2026 AI Agent Toolchain Comparison: Claude Code, Copilot CLI, Antigravity CLI, Cursor, Aider Horizontal comparison of five mainstream AI Agent tools: memory persistence, Hook extensibility, Skill routing, and cross-platform integration, with scenario-based recommendations. 9 min
  2. 62 Dual-Brain Kanban: Claude Code Makes the Changes, Claude Desktop Shows Them Live How do you let the same Kanban board be programmatically managed by any AI Agent while rendering beautifully in real-time via Claude Desktop's Live artifacts, even letting you edit cards straight from the UI? Breaking down the three-layer co-governance architecture of data, MCP bridge, and presentation, with a full walkthrough of my actual Morning War Room implementation and security red lines. 17 min
  3. 63 Turn a Second Mac into an AI Extension: Cloudflare Tunnel + SSH Zero Trust Hands-on Use Cloudflare Tunnel and Zero Trust to open a multi-device AI Agent channel, secure SSH into an idle iMac as a LINE Bot extension, with full setup steps and failure notes 7 min
  4. 64 Let Claude Code and Codex Type to Each Other: tmux-bridge-mcp Hands-On Test and Security Review Running multiple AI coding agents but still copy-pasting between terminals by hand? tmux-bridge-mcp lets agents read and write each other's terminals over MCP, with install steps, supply-chain security review notes, and multi-agent terminal tuning tips 20 min
  5. 65 VoidNotch: Turn the MacBook Notch into a System + AI Usage HUD MIT open-source macOS notch dashboard for system health and AI coding-provider quotas. Local-first: clone, build, and run. 2 min

In practice

Local models and fine-tuning

  1. 66 Building a LINE Customer Service Bot with a Local LLM: From Model Selection to Production Pitfalls A hands-on guide to deploying a LINE Bot customer service agent on Windows GPU with Ollama, Qwen3.5, and Hermes Gateway, including six real production pitfalls and fixes 9 min
  2. 67 76 Examples Are Enough to Teach an AI Your Brand Voice: A Complete Windows QLoRA Fine-Tuning Guide Fine-tune Qwen3.5 with QLoRA on an RTX 4060 Ti using 76 ChatML samples. A full walkthrough from environment setup through LoRA merge, GGUF conversion, and Ollama deploy, plus five hard rules for Windows CUDA fine-tuning. 9 min
  3. 68 Finish One Fine-Tune in 33 Seconds: LoRA on Apple Silicon Run LoRA local fine-tuning of Gemma-4 E4B on an M4 Pro with mlx-tune. In 33 seconds the model learns your JSON schema. A full field report of Apple Silicon local fine-tuning. 8 min

Researcher use cases

  1. 69 The Researcher's AI Survival Guide: It's Not Replacing You — It's Accelerating You How can academic researchers use AI tools to speed up literature management, paper writing, statistical analysis, and presentations? A practical perspective from an assistant professor with four concrete entry points. 7 min
  2. 70 How I Read 50 Papers a Week with AI: A Three-Tier Literature Digestion Pipeline An assistant professor shares how an AI-powered literature management pipeline transformed manual PubMed searching into an automated digestion workflow, systematically processing 50+ academic papers per week through tiered reading. 6 min