feat(constraints): a comment narrates as well as instructs - #21
Merged
Conversation
§51 measured where the fallbacks are: 29 of 29 code-bucket fallbacks on the frozen corpus
are CONSTRAINT_DIRECTIVE_LOST. Not drift, not AST -- this gate, every time.
§42 scoped it by region (an instruction lives in a comment, not an expression). This
scopes it by mood within that region, because a comment is also where a codebase explains
its own history. Roughly twelve of the 29 were sentences like "the MCP branch of runCli
has always read these two", "It never did: this branch bypassed pruning", "could never
have worked", "a saving that never reached the wire". Losing one of those costs a reader
some history; losing "never hash items matching preserveKinds" costs a caller a rule, and
the gate refused the whole file for either.
This gate protects content, so unlike §48 and §50 a wrong call deletes an instruction
rather than costing output size. Narrowed three ways, all in the safe direction:
- only `never` and `always`, the two keywords equally comfortable describing and
instructing. `must have been called before` is a requirement about a past state, and
a perfect-tense test applied to `must` would drop it.
- only provable perfect/past constructions. "is always deterministic" and "do not
support" are descriptive too and are left firing on purpose -- there the line is
genuinely blurry, and under-narrowing costs reduction while over-narrowing costs
content.
- unanimity: a segment is dropped only if every keyword in it is narrative-capable, so
"this has always been true, so you must call it first" still fires.
The negative control is the load-bearing test: sixteen real instructions, several verbatim
from this repo, asserted to keep firing. A rule that drops one of those is not a better
rule at any reduction figure.
Per-row over 576 rows, both routes, target 0.3, against v1.4.0: 572 byte-identical, 4
fallbacks fixed, 0 new, 4 newly reducing, 0 stopped, and no change to any row that was
already reducing. The four are adapters/mcp/tools.ts, cli/main.ts, gateway/exec.ts and
gateway/proxy.ts -- exec.ts being the file containing "could never have worked".
The gain is NOT portable and that caveat is in §52: all four are this repository's own
source, which M11 measured as 32.8% comment prose written in a what-used-to-be-true style.
Python gained zero. The 6pp on the TypeScript bucket is the corpus-bias trap CLAUDE.md
warns about, showing up as a favourable number, which is the harder direction to notice.
657 tests, typecheck, lint and build green.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ive-scope # Conflicts: # DECISIONS.md
§7 item 5 is done as a first pass (§52) with its caveat carried forward: the 6pp is this repository's own narrative comment style, not a portable figure, and Python gained zero. Names what is deliberately still open on that axis -- descriptive present-tense uses -- and why over-narrowing a content-protecting gate is the expensive direction. Suite count 628 -> 657. Co-Authored-By: Claude Opus 5 <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.
§51 (merged in #20) measured where the fallbacks actually are: 29 of 29 code-bucket fallbacks on the frozen corpus are
CONSTRAINT_DIRECTIVE_LOST. Not drift, not AST — this gate, every time. This is the first pass at it.§42 scoped the gate by region: an instruction lives in a comment, never in an expression, which stopped it firing on
logger.critical(exc). This scopes it by mood within that region, because a comment is also where a codebase narrates its own history.What it was refusing
Inspecting the matched text behind those 29 fallbacks, roughly twelve read like this:
Losing one of those costs a reader some history. Losing "never hash items matching preserveKinds" costs a caller a rule. The keyword is identical, and the gate refused the whole file for either.
Narrowed in the safe direction, three ways
This gate protects content — unlike §48 and §50, where a wrong call costs output size, a wrong call here silently deletes an instruction.
neverandalways, the two keywords equally comfortable describing and instructing.must,must not,do not,required,critical,only if,except when,make sure toare untouched — "must have been called before" is a requirement about a past state, and a perfect-tense test applied tomustwould drop it.have/has/had, or a following past-tense verb. "is always deterministic" and "do not support" are descriptive too and are left firing on purpose: there the line between describing a constraint and stating one is genuinely blurry.The negative control is the load-bearing test
test/unit/narrative-directive-scope.test.tsasserts the eight narrative sentences stop firing — and that sixteen real instructions still do, several verbatim from this repository. A rule that drops one of those is not a better rule at any reduction figure, and the test says so directly rather than leaving it to a reduction number two layers away.Measured — per-row, 576 rows, both routes, target 0.3, against v1.4.0
TypeScript file route: 39 reduced / 16 fallbacks → 43 / 12, aggregate 18.52% → 24.58%. The four are
adapters/mcp/tools.ts,cli/main.ts,gateway/exec.tsandgateway/proxy.ts—exec.tsbeing the file that literally contains "could never have worked".The caveat matters more than the headline
Python gained nothing — 0 of the 4. Every recovered file is this repository's own source, and this repository is unusually narrative: M11 measured 32.8% of
src/as comment prose, written in a what-used-to-be-true style. pip's comments describe behaviour in the present tense and were never caught.So the 6pp on the TypeScript bucket is not a portable estimate. It is the corpus-bias trap
CLAUDE.mdwarns about, showing up as a favourable number instead of an unfavourable one — the harder direction to notice. What is portable is the shape: zero regressions, and four files that produced nothing now produce something.Still open on this axis, deliberately
Descriptive present-tense uses still raise directives. §50's other open item is the same gate: it is why the better sub-region coverage setting costs two working files.
657 tests, typecheck, lint and build green.
🤖 Generated with Claude Code