A letter to the Effectful team

Hopeful, effectful feedback on Foldkit's future

Since Effectful is throwing its weight at Foldkit and aiming at the complete stack for software, and y'all say you want feedback, here are my humble opinions.

Extra context: where I'm coming from in my 3+ years of Effect

I think it was Ethan Niser who introduced me to Effect back in mid 2023. By November it had allowed me to ship a significantly complex integration with great success - data from an infinitely customizable content database being translated by an unreliable & developer-hostile translating service, all running on users' own infrastructure. I wouldn't have made it without Effect's typed errors and retry policies.

I've been a fan & user ever since.

Adopting Effect was pivotal in my career, it was the first time I felt justified to have an "engineer" title. But it was also at the beginning of the end - very shortly after it I stopped being a professional software developer. So take everything I say with a grain of salt: the 3.5+ years of Effect under my belt have been mostly as a hobbyist.

UI behavior as layers

As I see it, Vercel's launch of the UI SDK marks their unspoken admittance that React will lose in the agentic era. And it gives me a glimpse of what a layer-based approach to platform-agnostic UIs could look like.

A focus trap is cancelled on the web with ESC. Perhaps on a smart TV it's the back button. Listening to these keys are completely different APIs in both platforms. Both implement the FocusTrap service with their own internals for emitting the FocusEscaped message. The dialog component use the FocusTrap behavior without know its implementation.

Screenshot of https://ui-sdk.dev/ showing example behaviors like createPopup and createListbox

I'm a newbie in cross platform - some bitter React Native and mild Capacitor jobs -, and I haven't dived too deep into the UI SDK. But a behavior-first approach feels like the better use of the team's time over something like current FoldkitUI.

Agent-enabled builders will be inventing new primitives that don't fit neatly into the Dialog/Combobox/Toast/... box of lego blocks. It's time we give them the block assembly line.

Devtools: Effect Doctor, FK edition

A year ago Kit shared doctor-effect, which could be brought into Foldkit devtools to visualize submodel/block/layers, or whatever we end up with by the end of the iteration process of the composability research.

Screenshot of doctor-effect, a terminal UI showing a tree of services for a piece of code.

If not this tree view of our blocks, then something is needed to better debug them. The current approach of submodels as regular entries in the model JSON viewer + a confusing per-model message filter picker (which doesn't even sync to the model viewer) doesn't cut it.

Xstate-grade program visualization

I've used the experimental Foldkit Machine a few times, only once with full line-by-line attention. It lacks in several areas and is a bit confusing, but it's a great improvement over putting ad-hoc guards all over your update functions.

I'm very bullish on going deep on state machines, which in this day and age will also make it easier to test & verify our applications.

Screenshot of an example statechart about payments in Stately.ai

But my point goes beyond it: can we have something like stately.ai's inspectable & runnable statecharts for Foldkit? More broadly, what does Foldkit's constraints and tight architecture allow for viewing how a program behaves? (and touching/manipulating it; think Brett Victor's Inventing on Principle)

Styling

A few months back StyleX was all the rage on Twitter for its explicitness and better agent constraining, as opposed to Tailwind. Pleat by Jem offers a more Effect/Foldkit native approach that I think y'all should pay attention to. It's still an experiment (although a polished one), and has its shares rough edges and performance issues, but I've been happily using it in production to good success.

Pleat's landing page hero: "Styles are values. Pleat folds them."
  • Its object-based nature better generalizes outside of CSS (vs. Tailwind or CSS modules). Different environment? Different API shapes, or perhaps an unified shape that compiles to platform-specific code. Invaluable for the future vision of platform-agnostic Foldkit.

  • It has the best story for generative UI and agentic systems, safe and token efficient. Could be more directly based on Effect schema, perhaps - not sure Theme.decodePartial would be approved by Giulio.

  • Primitives, Semantic tokens and Component tokens as the building blocks of theming is a great mental model, and I believe could be paired well with Layers.

  • Recipes are class-variance-authority 2.0 - cleaner, more explicit, and 0 need for cn or tailwind-merge. It's also more agent-friendly as the algebra of Pleat are more straightforward than cn's merging strategy.

  • I'd bet it's easier to build good linters for as opposed to alternatives

Mixed bag of wishes

Rich text editor primitives, perhaps as a behavior.
It's so hard to integrate an existing RTE into Foldkit. I've tried literally dozens of designs with Tiptap, Slate, Wordgard, Lexical, what have you. In the end, the issue is we're trying to make bridges between worlds that don't speak the same language.

Be more vocal about what you need the community to build, beyond using the effect stack itself. Bunch of people full of energy, often stepping on each-others' toes rebuilding the same thing - I think there are like 4 Shadcn versions of Foldkit, for example. Why not guide and unify them with some guidance from the Effectful team? I'd love to have bi-weekly community calls to work on a specific shared project. What other touch points beyond the Q&A can we have to foster effective collaboration?

I'm yet to dive into Patrick's ambitious Foldkit Plus, but it's an attempt at solving many of the above. It can be a starting point for this community convergence.

Integrate learnings from Antithesis' Bombadil into scene testing. Haven't used it in depth, but I'm bullish on PBT that hammers our apps until it breaks.

2D canvas primitives a la tldraw? ThreeJS integration? AR/VR? Declarative dragging? As agents can lift more and more weight, I expect we'll move into spatial interfaces we can touch and experience with our bodies. Filip Falcon's EgoNitida may be a start (haven't used it yet), and there are many out there exploring this frontier.

More Effect/ai integrations to leverage on-device intelligence. On-device speech recognition (ADR) paired with tiny system-one models like Julia 1.5 will allow us to bring ever-more intelligent UIs to users. I'm already using this for my budget/shopping-list app to allow me to speak freely and get back a list of expenditures and things to buy, but the set-up feels brittle.

A few of the things Devin already mentioned and I want to reinforce: Local-first and sync (perhaps with IVM storage, Rindle being a reference), bundle splitting, workers & PWA features, auth...


To avoid losing momentum, I sat down to write and publish in one go, so this list is incomplete. More ideas will come. Let me (and others) know how to best hand 'em to y'all.

Thank you Michael, Tim, Mirella, Sebastian, Giulio, Johannes, Max, and now Devin (and your others colleagues I haven't interacted with), for all the great work you do at Effectful.

Really hope the company breaks through without crushing your soul or ethics.

Henrique