<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Agent Project Memory on RockB</title><link>https://baeseokjae.github.io/tags/agent-project-memory/</link><description>Recent content in Agent Project Memory on RockB</description><image><title>RockB</title><url>https://baeseokjae.github.io/images/og-default.png</url><link>https://baeseokjae.github.io/images/og-default.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sat, 22 Aug 2026 13:01:15 +0000</lastBuildDate><atom:link href="https://baeseokjae.github.io/tags/agent-project-memory/index.xml" rel="self" type="application/rss+xml"/><item><title>Local Agent Observability and Cost Analysis: How to See and Cut Your AI Coding Spend</title><link>https://baeseokjae.github.io/posts/agent-doctor-local-observability/</link><pubDate>Sat, 22 Aug 2026 13:01:15 +0000</pubDate><guid>https://baeseokjae.github.io/posts/agent-doctor-local-observability/</guid><description>Local agent observability tracks AI coding cost, tokens, and subagents in real time on your machine. Learn how to cut spend and keep data private.</description><content:encoded><![CDATA[<p>Local agent observability and cost analysis means tracking your AI coding agent&rsquo;s tokens, tool calls, and subagent spend in real time on your own machine, without sending telemetry to the cloud. It matters because a single Claude Code session can silently burn $2.47 across 142 tool calls before you ever notice, and the JSONL transcripts agents write are only usable after the budget is already gone. This guide explains how local-first observability tools reveal that spend, how project memory cuts repeated-context costs, and how to choose the right stack for your workflow.</p>
<h2 id="why-local-first-observability-matters-for-ai-agents">Why Local-First Observability Matters for AI Agents</h2>
<p>AI coding agents have become genuinely useful, but they have also become genuinely expensive and opaque. When you run Claude Code, Cursor, Codex, or Gemini against a real codebase, the agent makes dozens or hundreds of tool calls per session, spawns subagents, and consumes tokens you never see. The default experience is a black box: you type a prompt, the agent works, and later you get a bill.</p>
<p>Local-first observability changes that by putting a live dashboard between you and the agent. Tools like ObservAgent run on localhost, capture events as they happen, and show you cost, latency, and subagent activity while the session is still running. The privacy angle is a real differentiator: no cloud, no telemetry, and your data never leaves your machine. For solo developers and small teams working on proprietary code, that sovereignty is often the deciding factor.</p>
<h2 id="the-problem-opaque-expensive-agent-sessions">The Problem: Opaque, Expensive Agent Sessions</h2>
<p>The core problem is that agent transcripts are not usable in real time. Claude Code writes JSONL transcripts of every session, but those files are only useful after the fact. By the time you open them, the budget is already burned. You discover the overrun in the postmortem, not in the moment when you could have stopped it.</p>
<p>This is a structural mismatch. Agents are designed to keep working autonomously, and they will happily keep calling tools and consuming tokens until the task is done or the context window fills. Without live visibility, you cannot answer the most basic questions: How much has this session cost? Which subagent is spending the most? Is a tool call stuck in a retry loop? Is the agent re-reading the same file over and over?</p>
<p>The cost compounds. A single session that burns $2.47 across 142 tool calls is not unusual — it is the norm for a moderately complex task. Multiply that across a week of daily sessions and the spend becomes a real line item, one you cannot control because you cannot see it.</p>
<h2 id="real-time-cost-attribution-across-subagents-tools-and-models">Real-Time Cost Attribution Across Subagents, Tools, and Models</h2>
<p>The most valuable capability of local observability is per-subagent cost attribution. Modern agents decompose work into subagents — a main orchestrator, an executor, a verifier — and each one spends differently. ObservAgent&rsquo;s demo shows exactly this pattern: a main agent spent $1.82 across 89 calls, an executor spent $0.41 across 31 calls, and a verifier spent $0.24 across 22 calls.</p>
<p>That breakdown is actionable in a way a single total is not. If the verifier is re-checking work that never changes, you can adjust its instructions. If the executor is making 31 calls to do what should take 10, you can tighten the task. Per-model attribution matters too: if you are mixing a frontier model for planning and a cheaper model for mechanical edits, you want to confirm the cheap model is actually handling the bulk of the work.</p>
<p>Tools like CodeBurn take this further by tracking token usage and cost across 37 different tools and agents — Claude Code, Cursor, Codex, Gemini, and more — with breakdowns by model, project, and task. That cross-tool view is essential if you use more than one agent, because it lets you compare cost per project and decide where to standardize.</p>
<h2 id="project-memory-as-a-cost-lever-stop-re-explaining-your-project">Project Memory as a Cost Lever: Stop Re-Explaining Your Project</h2>
<p>A large share of agent spend is wasted on re-explaining context. Every new session, the agent has to rediscover your project structure, your conventions, and your decisions. That repeated context is pure cost — tokens spent on information the agent already had in a previous session.</p>
<p>Project memory tools solve this by persisting context in a portable, human-readable form. Directed Memory Bank, for example, stores project context in plain markdown that works across Claude Code, Cursor, Codex, and Gemini. Because it is plain markdown, it is portable and readable by both humans and agents. The next session loads the memory bank instead of re-deriving the project from scratch.</p>
<p>The cost lever is direct: every token you save on re-explanation is a token you do not pay for. For a project you work on daily, the savings compound quickly. And because the memory is plain text, you keep full control and full portability — no proprietary format locking you in.</p>
<h2 id="the-feedback-loop-observability-that-improves-the-next-turn">The Feedback Loop: Observability That Improves the Next Turn</h2>
<p>The most advanced local observability tools do not just report — they feed what they see back into the agent&rsquo;s next turn. This is the difference between a postmortem and a live correction loop.</p>
<p>Consider a tool that routes observations into the agent&rsquo;s next prompt. When an Edit fails three times, it injects a fix path into the next prompt. When a build keeps breaking, it tells the agent to change approach. When it detects a stale in-memory copy of a file versus the on-disk state, it tells the agent to re-read the file before editing. This is observability that learns from failure in real time, rather than waiting for a human to review a log.</p>
<p>This feedback loop is the &ldquo;Agent-Doctor&rdquo; vision: the observability layer acts like a doctor monitoring a patient, catching problems while they are still treatable. A build that keeps breaking is caught on the third failure, not after an hour of wasted calls. A stale file is re-read before the edit, not after a broken diff.</p>
<h2 id="token-waste-and-prompt-caching-concrete-cost-reductions">Token Waste and Prompt Caching: Concrete Cost Reductions</h2>
<p>Beyond visibility, local observability tools actively find waste. Cache Lens is an open-source analyzer that identifies token waste, repeated context, and prompt-caching opportunities. It surfaces exactly where you are paying for tokens you could have cached.</p>
<p>Prompt caching is one of the most concrete cost-reduction plays available. When an agent repeatedly sends the same system prompt or the same large context block, caching lets you pay a fraction of the cost for the repeated portion. The savings are real and measurable — but only if you know where the repetition is happening. That is precisely what a token-waste analyzer reveals.</p>
<p>Frugon takes a different angle: it finds which LLM calls a cheaper model could handle. Not every call needs a frontier model. A local, MIT-licensed analyzer that flags &ldquo;this call could be served by a cheaper model&rdquo; is a direct path to cutting your bill without degrading quality. The strong community interest — 67 Hacker News points — shows how many developers are looking for exactly this.</p>
<h2 id="privacy-and-sovereignty-why-local-first-wins">Privacy and Sovereignty: Why Local-First Wins</h2>
<p>The privacy argument for local-first observability is not a nice-to-have; it is a hard requirement for many teams. When you use a cloud observability service, your agent&rsquo;s tool calls, file paths, and code snippets are transmitted to a third party. For proprietary code, that is a leak you cannot afford.</p>
<p>Local-first tools keep everything on your machine. ObservAgent reports a ~50 MB memory baseline, under 50 ms query latency, and 5,000 events per second of throughput — performance that makes local observability practical, not just possible. Claud-ometer makes privacy its explicit differentiator: no cloud, no telemetry, just your data.</p>
<p>This sovereignty matters for compliance too. If you work under a data-residency or confidentiality obligation, sending agent telemetry to a cloud service may simply be off the table. Local-first observability sidesteps the entire question.</p>
<h2 id="open-source-vs-commercial-observability-tradeoffs">Open-Source vs. Commercial Observability Tradeoffs</h2>
<p>The local observability space is dominated by open-source tools, and that is a feature, not an accident. Open-source tools like ObservAgent, Cache Lens, Frugon, CodeBurn, and Claud-ometer are free, auditable, and self-hosted. You can read the code, verify there is no hidden telemetry, and extend the tool to your own needs.</p>
<p>The tradeoff is support and polish. Open-source tools are often maintained by one or a few developers, and you are responsible for setup, updates, and troubleshooting. Commercial tools offer support, documentation, and a smoother experience, but they cost money and may route data through a vendor.</p>
<p>For solo developers and small teams, the open-source route is usually the right call. The tools are mature enough for daily use, the privacy guarantee is stronger, and the cost is zero. The main question is whether you have the time to maintain them.</p>
<h2 id="how-to-choose-the-right-local-observability-stack">How to Choose the Right Local Observability Stack</h2>
<p>Choosing a stack comes down to three questions: what do you want to see, what do you want to feed back, and what do you want to remember?</p>
<p>If your priority is real-time cost and subagent visibility, start with a dashboard tool like ObservAgent or Claud-ometer. If you want to actively cut token waste, add a token-waste analyzer like Cache Lens or a model-routing analyzer like Frugon. If you use multiple agents and want cross-tool cost attribution, CodeBurn&rsquo;s 37-tool coverage is the strongest fit. If your pain is re-explaining your project every session, add a project memory tool like Directed Memory Bank.</p>
<p>The good news is that these tools are complementary, not competing. A typical stack is a real-time dashboard for visibility, a token-waste analyzer for cost reduction, and a project memory bank to stop repeated-context spend. All of them run locally, all of them are open source, and all of them keep your data on your machine.</p>
<h2 id="conclusion-from-opaque-spend-to-agent-doctor-visibility">Conclusion: From Opaque Spend to Agent-Doctor Visibility</h2>
<p>Local agent observability and cost analysis turns an opaque, expensive black box into a visible, controllable system. Real-time cost attribution shows you which subagent is spending, token-waste analyzers show you where to cut, project memory stops the repeated-context bleed, and feedback loops catch failures before they compound. And because it all runs locally, you keep your data and your sovereignty.</p>
<p>The tools are free, open source, and mature enough for daily use. The only real cost is the time to set them up. For anyone running AI coding agents seriously, that is a small price for turning your agent spend from a surprise bill into a managed line item.</p>
<h2 id="faq">FAQ</h2>
<p><strong>What is local agent observability?</strong>
Local agent observability is the practice of tracking an AI coding agent&rsquo;s tokens, tool calls, subagent activity, and cost in real time on your own machine, without sending telemetry to a cloud service. It gives you live visibility into what the agent is doing and spending.</p>
<p><strong>How much does a typical AI coding agent session cost?</strong>
A moderately complex Claude Code session can burn around $2.47 across roughly 142 tool calls, with per-subagent attribution showing a main agent at $1.82, an executor at $0.41, and a verifier at $0.24. Costs vary widely by task and model.</p>
<p><strong>Why can&rsquo;t I just read the agent&rsquo;s JSONL transcript to track cost?</strong>
Claude Code writes JSONL transcripts, but they are only usable after the session ends. By the time you analyze them, the budget is already spent. Real-time observability is the only way to catch overruns while you can still act.</p>
<p><strong>How does project memory reduce AI agent cost?</strong>
Project memory stores your project&rsquo;s context in a portable, human-readable form so each new session loads it instead of re-deriving the project from scratch. Every token saved on re-explanation is a token you do not pay for, and the savings compound on daily work.</p>
<p><strong>Are local observability tools free and private?</strong>
Most are. Tools like ObservAgent, Cache Lens, Frugon, CodeBurn, and Claud-ometer are open source, free, and self-hosted, with no cloud and no telemetry. Your agent data stays on your machine, which is a strong privacy and compliance advantage.</p>
]]></content:encoded></item></channel></rss>