惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
有赞技术团队
有赞技术团队
www.infosecurity-magazine.com
www.infosecurity-magazine.com
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threatpost
V
Visual Studio Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - Franky
人人都是产品经理
人人都是产品经理
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Cloudflare Blog
N
News and Events Feed by Topic
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
AWS News Blog
AWS News Blog
S
SegmentFault 最新的问题
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Spread Privacy
Spread Privacy
J
Java Code Geeks
博客园 - 聂微东
T
Tor Project blog
宝玉的分享
宝玉的分享
博客园 - 叶小钗
Webroot Blog
Webroot Blog
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
H
Heimdal Security Blog
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
I
InfoQ
Security Latest
Security Latest
Martin Fowler
Martin Fowler
Hacker News: Ask HN
Hacker News: Ask HN
P
Privacy International News Feed
C
CERT Recently Published Vulnerability Notes
Latest news
Latest news
雷峰网
雷峰网
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cisco Blogs
H
Help Net Security
L
LINUX DO - 最新话题
L
LINUX DO - 热门话题

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
I Taught My AI Assistant to Remember (And Saved 99% of Its Brain)
k1lgor · 2026-05-01 · via DEV Community
The Problem: Your AI Is a Goldfish Here's a scene that plays out in my terminal every single day: Me: "Hey AI, what's the architecture of this project?" AI: runs ls , runs find , runs grep , reads 15 files, spends 28,000 tokens AI: "Here's the architecture! It's Express with MongoDB!" Me: "Great, now implement the login route." AI: runs ls , runs find , reads the same 15 files again, spends another 25,000 tokens Me: quietly sobbing over my API bill If you've used any AI coding assistant (Cursor, Copilot, Claude Code, Devin, whatever), you've seen this. The LLM has the memory of a goldfish. Every new turn is like waking up in a strange room going "Who am I? Where am I? What project is this? Let me read everything again." It's not the LLM's fault . These models have context windows, not persistent memory. They can't close their eyes and remember that your project uses Express with MongoDB — they have to re-discover reality from scratch every time. But here's the thing nobody talks about: This costs you a fortune. The Price of Being a Goldfish Let's put real numbers on it. In a typical coding session, an LLM agent will explore the project by running ls , find , grep , and reading files. A lot of files. Every. Single. Turn. I benchmarked this against real repos on GitHub. Here's what I found: Repository Files Token Cost to Explore (read everything) Token Cost with Memoir A small side project (53 files) 246,000 tokens ~10K tokens 96% A medium React app (258 files) 826,000 tokens ~41K tokens 95% A serious codebase (2,538 files) 12.2 MILLION tokens ~67K tokens 99% TypeScript compiler (40,877 files) 36 MILLION tokens ~19K tokens ~100% Let me repeat that last one: 36 million tokens to explore the TypeScript repo with traditional methods. 19 thousand with the memoir. That's a ~99.95% reduction . Or, put another way: every time your AI asks "what's in this project?", it's burning through the equivalent of 72 copies of the Great Gatsby in tokens. When it could be burning through a single tweet . The Insight: Project Knowledge Almost Never Changes The core realization is so obvious it hurts: Your project's basic structure, dependencies, entry points, and source files change maybe once a day. Your LLM queries it 20 times per session. Why are we paying 30,000 tokens to rediscover the same package.json every 45 seconds?! If a human dev joined your team, you wouldn't make them re-read the entire codebase every time they wanted to write a function. You'd say "the routes are in src/api/ , the DB layer is in src/db/ , here's the README." They'd remember . Why can't our AI assistants do the same? Well… now they can. Enter pi-memoir pi-memoir (pronounced pi-mem-wahr , like the French word for memory — because developers love obscure multilingual puns) is an extension for the pi coding agent that gives your LLM persistent project memory . Here's what it does in one sentence: Harvest your project's structure once. Let the LLM query it for ~100 tokens instead of ~30,000. Forever. How it works Your Project/ └── .pi/memoir/ └── memories.jsonl ← Everything the AI knows, in one file When you run /memo harvest (or call memo_harvest ), pi-memoir walks every file in your project and builds a compact knowledge base: 📄 README → tagged project:readme 📦 package.json → tagged project:manifest 🏗️ Directory tree → tagged project:structure 🚪 Entry points → tagged project:entry ⚙️ Config files → tagged project:config Every single source file → tagged project:file + file:path/to/file.ts That's right — it stores a memory for every .ts , .js , .py , .rs , .go , .rb , .vue , .svelte — actually 128 file extensions in total. Up to 200 files, each under 20KB. Smart summaries per file type. It skips node_modules , .git , dist , and all the usual junk. Then the magic happens. The "DON'T USE BASH" Rule The extension injects a single instruction at the top of every system prompt: === PI-MEMOIRE: DON'T USE BASH — USE THE MEMOIRE === CRITICAL: Before running ANY bash/ls/find/grep/wc/read commands to explore the project, you MUST call memo_search first. Querying the memoir costs ~100 tokens. Running bash to discover the same info costs ~2,000+ tokens. • "what's the architecture?" → memo_search({ query: "architecture" }) • "what files?" → memo_search({ tags: "project:structure" }) • "dependencies?" → memo_search({ query: "package" }) ... If memo_search returns nothing, THEN fall back to bash/read. Think of it as telling your AI: "Check your notes before you run around the office asking questions." And because the tools ( memo_search , memo_store , memo_harvest ) are registered as first-class LLM callable tools — same as read , bash , or edit — the model actually uses them. It's not a suggestion. It's a protocol. The Numbers That Made My Jaw Drop I ran pi-memoir against six real-world repositories — from a 53-file side project to the 40,877-file TypeScript compiler — and measured the token cost of two approaches: The Old Way: LLM runs bash / ls / find / grep , reads files one by one The Memoir Way: LLM calls memo_search with keywords Repository Files Size Old Way Memoir Way Savings VibeVoice 53 264 MB ~246K tok ~10K tok 96% rtk 258 4.5 MB ~826K tok ~41K tok 95% claude-mem 679 104 MB ~2.7M tok ~55K tok 98% oh-my-codex 921 15 MB ~2.9M tok ~71K tok 98% hermes-agent 2,538 64 MB ~12.2M tok ~67K tok 99% TypeScript 40,877 548 MB ~36M tok ~19K tok ~100% The chart is basically comedy: Token Cost: The Old Way ████████████████████████████████████████ 36,000,000 The Memoir Way ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▏ 19,000 Every repo, every language, every size — 95-100% savings . Not "theoretically." Not "in ideal conditions." Real repos, real numbers. What This Means for Your Wallet Running Claude Sonnet 3.5 at $3/M input tokens: Without memoir: 1 session × 10 explorations × 30K tokens = 300K tokens = $0.90/session With memoir: 1 session × 1 harvest (30K) + 9 searches (100 each) = 30.9K tokens = $0.09/session On a team of 10 devs doing 5 sessions a day? That's $4,500/month → $450/month . Your AI just got 10x cheaper . And you don't have to buy it a fishbowl. The Quirky Bits It stores memories in a JSONL file Yes, the entire "knowledge base" is a flat JSONL file in .pi/memoir/memories.jsonl . No vector database. No Postgres. No Redis. A flat file. And you know what? It works better. The memoir stores 500-odd memories for a 40K-file project in ~200KB of text. That's smaller than a single JPEG of a cat. And JSONL means you can grep it, wc -l it, pipe it through jq , check it into git, read it on your phone while commuting. It's the most portable "database" in the universe. Zero external dependencies Seven TypeScript files. 1,597 lines of code. Zero npm dependencies. It uses typebox — which is bundled with pi anyway — and that's it. No vector DBs, no embeddings APIs, no LLM calls at harvest time. Just the filesystem, JSON.parse , and a TF (term frequency) scoring algorithm that would make a CS undergrad shrug. But it works. For the simple reason that project knowledge is mostly keywords and categories , not semantic embeddings. When the LLM asks "what's the architecture?", it doesn't need cosine similarity between a 1536-dimensional vector and the README. It needs a string match on the word "architecture" paired with the project:structure tag. It auto-captures decisions on shutdown When you close a session, pi-memoir scans the conversation for decisions, architecture changes, and important notes — and stores them automatically with an "auto" source tag. So even when you forget to /memo store "we decided to use Drizzle ORM instead of Prisma" , the memoir remembers. No more "wait, why did we switch databases?" scrolls through 3 hours of chat history "oh right, the connection pool issue." Okay But How Do I Actually Use This? 1. Install pi You need pi , the LLM-native coding agent. It's bun install -g @mariozechner/pi-coding-agent . 2. Install pi-memoir pi install git:github.com/k1lgor/pi-memoir Or, if you're the type who likes living on the edge: pi install ./path/to/cloned/pi-memoir 3. Harvest your project /memo harvest Walk away. Make coffee. It takes ~2 seconds on a small project, ~30 seconds on TypeScript. 4. Work normally That's it. The LLM now queries the memoir instead of running ls / grep / find . You'll see it in the logs: 🧠 [memo_search] Found 3 results for "architecture" (tags: project:structure) And in your wallet: 💸 Token savings: 99.9% this session Bonus: Benchmark your own project The extension ships with a standalone bench script: node bench.mjs . --all 📈 Summary Files scanned: 40,877 Read files: ~36,362,143 tokens Query memoir: ~19,293 tokens Savings: ~36,342,850 tokens (99.9%) If you can't feel the dopamine rush from a 99.9% savings number, I don't know what to tell you. What's Next? The current version is already saving me ~$200/month in LLM costs. But here's what's cooking: 🔬 Semantic search via LLM re-ranking — for when keyword matching isn't enough 🕸️ Knowledge graph from cross-file relationships — imagine the memoir telling the LLM "this function depends on that module which is imported by this route" 📓 Obsidian vault export — because what's more developer than exporting a perfectly usable knowledge base into a note-taking app you'll abandon in 3 months The One-Liner If you use AI coding agents, you are paying for the same ls command 47 times a session. Pi-memoir replaces that with a cheap memory lookup. It's one install command. It takes 2 seconds to harvest. It saves 95-99% of your project exploration tokens. Install it. Harvest your project. Watch your token count crater. P.S. — If you're still not convinced, run the benchmark against your own project. node bench.mjs . --all . I promise the number will make you smile. P.P.S. — The name is "pi-memoir" but you can pronounce it however you want. I'm partial to "pee-mem-wah" like you're a very confused French person talking about urination. But "pie-memory" works too. Built with ❤️ by k1lgor . Inspired by MemPalace (verbatim memory with semantic retrieval) and Graphify (knowledge graph extraction).