feat(cli): add a map, a précis, and a size signal (WI-P4/P5/P6)#100
Merged
Conversation
…rge_payload) Measured live: load-delegated-criteria 513,570 bytes, load-institutional- system 396,609, get-law 276,748, get-case 82,700. Nothing warned about any of it, and the only narrowing tool was --article, which presumes you already know which article you want. Reading a whole statute to find that out is the expensive way to ask a cheap question. --toc (WI-P4) returns chapter headings, article numbers and titles, and deleted/moved status, with no article text: 276,748 → 18,831 bytes on 개인정보 보호법, 6.8% of the full load. Heading rows are excluded from article_count — law.go.kr threads them through the article list tagged 전문 with a neighbouring article's number, and counting them inflates the very number a caller uses to judge whether a full load is affordable. The 제0조 move placeholder is dropped rather than forwarded, since passing it through sends a caller chasing an article that does not exist. --brief (WI-P6) blanks text/full_text on cases, constitutional decisions and interpretations, keeping the 요지: 82,700 → 14,044 bytes, 17.0%. It returns the same type — a narrower one would break every consumer's field access for a difference that belongs on the envelope. flags.brief.withheld lists what was actually there, so brief mode never claims to have hidden a section the source never had. large_payload (WI-P5) is measured on the serialized data, not guessed from a row count: 139 short articles and 20 long ones differ by an order of magnitude, and a size check written against real output keeps working for commands added later. Searches are exempt — candidate breadth is what resolves ambiguity, and 20 hits already costs ~18,000 characters. Two defects surfaced while building this, both pre-existing: - 조문내용 arrives as a nested array when a row carries both a 장 and a 절, and `str()` on that produced `[['제3장 …', '제1절 …']]`, which then travelled through get-law as if it were the statute's own wording. Wrong in a way a reader cannot detect from the output. - The P8 smoke passed load-legal-context-bundle a positional query when the parser wants --query, so argparse rejected it, exit 5 was in the allowed set, and the case was green while covering nothing. The smoke now rejects usage_error outright, and exercises --toc/--brief as the separate dispatch branches they are. Serialization gains an opt-in `_omit_when_empty`. Present-but-null is normally the right default — it tells a consumer the concept exists and is unset — but on a 139-entry map the placeholders outweighed the content. Note: the plan's ~10KB target for --toc is not met at 18.8KB. Reaching it would mean dropping entry_kind and still landing at ~15KB; the estimate predates measuring what 139 entries cost. --brief lands at 17% rather than the planned ≤10% because the remainder is mostly summary, and cutting 요지 would remove the only thing brief mode is for. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Measured live on 2026-07-19, bytes of the emitted envelope:
load-delegated-criteria --budget standardload-institutional-system --budget standardget-law(139 articles)get-case(one decision)Nothing warned about any of it. The only narrowing tool was
--article, which presumes you already know which article you want — and reading the whole statute to find that out is the expensive way to ask a cheap question.(The bundle-loader figures were the plan's unmeasured item.
load-delegated-criteriaturned out to be the largest output in the package, larger thanget-law.)What
get-law --toc(P4) — chapter headings, article numbers and titles, deleted/moved status. No article text. 276,748 → 18,831 bytes (6.8%).article_count: law.go.kr threads them through the article list tagged 전문 reusing a neighbouring article's number, and counting them inflates the very number a caller uses to judge whether a full load is affordable.제0조move placeholder is dropped rather than forwarded — passing it through sends a caller chasing an article that doesn't exist.--brief(P6) on cases, constitutional decisions and interpretations — blankstext/full_text, keeps the 요지. 82,700 → 14,044 bytes (17.0%). Returns the same type; a narrower one would break every consumer's field access for a difference that belongs on the envelope.flags.brief.withheldlists what was actually present, so brief mode never claims to have hidden a section the source never had.flags.large_payload(P5) — measured on the serialized data, not guessed from a row count (139 short articles and 20 long ones differ by an order of magnitude), so it also covers commands added later. Searches are exempt: candidate breadth is what resolves ambiguity, and 20 hits already costs ~18,000 characters (§3.1 keepsdisplay=20).Two pre-existing defects surfaced
조문내용nested-array repr leak. When a row carries both a 장 and a 절, law.go.kr returns a nested array;str()on it produced[['제3장 …', '제1절 …']], which travelled throughget-lawas if it were the statute's own wording. Wrong in a way a reader cannot detect from the output.load-legal-context-bundle— it passed a positional query where the parser wants--query, argparse rejected it, and exit 5 was in the allowed set. The smoke now rejectsusage_erroroutright and exercises--toc/--briefas the separate dispatch branches they are.Deviations from the plan's acceptance criteria
Reporting rather than contorting to hit them:
--toclands at 18.8KB, not ~10KB. Droppingentry_kindtoo would still leave ~15KB; the estimate predates measuring what 139 entries cost in JSON structure. Serialization gained an opt-in_omit_when_emptywhich already cut 30.3KB → 18.8KB.--brieflands at 17%, not ≤10%. The remaining 14KB is mostlysummary(3,680 chars). Cutting it would hit the number by removing the only thing brief mode is for.Verification
Live: full
get-lawfireslarge_payload {chars: 139078, articles: 139}; 대한민국국기법 (12 articles, 16.5KB) stays quiet;--tocrenders headings correctly post-fix;--briefwithholds[text, full_text].474 deterministic tests pass (19 new).
🤖 Generated with Claude Code