---
title: "Turn a terminal session into steps someone else can run | Proofline"
description: "Hand over a short script that runs from a clean shell, with a transcript as support."
url: https://proofline.sh/learn/terminal-session-handoff/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Turn a terminal session into steps someone else can run

Hand over a short script that runs from a clean shell, with a transcript as support. History and transcripts leave out the state that made the commands work: the directory, exported variables, aliases and functions.

Broken dependencies The Proofline team November 24, 2026 3 min read

## A trace that leaves a question open

```
cd /tmp
export RATE=5
curl() { echo fake; }
curl x
```

Run with `bash -x`, this prints:

```
+ cd /tmp
+ export RATE=5
+ RATE=5
+ curl x
+ echo fake
fake
```

The trace shows the directory and the variable because the script set them. It shows `curl x` followed by an `echo`, which is the only hint that `curl` is a function here and not the program. If the function and the variable had come from a profile file, the trace would hold neither definition, and the receiver would run the real `curl`.

## Run it where nothing is inherited

```
env -i HOME="$(mktemp -d)" PATH=/usr/bin:/bin bash --noprofile --norc -eu steps.sh
```

`env -i` starts with an empty environment, and the options stop bash from reading its startup files. `-u` fails on a variable that you forgot to define. Each failure is a fact that the handoff was missing: add it to the script, or to a list of prerequisites if it is a secret. Never put the secret's value in the script.

The remaining differences are in files, installed versions and the network. Print the versions at the top of the script, with `node --version` and the like.

## Record the status

[`script`](https://man7.org/linux/man-pages/man1/script.1.html) records a session with its output. Its exit status is 0 unless you ask for the child's with `-e`:

| Command | Exit |
| --- | --- |
| `script -qc 'false' /dev/null` | 0 |
| `script -qec 'false' /dev/null` | 1 |

With `-e`, and a log file, the recording's last line was:

```
Script done on 2026-11-24 09:08:39+00:00 [COMMAND_EXIT_CODE="3"]
```

The file contains control characters, and everything that was displayed. A password typed at a prompt that does not echo is not displayed, while one on a command line or in a printed configuration is. Read the recording before you send it.

## Choose the form

| Receiver's task | Send |
| --- | --- |
| Repeat it | The script that passed in a clean shell |
| Check what you saw | The script, and the transcript with exit codes |
| Continue from the middle | The script up to that point, and the state it leaves |
| Judge whether a step was done in production | The audit record. Your terminal is a weaker source |

## Make the script say what it expects

End it with an assertion and not with output to be read by eye:

```
got=$(wc -l < export.csv)
[ "$got" -eq 10001 ] || { echo "expected 10001 lines, got $got"; exit 1; }
```

A receiver who gets a different number knows at once, and knows which number you had.

## Worked example

This example is fictional. Ana pastes her history into a ticket: six commands that rebuild a search index. Ben runs them and gets an empty index. Under `env -i`, Ana's own commands fail at the second with `INDEX_ENV: unbound variable`. Her profile exports it, and without it the tool silently uses a default. The script now fails when the variable is missing, and Ben decides which environment to rebuild instead of rebuilding the wrong one.

If output went through a pipe, [its status may be lost](/learn/pipeline-hides-test-exit-code/). Return to [handing over evidence](/learn/engineering-handoff-evidence/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [The log says failed and the step is green](/learn/pipeline-hides-test-exit-code/)
    
    Code review The Proofline team November 24, 2026 3 min read
    
-   ### [Hand over enough evidence for the next engineer to decide](/learn/engineering-handoff-evidence/)
    
    Code review The Proofline team November 24, 2026 5 min read
