Skip to content

Change Classification

Every change between two versions of a ContextBrew model is classified by a deterministic engine — not an LLM, not a heuristic you have to trust. This page publishes the rules that engine applies, where they live in code, and the limits of what classification means. Classification is an aid to review, not a compatibility guarantee: a human still reviews what a change was supposed to do.

The engine lives in packages/core/src/semantic-diff/ — one implementation, shared by the CLI, the Studio panels, and the drift instruments (a guard test forbids consumers from re-implementing diff logic).

Class Meaning Typical examples
Breaking Consumers of the model can no longer rely on what existed before Removing an aggregate, requirement, column, navigation edge, table, or screen
Modifying The change alters behavior or constraints but preserves the shape Weakened acceptance criteria, changed invariants, ambiguous renames, modified fields
Additive New optional surface; existing consumers are unaffected New optional field, new story, new screen, confident renames with continuity preserved

Removal of the core structural targets — aggregates, requirements, columns, navigation, tables, screens — is always breaking (BREAKING_ON_REMOVE in change-classifier.ts). Everything else is judged by the severity checks below.

Each change also carries a severity — ERR, WARN, or INFO — computed by analyzeBreakingChanges (breaking-changes.ts). Severities map mechanically to a semantic version level:

  • any ERR → major
  • else any WARN → minor
  • else → patch

The mapping is computed, not declared: the version a change deserves falls out of the severity analysis, and the same analysis drives the drift instruments. Stability gates apply — draft-status models skip ERR checks so early exploration doesn’t cry wolf.

A rename is only recorded as a rename when the evidence supports it: identity continuity (the same id moving) or a content fingerprint with Jaccard similarity ≥ 0.8 (rename-detector.ts, default threshold). Below the threshold, the sub-threshold policy applies — block, warn, or treat as delete+add — rather than silently guessing (delta-engine.ts).

  • It does not prove a change is safe — a compatible-looking optional addition can still be wrong.
  • It does not know your consumers’ code; it classifies the model, not the codebase. For that, run the drift instruments (ctx check) which compare the model against the code.
  • It is not a substitute for review: the class explains what kind of change happened; review decides whether it should have.
  • CLI: ctx diff output between two versions.
  • Studio: the version-compare and working-state views render breaking / modifying / additive badges computed by the same engine.
  • Ledger: every recorded change event carries its classification in the change envelope.