Contract Graph · Concept 06

Upgrade

How to move an existing Contract Graph install to 0.6.0. In a terminal run cg init. In a new chat run /cg-warmup — the same skill whether this repository already has a graph or not.

This is the human path. cg init is a terminal command. /cg-warmup is a chat skill for existing code with or without Contract Graph already installed. Installed .agents/cg/workflow.md is preserved and may still say “warmup once”; the replaced skill is the procedure.

Sequence

In a terminal

npm install --global contract-graph@0.6.0
cd <repo>
cg init --yes --docs docs
cg verify

Keep the same --profile set; add a profile only if you need a new harness. A stored all selection expands to agents, claude, and copilot. Non-interactive init needs --docs docs (or another single-directory root) when docs/ already exists. Reload the IDE so the replaced /cg-* skills appear.

In a new chat

/cg-warmup — adoption if roots are unmapped or still need descent, reseed when cg modules exits 0. After init, git should show skills, schemas, hooks, and first-line pointers changing; existing contracts stay clean until /cg-warmup runs.

Adding a harness later is another cg init --yes --profile claude (keep --docs), not warmup. cg sync copies each module AGENTS.md to CLAUDE.md.

Adoption or reseed

cg modulesWhat warmup does
any UNMAPPED or DESCENDAdoption (or resume): write missing contracts
exit 0, all governedReseed: additive only

cg modules lists roots the language adapters detect. Directories that already have a contract.yaml but are not adapter roots do not appear as UNMAPPED. Exit 0 means those detected roots are governed; reseed still walks children from the graph and current cues. You do not choose a different skill for “already has Contract Graph” versus “existing code with no graph”. Both use /cg-warmup in chat after cg init in a terminal.

0.6.0 catalogs

Architecture, engineering, and product now share the principles-v1 schema. cg init preserves authored catalogs and does not convert them. If verification fails on the old format, preview first:

cg migrate-principles
cg migrate-principles --reasons /path/to/reasons.json --json
cg migrate-principles --reasons /path/to/reasons.json --write
cg init --yes --docs docs
cg verify

Preview writes nothing. Supply rationale only for IDs that still need a reason. Then rerun init and, in a new chat, /cg-warmup.

What a non-empty reseed writes

A connected older graph is the high-value reseed case. Against current cues it may add a child contract.yaml for a separable package that already exists; add the child edge and the child path on existing routes whose when already names that surface; move the child's services off the parent surface so they are not duplicated; and append the next unused Pnn-nn rows with detectors already on disk (unproven — … only when none exists).

purpose, forbids, and existing P IDs stay. In-flight cg-plan trees and an older adoption corrective set are left in place. The delta is <docs>/plans/warmup-reseed-delta.md until the owner files it under decisions.

What init replaces

cg init replaces skills, schemas, and hooks. It preserves contracts, architecture.yaml, product.yaml, engineering.yaml, enforcement.yaml, workflow.md, phases.json, and docs. It does not merge catalogs, and it does not delete leftover .agents/rules from older installs. There is no cg upgrade verb.

Older graphs

A connected older graph still takes reseed after cg init. Warmup can add child contracts, product rows, and route targets that current cues require. Consecutive reseed with unchanged cues should write no file and stop.

Stale catalog

Typical older installs already have hierarchy.kinds, graph.recurse, graph.surface, and graph.adapters. If cg verify reports the catalog is older than this verifier, copy the packaged architecture catalog or amend it deliberately. cg init will not overwrite it.

What reseed will not do

  • Copy a template over an existing contract.yaml.
  • Blank purpose, forbids, or existing P IDs.
  • Merge packaged architecture.yaml into the repository.
  • Move application code.
  • Prove that every implementation dependency matches the graph.

Reseed can miss too: it is an agent walk of current cues, not import-correspondence.