◉CLAUDE LABJP
●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 50 days left. Migrate to Sonnet 5.5●Q&A — A long-running report: Max plan users hit usage limits almost immediately●HAIKU 5.5 — Code written for Haiku 4.5 hits a 400 error on budget_tokens●NEW — Before you cut an always-loaded instruction file in half, sort it into three drawers●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 50 days left. Migrate to Sonnet 5.5●Q&A — A long-running report: Max plan users hit usage limits almost immediately●HAIKU 5.5 — Code written for Haiku 4.5 hits a 400 error on budget_tokens●NEW — Before you cut an always-loaded instruction file in half, sort it into three drawers
Articles/Cowork
◈ Cowork/2026-10-11Intermediate

I Stopped Making Cowork Read My Whole Troubleshooting Notes — Pulling One Section by Number Cut 105 KB to 1.5 KB

A record of turning a 105 KB file of web-ops troubleshooting notes into something you query by number. My first extraction script could reach only 30 of 120 numbers, and #70 came back as zero bytes. The fixed awk, a zero-byte check, and measured section sizes are all here.

Cowork44Ops NotesContextawkIndie Dev23

My troubleshooting notes had quietly grown to 1,549 lines.

Every time I told Cowork, "I think I've hit this symptom before," I handed over the whole file. One symptom, and nearly 105 KB along with it. One day, watching it load, I stopped and wondered why I was doing this.

So I changed it: say a number, get back one section. My first script, though, couldn't find most of the numbers. I'm keeping that failure in the record, with the measurements.

The short version: sections are small, and the real problem was numbers I couldn't reach

Measured results first. The file is a single Markdown document of problems I've run into while operating web sites.

ItemMeasured
Whole file104,822 bytes (1,549 lines)
Headings (## and ###)217
Section size (median)356 bytes
Section size (90th percentile)910 bytes
Largest section4,008 bytes
Index (chapters and numbered headings only)144 entries, 11,740 bytes
Pulling one section by number401 to 1,567 bytes

Passing the whole file versus pulling one section differs by roughly 60x to 260x in bytes. I hadn't expected the median section to be only 356 bytes until I measured it.

Notes are something you query, not something you make the assistant read. I drew that line only after I saw the numbers.

My first extraction script reached a quarter of the numbers

The first awk I wrote picked up only headings that carried a number like #119.

# First version: only matches "### #119 ..." style headings
awk -v n="$2" '
/^#{2,3} / { on = ($0 ~ ("^#{2,3} #" n "([^0-9]|$)")) }
on { print }
' "$1"

#119 worked. It returned 1,567 bytes, and for a moment everything looked fine.

Then I asked for #70, a section I look up all the time. It returned 0 bytes. No error, just nothing.

Recounting the headings explained it:

  • Headings with a #-style number, like ### #119 ...: 30 distinct numbers
  • Headings with a plain chapter number and no #, like ## 70. ...: most of the rest

The notes had grown over months, so only the later sections used the #number style while the early ones used chapter numbers. The script reached 30 numbers; 120 were actually addressable (within 1 to 134). A quarter.

What worried me most was that, from Cowork's side, "0 bytes" looks identical to "no match." A symptom could be written down in the notes and still be judged "no precedent."

The fixed version, and what it returns

For chapter-style sections (## 70.) the script now returns everything up to the next ## , children included. For #number sections it returns just that section.

#!/bin/bash
# kb.sh FILE NUMBER
# "## N." runs to the next "## " (children included); "### #N" returns that section only
awk -v n="$2" '
/^## /  { on = ($0 ~ ("^## " n "\\.")); top = on; if (on) print; next }
/^### / { if ($0 ~ ("^### #" n "([^0-9]|$)")) { on = 1; top = 0; print; next }
          else if (!top) { on = 0 } }
on { print }
' "$1"

Measured after the fix:

NumberBytes returnedWhat it is
#70401Scheduled-task prompts drifting out of sync with their instructions
#191,531Page-speed fixes (three child sections included)
#1191,567An x-default hreflang being declared twice
#1251,016Child pages inheriting a root-level setting
#999 (does not exist)0No match

Ten consecutive runs took 0.057 seconds in total, so speed is a non-issue.

The last row is the one that matters. Zero bytes for a number that doesn't exist is correct behavior. Zero bytes for a number that does exist means the tool is broken. To tell those apart, I added the check in the next section.

Don't let "0 bytes" pass quietly — cross-check against the index

I build the list of numbers that exist first, then pull every one of them and complain about any that return nothing.

#!/bin/bash
# kb-check.sh FILE — pull every number in the index and count the 0-byte results
F="$1"
nums=$( { grep -oE '^## [0-9]+\.' "$F" | grep -oE '[0-9]+'
          grep -oE '^### #[0-9]+' "$F" | grep -oE '[0-9]+'; } | sort -nu )
bad=0
for n in $nums; do
  size=$(./kb.sh "$F" "$n" | wc -c)
  [ "$size" -eq 0 ] && { echo "0 bytes: #$n"; bad=$((bad+1)); }
done
echo "checked=$(echo "$nums" | wc -w) zero=$bad"

I run it once after adding a section. On my file it prints checked=120 zero=0 and finishes in 0.8 seconds. If zero is anything else, it means a new heading style has crept in.

I also chose not to build the index on line numbers. They shift every time a section is added. Querying by heading text and number keeps the script working as the notes keep growing.

Rewriting the instruction I give Cowork

With the tooling in place, I rewrote the instruction too.

Before:

My troubleshooting notes are in STUMBLING_POINTS.md. Look for the relevant parts.

After:

My troubleshooting notes are in STUMBLING_POINTS.md. Don't read the whole file. First pull one section with kb.sh by number. If you don't know the number, look at the index (the list of headings) and pick the likely one. If any number comes back with 0 bytes, tell me instead of moving on.

The last sentence comes straight from the failure above. Not letting "nothing came back" slide by gives me one more place to notice a miss.

Where this leaves me

In numbers, roughly 105 KB per lookup became a 0.4 to 1.6 KB section. What stayed with me, though, was something else: decide how a lookup behaves when it fails before you decide how it behaves when it works.

If you keep a notes file like this, a first step could be counting whether your heading numbers follow a single style. Mine didn't, and that was where the whole approach began to be useful.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

◈ Cowork2026-10-01
Before You Trim a Scheduled Task's Runbook, Count How Many Times It Gets Re-read
I cut 13 KB from a scheduled task's preloaded docs, and recounted by re-reads it was worth about 1.3 tool calls. Here is the ledger that counts re-reads, and a shell helper that records bytes during a run.
◈ Cowork2026-09-24
Will Your Cowork Scheduled Task Still Run Next Saturday?
A definition that runs once and stops, two fire times packed into one task, a weekday that quietly emptied after an edit. Cowork schedules can go missing without leaving a single log line. Here is a working audit that compares what you defined with what you meant.
◈ Cowork2026-09-23
Write Access Came Third: The Order I Hand Folders to Cowork
When I connect a folder to Cowork I open it in three steps: read-only, a place where new files may appear, then write access. Here is the line I drew with a client's asset folder, and the three things I settle before connecting.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links