WEBVTT

1
00:00:00.000 --> 00:00:02.638
Here is a small task for a coding agent.

2
00:00:02.638 --> 00:00:06.133
This status function strips its input, lowercases it,

3
00:00:06.133 --> 00:00:08.639
and walks through three if statements.

4
00:00:08.639 --> 00:00:11.211
Replace the conditionals with a lookup.

5
00:00:11.550 --> 00:00:17.689
A proposal comes back: one table, one line, and no if statements at all.

6
00:00:17.689 --> 00:00:19.138
It looks cleaner.

7
00:00:19.138 --> 00:00:20.161
Is it right?

8
00:00:20.500 --> 00:00:24.393
The task also says what to preserve: whitespace handling, case,

9
00:00:24.393 --> 00:00:25.938
and the unknown fallback.

10
00:00:25.938 --> 00:00:26.989
But in this file,

11
00:00:26.989 --> 00:00:31.191
neither that contract nor the caller is written beside the function.

12
00:00:32.232 --> 00:00:36.008
Before you judge the proposal, look at what will judge it.

13
00:00:36.008 --> 00:00:38.938
The fixture's verifier holds ten fixed cases.

14
00:00:38.938 --> 00:00:42.323
Each one is an input, and the label it must produce.

15
00:00:42.665 --> 00:00:43.651
Predict a few.

16
00:00:43.651 --> 00:00:45.340
Plain "ok" gives passed.

17
00:00:45.340 --> 00:00:47.170
Capital "OK" gives passed.

18
00:00:47.170 --> 00:00:50.549
"ok" with a space on each side gives passed too.

19
00:00:50.549 --> 00:00:55.476
And "pending" is not a status the function knows, so it gives unknown.

20
00:00:55.815 --> 00:00:59.233
The same ten cases run against every version of the function.

21
00:00:59.233 --> 00:01:00.354
The code may change.

22
00:01:00.354 --> 00:01:01.306
The cases do not.

23
00:01:02.349 --> 00:01:04.463
Run the ten cases on the proposal.

24
00:01:04.463 --> 00:01:05.148
Seven pass.

25
00:01:05.148 --> 00:01:08.320
Three fail, and the verifier exits with status one.

26
00:01:08.665 --> 00:01:12.600
The failures are the padded inputs: "ok" with spaces,

27
00:01:12.600 --> 00:01:17.352
"fail" with a tab and a newline, and capital "PASS" with spaces.

28
00:01:17.352 --> 00:01:19.356
The proposal dropped strip.

29
00:01:19.699 --> 00:01:23.932
For each of them, the original function returned the right label.

30
00:01:23.932 --> 00:01:25.821
The proposal returns unknown.

31
00:01:25.821 --> 00:01:29.990
A caller that sends a padded status would see its result change.

32
00:01:31.031 --> 00:01:35.892
The worked refactor uses the same table, and keeps strip in front of lower.

33
00:01:35.892 --> 00:01:39.002
All ten cases pass, and the verifier exits zero.

34
00:01:39.348 --> 00:01:42.476
Now count the if statements: three in the original,

35
00:01:42.476 --> 00:01:44.562
and zero in both shorter versions.

36
00:01:44.562 --> 00:01:48.119
The count cannot tell the broken one from the working one.

37
00:01:48.465 --> 00:01:52.039
A shorter function still has to keep the contract.

38
00:01:52.039 --> 00:01:55.471
And ten of ten establishes those ten cases only.

39
00:01:55.471 --> 00:01:58.902
It does not prove the behavior for every string,

40
00:01:58.902 --> 00:02:01.476
or that a caller accepts the change.

41
00:02:02.515 --> 00:02:04.489
One step came before those runs.

42
00:02:04.489 --> 00:02:07.203
You ask for one bounded expression, as text.

43
00:02:07.203 --> 00:02:10.966
What comes back is text too, until a person has inspected it.

44
00:02:11.315 --> 00:02:12.605
So read it first.

45
00:02:12.605 --> 00:02:15.641
Only then copy it into a candidate file.

46
00:02:15.641 --> 00:02:21.486
Nothing executes the reply itself: the ten cases meet the file you inspected.

47
00:02:21.831 --> 00:02:24.762
And if the text asks for more, such as a key,

48
00:02:24.762 --> 00:02:28.084
network access or an install you do not know, stop.

49
00:02:28.084 --> 00:02:32.448
Run a generated command only in a dedicated directory or container,

50
00:02:32.448 --> 00:02:34.402
one that holds no credentials.

51
00:02:34.402 --> 00:02:37.202
Otherwise, record the missing prerequisite.

52
00:02:38.248 --> 00:02:42.671
Suppose the text you copied into the candidate file was this instead:

53
00:02:42.671 --> 00:02:45.619
a conditional expression, and no table at all.

54
00:02:45.965 --> 00:02:47.569
Run the ten cases on it.

55
00:02:47.569 --> 00:02:48.438
All ten pass.

