Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 3 min read

I'm building local AI agents that show their work

Most AI tools hand you a confident paragraph and expect you to take their word for it. You drop in a messy CSV or point a tool at a GitHub repo, and ten seconds later it gives you a smooth summary with no way to check ho

Most AI tools hand you a confident paragraph and expect you to take their word for it. You drop in a messy CSV or point a tool at a GitHub repo, and ten seconds later it gives you a smooth summary with no way to check how it got there. Did it read 05/02/2026 as May 2 or February 5? Did it quietly drop the broken rows, or did it just make up a percentage?

That annoyance is why I started building margin. It's an open-source collection of small, single-purpose AI agents that show their work. Every answer comes with receipts: the exact row of data, line of code, or git commit behind it. The name comes from notes written in the margin of a page, and the local web UI is even laid out like ruled paper with a thin red margin line down the left side.

Why it only runs on your own machine

I want to be upfront about one thing: I'm not deploying margin as a hosted web app, and I have no plans to turn it into a SaaS. It's built for local use.

Part of that is practical, and part of it is the whole point. If you're cleaning a messy sales spreadsheet or scanning a codebase for leaked API keys, you probably don't want to upload those files to someone else's server or pay an API bill every time you run a check. By default, margin runs with Ollama using qwen3.5:9b (which fits on an 8 GB GPU), and parts of it work with no model at all. You can still plug in OpenAI or Anthropic if you want to, and the UI tells you clearly when prompts leave your computer.

Code does the math, and you make the judgment calls

The easiest way to see how margin behaves is with its Data Storyteller agent. Say you have a messy export with a title row sitting where the headers belong, mixed date formats, a duplicate row, and a revenue cell that says n/a.

If you run it locally:

pip install margin-cli margin-data-storyteller
curl -O https://raw.githubusercontent.com/Waddah0-0/margin/main/examples/sales.csv
margin run data-storyteller sales.csv

When it hits 05/02/2026, it stops and asks whether that column is day-first or month-first instead of guessing in the dark. If you tell it to assume defaults, it still labels every assumed decision as unconfirmed in the report.

When it writes a summary of the data, the language model is blocked from typing numbers. Code computes every stat twice (once in pandas, once in DuckDB SQL, failing the run if they disagree), and the model can only point to those checked facts by ID. In the web UI, every number in the story is clickable so you can open the exact calculation behind it.

What's in it right now

Each agent installs on its own, and the CLI and local web UI (margin-api) pick up whichever ones you've installed. Right now there are four working agents (plus a tiny echo template for testing):

  • Data Storyteller cleans messy CSV, Excel, Parquet, JSON, or SQLite tables, logs every row-level change, checks its own stats, and writes a short story with charts.
  • AI Code Detector looks at a local folder or GitHub repo and estimates how likely it was written with AI help. It gives a range and line-level evidence on both sides, and it refuses to print a hard "AI" verdict because no tool should be used to accuse someone off a score.
  • Commit Graph turns a repo's git history into a readable branch tree split into chapters, flags files that keep changing or always break together, and can export the whole history as an SVG poster.
  • Secret Leaks scans working files and git history locally for hardcoded API keys, private keys, and database credentials, storing only redacted previews in the report.

Still early, and more agents are coming

margin isn't finished yet. All four agents are still marked experimental, and I'm planning to add more focused agents over time. Because every agent is just a small Python class with typed inputs and outputs, adding a new one automatically gives it a CLI command, an HTTP endpoint, and a form in the web UI.

If you want to try it locally, poke holes in it, or look at how it's put together, the repo is up at mrgin. I'd like to hear what kind of small, annoying local task you'd want an agent for if it showed its receipts.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.