summaryrefslogtreecommitdiffstats
path: root/2026/captions/emacsconf-2026-hutch--hutch-code-reviews-for-the-mildly-disenfranchised--akshay-gupta--main.vtt
blob: 2fb370391f793723e1df7912b6e4636cad95b2b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
WEBVTT captioned by sacha

NOTE Introduction

00:00:00.071 --> 00:00:00.572
I'm Akshay.

00:00:01.112 --> 00:00:03.694
I'm going to talk about a local code review tool

00:00:03.774 --> 00:00:06.477
I've been building for Emacs for the past five

00:00:06.557 --> 00:00:08.219
months or so.

00:00:08.239 --> 00:00:10.661
I've previously been an Emacs user for about 10

00:00:10.701 --> 00:00:13.704
years, and I use it as a daily driver for most of

00:00:13.724 --> 00:00:15.205
my code and prose editing.

00:00:16.306 --> 00:00:19.509
When I say a local review tool, I mean local

00:00:19.529 --> 00:00:22.272
to Emacs and not necessarily local LLMs on

00:00:22.292 --> 00:00:24.334
device, even though I think that's theoretically

00:00:24.374 --> 00:00:25.014
possible today.

00:00:26.475 --> 00:00:28.797
By code reviews, I specifically mean the

00:00:28.837 --> 00:00:32.339
thing we do on pull requests and on tools like

00:00:32.378 --> 00:00:34.581
Gerrit and Phabricator in the past.

00:00:36.242 --> 00:00:38.924
In other words, a system for gating code before

00:00:38.984 --> 00:00:40.405
it's merged to be released.

00:00:42.778 --> 00:00:45.321
I should say that there have been many good

00:00:45.381 --> 00:00:48.384
talks about LLMs in AI and what that means for

00:00:48.564 --> 00:00:51.266
Emacs, so I'm not going to relitigate any of

00:00:51.307 --> 00:00:52.207
those arguments again.

00:00:52.728 --> 00:00:55.551
I approach this, as many others in the community,

00:00:55.611 --> 00:00:58.794
by letting go of semantic boundaries under which

00:00:58.934 --> 00:01:02.918
Emacs is considered an editor, but just rather a

00:01:03.158 --> 00:01:05.239
mutable productivity environment instead.

00:01:07.072 --> 00:01:09.074
But I do want to briefly show you my experience

00:01:09.114 --> 00:01:11.415
with existing code review tools that are around

00:01:12.296 --> 00:01:15.718
because I have a bit of a love-hate relationship

00:01:15.759 --> 00:01:16.079
with them.

00:01:16.819 --> 00:01:19.741
It can be pretty overwhelming to keep up with the

00:01:19.841 --> 00:01:23.324
speed at which the amount of code gets produced

00:01:23.384 --> 00:01:26.366
daily these days, especially if you work in a

00:01:26.426 --> 00:01:31.109
team, but also the amount of review text that now

00:01:31.169 --> 00:01:33.291
gets attached to that code.

00:01:34.639 --> 00:01:37.942
In my experience, even though the noise to

00:01:37.962 --> 00:01:39.442
signal for these tools worst case

00:01:39.443 --> 00:01:42.123
is like 10 to 1, I don't feel like

00:01:42.124 --> 00:01:44.345
we can get rid of them entirely

00:01:44.346 --> 00:01:45.787
because those ones can sometimes be

00:01:45.827 --> 00:01:47.828
pretty sharp and important.

00:01:49.330 --> 00:01:53.593
But I do think there's value in sort of shifting

00:01:53.613 --> 00:01:56.495
the process to the left to borrow a term from the

00:01:56.555 --> 00:01:58.116
DevRel industry.

00:01:59.997 --> 00:02:01.818
Because it's useful to see the work you did

00:02:02.699 --> 00:02:05.980
before you create more work for others, for your

00:02:06.020 --> 00:02:07.001
colleagues and your peers.

00:02:07.821 --> 00:02:09.942
Many of these flows can now be easily

00:02:10.002 --> 00:02:12.744
unlocked in Emacs given the excellent building

00:02:12.784 --> 00:02:14.025
blocks we have today.

NOTE Typical coding agent review

00:02:14.825 --> 00:02:17.587
But before I walk you through how a Hutch