56
00:02:48.438 --> 00:02:52.982
And the if count is zero, because the verifier counts if statements,

57
00:02:52.982 --> 00:02:55.656
and a conditional expression is not one.

58
00:02:55.998 --> 00:02:59.335
But the task asked for a lookup, and there isn't one.

59
00:02:59.335 --> 00:03:04.182
The count is a narrow measure: it cannot see what replaced the if statements.

60
00:03:04.182 --> 00:03:05.253
So open the file.

61
00:03:05.253 --> 00:03:10.289
A refactor is not accepted until the requested structure has been inspected too.

62
00:03:11.331 --> 00:03:15.695
Now run the same ten cases on the function you started with.

63
00:03:15.695 --> 00:03:16.495
Ten of ten.

64
00:03:16.495 --> 00:03:17.222
Exit zero.

65
00:03:17.564 --> 00:03:21.434
So the original and the refactor both pass every case.

66
00:03:21.434 --> 00:03:24.516
Only the if count differs: three, and zero.

67
00:03:24.516 --> 00:03:27.095
The cases cannot tell the two apart.

68
00:03:27.431 --> 00:03:28.954
And that is the point.

69
00:03:28.954 --> 00:03:30.823
The behavior was preserved.

70
00:03:30.823 --> 00:03:34.562
What changed is how much a fresh session has to guess.

71
00:03:34.898 --> 00:03:39.857
In the original, a session must infer the contract from a chain of conditionals.

72
00:03:39.857 --> 00:03:40.849
In the refactor,

73
00:03:40.849 --> 00:03:45.189
the lookup table and the fallback are visible beside the change point.

74
00:03:46.231 --> 00:03:49.408
Scale that up from one function to a repository.

75
00:03:49.408 --> 00:03:52.652
A prepared repository also names its entry point,

76
00:03:52.652 --> 00:03:56.358
its contract and its offline check in its context files.

77
00:03:56.358 --> 00:03:59.668
The agent still needs permission to read and edit.

78
00:03:59.668 --> 00:04:03.242
The repository has only removed the avoidable guesses.

79
00:04:03.581 --> 00:04:05.500
That is what agent-ready means.

80
00:04:05.500 --> 00:04:09.772
A fresh session can find the relevant code, learn the local contract,

81
00:04:09.772 --> 00:04:12.992
run a short check, and report what it did not check.

82
00:04:13.331 --> 00:04:17.482
And readiness is a property of evidence at a named revision.

83
00:04:17.482 --> 00:04:20.942
It is not a feeling about how tidy the tree looks.

84
00:04:21.981 --> 00:04:24.493
So what can a comparison like this show?

85
00:04:24.493 --> 00:04:28.826
The fixture is one function, so it cannot show every kind of blocker.

86
00:04:28.826 --> 00:04:32.657
On a whole repository, you record observations like this one:

87
00:04:32.657 --> 00:04:36.112
the documented check exits zero on the refactored copy.

88
00:04:36.447 --> 00:04:40.138
It supports one claim: these cases pass, at this revision.

89
00:04:40.481 --> 00:04:44.315
And it leaves evidence missing: the callers, the permissions,

90
00:04:44.315 --> 00:04:46.138
and the inputs nobody listed.

91
00:04:46.138 --> 00:04:50.537
Every observation has this shape: what you saw, the claim it supports,

92
00:04:50.537 --> 00:04:52.172
and what is still missing.

93
00:04:53.214 --> 00:04:57.625
Now take your own repository: your project, or the one you contribute to.

94
00:04:57.625 --> 00:05:00.164
First freeze a baseline at a named commit,

95
00:05:00.164 --> 00:05:03.185
and pick one small behavior an agent might change.

96
00:05:03.531 --> 00:05:06.620
You may ask an agent for a map and a list of commands.

97
00:05:06.620 --> 00:05:08.623
Each line of its answer is a claim.

98
00:05:08.623 --> 00:05:12.342
Verify it by opening the files and running the commands yourself.

99
00:05:12.681 --> 00:05:18.364
Then score what you observed, in four dimensions: structure, documentation,

100
00:05:18.364 --> 00:05:19.652
tests and checks.

101
00:05:20.697 --> 00:05:26.583
Each dimension has four levels, and each level has anchors: things you can observe.

102
00:05:26.583 --> 00:05:29.348
A level includes every anchor below it.

103
00:05:29.697 --> 00:05:33.613
Your score is the highest level whose anchors are all present.

104
00:05:33.613 --> 00:05:36.708
One missing anchor, and the score stops below it.

105
00:05:37.747 --> 00:05:38.466
Structure.

106
00:05:38.466 --> 00:05:43.930
Level three asks for three things: the map entries you checked are accurate,

107
00:05:43.930 --> 00:05:46.805
the change point has one responsibility,

108
00:05:46.805 --> 00:05:50.759
and your probe reaches it in three file opens or fewer.

109
00:05:50.759 --> 00:05:56.438
The evidence is a behavior, the files you opened in order, and a path and line.

