Summary
Add cgis init-ontology — auto-propose a starter patterns.yaml from the measured graph, so cgis_drift is usable without hand-authoring the ontology.
Motivation
cgis_drift is the most valuable feature but has the steepest onboarding cost: it needs a hand-written patterns.yaml binding each domain (fqn_prefix) to an expected_pattern + drift_tolerance. On a fresh repo (drift on a clone is a no-op without it), this is the single biggest barrier to adoption.
When I onboarded a real FastAPI backend I did this manually and mechanically:
- enumerate top-level packages → candidate domains (
app.services, app.crud, app.utils, …)
- measure each domain's actual triad census
- pick the closest of the 5 templates as
expected_pattern
- set
drift_tolerance = measured + small margin (ratchet baseline)
Steps 2–4 are exactly what the engine already computes. It can propose the file.
Proposal
cgis init-ontology(db_path, out="patterns.yaml", margin=0.03, min_nodes=10)
- discover candidate domains from package/module structure (configurable depth)
- for each, compute the census and pick the nearest template by TV distance (report the fit + the runner-up)
- emit
drift_tolerance = measured + margin and a # measured ≈ X comment per domain
- domains below
min_nodes → hygiene-only (no expected_pattern)
- reuse the existing language
profiles / patterns blocks verbatim
Output is a ready-to-edit baseline the user ratchets down over time, instead of a blank page.
Impact
Turns drift from "expert-only, write YAML first" into "run one command, get a baseline." This is the difference between a demo and something teams actually adopt in CI.
Summary
Add
cgis init-ontology— auto-propose a starterpatterns.yamlfrom the measured graph, socgis_driftis usable without hand-authoring the ontology.Motivation
cgis_driftis the most valuable feature but has the steepest onboarding cost: it needs a hand-writtenpatterns.yamlbinding each domain (fqn_prefix) to anexpected_pattern+drift_tolerance. On a fresh repo (drifton a clone is a no-op without it), this is the single biggest barrier to adoption.When I onboarded a real FastAPI backend I did this manually and mechanically:
app.services,app.crud,app.utils, …)expected_patterndrift_tolerance = measured + small margin(ratchet baseline)Steps 2–4 are exactly what the engine already computes. It can propose the file.
Proposal
drift_tolerance = measured + marginand a# measured ≈ Xcomment per domainmin_nodes→ hygiene-only (noexpected_pattern)profiles/patternsblocks verbatimOutput is a ready-to-edit baseline the user ratchets down over time, instead of a blank page.
Impact
Turns drift from "expert-only, write YAML first" into "run one command, get a baseline." This is the difference between a demo and something teams actually adopt in CI.