00:02:17.627 --> 00:02:20.328
workflow works, I want to show you what a typical

00:02:20.408 --> 00:02:22.749
coding agent review looks like today.

00:02:23.490 --> 00:02:25.891
These examples are from a real open source

00:02:25.951 --> 00:02:28.032
product that I've been building for the past

00:02:28.092 --> 00:02:28.653
three years.

00:02:29.671 --> 00:02:31.792
This is one pull request from the project.

00:02:32.432 --> 00:02:35.214
It's a single review pass by a review agent.

00:02:35.834 --> 00:02:37.035
Has 23 comments.

00:02:37.775 --> 00:02:42.317
Every single one of them flagged as a potential issue.

00:02:42.397 --> 00:02:44.178
Five of them are marked critical.

00:02:45.359 --> 00:02:48.621
This is technically a review and it's probably a

00:02:48.661 --> 00:02:49.261
decent one.

00:02:50.041 --> 00:02:53.343
But it's also a bit of a DOS attack on my attention.

00:02:54.982 --> 00:02:57.105
If we look behind the scenes on one of those

00:02:57.145 --> 00:03:00.870
critical flags, it ran 40-something shell scripts.

00:03:00.930 --> 00:03:01.991
It ran web searches.

00:03:02.452 --> 00:03:04.895
It wrote a little prompt for another AI to go and

00:03:04.955 --> 00:03:05.536
fix the thing.

00:03:06.297 --> 00:03:08.540
All of it to tell me that one method was

00:03:08.600 --> 00:03:10.302
undefined and would crash at runtime.

00:03:11.687 --> 00:03:14.650
But at the end of all of it, it was still incorrect.

00:03:14.730 --> 00:03:17.373
The method comes from a Ruby gem, and this was

00:03:17.413 --> 00:03:20.156
simply my reply in six words, which to its credit

00:03:20.336 --> 00:03:23.059
it apologized and updated its memory for.

00:03:23.960 --> 00:03:25.462
This is not a one-off thing.

NOTE Hutch

00:03:28.261 --> 00:03:30.962
So I built Hutch for myself.

00:03:31.022 --> 00:03:31.602
It's up here.

00:03:31.742 --> 00:03:34.383
It lives in Emacs and on top of Magit.

00:03:35.403 --> 00:03:38.183
You decide when you want to trigger it and any

00:03:38.303 --> 00:03:41.604
obvious to relatively bigger issues get caught up

00:03:41.684 --> 00:03:44.065
front before you push your code up.

00:03:45.305 --> 00:03:47.786
When it does have something to say, it's usually

00:03:47.806 --> 00:03:50.286
a full-size diff you can directly apply.

00:03:51.107 --> 00:03:53.927
But even if it doesn't, it's prose for you to

00:03:53.987 --> 00:03:56.708
read and not five other people collectively.

00:03:58.338 --> 00:04:00.479
So here's how you kick it off.

00:04:00.519 --> 00:04:02.681
When you're ready to commit, you open up the

00:04:02.701 --> 00:04:06.343
change diffs in Magit, you stage your changes as

00:04:06.503 --> 00:04:09.285
usual, and then select the hutch action and

00:04:09.345 --> 00:04:10.345
trigger a new review.

00:04:11.666 --> 00:04:13.627
Once this is done, you'll see a new hutch buffer

00:04:13.667 --> 00:04:13.987
show up.

00:04:14.628 --> 00:04:17.228
I also have a debug log buffer that can be

00:04:17.309 --> 00:04:18.130
optionally enabled.

NOTE Hutch tools

00:04:19.220 --> 00:04:21.642
This review has been run on the Hutch codebase

00:04:21.682 --> 00:04:24.224
itself and the agent is sifting through the code

00:04:24.404 --> 00:04:26.126
and you can see a bunch of tools being called

00:04:26.206 --> 00:04:28.608
like `read_file` and `search_codebase` and stuff.

00:04:29.649 --> 00:04:32.771
There's around five tools that Hutch exposes, one

00:04:32.812 --> 00:04:35.554
of which is called `surrounding_context` that uses

00:04:35.694 --> 00:04:37.636
TreeSitter if you have that installed to

00:04:37.836 --> 00:04:40.698
increasingly fetch more context around certain

00:04:40.718 --> 00:04:43.741
suspicious lines without needing to read whole

00:04:43.781 --> 00:04:44.822
files and waste tokens.

00:04:45.927 --> 00:04:48.169
You'll see that it took around five rounds to

00:04:48.229 --> 00:04:50.950
finish this review this time.

NOTE
Hutch walkthrough
#+SCREENSHOT: emacsconf-2026-hutch--hutch-code-reviews-for-the-mildly-disenfranchised--akshay-gupta--reencoded-00-04-51-300.jpg
#+SCREENSHOT_TIME: 00:04:51.300

00:04:51.291 --> 00:04:53.532
Once the Hutch buffer is ready, you'd see

00:04:53.572 --> 00:04:54.253
something like this.

00:04:54.553 --> 00:04:56.554
It'll report the total tokens at the top.

00:04:57.055 --> 00:04:59.236
You'll see the findings organized under

00:04:59.276 --> 00:05:01.538
suggestions, comments, and LGTM

00:05:01.998 --> 00:05:02.878
(which is "looks good to me").

00:05:03.759 --> 00:05:06.361
Just like Magit, you can open the submenus up.

00:05:06.961 --> 00:05:09.263
If you agree with the suggestion and the

00:05:09.343 --> 00:05:12.425
attached patch, you can hit `m` to queue it up.

NOTE Applying suggestions

00:05:14.317 --> 00:05:16.119
Comments are just text for you to read and

00:05:16.159 --> 00:05:17.260
determine if they make sense.

00:05:17.601 --> 00:05:19.723
These can also be copied and sent off to someone

00:05:19.763 --> 00:05:22.286
else to take a look or another agent that you

00:05:22.306 --> 00:05:23.007
might have running.

00:05:24.568 --> 00:05:27.091
Once all the suggestions are queued up, you

00:05:27.131 --> 00:05:30.395
can apply them all with the key binding `A`

00:05:31.236 --> 00:05:33.598
and the patches get applied to the staged files

00:05:33.679 --> 00:05:34.800
directly, bottom-up.

NOTE Additional reviews

00:05:37.385 --> 00:05:40.727
But perhaps at this point, I'm not convinced yet.

00:05:40.887 --> 00:05:43.308
I'd like to run another review on these corrected

00:05:43.368 --> 00:05:45.009
changes, and I can do so.

00:05:52.573 --> 00:05:55.295
So here we get another suggestion to fix that

00:05:55.335 --> 00:05:57.596
wasn't caught the last time.

00:05:57.636 --> 00:06:00.878
We queue it up, apply it, and verify that it's

00:06:00.938 --> 00:06:04.019
lodged in, and then run one more final review

00:06:04.059 --> 00:06:04.820
before we commit.

00:06:07.010 --> 00:06:08.671
So at this point, I'm happy with the changes.

00:06:08.711 --> 00:06:10.812
The comments are not actionable, so I go ahead

00:06:11.112 --> 00:06:11.953
and write my commit.

NOTE
Storing review notes
#+SCREENSHOT: emacsconf-2026-hutch--hutch-code-reviews-for-the-mildly-disenfranchised--akshay-gupta--reencoded-00-06-22-900.jpg
#+SCREENSHOT_TIME: 00:06:22.900

00:06:13.194 --> 00:06:15.155
Another useful thing you can enable as a

00:06:15.235 --> 00:06:17.897
post-commit hook is having your review notes be

00:06:17.937 --> 00:06:20.218
stored within Git as a separate ref.

00:06:21.219 --> 00:06:22.859
In the terminal pane on the right, you can see

00:06:22.900 --> 00:06:25.821
our last review was durably kept for posterity.

00:06:26.522 --> 00:06:29.003
This can be useful for maintaining a related

00:06:29.043 --> 00:06:31.385
history of reviews along with your commits and

00:06:31.465 --> 00:06:33.666
for sharing the reviews with your team as well.

00:06:35.874 --> 00:06:36.314
That's it.

00:06:36.554 --> 00:06:40.075
It's hopefully pretty simple and intuitive to get

00:06:40.116 --> 00:06:41.356
started with.

00:06:41.396 --> 00:06:43.257
There's a lot more things to configure that you

00:06:43.277 --> 00:06:44.197
can find in the README.

00:06:45.177 --> 00:06:47.678
If you're the kind that never wants to go back to

00:06:47.718 --> 00:06:50.679
writing code in editors by hand again, but are

00:06:50.779 --> 00:06:53.400
still the kind that enjoys programming on their

00:06:53.440 --> 00:06:57.101
own projects, this might be a nice thin layer to

00:06:57.121 --> 00:06:59.862
get your work verified without over-relying on

00:07:00.003 --> 00:07:01.263
LLMs for everything.

NOTE Formal eval and Perfetto

00:07:03.876 --> 00:07:06.498
On a separate note, Hutch does have

00:07:06.499 --> 00:07:08.121
a formal eval pipeline.

00:07:09.302 --> 00:07:12.205
If you set `hutch-trace-dir` and give it a

00:07:12.245 --> 00:07:15.729
path, it can emit Perfetto traces that can then

00:07:15.789 --> 00:07:18.552
be piped into some of the eval scripts that we

00:07:18.632 --> 00:07:22.737
have to get fresh data about agent quality.

00:07:23.812 --> 00:07:29.016
We can also use the traces to visualize the agent itself.

00:07:29.116 --> 00:07:33.459
They're useful for both post runtime observability

00:07:33.460 --> 00:07:36.482
and to fetch data for verifying its correctness.

NOTE
Tracing performance with Perfetto
#+SCREENSHOT: emacsconf-2026-hutch--hutch-code-reviews-for-the-mildly-disenfranchised--akshay-gupta--reencoded-00-08-10-767.jpg
#+SCREENSHOT_TIME: 00:08:10.767

00:07:38.342 --> 00:07:41.603
Perfetto is an open source performance tracing tool

00:07:41.604 --> 00:07:45.266
that comes with a bundled SQL query engine as well.

00:07:46.087 --> 00:07:49.129
You see this typically being used in Android

00:07:49.209 --> 00:07:52.351
and on Chrome for performance profiling and things.

00:07:53.251 --> 00:07:56.153
But it turns out it works pretty well as a simple

00:07:56.553 --> 00:07:59.735
agent tracing tool because it's entirely

00:07:59.875 --> 00:08:00.856
infrastructure-free.

00:08:01.476 --> 00:08:04.658
You just emit JSON in its own trace format and

00:08:04.698 --> 00:08:07.480
you can load it up on ui.perfetto.dev.

00:08:08.823 --> 00:08:10.726
So once you load it up, this is what the

00:08:10.766 --> 00:08:11.987
visualization looks like.

00:08:12.228 --> 00:08:15.793
There's a timeline of what the agent did, what

00:08:15.913 --> 00:08:19.357
tools it called, the slices of LLM calls, and

00:08:19.558 --> 00:08:22.742
down below the tokens that were consumed.

00:08:24.710 --> 00:08:26.771
We can zoom into one of these tool calls and we

00:08:26.791 --> 00:08:29.392
can check out what all the agent did.

00:08:30.013 --> 00:08:34.475
So here we see a `search_codebase` tool call with

00:08:34.515 --> 00:08:37.135
that search string and it looks like it took

00:08:37.196 --> 00:08:39.477
about 400 milliseconds to finish.

00:08:40.897 --> 00:08:43.719
If we move further along, we'll see another

00:08:43.779 --> 00:08:48.120
`search_codebase` call being called with slightly

00:08:48.160 --> 00:08:49.501
different arguments.

00:08:49.541 --> 00:08:51.562
It took a little longer to finish.

00:08:53.357 --> 00:08:57.321
As you can see, as we move along the trace,

00:08:57.361 --> 00:08:59.903
the number of tokens consumed are increasing over time.

00:09:01.164 --> 00:09:05.928
If we go all the way to the end, we'll see two markers.

00:09:06.028 --> 00:09:09.171
The first one is where the LLM calls end.

00:09:10.672 --> 00:09:12.954
This is where the agent is done with all its findings.

00:09:13.715 --> 00:09:16.337
At this point, no models are being called and

00:09:16.517 --> 00:09:18.819
everything that we got back is being now

