Memory Engineering: Building Sweat's Company Brain

Our agents kept repeating mistakes we had already solved. We built Claude Note to save what they learn and retrieve it when another session needs it.

Claude Note on GitHubFree and open source. MIT licensed. Built for Claude Code and Codex.

By Artemii NovoselovEngineering
A map of the notes written by our AI agents, coloured by subject. How we build sits in the middle, with the company's other subjects around it.

Loading the map.

Each dot is a note, grouped by meaning and coloured by subject. Solid black dots open public engineering notes; outlined dots show a title and summary. Coloured dots show location only.

15,000 Notes Across the Company

Our agents write code, research markets, and make films. Their notes cover that work: 3,489 concern engineering, with the rest spanning product, strategy, research, and our films. A lesson from last week's film should be available when we make the next one.

Repeating a 54-Minute Mistake

A new session may have no record of what went wrong last time.

Our agents use QMD to search their notes. Once, an agent ran qmd query during a task. It loaded a 1.28 GB model, hung for 54 minutes, and left our server unresponsive. The agent saved a warning against using it inside an agent turn or hook.

We later asked the same model, in two fresh sessions:

"Our recall hook uses qmd search. Can I switch it to qmd query to get better results? Two short lines."

One session received the warning through recall. The other did not.

Claude Code 2.1.296 · no recall

Yes, qmd query (query expansion plus vector search plus LLM reranking) usually gives noticeably better recall than BM25-only qmd search.

The cost is that it loads local models and can take seconds per call, so raise the hook's timeout or try qmd vsearch as a faster middle option.

Claude Code 2.1.296 · with recall

No. qmd query loads a 1.28 GB query-expansion model before every search, and a note from 2 August 2026 records one run hanging for 54 minutes inside an agent turn, so it's too slow for a hook.

Keep qmd search and improve the queries instead: drop stopwords, since one rare word can zero out the results. If you need semantic matching, try the lighter qmd vsearch.

Recorded October 12, 2026, in a sandbox vault containing the warning. See the demo record and raw runs. The final tip about qmd vsearch came from the model; that command also loads a model in QMD 2.x.

Saving a note only helps if the next session finds it. Claude Code's automatic memory loads the first 200 lines of its main memory file; a larger collection needs retrieval.

Capture, Compound, Recall

Claude Note records prompts, tool calls, and turn endings through hooks in Claude Code and Codex. After each session, a worker sends the transcript to Claude, which writes lessons as Markdown notes in your folder.

Play the sequence or select a step.

session c5cd21d7314 events · excerpt
  1. toolmcp supabase · execute_sql
  2. toolmcp supabase · execute_sql
  3. stopturn ended
  4. prompt"how do i OAuth re-consent?"
  5. toolRead oauth.ts
  6. toolBash grep -rn "client_id|GOOGLE_WORKSPACE" …
  7. toolBash ls …/scripts/ | grep -iE …
  8. stopturn ended
  9. prompt"[Image #1] postmaster"
  10. stopturn ended
  11. prompt"can you do the re-consent for me"
  12. toolBash grep -rn "googleapis.com/auth" …
  13. toolWrite google-workspace-reconsent.mjs
  14. toolBash chmod +x …
  15. toolEdit google-workspace-reconsent.mjs ×4
google-workspace-oauth-reconsent.mdwritten by Claude · excerpt
---
type: gotcha
---

Google Workspace OAuth Re-consent

A real session and the notes it produced. Hover over a note section to see its source.

Note types help determine when to retrieve them:

  • GotchaA failure, its cause, and the fix. Prioritized after command errors.
  • PatternA method worth reusing.
  • DecisionAn agreed choice to carry forward.
  • ReferenceFacts such as API behavior and vendor limits.

Later sessions append dated updates. In our team setup, laptops share eligible notes with the company vault daily. A nightly merge adds new knowledge, skips duplicates, replaces outdated notes, and sends conflicts to a reviewer agent.

Open a row to see the action.

New notegoogle-workspace-oauth-reconsent.mdNo candidate covers OAuth re-consent when adding new scopes.

ActionCreate a note for a new topic.

Additionchrome-cdp-automation-macos.mdMatches the existing howto word for word, except for a new Meeting Detection via CDP section, so only that section is appended.

ActionAppend the new section to the existing note.

Duplicatelaunch-post-experiment.mdThe candidate already contains the same scope, product decisions, data source, domain and technical details.

ActionKeep the existing note unchanged.

Replacementvideo-qa-checkpoint-pattern.mdRepeats the candidate's full content and adds three dated sections, so it is the newer, complete version.

ActionReplace the existing note with the more complete version.

Conflictmeeting-end-detection-silence-timeout…Claims silence timeout is unreliable for meeting end, while the candidate keeps it as a fallback signal. → Reviewer agent

ActionSend the disagreement to a reviewer agent.

Counts and recorded reasons from October 11, 2026. One example per action; filenames changed.

Beyond Engineering

