Persistent environment for Claude Code and Codex overnight
Set up a remote agent session, verify disconnect behavior, and return to a reviewable branch the next morning.
Maintained by the Matrix OS team. Product instructions are updated with the supported workflow.
The useful overnight result is a change you can review in the morning. Getting there starts with a remote process, a session you can reconnect to, and a task with a clear finish line.
Run Claude Code or Codex on a remote computer to keep work independent of laptop sleep. Matrix OS provides that workspace from $20/month, with agent access and usage billed separately. Try the disconnect once while you are still around; it is a much better time to discover a setup problem.
Three separate things
Your laptop. The computer. The task.
Choose an action to see what changes.
- Viewing device
- Disconnected
- Remote compute
- Still available
- Project files
- Retained
The cloud computer is independent of the viewing device. An agent can continue if its process, credentials, usage allowance, and approvals permit it.
Conceptual guide, not a live status display. Lifecycle behavior depends on the environment and its settings.
Choose the execution path
| Path | Laptop-independent execution | What you configure | Cost |
|---|---|---|---|
| Matrix workspace | Yes | Agent login, project, task boundaries | Matrix plan plus AI |
| Your own server | Yes | Host, session management, recovery | Server plus AI |
| Provider cloud task | Yes, within its lifecycle | Environment and repository access | Provider plan/usage |
| Agent on sleeping laptop | No | Local power settings | Existing local setup |
1. Provision the workspace
Download Matrix Desktop, choose a plan, and open your computer. The eligible first primary computer has a 14-day trial with a card required. Review the price and renewal date before completing checkout. Quickstart.
If you prefer the CLI, install it on your client using one supported method:
npm install -g @finnaai/matrix
# Or: brew install finnaai/tap/matrix
matrix login
matrix shell ls2. Prepare the project on the remote computer
Open Terminal in Matrix, authenticate your Git provider, and clone the project. Install dependencies from the lockfile and run the existing tests. Write down the starting commit, then create a separate branch or worktree.
Authenticate Claude Code or Codex on this computer too. A login on your laptop does not necessarily carry over. Follow the selected provider's account and usage terms.
You now have a baseline. If the tests already fail, let the agent know which failures existed before its work. Otherwise, both of you may spend the night investigating the wrong problem.
3. Start a bounded session
The CLI can start an interactive command on the Matrix computer:
matrix run -it --project main -C projects/my-repo -- claude
# Or use Codex in its own session:
matrix run -it --project main -C projects/my-repo -- codexReplace the project and directory with your actual values. These commands launch the agent; they do not grant unlimited permissions. Matrix CLI.
Give the agent a task contract:
Work on the failing parser test in this branch.
Edit only the parser module and its tests.
Run the relevant tests and report exact results.
Stop if the fix needs production credentials or a destructive migration.
Save a summary with changed files, remaining questions, and the branch name.
Do not merge or deploy.4. Test disconnect before leaving overnight
Start with a short run. Record the terminal tab ID, close the client, then reconnect:
matrix shell ls
matrix shell connect --project main --tab YOUR_TAB_IDUse the original tab ID. A new shell is not evidence that the previous agent session survived. Confirm the process continued and the expected output exists.
5. Review the next morning
Read the summary, but also open the diff and the test output. Check that the change solves the assigned problem and rerun the relevant tests before merging. A confident summary is a useful index to the evidence, not a replacement for it.
If the agent paused for approval, inspect the decision. It may have reached exactly the boundary you set. Answer that request rather than removing every safeguard so the next run looks busier.
If the process ended unexpectedly, check the last log entry and saved state before restarting. You want to continue from what happened, not accidentally launch the same work twice.
When to use Matrix OS vs another overnight path
Use Matrix for a retained browser, terminal, files, and project workspace across agents. Use a managed cloud task when its repository handoff fits. Use your own server when you want to operate the host yourself.
FAQ
Does persistent mean the process survives every reboot?
No. A host restart can end a process even when files remain. Save checkpoints and use the agent's supported resume mechanism after inspecting current state.
Why did my remote agent stop?
Check permissions, model quota, authentication, command errors, and runtime limits. Moving off the laptop removes one failure source, not all of them.
Do Claude Code and Codex share memory automatically?
No such assumption is needed. Save a reviewed project brief and explicitly instruct the next agent to read it. Personal context across tools is a direction to evaluate through visible behavior, not an automatic guarantee.
This is a Matrix OS guide, reviewed October 20, 2026. We compare documented capabilities and explain our recommendations; we have not benchmarked these products against each other. Agent usage is separate from workspace pricing unless stated otherwise.
Start with one real task
Get your Matrix. Visit the homepage to download Matrix OS Desktop for macOS, Windows, or Linux. Start with one repository and one bounded task. The first eligible primary computer has a 14-day free trial; a card is required and billing starts unless you cancel before renewal. Review current plans.

