How do we fight bloat in agent-produced systems?

Type: types/note.md · Tags: kb-maintenance, curation, context-engineering, document-system

Stakes

Agents make generating both code and natural-language artifacts — notes, documentation, specifications, instructions, tests, and schemas — cheap. Software engineering already has many partial defenses against code bloat (dead-code elimination, refactoring, linters, dependency budgets, YAGNI), yet none has settled bloat even for pure software. Systems like Commonplace combine natural language and code, which adds prose, conventions, links, and routing surfaces that lack static reachability checks.

Bloat in these mixed systems compounds through three channels:

  • Context and routing cost: duplicated or verbose prose, overlapping conventions, and extra routes compete for bounded agent attention and raise lookup cost.
  • Maintenance and drift load: every retained artifact, copy, or structure must be reconciled when neighboring code or claims change; maintenance capacity must match harmful-artifact inflow.
  • Recursive exposure: retained prose and code can become input to later agents. Anecdotal reports about generated code comments suggest that later agents may repeat a misleading explanation; they do not establish how often this happens.

This query stays open as long as bloat control relies on periodic manual sweeps and ad-hoc restraint; it narrows or retires if a tested lifecycle regime keeps both code and natural-language bloat bounded under sustained autonomous production.

Current answer

Our current answer is to follow five principles:

Unsettled

  • Would removing this passage change any decision or answer? Code has unused-symbol checks, call graphs, and test coverage — and even those miss live but over-engineered code. Natural language has no comparable reachability check: a redundant section, obsolete convention, or overlapping note can stay syntactically valid and linked without changing any real decision or answer.
  • Cross-boundary bloat between code and prose. Mixed systems accumulate co-bloat across the boundary: prose restating live code, code enforcing obsolete prose conventions, tests locking in incidental behavior, and prompt guards compensating for code bugs that were later fixed. We lack a reliable way to surface when a change on one side has made an artifact on the other side redundant.
  • Missing triggers for retirement. Cheap adoption and weak retirement accumulate cost notes that a cleanup procedure exists once a target is named, but we lack reliable signals and rules that route obsolete prose, conventions, or code into retirement review before migration cost compounds.
  • Separating useful redundancy from bloat. Some repetition pays — checked routing catalogues, explicit relations that prevent reader misreading, or local warnings placed next to the code they constrain. We have no practical test that reliably separates load-bearing redundancy from bloat without case-by-case judgment.
  • When we ask for a shorter note, does the revision remove redundant content or just use fewer words to say the same thing? In a controlled training experiment, a length penalty led one small model to prefer the shorter of two correct constructions. The study did not test revision prompts or measure reader comprehension. One conjecture in kb/log.md is that asking for both thoroughness and brevity could preserve redundant content while making sentences harder to parse.
  • When do agents add rather than consolidate? When an agent adds another guard instead of revising an existing one, what made addition the easier choice? An agent that cannot see the existing guard needs a way to find it. An agent that finds the guard but cannot tell what depends on it needs a way to check the consequences of changing it.

Relevant Notes: