Safe Local Codebase Loop · Fail-Closed Secret Guard
Refactor and test local modules on an isolated cloud computer—without risking secrets or working trees.
Point TESI’s MCP server or Python CLI at a clean local module (sourceDir). Local guards block .env*, keys, binaries, and symlinks offline before TESI runs the refactoring and unit-test loop on its own Linux VM and writes SHA-256 verified output files to a staging folder (extractFilesTo)—from $10 USD.
1. End-to-end CLI & MCP local module workflow
Pack a local subfolder, verify starting credit for free, run on TESI, and extract staged files with TESI-DELIVERY-MANIFEST.json:
# 1. Pack ./src/billing locally (refuses .env*, private keys, binaries & symlinks offline):
python3 -I tesi-receipt.py --file refactor.json --pack-project ./src/billing \
--prompt "Refactor rounding to Decimal half-up and add pytest edge cases; run all tests."
# 2. Check starting credit for free (sends byte count only, no source text):
python3 -I tesi-receipt.py --file refactor.json --check-credit
# 3. Submit with your prepaid key & extract delivered files safely to ./staged-out:
python3 -I tesi-receipt.py --key-file ./tesi-purchase/key.json --file refactor.json \
--submit --no-checkout --wait 120 --reply-file refactor-reply.md
python3 -I tesi-receipt.py --extract-files ./staged-out --reply-file refactor-reply.md
Defense-in-Depth Safeguards
2. Four local safety boundaries enforced before and after every turn
Offline secret & binary refusal
Refuses .env*, *.pem, *.key, id_rsa, key.json, symlinks, non-UTF-8 binaries, and embedded sk_live_ / tesi_ak_ patterns locally with zero network traffic.
Byte-only pre-spend quote
tesi_quote(sourceDir=...) measures the packed UTF-8 byte count locally and queries /starting-credit without transmitting a single line of source code.
Path-traversal-proof staging
--extract-files and extractFilesTo reject .. segments, leading slashes, dotfiles, and duplicate paths before writing mode-0600 files.
Cryptographic delivery manifest
Writes TESI-DELIVERY-MANIFEST.json recording every extracted file’s byte length and SHA-256 digest alongside the verified replySha256.
Questions
Local refactoring & patch FAQ.
How does sourceDir prevent accidental leakage of .env files or credentials?
Before sending a single byte over HTTPS, both tesi-agent-mcp.py and tesi-receipt.py --pack-project scan the target subfolder locally and fail closed (exit 2, secret_file_refused) if they detect .env*, private keys, credentials, key.json, symlinks, binary files, or embedded bearer token patterns.
Does extractFilesTo overwrite my working tree directly?
No. Delivered fenced path=... files are written into your chosen staging directory (such as ./tesi-delivered) at mode 0600 after path-traversal validation and replySha256 verification, alongside TESI-DELIVERY-MANIFEST.json so you or your coding agent can diff and merge cleanly.
Can I quote the exact admission credit of a local subfolder for free before buying a key?
Yes. Call tesi_quote(sourceDir='./pkg', message='Add unit tests') in MCP or run tesi-receipt.py --pack-project ./pkg followed by --check-credit. Only the UTF-8 byte count is sent to the free starting-credit endpoint.
Start refactoring safely