1
00:00:00,300 --> 00:00:06,320
Right, so a few days ago we talked about
forcing every workflow agent onto one cheap

2
00:00:06,380 --> 00:00:06,680
model.

3
00:00:07,520 --> 00:00:08,640
This one is the follow up.

4
00:00:09,220 --> 00:00:13,420
This is The Claude Code Changelog, brought
to you by Jellypod AI.

5
00:00:13,960 --> 00:00:14,480
I'm Lachlan.

6
00:00:15,120 --> 00:00:15,720
And I'm James.

7
00:00:16,400 --> 00:00:20,440
Today it's Claude Code 2.1.300, released
October 14th.

8
00:00:21,040 --> 00:00:25,360
The headline is that the agent.spawn mod
hook can now rewrite a workflow agent's

9
00:00:25,420 --> 00:00:26,540
prompt and its model.

10
00:00:27,320 --> 00:00:31,059
Before this, per the changelog, that hook
could only refuse workflow agents.

11
00:00:31,280 --> 00:00:32,600
It could say no, and that was it.

12
00:00:33,258 --> 00:00:37,938
And that matters because of what we
covered in 2.1.296.

13
00:00:38,738 --> 00:00:44,378
CLAUDE_CODE_WORKFLOW_SUBAGENT_MODEL puts
every workflow agent on one model.

14
00:00:45,138 --> 00:00:47,458
Handy for cost, but it's a blunt
instrument.

15
00:00:48,178 --> 00:00:54,498
Your simple discovery step runs fine on
Haiku 5.5, then your heavy synthesis step,

16
00:00:54,998 --> 00:00:59,258
or the one that needs strict structured
output, falls off a cliff because it's on

17
00:00:59,298 --> 00:01:00,438
the same cheap model.

18
00:01:01,302 --> 00:01:03,282
So now you get step aware routing.

19
00:01:03,782 --> 00:01:06,982
In a TypeScript mod, you register on
agent.spawn.

20
00:01:07,502 --> 00:01:10,942
For workflow agents, the event carries the
run ID and the step index,

21
00:01:11,142 --> 00:01:11,782
plus the prompt.

22
00:01:12,362 --> 00:01:14,182
You look at those, and you return the
changes.

23
00:01:14,662 --> 00:01:19,422
Roughly: an object with model set to
haiku, and prompt set to the original event

24
00:01:19,482 --> 00:01:23,582
prompt plus a new line saying, rule,
return strict JSON only.

25
00:01:23,950 --> 00:01:25,290
Where does that mod live?

26
00:01:25,810 --> 00:01:30,370
Your project's mods folder, or you can
ship it inside a custom plugin.

27
00:01:30,850 --> 00:01:31,990
Same idea either way.

28
00:01:32,710 --> 00:01:37,510
And on the model value, you can use a
short alias like haiku or sonnet,

29
00:01:37,970 --> 00:01:39,370
or a full model ID.

30
00:01:39,850 --> 00:01:43,210
Both resolve now, and that ties into a fix
in this release.

31
00:01:43,943 --> 00:01:44,143
Right.

32
00:01:44,603 --> 00:01:47,683
Agent hooks used to ignore their model
setting entirely.

33
00:01:48,343 --> 00:01:54,803
In 2.1.300, aliases like haiku resolve
properly, a subagent's own frontmatter model

34
00:01:54,903 --> 00:01:59,203
no longer overrides it, and an unavailable
model falls back to the caller's model

35
00:01:59,263 --> 00:02:00,883
instead of letting the action through.

36
00:02:01,503 --> 00:02:05,243
Before that fix, a hook that set a model
wasn't something you could lean on.

37
00:02:05,923 --> 00:02:06,903
Let's make it concrete.

38
00:02:07,503 --> 00:02:10,703
Say you've got a workflow that fans out
across a repo.

39
00:02:11,283 --> 00:02:14,343
Early steps are scanning files and listing
candidates.

40
00:02:14,903 --> 00:02:18,343
Your mod checks the step index, sends
those to Haiku.

