A write-time 400-line Rust file cap

The number is crude. The useful part is that oversize is rejected on the write path before a large file becomes local gravity.

The 400-line cap matters because it runs on the write path. The interesting part is timing, not numerology.

A large module is not a problem because the number itself looks ugly. It becomes a problem when the repository starts teaching future edits that this file is a normal place to keep adding more code.

What the current rule does

The current size rule is intentionally simple. In file_conventions.rs, it counts physical lines in Rust source and fails when a file exceeds 400 lines.

RUST
const MAX_RS_FILE_LINES: usize = 400;

fn physical_line_count(content: &str) -> usize {
    content.lines().count()
}

When the cap is crossed, the rule emits ANTI-SIZE-001 and suggests a specific next move:

TEXT
split modules (dir-module + semantic submodules)

One current report is enough to make the path concrete. A Rust edit against musha/crates/core/src/ssot/run/core.rs is recorded as lines=462 cap=400 on the owned write path.

Why a crude cap still helps

Accepted structure teaches the next edit. Once a broad file exists, "just one more helper" becomes the path of least resistance. That is true for people, and especially true for models that learn from the local repository.

A local hook or CI job could also count lines. The useful property here is smaller: on the owned write path, the oversize file never becomes accepted code on that lane.

What it changes in the write loop

Late comments about module size can still be correct, but by then the repository has already accepted the larger container. The file has already become local gravity.

A crude write-time rule changes the sequence. The edit pushes a file over the boundary, the write is blocked, and the author has to choose a different move before the larger file becomes normal.

That makes the rule a force function, not a theorem. It is cheap to run, easy to understand, and hard to mistake for grand architectural certainty.

Where the number comes from

The number 400 is policy, not universal truth. Another repository could choose a different budget or combine it with deeper structural checks.

The smaller current claim is enough: on an owned write path, even a crude size rule can push decomposition before file growth becomes accepted habit.

Contents
  1. What the current rule does
  2. Why a crude cap still helps
  3. What it changes in the write loop
  4. Where the number comes from