Jamming with Jev and Claude on TidalCycles A developer built a coding agent using Anthropic's Claude and the live-coding music language TidalCycles that generates infinite music, exploring whether AI systems can exhibit creativity. The project frames machine creativity through Margaret Boden's definitions—combinational, exploratory, and transformational—and argues that language models, trained to predict likely continuations, default to familiar patterns rather than genuinely novel output. What is creativity? When thinking about what makes humans more intelligent than machines is our ability to create outstanding works of art. Our Western Schelling Points are that we immediately start to think about Leonardo Da Vinci’s Mona Lisa, Wolfgang Amadeus Mozart’s Requiem, or Wanderer Above the Sea of Fog by Caspar David Friedrich. Even outstanding achievements of technology like a Ferrari, an Apple laptop, or buildings like the Sagrada Família in Barcelona can be seen as works of art. We sometimes say that these works touch our soul. But what does that mean? With AI agents becoming substantially more intelligent, are they also creative? I got a couple of free credits from Anthropic, and I used them for building a coding agent that, with the help of TidalCycles, can generate infinite music. Similar to previous research into vindication https://medium.com/@jsemrau/game-theory-and-agent-reasoning-i-eed64b49ff37 and ambition https://jdsemrau.substack.com/p/governing-ambition-with-owasp-llm , I am now trying to answer the question: if infinite monkeys type on infinite computers, will one of them write Mozart’s Requiem? Before you spend more time reading my post, here is a result how this sounds like. Table of Contents 1. Creativity as a property of a system 2. What makes a song good in mathematical terms? 3. Live coding as a stage for machine creativity 4. Designing from first principles 5. The architecture 6. The phase machine 7. The director’s instruction 8. The role of surprises 9. The role of the judge 10. The code model 11. Prompting Tidal 12. Results: The live engine 13. Divergence: does it produce novel ideas? 14. Lessons Learned 15. Sources So let’s start to define first what we understand as creativity. Psychology’s standard definition needs three things: 1. An original and effective creative product. Something new that doesn’t work is noise. Something that works but isn’t new is routine. 2. Margaret Boden adds in The Creative Mind a third one: surprise Another minor variation is to distinguish the character of the innovation, whether it is psychologically creative P-creative when it is new to the one who creates it, and historically creative H-creative when it is new to everyone. For music, that means each track must be considered new compared with what other music the listener has listened to already. Boden further spreads creativity along three axes. 1. Combinational creativity that joins existing ideas in unfamiliar ways. The smartphone is a typical example here. 2. Exploratory creativity that moves through a structured space, like a chessboard or a blues rhythm, and finds new ways to play. 3. And finally, transformational creativity that changes the rules of the space itself. Einstein’s Theory of Relativity is the prime example here, because he changed Physics itself. Most creative innovation today is combinational, as the world around us is constantly improved by research institutes in the world around them, and new researchers are graduating to make their mark on the world. Transformative creativity is rare. Even among humans. Following that definition, my “Jam” session could be seen as combinatorial, as it combines music as code, autonomous agents, and live streaming with user input in a new way. We can argue that the invention and successive productization of generative AI fundamentally transformed the world of Artificial Intelligence. I sometimes refer to it as a completely new branch. Even though there is a clear lineage from Neural Networks and Markov Chains to Large Language Models. A language model by itself can never be truly creative, as it is trained to predict the most likely continuation. Therefore, by definition, it will always choose the most familiar way in a structured space. Ask the model for a chord progression, and it writes the most typical one. This is also sometimes referred to as the Exploration vs Exploitation problem. Instruction tuning narrows its range further, a narrowing often called mode collapse. Raising the sampling temperature doesn’t solve this. It adds randomness, which raises novelty but lowers quality at the same time. It then generates music that is neither pleasant nor interesting to listen to. And I don’t mean that in a Hindustan way. Creativity as a property of a system Csikszentmihalyi’s systems model 1988 places creativity not in one mind but in the interaction of three parts: 1. an individual who produces variations, 2. a domain of rules and symbols, and 3. a field of gatekeepers who decide which variations survive. The Geneplore model Finke, Ward and Smith, 1992 splits the creative act into generating candidates who structure and exploring them. The agent system does this with modern agent tools; such a system is apparently obvious. What does this mean for my project? Let’s start with a general flow of how such an agent could work. Generation . Here I have implemented 2 agents. The first is the Director, who sketches the overall track and adjusts execution with verbal instructions per track. The second is the Performer, who edits or generates three proposals per move. Domain contains the art direction. I.e., the rules and symbols that are valid for this track, the validator, the harmony rule, the block library, kits, and valid ranges. Field the Jev-based judge in the loop, which classifies the most probable statement, and the human-in-the-loop that gives me a simple 👍/👎 per line, adjusting the song during flight. Memory is an important component in all my projects, and here it’s the same. This time the project contains the track’s history, the last four tracks’ keys, progressions, hooks, and surprises, and the session logs. Chance is where creativity comes in. Here, a planned accident, not a completely random spark, shapes the arc of the song. Let’s try to model creativity C mathematically in the context of generating music. Creativity is expressed as the current plan in relation to the history of making music. Let x be the director’s plan for a track. L be the space of all valid plans in key, chord tones on strong steps, sounds from the style’s kit, values in range and H be the stream’s memory of the last four tracks. Then we can write creativity as Given the stream's recent history, H is its value times its novelty. Because both factors are 0 or 1, multiplying them works as an AND . A plan that is valid but repeats something scores 0, and so does a fresh plan that's out of key. "New" is also only relative to H : the plan only has to be new for this stream's recent tracks, not new in music history. C = 1 is true when the plan is valid, and none of its key, progression, or surprise was used in the last four tracks. Otherwise C = 0 . Value is pass or fail : 1 if the plan lies in L , the set of valid plans in key, chord tones on strong steps, sounds from the style's kit, values in range , and 0 otherwise. There is no "more valuable" plan. That is what the next sentence in your doc means by "value is a gate, not a goal". Novelty is checked separately for three features of the plan: - f x is the plan’s value for that feature, e.g., its key, “A minor”. - H f is the set of values that feature had in the last four tracks. - Each factor is 1 if the plan’s value is not among those four. The product ∏ is again an AND, so the plan is novel only if its key, its chord progression, and its surprise are all different from the last four tracks. In this concept, value is a gate. But in its actual code implementation, the gate repairs rather than rejects. The review function replaces each illegal part of a plan with a legal one and logs the correction. f x is one feature of the plan, its key, for example, and H f the values that feature took in the last four tracks. Novelty is enforced for the three features in the product: 1. a key from the last four tracks gets a new root in the same mode, and 2. a recent progression or surprise is replaced, or 3. other features the hook, the shape of the sections, the sounds are asked to differ in the prompt but not enforced. What makes a song good in mathematical terms? The agent samples its plan from a dynamic list of all possible and valid plans. Where b is the fixed brief the vocabulary and rules, the same for every track , sigma is one of twelve sparks drawn at random ”a hook with more rests than notes”, “start the progression away from the tonic” , and hat k is a random suggested key that isn’t in H, half the time a neighbour of the previous key. sigma and at k move the model’s starting point without lowering value, because whatever it writes still passes the gate. Within a track: complexity as a target. A track is a creative moment-to-moment process that keeps developing. The complexity of a program P can be expressed as Each phase of the arc has a target with After two moves in a row that only turn a knob, the next move must change the music itself. After running a series of experiments, I landed on the rule to have at most one surprise per track and never one of the last four, chosen by the director from a menu of eight rule-breaks built only from safe operations. Surprise in Boden’s sense is a violated expectation, and here the expectation is the one the music sets up itself: the drop that falls back, the kick that stays away. If the agent contributes anything beyond the space the code designed is measured with the blind Judge where pi is the share of blind comparisons the agent’s ideas win against random-but-legal ideas, and rho is the share they would win by chance their share of the pool, roughly 0.5 . Then delta 0 means an independent judge prefers the model’s choices to chance within the same space. Code makes every option good enough, memory makes the chosen option new, chance pushes the model off its most typical answer, the surprise budget lets it break the arc on purpose, and a blind judge checks that it chooses better than chance. In Boden’s terms, the system is P-creative and exploratory, with a small, pre-approved step towards transformation in the surprises. To give you a more hands-on expression from one sample session with Claude Sonnet 5 as director and performer, Jev as blind judge, trance, about 71 minutes and 12 tracks. Where novelty was not enforced, the model’s typical answer came back. All 12 progressions start on the tonic chord, even with a spark asking for the opposite. Eleven of the twelve hooks start on the root and outline the triad. Four titles begin with “Iron” and three with “Concrete”, “dark, driving” recurs in the moods, and every tempo falls between 136 and 144 BPM of the 126 to 146 allowed. Asked to change the subgenre from track to track, the model chose psy six times, acid four times, uplifting twice, and progressive never. The first lesson was that novelty appears where it is enforced or measured, and typicality returns everywhere else. But I am getting ahead of myself. For an agent system, creativity is therefore partly an engineering decision: which dimensions to remember, which to perturb, and which to leave to the model. Since I want to ensure we are not generating the full track as Suno does it, and also want to emphasize the live editing nature, I landed on live coding. Live coding as a stage for machine creativity Live coding is a niche performance practice in which a human musician writes and modifies code while it plays, with the code projected for the audience. In TidalCycles, a Haskell-embedded pattern language, a set might start with a single line: 'd1 $ s “bd ~ ~ bd ~ ~ bd ~' From this starting point, the code may grow into a small program of up to nine lines, one per channel 'd1'... d9' Each line is a pattern: rhythms and melodies in compact mini-notation ‘0 ~ 2 4’, ‘