# Tutorial: make one resilient edit In a few minutes, you will make a small edit that survives harmless whitespace drift, confirm the result, and undo it. This uses the CLI. The same core is available from Python and MCP. ## 1. Install and create a file ```bash uv add intact mkdir -p /tmp/tact-tutorial && cd /tmp/tact-tutorial printf 'DEBUG = True\nTIMEOUT = 30\n' > config.py ``` ## 2. Read before you edit ```bash uv run tact read config.py ``` The result includes a SHA-256 for the bytes it read. You can supply that hash later as an advisory `--sha` check, but the important first habit is simpler: read the current file before proposing an edit. ## 3. Simulate harmless drift Suppose a formatter or another author removes one space after you read the file: ```bash sed -i 's/DEBUG = True/DEBUG=True/' config.py ``` A byte-exact editor looking for `DEBUG = True` would now refuse the change. Tact can identify the same line under its whitespace-tolerant rungs, while still reporting what happened. ## 4. Edit and inspect the result ```bash uv run tact edit config.py --old 'DEBUG = True' --new 'DEBUG = False' cat config.py ``` The command should report a non-`EXACT` match and the file should contain `DEBUG=False`. If there were two plausible matches, it would refuse and ask you to provide `--near LINE` rather than choose one for you. ## 5. Undo the write ```bash uv run tact undo config.py cat config.py ``` Undo restores the pre-edit state, including the simulated spacing. It journals the state it replaces, so repeating `undo` can restore the edit. ## Next steps - [How-to guide](howto.md) for patches, anchors, delta reads, and MCP setup. - [Reference](reference.md) for command shapes, `--json`, exit codes, and library mappings. - [Explanation](explanation.md) for the ladder and its deliberate refusal boundaries.