🚀 TwoFold v0.9

I’ve been tinkering with TwoFold for around 7 years now - mostly on the backburner, but occasionally I’d get sucked back in. And I’m glad I did, because it’s a project that’s super relevant to my daily life (I use Markdown files for my personal journal and note-taking). So, after a nearly 2-year hiatus, I finally released TwoFold v0.9. I dusted off the codebase about two months ago, and since then, I’ve been churning out three versions.

Let’s dive into the chaos.

A few highlights from the changelog that I’m super pumped about:

  1. Deno Compatibility: Initially designed for Bun, TwoFold now (mostly) plays nice with Deno. Some tags, like Shell, are still Bun-exclusive, but core tests pass with flying colors on both platforms. I did generate a tfold.js file that I tested on Node.js and the core functionality mostly works, but I don’t plan to support Node.js in the future.

  2. Variables, Variables, Variables: I created the set and json tags, which let you define variables that can be used inside the props or the inner text of the tags. And you can expand/interpolate variables inside prop values. It’s a little programming language inside your text files! For example:

<set name="Cro" state="still alive" />
<log "warn" msg=`${name}::${state}` />

This should log something like this inside your terminal:

2✂f [WARN] {
msg: “Cro::still alive”,
}

I mean, it will definitely log this, because I tested it.

The Variables feature is not finished yet, because I didn’t implement the **kwargs / ...spread syntax yet, and I didn’t add importing. These should land in v0.10, unless I get distracted by something shiny.

  1. Animated Text Files: I got a bit carried away with tags like the dancing skeleton, spinning globe, and Matrix-inspired Smith and Neo. These demonstrate the potential for text games, generative art, or system monitoring, all inside a simple text file.
    This is possible because tag functions can now tweak their own AST meta.node. It’s like letting your code rewrite itself. Dangerous? Yes. Fun? Also yes.

  2. LLM Chat, Streaming Live!
    The ai tag streams responses from local/remote models in your text file thanks to the new editSave function that edits the AST and saves changes to disk. This was a lot of work, but I’m super happy with how it came out.
    This is a different feature than the animation, because the response can take a few minutes to finish and the user still gets streaming responses in the text file. It’s also more experimental…

  3. New Utility Tags: Log, Docs, Tables

  • <log>: For when you want to scream into a file instead of the void.
  • <jsDocs>: Auto-generates docs in docs/readme. I use it to avoid writing tag documentation manually.
  • <table>: Converts malformed ASCII tables to Markdown. I’m 140% sure this will save me 10 minutes someday.
  1. Small Binaries: Each release now includes a tfold binary, weighing in at a trim 55M. The JavaScript code is actually insignificantly small… the Bun executable is 55M, and the tfold is also 55M. That’s because I’m so obsessed about keeping my external dependencies to a minimum.

  2. Performance Enhancements: Lexer and Parser speeds have been significantly improved, and there are even more tests. Your patience (and mine) will appreciate it.

What’s next?

The plan for v0.10 is to improve the variables, like I said before. I also need a new sintax to allow Database-like tags, for example:

This is a normal file, blah blah.

<IDEA "Allow long, multi-line text inside single tags"
  why="It's less typing, and it looks cleaner" />

Inner text inside single tags, take 1:

<TODO prio=! in=proj due=2025-12-12 <
- task 1
- task 2
>/>

And take 2, this is super easy to implement:

<TODO prio=!! in=proj done=2025-12-12 m=`
- task 3
- task 4
`/>

This sintax is not final, I will play with different ideas. In the end, I want to have an entry point into my Markdown journals, import all files and have instant access to all my TODOs, IDEAs, bookmarks, contacts, books and movies.

Conclusion

In the end, TwoFold is a weird little tool that helps people write text files that write back. If you’re into chaotic experiments, check it out. If not, I won’t cry. (Okay, maybe a little.)

@notes #trinkets #twofold #project