A few days ago someone on LinkedIn listed six questions every team should answer before building an AI agent. Number 5 was short: "Can you trace what it did?"

I thought my answer was yes. It wasn't.

The setup

I build Agentic App Store, an open-source (MIT) app store you host yourself. You install apps with one click on your own Mac or Linux box, and AI agents can work inside those apps through one door, the AI Hub:

  • Agents like Claude Code or Codex connect to one MCP address and see every installed app's tools.
  • The hub's own assistant can use the same tools from a chat window.
  • Each app marks its tools as read, write or danger. A danger call (delete shapes, replace text) stops in the hub and shows the person a card with Accept / Accept all in this chat / Reject. The prompt never decides that; the hub does.

So the approval part was there. What was missing was the record. The hub kept the last 200 tool calls in memory, without the person's answer, and a restart wiped them.

That's a status page, not a history.

What I wanted to be able to answer

For any AI action, a week later:

  1. When, and through which door (an MCP agent or the assistant chat)?
  2. For whom, which app and tool?
  3. Exactly what the AI sent?
  4. How it ended: done, failed, or never ran?
  5. What the person answered, if the call needed an answer?

Number 4 matters more than I expected. A rejected change never reaches the app, so the app has no record of it. But "the AI tried to delete everything and I said no" is exactly what you want to find later.

The design: one line per call, written where every call passes

Every tool call, from every door, already goes through one function in the hub: calls.call(). That's the natural place to write the history. One JSON line per call, appended to a file in the hub's data folder:

def record(*, via, user, app, tool, kind, args, ok, error="", ms=0, approval="", ran=True): entry = { "id": secrets.token_hex(6), "at": time.time(), "via": via, "user": user, "app": app, "tool": tool, "kind": kind, "args": _args_text(args), # what the AI sent, cut at 4,000 chars "ok": ok, "ran": ran, "error": error[:500], "ms": ms, "approval": approval, # accepted, rejected, allowed, declined, no answer... } with _lock, _file().open("a", encoding="utf-8") as f: f.write(json.dumps(entry, ensure_ascii=False) + "\n") 

Plain JSONL on purpose: it's easy to read, easy to back up, and easy to delete. The file keeps the newest 10,000 entries and is readable only by the hub's owner.

Getting the person's answer into the same line

The approval happens in one module (approvals) and the call in another (calls). Both run in the same asyncio task, one tool call at a time, so a ContextVar carries the answer from one to the other without changing every function signature in between:

APPROVAL: ContextVar[str] = ContextVar("ai_hub_approval", default="") # approvals.ask(), after the person clicks Accept: history.APPROVAL.set("accepted") # calls.call(), when it writes the line: approval = history.APPROVAL.get() history.APPROVAL.set("") # the answer belongs to this one call only 

The reset is important. Without it, the next harmless read in the same chat would show up as "accepted" too.

Calls that never run get their own line with ran: false: rejected changes, reads the person declined, and calls from places that have no chat to ask in (the voice companion, say). Those don't run either. The model is told to ask in the chat.

The bug I found while taking screenshots

I tried it live: I asked the AI to clear a demo drawing and planned to click Reject for the screenshot. I was too slow. Claude Code gave up waiting for the tool call before the hub's own 4-minute timeout, and the history showed... nothing for that call.

When the client gives up, the hub's waiting coroutine gets cancelled. My code only wrote a line after a decision, and a cancellation is not a decision. So "never asked" and "asked, but nobody answered" looked the same, which is exactly the gap the history was supposed to close.

The fix is small:

async def _kept_answer(tool, args, user, via, chat, post, card, waiting): try: return await _answer(chat, post, card, waiting) except asyncio.CancelledError: history.record(..., ok=False, ran=False, approval="no answer: the AI stopped waiting") raise 

Record, then re-raise: the cancellation still does what it should, and the history keeps the attempt. There's a test for it now too.

What the owner sees

On the hub page, the old "Recent tool calls" card became History of the AI's actions:

The AI asked to clear the drawing and I rejected it; then it asked to change a colour and I accepted

The history: each call with its kind, the person's answer and how it ended

Opening the rejected call shows exactly what the AI sent

  • Search across everything (an app, a tool, a person, words the AI sent, "rejected").
  • Click a row to see the whole entry, and delete it if you want.
  • Delete all, after a question that says how many entries will go.
  • Download the whole history as JSON.
  • Times show in your browser's time zone (the containers run on UTC).

Only the hub's owner can see it, because an entry holds whatever the AI sent, and that can be anyone's data.

What it is, and what it isn't

It is the everyday kind of audit trail: on your own server, next to your data, covering every agent that goes through the hub.

It is not a validated compliance system. If you work in a regulated field, the hub's history can support your own validation, but it doesn't replace it.

Try it

Agentic App Store is open source (MIT): https://about.reflex-ddns.com

If you run agents against real systems, I'm curious: who reviews what your agents did last week, and where do they look?