Record, copy and replay a task
Record one task in your app, get a small copy of the database rows it touched, then replay the task on that copy as often as you need.
The short version
- Record once, retry as often as you like. Crumbtrail saves the rows a task touched as a small real copy.
- Your app is unchanged. You point it at the copy instead of the original.
- Works with the access you have. The app's login is enough. More access gives a more exact copy.
- Clear results. Every copy says Complete or Incomplete, and why. Recognised passwords are replaced; replacement has limits.
Install, then four commands: init, record, open, reset.
Before you start
You need an app that talks to a Postgres, MySQL or SQL Server database, and a login that can read it. Crumbtrail sits between them only while you record.
- Start on a test or staging copy of the app.
- Know the database address. It looks like
postgres://db.internal:5432/shop. Do not include a password in that address. - Database login passwords. The database passwords you give Crumbtrail are read from environment variables and are not written to the recording.
On Free, start with Your first run. Free works with an app on this computer, over HTTP, PostgreSQL and MySQL, includes saved setups (init), local coding agent tools (assistants) and local checks (check, on your own computer only; the first three saved checks by name never expire), and keeps other recordings for seven days. CI checks, stopping a build and apps on another machine are in Team and Enterprise. Database copies, with open and reset below, are in Team and Enterprise.
Prefer a browser? Run crumbtrail desk serve and open the address it prints. It does everything on this page. Add --help to any command for its options.
Install Crumbtrail
One command installs crumbtrail on Linux, Mac or Windows. It checks the download first and installs to your own folder without administrator rights.
Sign in at https://crumbtrail.ai/download and generate your personal install command.
To sign in from a terminal, run crumbtrail sign-in, open the address it prints and enter the code.
Check it:
crumbtrail --version
Done when it prints a version number. If the shell says crumbtrail: command not found, open a new terminal window. On Linux and Mac you can also add ~/.local/bin to your PATH: export PATH="$HOME/.local/bin:$PATH". To install by hand or offline, see Download.
Add your app
Save a setup once for each app, so later commands need almost no options. In the console this is Apps, then Add app.
Repeat --database for every database the app uses, or use --from-app to read the addresses from the app's settings file (.env or appsettings.json, Laravel's pgsql and sqlsrv settings included). Any password in that file is dropped. Then crumbtrail record -- YOUR-START-COMMAND starts the app already pointed at the recorder: two commands in all.
crumbtrail init --database shop=postgres://db.internal:5432/shop
crumbtrail init --from-app ./my-app
Use --name to keep one setup per app. See what you have saved:
crumbtrail init --list crumbtrail init --show default
Done when init --list shows the setup. Secrets in a setup are shown only as saved or missing.
Record the task
Recording runs until you stop it and captures everything done in that window. Add --collect-copy to also save the rows the task read and wrote.
crumbtrail record --collect-copy
Point the app's database settings at the addresses the command prints and restart its connection pool. The app keeps its own login and database names. Then do the task in the app.
Or let Crumbtrail start the app: put its start command after --. Recording stops when the app exits.
crumbtrail record --collect-copy -- npm start
To stop and save, press Ctrl+C in the recording window. Keep the app's connections open until the recorder reports its result. In the console, press Stop and save. Work still in progress is saved as missing rather than failing the recording.
Done when the recorder prints Complete or Incomplete for each database. Incomplete names each reason and the next step.
| Option | What it does |
|---|---|
--output DIR | Folder the recording is written to. |
--deadline 1h | Stops cleanly after this long. The default is 12 hours. |
--database NAME=URI | Names a database without saving the setup. Repeat for each one. |
--target-port PORT | Also records the app's incoming web requests. Give the port the app listens on. |
--https | Also records the app's secure web calls and encrypted database connections. The command prints the settings that make the app trust the recorder. PHP apps need no change to their code. |
--replace-values CHOICE | How much private data is replaced. automatic (the default) replaces sign-in secrets, personal data Crumbtrail recognises and what your rules name. team-rules replaces sign-in secrets and what your rules name. sign-in-only replaces sign-in secrets only, so the recording holds real personal data and stays on your machines. |
--leave-out RULE | Keeps matching web calls out of the recording, such as 'GET /health' or '/static/*'. The app still gets its responses. Repeat for more, or list them in .crumbtrail/leave-out.txt. |
--setup NAME | Uses another saved setup. With several setups and no name, the command lists them and stops. |
--no-setup | Ignores saved setups. |
Choose how the copy is built
Crumbtrail checks what each database allows and picks the best method it can use on its own. There are three levels. Each needs a little more access and gives a more exact copy.
| Level | What it needs | What you get |
|---|---|---|
| No setup | Only the app's own login. | The rows the app was shown. They may differ slightly from the starting rows, and the copy says so. |
| Separate read-only login | A plain read-only login that Crumbtrail uses on its own connection. | Nothing extra is sent on the app's connection. Rows are read just after each statement, so they can be slightly newer than the app saw. The copy says so. |
| Change history | A login that may read the database's change history, set up by whoever runs the database. | The exact starting rows. |
The connection method can use the app’s existing access; other methods can need an administrator’s help. The recording says which method was used and why.
Pick a level. Pass the method with --copy-method: auto (the default), connection or history. For the read-only login, add --read-login and name the variable that holds its connection string with --history-env. Keep the value in the variable, never on the command line.
read -r -s -p "Read-only login URL: " SHOP_READ_LOGIN export SHOP_READ_LOGIN crumbtrail record --collect-copy --read-login --history-env shop=SHOP_READ_LOGIN
crumbtrail record --collect-copy --copy-method history --history-env shop=SHOP_HISTORY --publication shop=app_history
With no change-history access, --keep-rows decides which rows are kept. auto (the default) also keeps useful PostgreSQL and MySQL rows that are not proven, and labels the copy Incomplete. proven keeps only rows proven to be the starting rows. shown keeps useful rows for every database and says what proof is missing.
To see what a database allows before you record, run this. It changes nothing.
crumbtrail copies preflight --database shop=postgres://db.internal:5432/shop --history-env shop=SHOP_HISTORY
Run your app on a copy
Open the recorded rows as a small real copy of the databases. The originals can be switched off.
crumbtrail open
It prints the recording it picked, then an address and login for each database, and keeps running. Leave it open. For another recording, add --input PATH.
Point the unchanged app at those addresses and restart its connection pool. Or let Crumbtrail start the app already pointed at the copy:
crumbtrail app run --setup default --to copy
--to also accepts original and recorder.
Signing in. Database copies (Beta) replace recognised stored password fields so you can use a test password. Check the replacement limits. Choose a test password with --login-password-env, and limit it to one user with --login-user. With no choice, a built-in development password is used for every user.
export COPY_LOGIN_PASSWORD="Testuser123!" crumbtrail open --login-password-env COPY_LOGIN_PASSWORD --login-user [email protected]
Where the copy lives: on this computer by default. Crumbtrail finds Docker through DOCKER_HOST, your active Docker context, then the usual sockets of Docker Desktop, OrbStack, Colima and Rancher Desktop (the named pipe on Windows). Use --place-ssh SERVER to keep it on a server you log in to, or --place-aws REGION to make it a new database in your own cloud account.
If a recording is Incomplete, open loads it as a diagnostic copy and says so. Add --strict to refuse instead.
Respond to the app from the recording (mock)
A mock responds to the app's calls from a recording, for supported calls without contacting their original destination. Calls with no recorded response are not forwarded.
crumbtrail replies serve --input ./task --route 0=postgres://db.internal:5432
Port 0 picks a free port. Point the app at the address the command prints, or put the app's start command after --.
Useful options: --answer-delay recorded makes responses take as long as they did in the recording. --save-results no skips saving what the mock saw. --output DIR sets where it is saved. Stop with Ctrl+C.
Replay the task against your app
Replay sends the recorded requests to your running app and compares its responses and errors with the recording. Run the app on a copy (step 3) first, then:
crumbtrail trials run --input ./task --target http://127.0.0.1:8080 --output ./trial
Replace the address with the one your app listens on. Cookies and issued values carry into later requests, and recorded sign-ins use the test password if you pass --login-password-env.
| Option | What it does |
|---|---|
--repeat N | Sends the whole recording this many times. |
--check-errors | Replays the recorded errors and reports whether each one still happens. |
--new-differences fail | Labels each difference as new. On Team and Enterprise a replay already fails the build by default: exit 3 when a response changed, 4 when one needs review. --new-differences allow always exits 0. Free shows every changed response, exits 0 and does not have this option. |
--baseline DIR | Compares with an earlier replay. Only differences not in it count as new. |
--learn-noise | Run once on the unchanged app. Sets aside response fields that change on every call, such as a short random code, and saves them in .crumbtrail/replay-noise.txt for later replays. |
--mock-status-port PORT | Port of the mock's status page (replies serve --status-port). After the last request the replay asks which outside calls the app made. Without it, outside calls after the last request read as needs review (exit 4). |
--wait-for-follow-on TIME | How long to keep the app running after the last request so its background outside calls can happen. The default is the time the recording shows; off stops at once. |
--reject-when RULE | Fails the run (exit 1) when a measured value breaks a rule, such as latency.max>1000. |
trials plan | Shows where requests would go, without sending any. |
Replay shows whether the responses and errors came back the same. Whether a fix worked is your call.
Reset and try again
Stop the app's database connections, then put the copy back to its starting rows.
crumbtrail reset
The copy keeps its addresses. Restart the app's connection pool and repeat the task. If connections are still open, reset refuses. Add --disconnect to end them. Their uncommitted work is lost.
To finish, press Ctrl+C in the window running open.
Read the results
Start with the copy. When it is Incomplete, one sentence says which tables may differ and whether the bug will probably still show. The codes are under Details.
crumbtrail copies show --input ./task crumbtrail show YOUR-RECORDING.crumb
Then check the responses. This runs the recorded database calls on throwaway copies:
crumbtrail copies check --input ./task
| Count | How to read it |
|---|---|
| Matched | The copy gave the recorded response. |
| Different | The copy responded differently. Read the difference before trusting the copy. |
| Not comparable | The recording lacked what was needed to compare. This is unchecked, not passed. |
A matched count proves only the calls that were checked. Running the task in your app is what shows the bug.
For a replay, score the saved evidence:
crumbtrail reports quality ./trial
Browse recordings in a window with crumbtrail desk serve, or in the terminal with crumbtrail desk browse --input ./task. Other reports: reports traffic, reports queries, reports changes and reports answers.
No database, replays and load tests
A database is optional. In the console, open Settings, then Apps, then Add an app and press My app has no database. Give the address your app listens on, for example http://127.0.0.1:4000, and say whether Crumbtrail starts the app or you do. Recording, mocking, replaying and load tests all work without one.
Add a recording. On the Recordings page, press Add recording. Choose a session.crumb file, a recording folder, or a file a teammate sent. Recordings made on the command line appear in the list on their own.
Replay. Open Replay, pick a recording, give the address of the new build of your app and press Start replay. The results list every response that changed, Before beside Now.
Load test. Open Load tests, pick a recording, give the address, and set how many virtual users, for how long and what counts as good enough. Press Start load test. The results show requests a second, response times and errors, and each goal as Met or Missed. Settings are saved under a name for the next run.
If something goes wrong
| What you see | What to do |
|---|---|
A message to run init first | Save a setup (step 1), or pass the options yourself and add --no-setup. |
| The command lists setup names and stops | You have several saved setups. Pick one with --setup NAME. |
| Copy method says rows may differ slightly | Only the app's own login (or a read-only login) was available. Ask whoever runs the database for change-history access to get exact rows, or accept the note. |
| The recording is Incomplete | Read each reason and its next step. Record again if a table you need was not read. |
| Reset refuses | The app still holds connections. Stop the app, or add --disconnect. |
| Sign-in fails on the copy | Use the copy's test password and a user who is in the recording. |
Command reference
| Command | What it does |
|---|---|
init | Save a setup. Also --list and --show NAME. |
record | Record with a saved setup. |
open | Open the newest recording as a copy. |
reset | Put the copy back to its starting rows. |
show FILE | Read a recording as plain text. |
app run | Start the app against the original, the recorder or a copy. |
copies preflight | Check database access. Changes nothing. |
copies build | Build a copy from a recording without starting it. |
copies open | Start a copy, building it first when given a recording. |
copies show | Read what a recording saved. |
copies check | Check recorded responses on throwaway copies. |
copies reset | Reset a copy. |
replies serve | Mock: respond to the app from recordings. |
trials run | Replay recorded requests against your app. |
trials plan | Show where a replay would send requests. |
trials noise | List the fields replays set aside. |
reports quality | Score saved replay evidence. |
reports coverage | Show which endpoints the recording and replays tested. --fail-on-gaps exits 3 on a gap. |
desk serve | Browse recordings in a local web page. |
desk browse | Browse recordings in the terminal. |
try | Record and replay a built-in sample shop, and see a changed response get caught. |
support | Free only: list the systems and databases Free supports. |
Test changes and local checks
| Command | What it does |
|---|---|
check bootstrap | Make your first check on this computer: crumbtrail check bootstrap --from-app ./my-app. Copy fixtures and CI pipelines are in Team and Enterprise. |
check add | Save a recording as a local check: crumbtrail check add ./task. Free saves any number of checks on this machine. The first three by name never expire, and the check exits 0; check pipeline writes the file that runs and fails pull requests in Team and Enterprise. |
start and stop | Record your app with one command, then save the task as a check, replay it once and see PASS or DIFFERENT: crumbtrail start, then crumbtrail stop. Paid builds. |
sessions suggest-first | Find the service and routes to record first, without reading secret files. Add --path ./my-app. |
watch | Capture requests while you develop: crumbtrail watch -- npm run dev. watch list shows them and watch promote turns them into checks. |
guard | Run a coding assistant with your protected checks sealed, then verify its scope, checks, tests and diff coverage: crumbtrail guard -- ASSISTANT-COMMAND. |
journeys record | Record clicks in Chrome or Edge as a test: crumbtrail journeys record --target-port 3000 --output ./journey. Beta |
journeys run | Run the clicks again and see which step responds differently: crumbtrail journeys run --input ./journey --target http://127.0.0.1:3000. Beta |
reports spec | Check recorded responses against an OpenAPI description, a .proto file or a GraphQL schema: crumbtrail reports spec --spec api.proto -i ./task. |
show --pieces | Read each streamed response piece by piece, with the time each piece arrived: crumbtrail show --pieces ./task. |
record --route | Record RabbitMQ over an unencrypted connection with --route 0=amqp://HOST:PORT. Use nats:// for NATS. |
Catch errors and privacy
| Command | What it does |
|---|---|
record --save-on-error | Save a request that ends in a server error. First set CRUMBTRAIL_ERROR_ORIGINAL to a read-only database connection, then run crumbtrail record --save-on-error --target-port 8080 --route 0=postgres://HOST:PORT and start your app yourself. Team and Enterprise. |
sessions errors list | List the saved errors. Team and Enterprise. |
repro make | Put a saved error in one file: crumbtrail repro make --error ID --output error.crumbrepro. Enterprise. Beta |
repro open | See whether the error comes back: crumbtrail repro open error.crumbrepro. Opening a file can run commands and write files on your computer, so open only files from people you trust. A file from another computer also needs --trust-this-file. Enterprise. Beta |
copies find-private | Propose rules for private data your rules miss, from your PostgreSQL database. Add --original-env SHOP_DB, the variable that holds its address. Team and Enterprise. |
copies person | List the rows linked to one person: crumbtrail copies person --database-env SHOP_DB --start public.users.id=42. copies person-plan plans the delete. PostgreSQL, Enterprise. Beta |
copies audit-pack | Write one file that says what a copy replaced: crumbtrail copies audit-pack --input ./task. Enterprise. Beta |
Copies, rollouts and team tools
| Command | What it does |
|---|---|
copies reset | Put a copy back to its starting point. Add --copy-dir DIR. Team and Enterprise. Beta |
copies shrink | Shrink a PostgreSQL copy to the rows its recorded responses need: crumbtrail copies shrink --copy-dir DIR --output SMALL --by-answers. Enterprise. Beta |
outbound add | Add a place for replay results: crumbtrail outbound add --kind chat --name TEAM --address-env CHAT_ADDRESS. Kinds are chat, ticket, otlp and metrics. Then run outbound test ID and outbound on ID. Sign in with cloud sign-in as an administrator. Team and Enterprise. Preview |
cluster rollout gate | Hold a Kubernetes rollout unless 95% of recorded calls respond the same: crumbtrail cluster rollout gate --namespace shop --name orders --result out --same-answers-goal 95 -- crumbtrail trials run --input ./task --target http://canary --output out. Team and Enterprise. Preview |
Free usage and error reports
Free always sends usage and error reports to Crumbtrail; they cannot be switched off. Reports never include your recordings, addresses, queries, headers, names, passwords or tokens. See the Privacy Policy.
Paid no-reports builds send nothing out by default; connecting your own AI service for the assistant is a separate choice.
Reports use a fixed field list: report kind, command category, product version, edition, operating system, architecture, duration and call-count ranges, error category, licence check result, a random installation ID, report format version and event hour. The list excludes recording contents, query text, passwords and error text.
The installation ID connects reports from the same installation across upgrades. Use crumbtrail reports preview to inspect pending reports in the current run. Reports can be lost when the network is unavailable or the tool exits; your command still runs.