#!/usr/bin/env python3 """Count the job-specific words in a spec, for the goal-drift word caps. Why (2026-11-06): the cap exists so the goal cannot turn into process -- a spec that grows layered rules is how the friends lane's goal drifted. It was counting the wrong words. The sweep writes its generated specs with the lane's whole RULES.md and INTAKE.toml embedded verbatim, plus a shared-lessons block, so c5's `0-search` spec came to 3,047 words of which only 472 were the actual ask. launch.sh refused it at the 1,000-word cap, and the lane's generated jobs could not run at all. Lane rules grow over time, so this gets worse on its own; the no-ops rule added to LANE_RULES_COMMON.md earlier the same day put another ~130 words into every lane's RULES.md and therefore into every generated spec. So the cap measures what somebody actually asked for, and not what the harness injected around it. Blocks that the harness itself wrote into the spec are excluded: --- BEGIN VERBATIM LANE POLICY: --- ... --- END VERBATIM LANE POLICY --- ## Shared lessons ... up to the next heading