# Adopt Elide in an existing project

> Migrate a Java, Kotlin or Spring Boot project to Elide with an AI coding harness.

`elide adopt` starts an AI coding harness with a migration prompt for the project in the current directory. The
harness edits files; Elide does not. Other languages in the project are kept.

## What works today

These shapes pass `elide install`, `elide build`, `elide test`, startup, and the original build, starting from a
fresh checkout:

| Project shape | Existing build | Tested on |
| --- | --- | --- |
| Java, Spring Boot application | Maven | Spring Petclinic: dependencies, resources, tests, runnable app, JAR |
| Java, Spring Boot service | Gradle | Spring REST service: dependencies, resources, tests, HTTP readiness |
| Kotlin/JVM command-line app | Gradle Kotlin DSL | Single module with Kotlin serialization and coroutines |

The prompt is tested with Codex. Multi-module, Android, and unusual generated-source or annotation-processing setups
are untested.

## Before you start

1. Install and sign in to a harness:

   | Choice | Executable | Harness |
   | --- | --- | --- |
   | `codex` | `codex` | OpenAI Codex CLI |
   | `claude` | `claude` | Claude Code |
   | `omp` | `omp` | OMP |

2. Commit the project, so the migration is one reviewable diff.
3. Build it once with Maven or Gradle, so there is a known-good baseline.

## Interactive adoption

```shell
elide adopt
```

Elide asks three questions, then starts the harness.

### Choose a build strategy

| Strategy | Harness does |
| --- | --- |
| **Elide build** | Writes `elide.pkl`, switches to `elide build`, and validates with Elide. Maven or Gradle files stay until that passes. |
| **Existing build** | Keeps Maven or Gradle; adopts Elide runtime and toolchain commands only. |

For a Spring Boot app built with Elide, choose **Elide build**; the prompt checks the entry point, Spring
dependencies and plugins, resources, tests and packaging.

### Choose a harness

Choose `codex`, `claude` or `omp`. Elide prints the path of the harness log before starting, then shows a status
display. `--log` also streams the harness output; manual approval always streams it.

Success means the harness exited 0, not that the migration is correct.

Append Markdown guidance to the prompt; repeat the flag to add fragments in order:

```shell
elide adopt --prompt-append ./adoption-guidance.md
```

### Choose an approval mode

| Mode | Behavior | Use for |
| --- | --- | --- |
| `auto-approve` | The harness's automatic approval; its sandbox rules apply. | A committed worktree you will review. |
| `manual-approve` | You approve each action. | Unfamiliar or sensitive repositories. |
| `yolo` | Bypasses the harness's approvals and sandbox where it can. | Disposable environments without secrets. |

Cancelling a question exits without starting the harness. Ctrl+C stops the harness, keeps the log, and exits 130.

## Run without questions

```shell
elide adopt \
  --build elide \
  --harness codex \
  --approval auto-approve \
  --non-interactive
```

`--non-interactive` requires `--build`, `--harness` and `--approval` (`auto-approve` or `yolo`). Without it, preset
answers skip their questions:

```shell
elide adopt --build elide --harness claude
```

## Validate the migration

Review the diff: dependency versions, source and resource directories, entry point, tests and packaging. Then run:

```shell
elide install
elide build
elide test
```

Run the original Maven or Gradle build too, while it exists. If the result is wrong, read the log, revert, and retry
with a `--prompt-append` file.
