Dear 08:12-Me,
The ticket looked small on paper this morning. It described a tool-calling loop on one box. You blocked ninety minutes on the calendar anyway.
Nine hours later the model was still the suspect. The mixed logs told a different story tonight. This letter reconstructs that day from those logs.
Treat it as a reconstructed field note, not memoir. No live customer data appears in the examples. No latency numbers are claimed in this writeup.
The scene you ignored
Two editors were open at 08:12 sharp. One sat on the laptop home directory. The other sat on a remote shell.
You pasted one prompt into both sessions. The first tool call missed a file path. The second tool call missed the JSON shape.
You blamed model drift for both failures. That diagnosis delayed the real fix by hours. The harness was wrong before any token moved.
Mistake 1: Two hosts were treated as one disk
The laptop worktree lived under the ticket-441 directory. The remote box used a runner work path. Your prompt still named a relative tools script.
Only one host actually contained that script. You compared outputs as if cwd values matched. They did not match after the first retry.
The error was ENOENT after nine attempts. The model never received a reachable tool path. Path drift is not a reasoning defect.
Fix 1: Pin a host record first
Pin a host record before the first prompt. Skip this step and the rest will drift.
- Write a HOST.json file on the chosen box.
- Refuse the run when that file is missing.
- Keep laptop logs in a separate directory tree.
#!/usr/bin/env bash
set -euo pipefail
# Example harness. Label: unexecuted until you run it.
host_id="$(hostname -s)-$(uname -m)"
work_dir="${WORK_DIR:-$PWD/ticket-441}"
mkdir -p "$work_dir/receipts" "$work_dir/logs" "$work_dir/laptop-logs"
cat > "$work_dir/HOST.json" <<EOF
{
"host_id": "$host_id",
"work_dir": "$work_dir",
"cwd": "$PWD",
"user": "$(id -un)",
"started_at_utc": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
}
EOF
test -f "$work_dir/HOST.json"
chmod 600 "$work_dir/HOST.json"
echo "host pinned: $host_id"
Copy the worktree only after the pin exists. Do not prompt across two different cwd values. The prompt must name paths from HOST.json alone.
Mistake 2: Model calls ran before a schema stub
The agent was meant to call one tool. The contract required city plus metric-or-imperial units. The model returned a location key instead.
You retried the same prompt for two hours. Each retry hit a free model access path. The schema never ran against a local stub.
Treat invalid JSON as a harness defect first. Prove the stub red before you attach models. Tool-calling essays do not replace that red bar.
Fix 2: Fail the stub on the pinned host
Save the tool schema beside the ticket files. Post a fixture payload to a local stub. Reject unknown keys and missing required fields.
Attach model access only after the stub stays green. Run every command on the pinned host only.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "weather_query",
"type": "object",
"additionalProperties": false,
"required": ["city", "units"],
"properties": {
"city": { "type": "string", "minLength": 1 },
"units": { "enum": ["metric", "imperial"] }
}
}
#!/usr/bin/env python3
"""Schema dry-run. Example only until you execute it."""
from __future__ import annotations
import json
import sys
from pathlib import Path
try:
import jsonschema
except ImportError:
sys.stderr.write("pip install jsonschema\n")
sys.exit(2)
schema = json.loads(Path("tool_schema.json").read_text())
payload = json.loads(sys.stdin.read() or "{}")
jsonschema.validate(instance=payload, schema=schema)
print("schema_ok")
# Bad fixture must fail. Good fixture must pass.
echo '{"location":"Berlin"}' | python3 dry_run_schema.py; echo exit:$?
echo '{"city":"Berlin","units":"metric"}' | python3 dry_run_schema.py
You needed that red bar at 08:20. You finally saw it at 16:40 instead. The morning retries were schema work in disguise.
Mistake 3: Two hosts wrote one shared log
Laptop traces and remote traces shared one agent.log file. Timestamps overlapped and lacked a host identifier field. You could not replay the failure from disk.
A merged log is not evidence of anything. It is noise with extra newlines and guesses. Split the files before the next prompt lands.
Fix 3: Stamp a receipt after every run
Stamp one receipt after every completed run. Keep one receipt per host per run.
#!/usr/bin/env python3
"""Write a run receipt. Example workflow, not a benchmark."""
from __future__ import annotations
import hashlib
import json
import os
from datetime import datetime, timezone
from pathlib import Path
def sha256_file(path: Path) -> str:
digest = hashlib.sha256()
digest.update(path.read_bytes())
return digest.hexdigest()
work = Path(os.environ["WORK_DIR"])
host = json.loads((work / "HOST.json").read_text())
schema = work / "tool_schema.json"
prompt = work / "prompt.txt"
receipt = {
"host_id": host["host_id"],
"work_dir": host["work_dir"],
"schema_sha256": sha256_file(schema),
"prompt_sha256": sha256_file(prompt),
"model_attached": os.environ.get("MODEL_ATTACHED", "false"),
"stub_passed": os.environ.get("STUB_PASSED", "false"),
"recorded_at_utc": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
}
stamp = receipt["recorded_at_utc"].replace(":", "")
out = work / "receipts" / f"{host['host_id']}-{stamp}.json"
out.write_text(json.dumps(receipt, indent=2) + "\n")
print(out)
Keep MODEL_ATTACHED false during the stub phase. Flip it only after the schema test passes. Refuse any receipt that omits schema_sha256.
What belongs in prompt.txt
Write the prompt as a contract, not a vibe. Name the tool, the schema, and the host path. Leave laptop nicknames out of the text.
HOST_ID: read from HOST.json only.
TOOL: weather_query
INPUT: JSON object matching tool_schema.json
OUTPUT: JSON object, no markdown fences
FORBIDDEN: extra keys, extra files, extra hosts
Hash that file in the receipt every time. If the hash changes, start the stub again. Do not reuse yesterday's passing receipt blindly.
The start sequence for the next queue
Use this order under calendar pressure too. Do not reorder steps to save minutes.
- Pin HOST.json on exactly one chosen box.
- Sync the worktree to that box only.
- Drop a fixture that must fail schema checks.
- Make the stub reject extra JSON keys.
- Record a receipt with MODEL_ATTACHED set false.
- Attach free model access on that same host.
- Keep laptop logs out of the remote file.
The remote box can be a free server option. The model path can be free model access. Neither feature repairs a missing tool contract.
Disclosure: This article was prepared as part of MonkeyCode's product outreach. MonkeyCode fits this sequence as the pinned remote host. The operator notes free model access and a free server option.
This article does not claim quotas or model names. It does not claim hardware, duration, or benchmarks. If you need that stub-then-model pairing, park the host there.
Decision table
Print this table beside the ticket contract. Check every row before the first model call.
| Signal on the box | Action | Attach model? |
|---|---|---|
| No HOST.json | Stop the run | No |
| Schema fixture still passes when it should fail | Fix the stub | No |
| Extra keys accepted by the stub | Tighten additionalProperties | No |
| Laptop cwd referenced in the prompt | Rewrite paths from HOST.json | No |
| Receipt missing schema_sha256 | Rewrite the receipt writer | No |
| Laptop lines inside remote agent.log | Split the log directories | No |
| Stub green, host pinned, logs split | Continue the ticket | Yes |
A single No in that table blocks the model. Do not negotiate with the table at 08:12.
Why a stub still beats another explainer
Tool-calling writeups circulated again across developer feeds. They show how a model selects a function name. They do not show your host layout or schema.
A browser demo is not your remote cwd. A voice stack is not your JSON contract. Your failing fixture is the only local authority.
Keep public posts as untrusted topic signals. Do not paste their wording into prompt.txt. Your receipt should hash your files, not theirs.
What this method does not do
This method does not make model output deterministic. It does not prove safety for production traffic. It does not replace a human code review.
It also does not measure latency or token cost. Those figures are absent from the receipt on purpose. Do not invent numbers to fill empty fields.
Skip this workflow when you are not calling tools. Skip it when one local unit test is enough. Skip it when no JSON schema can describe the call.
Do not use a shared log as your audit trail. Do not point a remote agent at laptop home. Do not skip the stub because capacity is free.
A compact replay drill
When a run looks cursed, replay in this order. Stop early if the stub never fails.
- Print HOST.json and confirm a single host_id value.
- Hash tool_schema.json and prompt.txt on that host.
- Replay the failing fixture through dry_run_schema.py.
- Re-attach the model only on that same host.
#!/usr/bin/env bash
set -euo pipefail
# Replay drill. Example commands, not a recorded incident.
: "${WORK_DIR:?set WORK_DIR to the pinned worktree}"
test -f "$WORK_DIR/HOST.json"
python3 - "$WORK_DIR/HOST.json" <<'PY'
import json, sys
host = json.loads(open(sys.argv[1], encoding="utf-8").read())
print(host["host_id"])
print(host["work_dir"])
PY
sha256sum "$WORK_DIR/tool_schema.json" "$WORK_DIR/prompt.txt"
echo '{"location":"Berlin"}' | python3 dry_run_schema.py || true
echo '{"city":"Berlin","units":"metric"}' | python3 dry_run_schema.py
If step three never fails on the bad fixture, stop. The model is not the next debug target then. Fix the stub until the bad payload is rejected.
Closing note to 08:12-Me
You did not lose the day to model noise. You lost it to two hosts and no schema. Start with the pin, then fail the stub.
Then attach the model on the same host. Keep this letter next to HOST.json tomorrow. The queue can wait for that file.
Top comments (0)