110
00:05:56.781 --> 00:06:00.267
Say a session found the function in two file opens.

111
00:06:00.267 --> 00:06:04.505
That supports the map for this change point, at this revision.

112
00:06:04.505 --> 00:06:07.240
Other behaviors may have different maps.

113
00:06:07.240 --> 00:06:11.752
And one checked entry that turns out wrong would disprove a three.

114
00:06:12.797 --> 00:06:13.627
Documentation.

115
00:06:13.627 --> 00:06:17.479
At level three, every listed command runs at the scored revision,

116
00:06:17.479 --> 00:06:21.271
and at least three invariants name the checks that protect them.

117
00:06:21.271 --> 00:06:25.597
The evidence is the context file's path, each command with its exit code,

118
00:06:25.597 --> 00:06:27.848
and the list of invariants and checks.

119
00:06:28.197 --> 00:06:31.778
Say a copy lists three test commands, and two of them fail.

120
00:06:31.778 --> 00:06:34.935
Then documentation is a blocker for a fresh session.

121
00:06:34.935 --> 00:06:38.576
It says nothing about whether the implementation is correct.

122
00:06:38.576 --> 00:06:43.128
And one listed command that fails as written is enough to disprove a three.

123
00:06:44.164 --> 00:06:44.544
Tests.

124
00:06:44.544 --> 00:06:49.679
At level three, two repeatable runs agree, they stay within the budget you chose,

125
00:06:49.679 --> 00:06:53.166
they use no hidden input, and a deliberate break fails.

126
00:06:53.166 --> 00:06:57.223
The evidence is the two summaries, the search for hidden inputs,

127
00:06:57.223 --> 00:06:59.695
and the result of the deliberate break.

128
00:07:00.031 --> 00:07:01.554
What would disprove it?

129
00:07:01.554 --> 00:07:05.461
A run that passes while a deliberate break goes undetected.

130
00:07:05.461 --> 00:07:07.845
Or a test that reads a hidden input.

131
00:07:07.845 --> 00:07:12.547
So run the documented check twice, and inspect whether it uses a clock,

132
00:07:12.547 --> 00:07:14.402
the network or hidden files.

133
00:07:15.447 --> 00:07:15.883
Checks.

134
00:07:15.883 --> 00:07:19.619
At level three, one offline command runs the required gates,

135
00:07:19.619 --> 00:07:22.297
and it exits non-zero for an unused import.

136
00:07:22.297 --> 00:07:26.345
The evidence is the gate command, its failing and passing output,

137
00:07:26.345 --> 00:07:28.898
and the point where the gate is required.

138
00:07:29.247 --> 00:07:32.523
Say a hook rejects an unused import with exit two.

139
00:07:32.523 --> 00:07:35.799
That shows the hook can stop that class of change.

140
00:07:35.799 --> 00:07:39.402
It does not cover other checks, or the paths around it.

141
00:07:39.402 --> 00:07:43.858
And a gate you can run by hand, but that nothing requires, is a two.

142
00:07:44.896 --> 00:07:46.711
An agent may propose a score.

143
00:07:46.711 --> 00:07:47.588
You choose it.

144
00:07:47.588 --> 00:07:51.907
A number with no path, no revision and no output attached is a guess.

145
00:07:52.246 --> 00:07:57.255
So for each dimension, record five things: the path or command, the revision,

146
00:07:57.255 --> 00:08:02.004
the result you observed, the highest level whose anchors are all present,

147
00:08:02.004 --> 00:08:05.257
and one observation that would disprove the score.

148
00:08:06.296 --> 00:08:08.504
Your first score is a table of four rows.

149
00:08:08.504 --> 00:08:11.143
Now remove one blocker that is within your scope.

150
00:08:11.143 --> 00:08:13.351
For example, reconcile two test commands,

151
00:08:13.351 --> 00:08:15.667
or add a map from a behavior to its module.

152
00:08:16.013 --> 00:08:19.845
Then run the same probe at the new commit, and score again.

153
00:08:19.845 --> 00:08:21.664
The score may stay the same.

154
00:08:22.013 --> 00:08:26.154
A tidier directory, with no changed observation, does not raise a score.

155
00:08:26.154 --> 00:08:29.950
And if the same command now passes because its tests were deleted,

156
00:08:29.950 --> 00:08:32.424
keep the old score, and record the finding.

157
00:08:33.462 --> 00:08:35.306
So: is it ready for an agent?

158
00:08:35.306 --> 00:08:37.658
Don't answer from how the tree looks.

159
00:08:37.658 --> 00:08:41.091
A passing check is evidence for the inputs it covered.

160
00:08:41.091 --> 00:08:46.113
And a score changes only when the observed anchor changes, at a named revision.

161
00:08:46.462 --> 00:08:51.027
End your record with one decision: accept, narrow, recheck or stop.

162
00:08:51.027 --> 00:08:56.273
Name the evidence that supports it, and the observation that would change it.
