Follow a hunt from change to evidence
This walkthrough changes the default encoding of two text I/O paths from latin1 to UTF-8 while preserving explicit encoding overrides. Use one task ID to compare the actual edits, acceptance evidence, and delivery record. Then reproduce a check failure in a separate test repository.
You need Git, Node.js, and Codant with a configured model. The walkthrough follows the current development tree. Run codant --version and codant --help to confirm that your build supports hunt --check, task evidence, and task changes. Run the hunt in a terminal that supports interactive approval. Installation and model setup · Hunt commands
Create a separate test repository
Download the create-demo.mjs starter and save it in the parent directory for the two test repositories. Open a terminal there. The target directory must be new.
node create-demo.mjs codant-hunt-demo
cd codant-hunt-demo
git init -q
node -e "require('node:fs').writeFileSync('.git/codant-demo-exclude', '')"
git config --local core.excludesFile .git/codant-demo-exclude
git add -- import-options.json export-options.json text-io.mjs verify.mjs
git -c user.name="Codant Demo" -c user.email=demo@example.invalid -c commit.gpgsign=false commit -qm baseline
node verify.mjs latin1
git rev-parse --show-toplevelimport-options.json and export-options.json each set the default for one path. text-io.mjs reads and writes files and gives explicit encoding arguments priority. verify.mjs checks input decoding and output bytes using temporary files for the default and the explicit latin1 and utf16le overrides, then removes the temporary files.
The example points core.excludesFile to an empty file inside the repository, so Codant can capture the Git baseline without reading a global ignore file from your home directory. The setting applies only to this new sample repository.
Register a candidate check
Append the check below to the Codant user configuration, normally ~/.codant/config.toml. A custom CODANT_DATA_DIR sets the directory for config.toml, and an explicit CODANT_CONFIG_FILE takes precedence. Replace project_roots with the absolute path printed by git rev-parse. Use your actual test repository path on Linux or macOS as well.
[[hunt_checks]]
id = "verify-utf8-defaults"
checker = "artifact"
project_roots = ['D:/work/codant-hunt-demo']
input_paths = ["import-options.json", "export-options.json"]
[[hunt_checks.conditions]]
kind = "json"
path = "import-options.json"
pointer = "/defaultEncoding"
condition = { operator = "equals", value = "UTF-8" }
[[hunt_checks.conditions]]
kind = "json"
path = "export-options.json"
pointer = "/defaultEncoding"
condition = { operator = "equals", value = "UTF-8" }The daemon freezes the selected check before execution, then reads the two JSON fields from the candidate. Run node verify.mjs separately afterward to test the actual bytes and encoding overrides. Trusted checks and project roots
Submit the hunt and review the approval
Run this from codant-hunt-demo and keep the complete task ID from the submission receipt.
codant hunt --check verify-utf8-defaults "Only change the defaultEncoding in import-options.json and export-options.json to UTF-8. Keep explicit encoding overrides working and leave all other files unchanged."The two files have separable write scopes. Actual subtask dispatch depends on delegation, budget, capacity, and file scope at runtime. If Codant requests approval to write the candidate back, inspect the preview for the two requested changes before approving it. Bounded parallelism and candidate delivery · Approval and receipts
Inspect the workspace and evidence by task ID
Replace TASK_ID with the complete ID from this run.
codant task show TASK_ID
codant task evidence TASK_ID
codant task changes TASK_ID --source delivered
git status --short
git --no-pager diff -- import-options.json export-options.json
node verify.mjs| Where to look | What to verify |
|---|---|
| Task record | Check the task state. If the task has children, inspect their scope and results. When dispatch decisions were recorded, look in latestDecisions for their reasons. |
| Acceptance evidence and delivered changes | Look for records of candidate review, the selected check, and write-back. If evidence returns nextCursor, continue with codant task evidence TASK_ID --cursor CURSOR. |
| Git and the behavior check | git status --short should list only the two configuration files, each changing latin1 to UTF-8. A successful node verify.mjs confirms the import, export, and explicit override behavior covered by the independent test. |
Open the same task with /ants TASK_ID in Codant's interactive terminal. With VS Code connected to the same daemon, open 蚁群 (Swarm) and click 刷新蚁群 (Refresh swarm). If the task is still in the current working set, match its ID to check its status. Use the commands above for retained acceptance and delivery records. To build your own local interface, start with the read-only observer. Track a task in the terminal · VS Code Swarm panel · Build a read-only task observer
Reproduce a failed check
Return to the parent directory that holds the starter. Repeat the setup using codant-hunt-fail in place of codant-hunt-demo, including the baseline commit and node verify.mjs latin1. The first workspace and its task history remain available for comparison.
Add the deliberately failing check below to the same Codant user configuration. Replace project_roots with the absolute path of the second repository. It requires the same import value to equal both UTF-8 and utf16le. At least one condition fails whenever this check runs.
[[hunt_checks]]
id = "reject-utf8-defaults"
checker = "artifact"
project_roots = ['D:/work/codant-hunt-fail']
input_paths = ["import-options.json", "export-options.json"]
[[hunt_checks.conditions]]
kind = "json"
path = "import-options.json"
pointer = "/defaultEncoding"
condition = { operator = "equals", value = "UTF-8" }
[[hunt_checks.conditions]]
kind = "json"
path = "import-options.json"
pointer = "/defaultEncoding"
condition = { operator = "equals", value = "utf16le" }
[[hunt_checks.conditions]]
kind = "json"
path = "export-options.json"
pointer = "/defaultEncoding"
condition = { operator = "equals", value = "UTF-8" }Submit the same change in the second repository and use the new FAILED_TASK_ID for the queries.
codant hunt --check reject-utf8-defaults "Only change the defaultEncoding in import-options.json and export-options.json to UTF-8. Keep explicit encoding overrides working and leave all other files unchanged."
codant task show FAILED_TASK_ID
codant task evidence FAILED_TASK_ID
codant task changes FAILED_TASK_ID --source candidate
codant task changes FAILED_TASK_ID --source delivered
git status --short
node verify.mjs latin1When the check fails, delivery stops before write-back. Inspect the failed check record and any retained candidate diff. The delivered list should be empty and the second repository should still pass its latin1 baseline test. If the run stopped earlier during model use, approvals, or candidate generation, use the task state and evidence to locate where it stopped. Failed checks and candidate queries · Hunt source walkthrough
If the task reports that native isolation failed to start on Windows, inspect the failure with the current task ID and check local sandbox status. Check the local sandbox