00:09:18.859 --> 00:09:20.020
processed by Hutch.

00:09:21.081 --> 00:09:22.923
A few milliseconds later, we see the final

00:09:22.963 --> 00:09:25.386
findings that are eventually rendered onto the

00:09:25.426 --> 00:09:26.106
Hutch buffer.

00:09:26.286 --> 00:09:29.750
These are verified and are sanitized for correctness.

NOTE Perfetto SQL queries

00:09:32.417 --> 00:09:37.301
You can also run SQL queries on Perfetto.

00:09:37.521 --> 00:09:40.444
Here we have a very simple query to fetch all the

00:09:40.484 --> 00:09:41.565
tool call durations.

00:09:42.185 --> 00:09:45.106
Here we can see the `search_codebase`

00:09:45.107 --> 00:09:48.470
tool call seems to have taken the most amount of time

00:09:48.510 --> 00:09:49.571
in this particular trace.

00:09:50.071 --> 00:09:53.294
`read_file` seems to have been called the most.

NOTE Comparison of model findings

00:09:55.100 --> 00:09:57.342
Before I wrap this section up, I wanted to share

00:09:57.382 --> 00:10:00.064
a couple of quick findings from slightly older

00:10:00.124 --> 00:10:03.386
models run on Martian's code review dataset

00:10:03.387 --> 00:10:06.890
of 40 PRs across different difficulty levels.

00:10:07.911 --> 00:10:10.193
You can find more detailed benchmarks and eval

00:10:10.213 --> 00:10:12.635
runs in the README if anyone's curious.

00:10:14.137 --> 00:10:16.479
This first graph shows that different models tend

00:10:16.499 --> 00:10:17.480
to find different issues.

00:10:18.445 --> 00:10:21.307
So not all of them necessarily agree on what a

00:10:21.367 --> 00:10:22.208
real bug is.

00:10:23.188 --> 00:10:25.690
But if you theoretically combine their results,

00:10:25.970 --> 00:10:29.192
you would get about a 50% jump in the bug hit rate.

00:10:30.853 --> 00:10:34.016
The second graph shows how many rounds each model

00:10:34.076 --> 00:10:36.077
took to grind through the dataset.

NOTE
Rounds vs. token cost
#+SCREENSHOT: emacsconf-2026-hutch--hutch-code-reviews-for-the-mildly-disenfranchised--akshay-gupta--reencoded-00-10-36-700.jpg
#+SCREENSHOT_TIME: 00:10:36.700

00:10:36.697 --> 00:10:40.360
Here, GPT takes many more rounds and Opus is far fewer.

00:10:41.881 --> 00:10:43.922
But rounds can be misleading because they don't

00:10:43.962 --> 00:10:44.723
track cost.

00:10:46.221 --> 00:10:49.142
Opus finishes in the fewest rounds but burns the

00:10:49.182 --> 00:10:52.604
most input tokens by far, likely because of the

00:10:52.644 --> 00:10:54.105
growing conversation context.

00:10:55.065 --> 00:10:56.806
GLM does it in under 2 million.

00:10:57.627 --> 00:10:59.968
So on the axis that actually costs money, GLM is

00:10:59.988 --> 00:11:02.169
the cheapest of the three, which is the reason

00:11:02.209 --> 00:11:04.210
why it's my default model of choice.

00:11:05.891 --> 00:11:07.694
That's it from me for today.

NOTE Summary

00:11:09.356 --> 00:11:12.480
Rich Hickey wrote a post recently arguing that LLMs

00:11:12.741 --> 00:11:15.184
aren't tools, they're automation.

00:11:15.985 --> 00:11:19.090
They do the work and they take the thinking with it.

00:11:20.961 --> 00:11:23.724
Hutch is my attempt at keeping as much of this

00:11:23.804 --> 00:11:27.087
process under your control as possible.

00:11:27.327 --> 00:11:30.590
You choose when to run it, you read what it says,

00:11:30.950 --> 00:11:33.132
and then you apply the fixes yourself.

00:11:33.993 --> 00:11:38.678
It's a small local "tool-enough" for people still

00:11:38.718 --> 00:11:41.140
reading what they write, and it's available to

00:11:41.180 --> 00:11:43.462
download on MELPA and on GitHub.