FAQ: Did the Command Finish, or Did the Transcript?
说明与用途
文章说明如何通过包装脚本记录退出码、标准输出/错误和时间戳,避免误判聊天记录中的命令是否完成。
问题
Developers rely on chat transcripts to determine if a command finished, but transcripts are lossy and may omit critical evidence such as exit codes, stderr, or process duration.
结果
Implementing a capture wrapper ensures that every agent command produces verifiable evidence of completion, eliminating reliance on potentially truncated chat transcripts.
工作流
- 1. Wrap agent commands with a capture script that logs argv, cwd, env, start/end timestamps, stdout, stderr, and exit code.
- 2. Store each run in a timestamped directory under a capture root.
- 3. After execution, inspect the exit_code file to confirm success (0) or failure (non‑zero).
- 4. Compare stdout.log and stderr.log sizes to detect omitted error output.
- 5. Use the summary.json file to programmatically assess run duration and exit status.
- 6. If exit_code or stderr.log are missing, treat the transcript as incomplete and request full logs from the server.
证据
The transcript is a lossy view of a process, never the process.
Look for an exit code file. Look for a duration.
I use a small wrapper for every agent command.
- 记录日期: 2026-09-18T12:30:44.250Z