◉CLAUDE LABJP
●2.1.334 — Claude Code 2.1.334: /model now has a search box once the list passes 25 models, matching names and model IDs●FAST — Fast mode for Claude Opus 4.8 ended on 11/30. Drop speed: "fast" and Opus 4.8 keeps working●OPUS 4.5 — claude-opus-4-5 retires on 2027/1/22, 50 days from now. The replacement is claude-opus-5-5●IME — On the Windows desktop app, pressing Enter to confirm Japanese IME input can send the message early●NEW — New: Compare tool-use requests across three routes before moving to Bedrock●MCP — More setups now share one local MCP server across Claude Code, Cursor and Antigravity●2.1.334 — Claude Code 2.1.334: /model now has a search box once the list passes 25 models, matching names and model IDs●FAST — Fast mode for Claude Opus 4.8 ended on 11/30. Drop speed: "fast" and Opus 4.8 keeps working●OPUS 4.5 — claude-opus-4-5 retires on 2027/1/22, 50 days from now. The replacement is claude-opus-5-5●IME — On the Windows desktop app, pressing Enter to confirm Japanese IME input can send the message early●NEW — New: Compare tool-use requests across three routes before moving to Bedrock●MCP — More setups now share one local MCP server across Claude Code, Cursor and Antigravity
Articles/Cowork
◈ Cowork/2026-10-18Advanced

I Preloaded a Scheduled Task with head -150: 15.6 KB Read, 3.3 KB for Today

A scheduled task preloaded its daily notes with head -150, and line count turned out to be no budget at all. A date-block reader with a byte ceiling, and how to avoid dropping ideas nobody has used yet.

Cowork74Scheduled Tasks21PreloadingContext3Operations25

✦ Premium Article

I wrote head -150 into a scheduled task's preload because I wanted the read size to stay flat however big the file grew.

One morning I finally measured what those 150 lines were: how many bytes, how many days, and where the cut fell.

The file is a daily research note: date headings stacked newest-first, 26,804 bytes over 244 lines. The first 150 lines came to 15,619 bytes, 58% of the file. The part I actually act on, the newest day's block, was 3,263 bytes, about 21% of what I had read.

The remaining 12.4 KB was the previous four days. Some sections of it matter, but most of it was read and not used.

Below: why cutting by lines is unstable, a small reader that cuts by date block, and the pitfall I almost fell into while changing it. As an indie developer who hands routine chores to scheduled tasks, I am sticking to numbers I measured on my own file.

150 lines is a line count, not a budget

First, a script that prints each date block's lines and bytes and shows where head -N lands. It assumes ## YYYY-MM-DD headings, one per day.

#!/usr/bin/env python3
"""Per-date-block lines/bytes, and where head -N cuts."""
import re
import sys
 
path, head_n = sys.argv[1], int(sys.argv[2]) if len(sys.argv) > 2 else 150
lines = open(path, encoding="utf-8").read().split("\n")
 
blocks, cur = [], None
for no, line in enumerate(lines, 1):
    m = re.match(r"## (\d{4}-\d{2}-\d{2})", line)
    if m:
        cur = {"date": m.group(1), "start": no, "lines": 0, "bytes": 0}
        blocks.append(cur)
    if cur:
        cur["lines"] += 1
        cur["bytes"] += len(line.encode("utf-8")) + 1
 
for b in blocks:
    print(f'{b["date"]}  start {b["start"]:>4}  {b["lines"]:>3} lines  {b["bytes"]:>5}B  {b["bytes"]/b["lines"]:>6.1f}B/line')
 
total = sum(len(l.encode("utf-8")) + 1 for l in lines)
got = sum(len(l.encode("utf-8")) + 1 for l in lines[:head_n])
print(f"head -{head_n}: {got}B / total {total}B ({got/total:.0%})")
cut = next((b for b in reversed(blocks) if b["start"] <= head_n), None)
if cut:
    print(f'cut lands in the {cut["date"]} block, line {head_n - cut["start"] + 1}: {lines[head_n-1][:40]}')

Bytes are counted with encode("utf-8"), not len(line), because Japanese characters take three bytes each. Counting characters hides most of the difference between lines.

Here is the output on my file.

Date blockLinesBytesPer line
10-18 (newest)313,263105.3B
10-17292,28478.8B
10-16302,53984.6B
10-15384,967130.7B
10-14384,648122.3B
10-13374,756128.5B
10-12384,195110.4B

What surprised me is that similar line counts can differ by more than 2x in bytes: 10-17 is 29 lines and 2,284 bytes, 10-15 is 38 lines and 4,967 bytes. One day averages 78.8 bytes per line, another 130.7.

So what head -150 delivers swings by nearly 2x depending on how long the recent lines happened to be. "150 lines, so it's constant" only holds when line length is constant.

The cut lands somewhere meaningless

The last line of the same script showed something else: line 150 is line 18 of the 10-14 block, in the middle of a section, just before a note about analytics not being fetched that day.

Four days (10-18 to 10-15) fit cleanly, and the fifth is cut off mid-section. Because the newest day sits on top, nothing I needed was lost, but that was luck.

I also checked section sizes across the file: A (primary sources) 5,383 bytes, B (pain points) 6,105, C (demand) 1,250, D (evergreen) 1,106, E (deadlines) 2,003, F (today's instructions) 2,441, G (angle ideas) 6,082. F, the section I lean on every morning, is about a tenth of the file; A, B and G make up most of the weight.

Cutting by lines cannot see that imbalance. It made more sense to read in the same units the notes are written in: date blocks and sections.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦You can check, with one script, how many bytes a head -N preload really reads from your own file and where the cut lands
✦You can switch a growing daily-notes file to a reader that takes the newest day in full and only the needed sections of older days, with a byte ceiling you can log
✦You can spot, before cutting, that dropping old days also drops ideas nobody has used yet
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
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 $10 for lifetime access
View Membership →

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-12-02
When a Scheduled Task Stops on 'denied by the auto mode classifier', I Move the Destructive Step Into Its Own Call
A Cowork scheduled task stopped on 'Permission for this action was denied by the Claude Code auto mode classifier'. How to tell this message apart, the order I narrowed it down in, the split-and-replace fix, and a script that checks task instructions beforehand.