My agent kept forgetting what it was doing. A scratchpad fixed it. A developer created `agent-scratchpad`, a structured working memory tool that prevents AI agents from repeating themselves by tracking progress as a keyed dictionary. The scratchpad renders its state as plain text for injection into system prompts, and includes helpers for list building, counting, and logging every decision for replay. This is a submission for the Hermes Agent Challenge. My Hermes research agent was asking the same questions twice. It would identify a paper, start analyzing it, then two turns later ask if anyone had studied the same topic. The context window had the answer but the agent wasn't tracking its own progress. The fix isn't more context — it's structured working memory. That's agent-scratchpad . A scratchpad is just a keyed dict with helpers for list building and counting. The useful part is to text — it renders the current state as plain text you can inject into any system prompt. python from agent scratchpad import Scratchpad pad = Scratchpad pad.set "topic", "quantum error correction" pad.append "papers found", "Shor 1995" pad.append "papers found", "Steane 1996" pad.increment "search count" pad.append "hypotheses", "Surface codes may be more practical than Steane codes" print pad.to text title="Research progress" Research progress: hypotheses: - Surface codes may be more practical than Steane codes papers found: - Shor 1995 - Steane 1996 search count: 1 topic: quantum error correction context = pad.to text title="What I know so far" response = client.messages.create model="claude-sonnet-4-5", system=f"You are a research assistant.\n\n{context}", messages=messages, The scratchpad goes in the system prompt. The agent can read what it's already found and not repeat itself. pad.set "key", value set scalar pad.get "key", default=None deep copy pad.delete "key" pad.has "key" pad.append "papers", "Shor 1995" build lists pad.prepend "queue", "urgent item" front-of-list pad.extend list "papers", ... bulk append pad.increment "search count" counter init to 0 pad.decrement "errors" pad.increment "cost cents", 5 pad.update {"a": 1, "b": 2} set multiple pad.clear pad = Scratchpad "logs/scratchpad.jsonl" pad.set "topic", "ML" appends {"ts": ..., "op": "set", "key": "topic", "value": "ML"} Replay the scratchpad log to see every decision the agent made. pad.save "state.json" Next run pad = Scratchpad.load "state.json" Full JSON snapshot for resuming long-running agents. Standard library only: json , copy , time , pathlib . Nothing else. pip install agent-scratchpad