We also test recall on film production and writing. These evaluation questions were phrased without seeing the source notes. Each is paired with the note retrieved first.

  • EngineeringOur live landing page suddenly went back to an old version after someone ran deploy. How could that happen?Duplicate Deployment Source Hazard
  • Our filmsPeople stop watching our short story video about halfway through. Should we tweak the pacing or start over?Video Narrative Remake Decision Threshold
  • This blogHow should I lay out a technical blog post with lots of demo videos so it doesn't feel cluttered or hard to read?Blog Design: Visual-First, No Gallery Overload
A clay office worker raises a finger to ask a question while, behind him, one drawer of a tall wooden card catalog slides open on its own, holding a single orange card.

Finding the Relevant Note

Before each prompt reaches the agent, recall searches by keyword and meaning. Keyword searches progressively shorten the query; semantic search finds related notes even when the wording differs. A reranking model selects the top four notes and supplies their file paths. If nothing is relevant enough, recall returns no match.

Try Recall

Enter a question or choose an example to see the search and retrieved note.

This browser demo uses recall.py's keyword rules on ten public notes. Full recall also uses semantic search and reranking.

When a Command Fails

The sentinel hook searches notes for error codes such as insufficientPermissions or ENOSPC. It tells the agent to stop retrying failures that need intervention, such as an expired login or full disk.

Watch the Walkthrough

The QMD example, retrieval process, and evaluation in 2½ minutes.

Recorded model responses. Captions included.Download

Testing Recall

A partial model download once corrupted the embeddings for 992 notes. Refreshes kept reporting "OK" for five days. We added evaluations to catch failures like this.

Claude generates questions from the notes, with each source note fixed as the expected retrieval result. We split the questions by source note, tune on one half, and test on the held-out half.

On October 12, 2026, recall retrieved the correct note in its top four for 28 of 36 held-out questions. We also tested 15 unrelated questions.

MeasureResultCount95% range
Right note among the four injected78%28 of 3662–88%
Right note first56%20 of 3640–70%
Same, without the reranking model58%21 of 3642–73%
Off-topic questions that still got notes7%1 of 151–30%
Answer followed our note, with recall70%7 of 1040–89%
Answer followed our note, without recall20%2 of 106–51%
Time added per prompt, median3.3 s0.36 s without the reranker; slowest 1 in 20: 5.3 s

These are small internal tests. A repeat run scored 81%. The answer-following comparison used just ten questions, judged by Claude with answers unlabelled and randomly ordered. That judge belongs to the same model family as the agent being tested. In a control using unrelated notes, it selected "neither" in all ten cases. The results are preliminary.

The Claude Note eval dashboard: right note injected, rank, found nothing, plain search, off-topic, slowest five percent, a trend across runs and a list of what to fix next.
The dashboard shows the repeat run, so its figures differ from the table. Nightly evaluations flag drops in performance.

The evaluations ship with Claude Note. JSON reports let agents inspect failures and update the notes.

Privacy and Sharing

  • On Your MachineNotes are Markdown files in your folder. Search, reranking, and retrieval run locally.
  • Sent to ClaudeThe worker sends session transcripts through your Claude CLI to write notes, under your account's terms.
  • Optional Sharingclaude-note push shares typed lessons, excluding session logs, private folders, and notes marked share: false. It redacts 14 secret types, including API keys and connection strings.
  • Read by AgentsRetrieved notes are labelled unverified leads. Agents are instructed to open them and check that they still apply. Only trusted people should write to the notes folder.

Within Sweat, merged notes retain their sources' access restrictions. Public notes in the map passed keyword screening, a manual read, and two independent reviews.

Install Claude Note

Allow about 15 minutes. You'll need Python 3.11+, uv, QMD 2.x, and the Claude CLI. Setup backs up changed files; --dry-run previews changes.

Our measured median recall overhead was 3.3 seconds per prompt, or 0.36 seconds without reranking. Writing notes uses one Claude call per completed session on your plan.

  1. Install Clone the repository and run the installer with your notes folder and email.

    git clone https://github.com/crimeacs/claude-note.git ~/src/claude-note && cd ~/src/claude-note && scripts/install-from-checkout.sh --non-interactive --vault ~/Documents/notes --author you@example.com --claude-hooks
  2. Enable Recall Adds recall and sentinel hooks, the search index, warm recall server, and nightly evaluation. Omit --codex if you only use Claude Code.

    claude-note setup --codex
  3. Verify Setup Creates a test note and checks it through the hooks.

    claude-note doctor
  4. Run an Evaluation (Optional) Generate questions from your notes, score retrieval, and open the dashboard.

    claude-note eval probes -n 80 && claude-note eval run && claude-note eval dashboard

You can also save a lesson manually:

claude-note remember --type gotcha --tags oauth "Adding a Google scope does not upgrade existing tokens: delete the token, re-consent with all scopes"

Source, documentation, and recorded demo runs are on GitHub. MIT licensed.