# If your tool breaks, would you know? Adding monitoring and snapshots to your own tools

> Tasks will sometimes fail, so when I design a tool, I design its checks at the same time instead of leaving it alone once it works. This post starts from two ways my video-downloading tool has broken: first pick the one workflow you know best and make its failures visible and traceable, then slowly connect them into one overall view.

Published 2026-11-20 · Updated 2026-11-20 · URL https://wizerdbache.com/en/notes/monitor-your-own-tools/


I have used AI to build quite a few small tools for myself, such as a tool that downloads videos. Once something is built and runs, it is easy to feel the job is finished.

What I want to say here is this: **things will go wrong at some point, so when you design a tool, design its checks at the same time.** You do not need a full system from the start. Begin with one workflow you know well, make its failures visible and traceable, and connect the rest later, bit by bit.

## 1. Two ways my video-downloading tool has broken

**First kind: it reported an error, but the cause was wrong.** Once, a Bilibili link would not download, and the tool said “page structure changed, cannot parse.” I went along with that and assumed I had copied the wrong URL, so I swapped in the URL from the share button. Then I found out the two URLs were actually the same, and an hour later the original one worked too. The real cause was that the platform had refused the request at that moment. The tool only ever asked one question: is there no video in this post? Every other situation, including rate limiting and dropped network connections, was reported as “the website has changed.”

**Second kind: it reported nothing at all.** When the tool could not read its queue file, it quietly replaced the queue with an empty one. On the next save, the original file was overwritten. The whole queue was gone, along with any evidence, and no warning appeared on screen.

One raised a false alarm, the other raised none; both sent my time to the wrong place.

Later I found the same problem in a tool I had built as a monitoring system: pressing refresh on the monitoring page re-collected only some of the readings, but the timestamp of the whole snapshot was recorded as “now.” Anyone reading the summary only looks at that timestamp and assumes every reading is new. It reports no error, because as far as it is concerned, nothing is wrong.

## 2. Why monitor: rules guide beforehand, monitoring senses afterward

