Effect-TS masterfully demonstrates how Software Transactional Memory turns chaotic concurrency into predictable, atomic logic. It is a high-level masterclass proving that rigorous architectural patterns are essential for truly production-grade TypeScript.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Roasting Julius' code in T3 CodeAdded:
Let's see, I'll start from the top.
So it's a minimal web GUI for coding agents currently, codex and Claude more coming soon.
if you really want to contribute, still read this first.
Let's see what, let's see what Julius said.
If you want to contribute, we're not actively accepting contributions.
You can still open issues or PRs, but know that there's a high chance that we just close it, deferred forever or never ever look at it.
I like this contributing.md.
I like this one.
If that's annoying, that's because it is this project.
It's got better.
It got better.
Like it's getting better.
This is good.
this project is still early and we're trying to keep scope, quality and direction under control PRs are automatically, what we're most likely to accept focused bug fixes, reliability fixes, perf improvements, sure.
Okay.
So let's see here.
What is in the agents file?
Sure.
Sure, sure, sure, sure.
Sure. Okay.
So there's package roles.
I feel like some of this is not necessary.
Sorry, Julius.
I think almost all of this is unnecessary context.
These are not, these are fine.
I would argue if Julius is listening, I doubt he is, but if he is, I would argue this is the only thing that you need in your agents file.
Maybe this.
Maybe if, if, I don't know if it has like a folder with reference repositories or something probably that goes in the, and you claude.md them as well.
Let's see.
apps now these are the, let's look git ignore Mike it does not look like Julius has adopted your pattern or at least it's not evident to me.
My pattern being? clone the repo locally.
As they say, not my problem.
Well, anyway, let's look at some code.
Let's look in a shared source.
I don't know.
What's drainable worker do drainable worker is a queue based worker that exposes a drain effect wraps the common queue unbounded plus effect forever pattern and adds a signal that resolves on the quque is empty and the current item has finished processing.
Okay.
It feels like, okay, wait, let's look at this.
Makes a queue makes a deferred, Wait.
Immediately complete deferred.
Okay.
Now I'm going to defer judgment for one minute.
As a state ref.
And finalizer to shut down the queue, which is fine.
State through finish one modifies the state by checking how many outstanding there are, I guess, outstanding tasks.
and if remaining is zero returns the idle deferred, otherwise returns null.
Oh, probably he wanted a latch instead of at the idle, deferred.
I dunno, just say.
It seems like a counter, outstanding that counts the amount of current pending items.
And then idle is just the third that completes when there are no entry outstanding.
So probably that would have been like a latch.
Right.
And the other way it's kind of rolling.
Yeah.
And that the third completes only when there are no entries because we saw before that completed at the end of the finish one.
It completed that if it was idle node, right?
Yeah.
This is a good case to use STM actually, because all of this is going to be unsynchronized.
And I have race conditions all over the place.
But if the whole purpose of this is just to drain a queue or to be able to wait for draining a queue.
And this is before having a signal, a signal where the, when the queue gets to zero.
That's the point.
Right.
It's not easy to do with a normal queue.
Right.
Very easy to do with a transactional queue.
You heard it here first, folks.
A good use case for STM right here.
Julius, if you're listening STM.
Yeah, I'd say STM, a simple as the TX queue.
And then your, your idle check simply becomes a size check with a retry with an STM retry.
And it will automatically give you a signal when, when the size gets to zero.
Create a PR for it.
We could.
Fair enough.
We could retry T3 code to do the PR.
That would be fun.
That would be fun.
Except we use neither, neither Codex nor a Claude code.
So yeah, I'm an, we're all, as far as I'm aware, we're all Open Code enjoyers, except for Tim, who's currently a Clanka enjoyer.
But still uses open code and no, I think actually he integrated Clanka into Lalph now too.
I've taken state idle and then this just waits.
And this idle check would just become your STM retry loop.
Right. Yeah.
Plus the state could also be a Tx ref.
So the whole set of changes is transactional.
Maybe we will make a PR.
Maybe I'll do that today.
And Mike can check my work.
You folks can watch in real time.
Like, what is the rule for when, when you need to take an STM and when, when, when is it correct to what's the word I'm looking for?
Hang on.
I'll show you.
I know this is really tiny.
Give me one second.
Let's go back in here.
When is it correct to wrap?
At what boundary do you do that with your STM?
What's that?
When do you wrap the STM with the with the transaction signal or atomically or whatever it's called?
When you create a Tx ref This is the effect that creates a Tx ref and requires a transaction.
If you do this.
Right.
You get your Tx ref.
How?
Like, how do you know, like similar to like I'm thinking of trans like providing the transaction similar to like scoped, right?
Like so how do where do how do I know.
a good question for the audience and also for me is like, how do you know what the transaction boundary is?
Like what's the rule of thumb there?
There's no real rule of thumb there.
It's totally dependent on business logic.
So in this case, the, the scope of a transaction is the scope of the retry.
Got it.
That makes more sense.
So you basically let it bubble up.
It's like database transactions.
When do you make a database transaction?
Depends.
Right.
So like the case of, in the case of like the, the T3 code example, if we take that more concretely, it would be correct to create the queue in the ref upfront as small transactions, and then later on down the road, when you're doing your idol check, you would do like, you know, your whatever, and you'd say, just for the sake of argument, you'd have this and you'd say like, And the current count is just the getting the size of the queue.
Let me get rid of this business here.
This would be the scope of the transaction here, this whole thing.
So you would wrap this whole thing.
That is to get the signal, yes.
That said, if you wanted to compose these into other things, then you would have to extract the inner check.
The idea here is that the scope of the thing that you want to retry as part of your transaction is your boundary for where you market as a transaction, like where you provide the transaction.
Whatever happens inside the transaction is atomic, whatever happens outside it's not.
So if I wanted to, for example, idle check and do some other operations within the same transaction, this would not be okay.
Because you would have to separate transactions.
Unless you decide that that transaction self-compose.
So if you have an above transaction, it automatically retries children's transactions, which I'm not sure it's a good kind of an implicit pattern.
Yeah, I kind of like that it feels the same as scope in some regards here.
Where like the boundary of your, you have to decide what the boundary of the transaction is similar to what, like you have to decide what the boundary of like a scoped operation is.
So there's like some degree of familiarity here.
Maybe I will make a PR and see if I can make this into something that uses STM.
Cleans this up a little bit for Julius.
What else is in here?
Yeah, so I'm in the net module now and I was just looking at this tri-reserve port method.
So yeah, for those, for this, I thought this was kind of a neat use of callback, but the idea here being that effect.callback allows you to wrap async operations into an effect.
So you get like a function that has access to a resume method.
So in here, it looks like a server's created, they have a settled callback, and if the server actually settles, then they resume.
And once you resume, the callback exits.
So if you run an effect.callback and you never call resume, then this effect would never finish unless it's interrupted.
Unwrap the server, then if there's an error, the settle method is called with a failure effect.
If listening is successful, it looks like settle is called.
It looks like settle is called with the resolved address, I guess.
And then effect.callback is also nice because if you have a callback that is currently running and gets interrupted, you kind of might want a way to like clean up stuff that's happening inside the callback.
And whatever you return from an effect.callback, it's kind of like, I really hate this comparison, but for folks coming from React, it's similar to like a useEffect where you can like do stuff and then have a thing that you return at the end that does clean up.
It's similar in spirit here, but this effect that you return at the end would be called if the callback is interrupted.
So like if nothing has called resume, and this callback is still running, and it gets interrupted, then this would get called.
And in this case, they're closing the server.
So I guess this service is primarily for network operations.
Effect equals use effect, gotcha.
We need the Johannes meme on like a one-click binding, the Drake use effect meme that Johannes had created a while back.
Net service is a service for startup networking helpers.
Is this not the same?
I guess not.
Can listen on host.
I guess this is like low-level networking node net wrappers.
This is a cool little example of zipwith.
Is port available on loopback?
Can listen on local host or on the IPv4 loopback and on the IPv6 loopback?
And if both are true, then zipwith gives you the result of both of these and you can do something with them.
Cool.
It's a nice little service.
Would callback only be useful in server side?
Would callback, sorry, would effect.callback be useful in server side events if I'm only expecting a specific event for processing versus just using stream?
They are unrelated, right?
I think callback is most useful for integrating with native JavaScript that is callback-based.
So if your server side events, however you're listening to them, if it's like, you know, an event emitter or something like that, that is only called once, then sure.
But server side events are like typically multi-shot type things.
So if effect.callback is a single shot thing, if you're doing something that's multi-shot, stream is probably better.
So in streams, because streams are multi-shot, they can integrate nicely with multi-shot event emitters.
But I think that there's a callback push.
Is there like a.
I think they've been unified into the same.
Maybe.
Anyway, this is the idea.
It's not like a perfect example of this, but like you could.
You could use.
Sorry, I was reading all of these new properties on here.
So you have to use the queue methods.
New event. You would do something like this.
And the idea being here is now this is like a multi-shot situation.
Like the stream can keep emitting these events because it has it like you would be offering them into a queue under the hood.
With effect dot callback.
It's a single shot resumption.
Like it's a it's a it's something that's meant to like wait until some async op is finished.
And then you call resume with that value of with the effect that you want to resume with.
Hopefully that makes sense.
There's no effect imports in here, so we're going to just not not go in there.
schema JSON.
This has only effect imported so we can look at this module.
It doesn't look like there's anything interesting here, though.
And nothing interesting.
All right, let's get out of shared.
Let's go to the apps.
Yeah, let's go to the server.
Let's look at.
I don't know, Mike, pick a pick a thing.
Checkpointing.
Checkpointing sounds good.
Well, layers and services.
Julius, so organized.
Let's look at services.
Checkpoint store.
The checkpoint store is a repository interface for file system backed workspace checkpoints owns get owns hidden get ref checkpoint capture restore and if computation for a workspace thread timeline.
It does not store user facing checkpoint metadata and does not coordinate provider conversation rollback. Okay.
This is a this is a sergeant Dokes moment right here.
These these these four lines, Sergeant Dokes.
I'm looking at I'm looking at you, Julius.
Surprised motherfucker.
It looks like that's just the interface.
Let's look at the actual implementation.
Okay, so and if you don't know who Sergeant Dokes is you had a bad life.
Watch Dexter.
Watch Dexter and then understand that the meme is related to AI generated code.
So make checkpoint store looks like it gets some platform services get core.
This is cool.
Look at this real quick.
I know I'm like a little ADD at the moment, but let's just look at this.
I want to see if Julius is using my beautiful new child process module.
He is.
He is.
I spent quite a bit of time on this module.
So I'm happy.
I'm happy that people are getting used out of it.
The old command module is was not good.
create trace to monitor.
No, I want to look at the service constructor.
Make it core.
Spawner.
We've got an execute method.
There's a lot of stuff going on here.
This is cool.
Command spawner.
Spawn it makes the child process.
Object with all the stuff it gets from spawn.
Yeah, I think one of the things that I'm most happy about is the ability to actually like properly collect output from different streams now.
Which is kind of nice.
Wasn't really possible in an easy manner before.
Actually really wasn't possible because of race conditions.
This is very cool.
This is a very involved get integration.
I like it.
All right.
Back to the checkpoint store.
It looks like it's primarily just using the delegating some commands to get to get checkpoints and other information.
I wonder if any of these are also then decoding with schema.
Capture checkpoint.
Make a temp directory.
Isn't there a make temp directory scoped?
Unless he's doing something else here.
I thought that there was a... I am switching to another screen, but you don't need to see what I'm doing.
Give me one sec.
Are they using the file system module from us or No, there is.
I think so, yes.
Make temp directory.
It's not like a huge win here, but you could just use make temp directory scoped here.
And avoid having to do the cleanup yourself here.
Avoid the whole acquire release here.
Make temp directory scoped and then flat map that directly into this and then wrap it all with effect.scoped.
Is there any schema stuff going on?
Let me see.
Sure why you would have it here.
I don't know.
I'm just looking at what's going on in here.
It's cool though.
This is a very nicely designed service.
A lot of these could probably be converted to effect.fn with span names to get better stack traces and also to integrate with tracing later if that was desired.
It's a small perf improvement, but it adds up over time to not recreate these generator objects every single time these methods are called.
And when you have lots of them being created all the time like this as part of calling a function.
Getting telemetry out of the box is also a huge win.
I think even less than that, getting the stack traces is a huge win.
Being able to see where something was called.
I got a lot of PRs to make to the T3 code.
This is crazy.
But according to the contributing.md You cannot.
My PRs will not be accepted.
Alright, one more thing we can look at and then we'll probably call it.
Let's look at persistence.
Wow, there's a lot of stuff going on in here.
Let's look at projection state maybe.
Is there anything interesting here?
Make the repository.
This upserts.
Making very heavy use of effect SQL, which is cool.
It's like literally going all in on effect.
Yeah, this is probably one of the best examples I've seen of effect v4 being used in production in an open source app.
That said, if you have better examples, send them to me.
This is high quality code.
You can tell that some of it's been generated with AI and still is very high quality.
Aside from a few small things that could be improved with just lint rules or the effect LSP running on checks.
But yeah, this is a very high quality code base from what I've seen so far.
I like how Julius specifically said don't open issues or PRs and there's 337 issues and 234 open PRs.
Because nobody reads code contributing.md.
Yeah, nobody but me apparently.
Probably you should have said in the readme as a first line, please open PRs and issues.
Please, please do not contribute.
Please contribute so people would do the opposite.
Anyway, yeah, high quality code base.
Go take a look.
Don't contribute.
Unless you have something worthy to contribute, I guess.
Yeah, T3 code looks like very high quality code.
I'm sure that in Open Code also there are reasons and rationales why they took the approach that they did.
There may be better ways to do things, but it's exciting to see effect getting adopted there as well.
I'm sure that over time we'll see more and more effect in that code base.
But yeah, this is it's cool to see effect in some of these larger open source projects.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 views•2026-05-29
So What's Odin Lang Even Good For
TechOverTea
131 views•2026-06-01











