# First Use On An Existing Repository

Code Factory is most useful when it meets code you already own. Start with one
small feature or risky workflow, not a whole migration.

```powershell
cd path\to\your-repository
pip install factoryline-code-factory==0.23.2 code-factory-1-spec==0.5.4 code-factory-2-forge==0.10.7
factory doctor --json
factory init .
forge adopt <feature> --root .
```

`forge adopt` records a reviewable baseline rather than pretending the factory
generated the repository. Review that SSAT, then move its existing targets into
the state machine without replacing their source:

```powershell
forge expand <feature> --root .
forge gate architected <feature> --root .
forge architect <feature> <feature>.adoption.ssat.yaml --adopt-existing --root .
```

The adoption path records the SSAT digest and unchanged target hashes, creates
only missing SSAT targets, and fails closed if the working code drifts from the
reviewed contract. Then choose the proof that matches your change:

```powershell
forge verify-tests <feature> --root .
factory trace <feature> --root .
factory verify-trace .factory/traces/<feature>.trace.json
```

For a policy that already controls release behavior, add a reviewed evaluator
manifest and prove its rules matter:

```powershell
factory verify-policy --root . --challenge policy.challenge.json
```

The command only certifies an evaluator after its baseline passes and every
deleted or inverted policy rule fails. See [Verify Policy](VERIFY_POLICY.md) for
the manifest format.

To create a new bounded target beside existing work, review the use cases and
deployment routes first:

```powershell
factory targets
factory create "Build a supervised operations console" --target agent-ui `
  --deployment-profile local-operator --out .\operations-console
```

The selected route is written into the starter but grants no deployment
authority. See the [Deployment Guide](DEPLOYMENT_GUIDE.md) before choosing an
external route.

## Tell Us What Happened

The most useful contribution is a real first-run report: what command you ran,
where it helped, and where it made you stop. Open the [first external run
template](https://github.com/zrk222/code-factory/issues/new?template=first-external-run.yml).
Remove secrets, customer data, and private paths before posting.
