# Local merchant tools

Run these commands inside the exported agent workspace with Python 3.11+. No installation, network or credentials are needed. The script reads public records, writes local proposed configuration and logs the commands. Preview output describes simulated business outcomes; it contains no private grades or reference answers.

```sh
python3 merchant_tools.py inspect
python3 merchant_tools.py inspect orders --id C01
python3 merchant_tools.py inspect config
python3 merchant_tools.py search C16
python3 merchant_tools.py preview campaigns
python3 merchant_tools.py preview checkout
python3 merchant_tools.py apply proposed_patch.json
python3 merchant_tools.py simulate proposed_patch.json --view winback
python3 merchant_tools.py preview all
python3 merchant_tools.py build-submission --analysis analysis.json --findings findings.json --handoff handoff.json
```

Available tables are listed by inspect. Other previews are tracking, vip, post_purchase, winback and offers. Preview evaluates working_config.json if present, otherwise the original configuration. The canonical source data stays in merchant.json. Start a new exported task to reset all state; prior attempts are preserved by the host runner.

A patch file is a list of objects, each with section and values. Example syntax (not a reference repair):

The simulate command previews a hypothetical patch on a temporary copy and does not change working configuration. It can be used in read-only assignments. A successful simulation does not approve a policy violation: for example, a threshold change may leave the current audience unchanged while breaking the explicit policy.

```json
[{"section": "winback", "values": {"enabled": true}}]
```

Supported fields and types are in SCHEMA at the top of merchant_tools.py and in the existing config. No executable expressions, arbitrary field paths, table edits or live actions are supported. The tool rejects sections outside the assignment's authority. You may write a submission directly instead of using apply; the trusted grader replays patches on its own original records. Agent-written config, logs or preview claims cannot overwrite the grader's source records or expected outcomes.

analysis.json is an object using the fields listed in submission_template.json. findings.json is a list of claim/evidence objects; reference records as `merchant.json#orders:O01` or similar precise locations. handoff.json is a list of release checks, dependencies, uncertainty and rollback instructions. Wording is freeform and remains subject to human review. build-submission writes submission.json, containing the proposed configuration diff and these artifacts.

Submit only submission.json to the host operator. Work logs are caller-controlled diagnostics, not verified execution traces. The host runner must stay outside the agent sandbox. This local tool does not create an OS sandbox or make a checkout containing private assets safe for an evaluation agent.