When people talk about AI agents, they often hear the line: Agent = Model + Harness ([LangChain: The Anatomy of an Agent Harness](https://www.langchain.com/blog/the-anatomy-of-an-agent-harness)). Everything outside the model, such as the system prompt, tools, hooks and all kinds of checks, counts on the harness side; the rules I write for the AI myself also belong here.

Thoughtworks’ Birgitta Böckeler divides the controls in a harness into two types ([Harness engineering for coding agent users](https://martinfowler.com/articles/harness-engineering.html)). In my own words:

- **Guides**: steer the agent before it acts, such as rules and prompts.
- **Sensors**: observe the result after it has acted, so it can correct itself, such as tests and checks.

With sensors but no guides, the same mistakes keep recurring. With guides but no sensors, you write rules without knowing whether they are followed or whether they work. **Monitoring is the sensing half.**

## 3. Monitoring shortens detection and diagnosis

The time it takes to fix a problem can be split into four stages:

1. **Detection**: noticing that something is broken.
2. **Diagnosis**: finding where and why it broke.
3. **Repair**: making the change.
4. **Verification**: confirming it is really fixed after the change.

This four-stage split is my own. Monitoring covers the first two: Google’s SRE book says monitoring should answer two questions, what is broken (the symptom) and why it is broken (the cause) ([Site Reliability Engineering, Chapter 6](https://sre.google/sre-book/monitoring-distributed-systems/)), and I think that lines up with “detection” and “diagnosis.” Repair and verification still have to be done by people.

Factories have been doing this for a long time. A factory monitoring system (SCADA) is roughly layered like this: the machines on the floor and their controllers report status, a communication layer sends the readings upward, a central screen lets operators see every machine’s status and alarms at once, and a historical record keeps the readings stored over time. **Small machines each report, layer by layer they connect upward, and one big screen shows everything at once.** When I get to integration later, it will look very similar.

## 4. Sounds complicated? Start with one workflow you know well

Guides and sensors, the four stages of a fix, and a whole wall of factory indicator lights: together they look like something you would have to build all at once.

That is when I think of Gall’s law, which roughly says that every working complex system has grown out of a working simple system; a complex system designed in full from a blueprint from the start usually does not work, and cannot be patched into working either ([Wikipedia: Gall's law](https://en.wikipedia.org/wiki/Gall%27s_law)).

So the first step is not to design the overall picture, but to **pick one workflow you use every day, the one that hurts most when it breaks**. The one I picked is video downloading.

## 5. Starting from one workflow: three things

### 1. Split the workflow into nodes, and write down what to collect when each one breaks

My video-downloading workflow goes roughly like this: paste the link → queue it → ask the platform → download → fetch subtitles and save. Every step can break. Using the fixes I made later as examples, a few of these nodes can be written as a table like this:

| Node | What happens when it breaks | What to collect |
|---|---|---|
| Queueing | The queue file cannot be read and is rebuilt as empty | The read failure itself; the broken file is kept separately |
| Asking the platform | Blocked; the platform refuses at that moment | What the platform returned |
| Downloading | Lists the formats, then refuses to transfer | The full error message and the command to rerun |

Write one like this for your own workflow, and you have your first monitoring design.

Also, log one line for each action: what happened, plus the time. My original tool had no log file at all; the only record was the text in the terminal, which was gone once the window closed, so there was no way to check whether it had failed yesterday. Later I changed it to log one line per action, and each failure gets its own folder (parameters, full error, rerun command). Ordinary logs are cleared after a few days; failure records are kept until someone deletes them, because failures are usually not noticed until several days later.

### 2. Sort failures into classes, because each class calls for a different response

| Class | Examples | What to do |
|---|---|---|
| Platform refusal | Login required, rate limited, transfer blocked | Wait and let it cool down; retrying now only makes it worse |
| Nothing to fetch here | Unsupported link, no video, post gone | Stop trying |
| Site changed | Page structure has changed | Change the code |
| Temporary, network | Cannot connect, transfer fails, link expired | Retry later |
| My side | Missing package, request quota used up | Fix the environment, wait for quota to reset |

For the error at the start, the one that was reported as a site change, the fix is to classify by the response the program actually received. When the cause cannot be seen, honestly label it “unknown” rather than forcing it into a class.

### 3. The hardest breakage reports no error: record the “last success”

Like that queue that was quietly emptied, there is no error message. Without an error message, you cannot just wait for one.

So record the time of the “last success” for each node; this is what I am going to add next. **Going too long without a success is itself an alarm.** No news is not necessarily good news.

## 6. There are two kinds of snapshots: a dashcam, and a regular checkup

Monitoring is watching all the time; a snapshot is capturing the state at the moment of looking, so it can be checked later. I split them into two kinds:

- **Dashcam (event log)**: when something goes wrong, it tells you the time, which node, and what happened.
- **Regular checkup (state snapshot)**: it does not record what you did; it records the readings at every measurement point on a given day, and flags any that are out of range.

The most useful way to use a snapshot is to **compare it with the last time things were normal**. Looking at a single one, it is hard to say what looks odd; set it beside the one from when things were normal, and the difference shows at a glance. Systems engineering calls a state that has been formally approved and serves as the reference point for later changes a baseline ([SEBoK: Configuration Baselines](https://sebokwiki.org/wiki/Configuration_Baselines)).

## 7. Integration comes after a few monitors of your own

Finish a subsystem’s own monitoring before talking about integration. I split integration into three layers:

1. **Export**: each subsystem has its own monitoring and also exports a copy of its data.
2. **Mediation**: convert different formats into one common format.
3. **Viewing**: one screen shows everything, with snapshots alongside.

Why not connect each subsystem directly to the overall screen? Because each subsystem may report in its own format; connect them directly, and the overall screen would have to understand every version. And when one subsystem suddenly goes quiet, you cannot tell whether “the transmission pipe is broken” or “the subsystem is really down.” I plan to have the mediation layer record **the last time it received data** from each subsystem, so the two cases can be told apart.

These three layers are very similar to the factory layering above.

## 8. Don’t leave it once it’s done: monitoring lights up, it does not fix

A frequently cited law of software evolution, Lehman’s law, says that software living in a real world that keeps changing must keep being adjusted, or it becomes less and less fit for use ([Wikipedia: Lehman's laws of software evolution](https://en.wikipedia.org/wiki/Lehman%27s_laws_of_software_evolution)). Platforms change, networks change, and your own usage changes too; the checks have to change along with them.

It is also worth remembering the limits of monitoring:

- It lights up; it does not fix. Once a red light appears, repair is a separate job.
- “No problems” only means that **where it can measure**, there are no problems.
- Also ask: if the monitoring itself stops, who will know? In my monitoring system, the regular automatic collection relies on a single schedule that runs once a day; if that schedule stops by itself, it takes two or three days before anyone notices.

## The first monitor you can build this week

1. Pick a workflow you know best, the one that hurts most when it breaks.
2. Draw its nodes.
3. For each node, write: what happens when it breaks, and what to collect.
4. Log one line per action: what happened, plus the time.
5. Keep evidence for failures and classify them, so you know whether the next step is retry, wait, give up, or change the code.
6. Record the time of the last success for each node.
7. Add snapshots later, and only at the end connect everything into one overall view.

First make one workflow visible and traceable when it breaks; let the rest grow slowly afterward.

## Prompt: have your AI design the first monitor for one workflow

Paste the text below to your agent, and replace the words in angle brackets < > with your own situation. It will ask you questions first, then give you a draft; after you have read it, decide whether to change the code.

```text
I want to add a first monitor to one of my own tools, so that when it breaks I can see it and trace it.
The tool is: <what the tool does, what it is written in, how it normally runs (by hand, on a schedule, or called by another program)>.
The one workflow I care about most is: <where it starts, and where it counts as success>.

Please work through this in order:
1. First read this tool’s code, then ask me up to 5 questions to clarify: how many times this workflow has broken, how each break was discovered at the time, and how I most fear it breaking.
2. Split this workflow into nodes, and write one line per node: what happens when it breaks, whether it currently reports an error, and whether the error it reports is accurate.
3. In particular, find two kinds of breakage: “reports an error but names the wrong cause” (for example, calling rate limiting a site change), and “reports nothing” (for example, quietly replacing a file it cannot read with an empty one).
4. Propose a minimal monitoring design: log one line per action with what happened and the time; when something fails, keep the evidence and classify it as retry, wait, give up, or change the code; and record the time of the last success for each node.
5. State clearly: if this monitoring itself stops, who would know, and how long it would take them to know.

Give me a draft first, and do not change the code directly. The first version should handle only this one workflow; do not build an overall view.
```