41
00:02:19,083 --> 00:02:24,063
The final step that merges findings and
writes a plan, you send to Sonnet or Opus.

42
00:02:24,783 --> 00:02:29,603
Same workflow, two price tiers, no env var
forcing everything down.

43
00:02:30,175 --> 00:02:32,135
The prompt side is just as useful, I
think.

44
00:02:32,775 --> 00:02:35,815
Since you can rewrite the prompt before
launch, you can inject your team's

45
00:02:35,855 --> 00:02:40,215
formatting rules, a repo specific schema,
or strip out sensitive text from the

46
00:02:40,255 --> 00:02:40,615
input.

47
00:02:41,175 --> 00:02:44,635
It's context you'd otherwise have to
repeat in every workflow definition.

48
00:02:45,135 --> 00:02:46,555
One mod, applied everywhere.

49
00:02:47,298 --> 00:02:48,358
Now, caveats.

50
00:02:48,978 --> 00:02:53,478
First, the hook's model beats the model in
a subagent definition file.

51
00:02:54,158 --> 00:02:59,918
The docs say that when a mod sets a model
in agent.spawn, Claude Code uses it in

52
00:02:59,998 --> 00:03:02,138
place of the per invocation choice.

53
00:03:03,078 --> 00:03:07,218
But your organization's availableModels
allowlist still applies.

54
00:03:08,058 --> 00:03:11,978
If you assign a model that isn't
permitted, it falls back to the caller's model,

55
00:03:12,678 --> 00:03:16,318
and it won't warn you loudly, so check
which model actually ran.

56
00:03:18,150 --> 00:03:21,890
Second, validation is stricter in 2.1.300.

57
00:03:22,410 --> 00:03:27,850
The changelog says updatedInput from
PreToolUse and PermissionRequest hooks is now

58
00:03:27,910 --> 00:03:29,950
validated like Claude's own input.

59
00:03:30,490 --> 00:03:34,430
Unknown keys get dropped, and input the
tool rejects denies the call.

60
00:03:34,910 --> 00:03:36,930
So don't get creative with extra fields.

61
00:03:37,750 --> 00:03:42,230
And third, and this is my own read of how
hooks behave, treat errors seriously.

62
00:03:42,670 --> 00:03:46,890
If your hook throws or denies the spawn,
that workflow step doesn't run.

63
00:03:47,190 --> 00:03:50,470
So wrap your logic and return the original
values as a default.

64
00:03:51,013 --> 00:03:52,573
Quick fire on the smaller stuff.

65
00:03:53,213 --> 00:03:59,693
Mods can now draw virtualText in the
prompt box, so ghost text or shortcut hints

66
00:03:59,733 --> 00:04:02,573
that never end up in your draft or the
submitted prompt.

67
00:04:03,593 --> 00:04:08,373
OpenTelemetry api_request events now split
cache writes into

68
00:04:08,793 --> 00:04:15,753
cache_creation_5m_tokens and
cache_creation_1h_tokens, which

69
00:04:15,793 --> 00:04:17,853
is gold if you're watching cache costs.

70
00:04:18,988 --> 00:04:24,368
Also fixed: ENABLE_TOOL_SEARCH=auto no
longer switches itself off mid conversation

71
00:04:24,428 --> 00:04:26,988
when MCP servers reconnect after a resume.

72
00:04:27,868 --> 00:04:32,108
Exiting now force kills background
commands still running 1.5 seconds after being

73
00:04:32,168 --> 00:04:32,768
asked to stop.

74
00:04:33,508 --> 00:04:37,588
And /autocompact stops warning about high
token usage when you pick a smaller

75
00:04:37,668 --> 00:04:37,948
window.

76
00:04:38,630 --> 00:04:44,070
If you've already got workflow pipelines
running, update to 2.1.300,

77
00:04:44,630 --> 00:04:48,550
write a tiny mod that logs the step index
and prompt first,

78
00:04:48,970 --> 00:04:50,170
and then start routing.

79
00:04:50,870 --> 00:04:53,830
Log before you route, so you know what
you're actually sending.

