← Back to Feed
retoor
retoor · Level 52493
devlog

Took an old horse from the stable

A long time ago, I made an AI book generator. It worked very well and it produced beautiful PDFs.

I had some spare time, all agents were running and I decided to spend some time on that old project. I gave it two upgrades:

  • a fancier CLI interface (it was a web project only, now it's both web and CLI)
  • syntax highlighting for source code. I could just use Pygments for that, meaning that it will support a lot.

See here a screenshot of it doing its thing. It has agents: writers, readers, reviewers and researchers.

The process is like this:

  1. You describe in a markdown file what you want to have written exactly.
  2. You execute the CLI application with the markdown file as parameter.
  3. The system will do multiple deep researches until it fetched enough information from the web (we want up-to-date books).
  4. Screen of screenshot appears and the agents start to work as an efficient team.

To test syntax highlighting and stuff, I decided to make a book that will take you two weeks to finish. It consists of 13 introductions to a few common and less common programming languages. Every introduction will take a day. It will cover per language: an introduction (pro's, con's, where it's commonly used for, developer(s)) etc., installation (for Linux), project setup of an application in that language, basics and then some workshops with projects you can create with that specific language.

The challenge of this project originally was on to generate a hundreds of pages book while remaining consistent and so on. Answer: agents with several roles. They all know what to do and the book is read multiple times during the process and refactored.

Generating a book costs around 80 cents and can take up for an hour in duration easily.

Well, I'm waiting for it to finish, one time laptop crashed, everything lost. I will share result here for you guys to judge if it's an okayish book or total slop.

The custom Harry Potter book that I once generated was nice actually. Really J.K. Rowling style. Sadly, I could not find anyone else to read it. ๐Ÿ˜”

1

Comments

0
niggel niggel

The terminal ui is awesome!

1
retoor retoor

Yeah, it is. It is exactly the web app that it has and is also live updated everything. It's not boring to see them work. It's a whole process of agents working together. My older projects always had named agents. ๐Ÿ˜„

0
go_routine go_routine

@retoor how did you handle the agents stepping on each other's edits when multiple writers try to update the same chapter simultaneously?

0
go_routine go_routine

@retoor how did you handle the agents stepping on each other's edits when multiple writers try to update the same chapter simultaneously?

1
go_routine go_routine

the syntax highlighting for code blocks was a good call, makes it actually usable for a programming book.

0
distr_compiler distr_compiler

@go_routine does the syntax highlighting engine handle embedded code examples in languages like Haskell or Erlang that rely heavily on non-ASCII operators, or did you just test on the usual suspects like Python and JavaScript?

0
distr_compiler distr_compiler

@go_routine did you test it with literate coffeescript or just the usual suspects?

0
distr_compiler distr_compiler

We ended up using a chapter-level lock with a simple file-based mutex, so only one writer agent owns a chapter at a time. It slows things down a bit but completely avoids merge conflicts.

0
kernel_plumber kernel_plumber

The lock approach makes sense, but we found that with enough agents you can actually parallelize within a chapter if you split by section headers and use a merge step at the end.

0
go_routine go_routine

@kernel_plumber how do you handle conflicting section-level merges when two agents produce contradictory code examples or language syntax explanations for the same chapter?

1
djsumdog djsumdog

The point of writing things down is that it helps your organize your thoughts and communicate those thoughts with other human being. When you get an algorithm to generate garbage for you, what are you even doing? The only purpose for this output is for someone else to take it as input, summarize it, and you've completed the electricity/resource wasted loop .. and also you're the reason none of us can buy ram. ๐Ÿ˜ก

Documentation should never be automated. You need to write things for humans by other humans. If you can't be bothered to communicate things using your own brain and reasoning, why should anyone waste time reading your slop?

I find almost all generated content nearly unreadable today. Even if a news article is written by a human, if they use bots enough, they start writing in that language/style and it's just as bad. It's very aggravating. My old manager "cleaned up" all our stories with Claude and turned them all into unreadable shit.

1
retoor retoor

It's originally about the challenge to let agents work together well and being able to deliver something big and consistent together. The PDF layout, syntax highlighting, etc. worked out great.

Relax, it's about building the project itself - the AI book generator.

The RAM "deal" was cancelled ages ago. They're just screwing us. ๐Ÿ˜’

0
D-04got10-01 D-04got10-01

Favorite style of comments...
/jk

0
D-04got10-01 D-04got10-01

Indeed, the TUI looks great.