Skip to content

Week 4 self-check answer guidance

A good answer names a failure you can observe, a boundary and the evidence. Other wording is fine if someone can still check the evidence.

Q1

For example: “For a parser change, keep the public function name stable and run the named parser test.” The failure is an accidental API break or an untested behavior change. The evidence is the diff, the test command and its output.

Q2

The request is only context for the agent, and the agent can skip it. Git runs the hook at the commit, and the hook's nonzero exit prevents the commit. The agent can claim that it ran the test without running it. So inspect the command output and the commit result.

Q3

No. A gate must exit nonzero for the bad staged input, and Git must not create the commit. Check the shell's exit status and look at git log/git show to settle it.

Q4

The hook should report pyproject.toml, because it is a protected dependency file for this task. If the Python file contains an unused import, the hook reports that too. Fix each finding before the passing run.

Q5

It does not verify application behavior, test coverage or the correctness of unstaged files. Run the focused test and inspect the committed diff.

Q6

The hook before a tool call sees only the calls of an agent session that has it attached. It judges each call by its arguments. Some changes reach tests/ without such a call: a person's edit, another tool's edit, or a change by an agent without the hook. The Git hook sees the staged result of every commit in the clone, once you make it check the same rule. The agent-side hook acts earlier and gives the agent a message it can act on. The Git hook acts later, whoever made the change.

Q7

ALLOW write_file tests/check_pairs.py, then ALLOW end_of_turn: the focused test passes, then replay check: changed under tests/ and the original test exiting 1 on the final code. The end-of-turn hook checked only that the test it found passed. It could not tell that someone had rewritten the test to expect the bug. The write rule keeps the test meaningful.

Q8

Example: the allowed tools are read-only search and one named test. The forbidden action is editing or committing. The hand-back field is research.md with file/function references. The parent opens the location because a generated summary is a claim, not proof.

Q9

The test-output field is missing. Pause, or return the work, until the implementer supplies that evidence. A diff alone cannot show the behavior.

Q10

Cannot tell. The hand-back has no location, input, command or output, so there is no evidence to confirm or refute safety.

Q11

Stop in any of these cases: the target is outside the role's files; the required test is absent; a tool would need a forbidden capability; or the hand-back cannot meet its contract. Record the exact boundary and ask for a narrower task.

Q12

You can defend any decision, but only when its evidence matches it. For example: “Decision: accept — evidence: blocked.txt has the finding and a nonzero exit status, passed.txt has PASS, and git show identifies the commit.”

Transfer

An instruction might say “before editing src/parser.py, read its tests and report the focused test.” A gate might refuse a commit that stages pyproject.toml with that parser change. The first check shows that the agent was asked to gather context. The second enforces the staged-path rule at the commit. Neither proves that the parser behaves correctly.

Retrieval 1. The hook's green result does not show that the focused test ran. Read the test command and its output, then inspect the commit result.

Retrieval 2. Open the cited file and run the named check yourself. Mark a summary without a location and an observable result cannot tell.