How your lifecycle gets set up
How much you configure here depends on the lifecycle strategy you picked during onboarding:- Managed - The agent auto-discovers your install, build, and run scripts by analyzing the codebase, attempting to start the application, and recording what works. You review the result, correct anything it got wrong, and validate. You don’t write the scripts from scratch.
- Connect - There are no install, build, or run scripts to configure. talks to an app you keep running, so this side only needs a base URL and a health check command.
The lifecycle strategy is chosen once during onboarding. If you’re not sure which one you picked or what each implies, see Lifecycle Strategy.
How It Works
maintains lifecycle configurations at the project level, with separate entries for origin and target:- Origin - How the source application builds and runs. Discovered during onboarding and used as the behavioral baseline for functional testing.
- Target - How the destination application builds and runs. Discovered automatically during the foundation milestone (Milestone 1) and used to verify that migrated code works correctly.
The Lifecycle Setup Page
Open the lifecycle setup from the roadmap sidebar by clicking the Lifecycle entry. The drawer shows Origin and Target tabs - one for each side of the migration.
Scripts
Ordered shell scripts that bring your application to a healthy, running state. Common scripts include:
- Inline code editor - Edit the script content directly. Scripts are executed as shell commands.
- Logs - View the stdout output from the last validation run.
- Errors - View stderr output. A bug icon appears on the script header if the last run failed with stderr output.

Environment Variables
Key-value pairs your application needs at build or runtime. Variables discovered from the codebase are pre-populated; you can add, edit, or remove them. Variables marked as secrets are encrypted at rest. Tick the Secret checkbox on a variable to mark it as a secret; once marked, the value is masked and a show/hide eye icon appears so you can reveal it when needed.Lifecycle Document
A markdown overview describing how the application is structured, the execution order of scripts, and how each phase fits together. For Modelcode Hosted projects, this document is auto-generated during lifecycle discovery. You can edit it to add context the agent might have missed.Validation Status
The status bar at the top of the lifecycle setup page shows the current validation state:
Authentication Handling
When discovers or validates your lifecycle, it probes API routes beyond the health endpoint to check whether the application has authentication that could affect automated testing.What Morph handles automatically
can detect and handle two types of authentication without manual intervention:- Disable flags — Many frameworks offer an environment variable or config setting that disables authentication in development or test mode (for example
DISABLE_AUTH=true,AUTH_ENABLED=false, or framework-specific flags likeEnableTesting). When finds one, it registers the variable, restarts the application, and verifies that protected endpoints are now accessible. - Static tokens — If the application uses a fixed API key or Bearer token (e.g. an
X-API-Keyheader), prompts you for the token value, stores it as an encrypted secret, and adds a verification script that confirms the token works.
What requires your attention
- Session-based login (username/password) — Applications that require a
POST /logincall to obtain a session cookie or Bearer token. reports this as detected but unsupported for automated bypass. - OAuth / SSO / MFA — External identity provider flows that involve browser redirects, third-party consent screens, or multi-factor challenges. These cannot be automated.
Manual steps for unsupported auth types
If can’t figure out your application’s auth automatically, you can prepare the environment yourself so that protected surfaces become reachable. Below are common patterns — pick the one that fits your stack.Add a test-mode environment variable
Most frameworks have a way to relax or skip authentication in non-production environments. Add that variable to the Environment Variables section of the lifecycle setup page, for example:
re-validates after every environment variable change.
Seed a test user and add a login script
For session-based auth, you can create a test user and add a lifecycle script that logs in before tests run:- Add a
bootstrapscript (ordered beforehealthcheck) that seeds a test user:
- Add an
authcheckscript (ordered afterhealthcheck) that obtains a session token and verifies a protected route:
- Store the credentials (
testuser/testpass) as secrets in the environment variables section so they are encrypted at rest.
Use the connect strategy with a pre-authenticated instance
When none of the above options work (e.g. OAuth with an external IdP that cannot be mocked), consider the connect strategy. Run the application yourself with authentication already configured, and point at the live, authenticated instance. skips install/build/run and only needs a base URL and health check.Editing and Re-validating
After making changes to scripts, environment variables, or the lifecycle document:- Click Save Changes to persist your edits
- Click Re-validate to run the full validation sequence again
Lifecycle Discovery
For Modelcode Hosted projects, discovers the lifecycle configuration automatically at two points:- During onboarding - After you select the Modelcode Hosted build environment, analyzes the origin repository, identifies how to install, build, and run it, and creates the origin lifecycle configuration.
- During the foundation milestone - When Milestone 1 starts, runs a lifecycle discovery step for the target repository. This ensures the target application can build and run before the agent begins writing migration code.
Tips
- Check the Errors tab first. When a script fails, the stderr output usually points directly at the problem - a missing dependency, a wrong port, or a typo in the command.
- Keep scripts minimal. Each script runs in a fresh shell process. If two commands need to share shell context (e.g., activating a virtual environment before running a command), concatenate them with
&&in a single script. - Use environment variables for configuration. Avoid hardcoding ports, database URLs, or API keys in scripts. Set them as environment variables so they are easy to change and can be encrypted if sensitive.
Related Docs
Lifecycle Strategy
Choose whether the agent builds and runs your app, or connects to a running one
Self Hosted
Run ModelDaemon on your own infrastructure for projects with private dependencies
Core Concepts
Build environment terminology and mental model
Milestones
How lifecycle discovery fits into the foundation milestone
Validation Hub
How lifecycle configuration enables functional test execution, and where lifecycle script results are reported