I’m Blake. I write about probability, stochastic processes, Python tooling, and the practical side of building things with code. More about me →

  • The agent personas in my coding workflow

    I use different agents for different jobs. The workflow starts with an idea or ticket, moves through a spec and implementation, then through two kinds of agent review. The developer makes the decisions at the gates.

    TLDR:

    • Planner: What are we actually agreeing to build?
    • Coder: Does the implementation meet that agreement?
    • Reviewer: Is this the clearest, smallest sound change?
    • Monkey: What happens when the assumptions fail?
    • People: Do we approve the spec, the PR, and the merge?

    Planner: turn ambiguity into decisions

    The spec separates what is verified fact from what needs the user’s decision.

    • ~/.agents/skills/my-planner/SKILL.md

    The Planner checks the ticket against the current repo, asks about missing requirements and verification, and writes a spec. If I do not agree with it, we return to the Planner. The Coder does not inherit unresolved guesses.

    The goal of the spec is to provide a single artifact with all the details a coding agent needs to work in a loop without supervision (guidelines, a definition of done, and instructions on how to verify changes, surrounding context)

    Coder: implement and show the evidence

    Every check-in adds fatigue. So: batch decisions up front, verify continuously, report once.

    • ~/.agents/skills/my-coder/SKILL.md

    The Coder works from the agreed spec in small increments, runs checks, and reports what passed and what remains unverified. It should stop for a decision it does not own, rather than quietly changing the scope.

    Reviewer: make the change simpler and clearer

    Report only actionable improvements worth making.

    • ~/.agents/skills/my-reviewer/SKILL.md

    The Reviewer reads the diff and surrounding code without editing it. A useful finding identifies the location, impact, and smallest fix. The Coder can then make the change and ask the same Reviewer to check it again.

    Monkey: try to break it

    Find plausible correctness issues, then try to reproduce them. This is a focused adversarial investigation, not a style review or an implementation task.

    • ~/.agents/skills/my-monkey/SKILL.md

    The Monkey probes reachable edge cases and failure paths without changing the code. It must distinguish a reproduced failure from a plausible risk. That gives me a different signal from the Reviewer’s simplicity-focused pass.

    Only then is there a draft PR. I review it before it enters the PR train; an external reviewer has another gate before merge. Feedback goes back to the Coder, not straight to production.

  • My rules for using Agents

    I find agent to be a useful tool for coding, GitHub, and Slack. But like any tool, there’s some degree of skill necessary to wield them effectively and not hurt others.

    When unguided, habits emerge that make code harder to maintain, communication harder to read, and collaboration thinner — which contribute to the collapse of a software team if left unresolved

    My concern here is practical: are we using agents in ways that help us build good software together? These are the standards I’ve set for myself across my time with them across the past year or so:

    1. Optimise for readability and clarity

      • Short, direct sentences. Dotpoints with spacing
        • No unguided slop essays
        • Particularly in PR descriptions
        • Your time saved must not become someone else’s reading burden
      • Aim to ask good concise questions that encourage constructive discussion
      • Sanitise all LLM-isms in output
        • Otherwise it’s frustrating to read, and gives the wrong impression
    2. Keep work focused and reviewable

      • No massive, unfocused PRs
        • Split changes into coherent pieces and explain their purpose
        • Remove unnecessary guff before asking for review
    3. Listen to people directly and stay engaged with people

      • Never delegate the act of listening
      • Read and consider their input yourself
      • Review all agent-drafted responses before sending it
    4. Mark what agents helped create

      • Whether assisted or generated verbatim, make that involvement clear
    5. Own and understand what you submit

      • Read the code, PR description, review reply, or message
      • Be able to explain it and defend it
        • Attribution doesn’t transfer responsibility
      • Go beyond being able to explain the output
        • Develop your own understanding and judgement
        • Prevent alienation and deskilling
    6. Always verify

      • Check the behaviour, claims, and sources
      • Add your own correct, relevant citations.
      • Open the links and confirm they support what you’re saying
      • Declare what hasn’t been checked.
    7. Give agents clear boundaries

      • Agree on the goal, scope, and decisions that need human input
      • Agents must always ask before changing tests
      • Discuss significant changes with the people affected before starting.
  • Writing a Julia project

    The Julia language has always fascinated me, it seemed pretty perfect for someone like me. It’s a maths-heavy language with a relatively simple syntax and a wicked fast execution – seems like a great idea, but how does it work in practice?

    First steps with Julia as a Matlab programmer

    I first used Julia during my mathematical neuroscience PhD in 2019. I was building off someone elses code to solve a partial differential equation for 2,000,000 different parameter configurations which was originally implemented in Matlab. Using the ode45 solver, this script would take over 3 days to finish. I don’t remember how I came across DifferentialEquations.jl, but looking at the documentation it seemed extremely thorough. I had heard that Julia was fast, so surely it was worth a shot?

    I focussed on the differential equation solver in this pipeline, and using a fairly naive approach in a Julia script (matching the ode45 solver) this computed the results in 3 minutes! I thought surely this must be a bug, but I plotted some of the curves and it was legitimate!

    Now, did I save time? It probably took a day or two to get up to speed with Julia and get this working, but it felt like I got much more out of the experience than just running the Matlab code. However, this experience wasn’t without difficulties:

    • I was a Matlab veteran, but relatively new to Python so a lot of Programming concepts in Julia were somewhat assumed knowledge,
    • Documentation was relatively sparse at the time,
    • 3rd party packages were a bit fiddly (using a package to generate a latin hypercube was the difficult part of that task from what I remember)

    Unfortunately I didn’t have the capacity to pursue Julia further at the time – I didn’t have the time, nor did I have someone to learn it from/with. So I continued with the more well-trodden trails of Python and Matlab, but I’ve kept an eye on developments in Julia over the years.

    Returning to Julia as a Python programmer

    Now in 2025, Julia has come a long way (and so have I). I re-learned Julia by plotting fractals and having a go at Advent of Code (which went well until I got quite ill on holiday). At this point I was a Python veteran with 4 years of machine learning engineering experience, and the Julia documentation made much more sense.

    However, I still had many difficulties with this:

    • The community is passionate, but adoption is still relatively low, learning Julia from posts and threads is much much harder than doing so with Python
    • The types system made sense in theory, but I still struggled with using abstract types in practice
    • Setting up a project was weirdly difficult?

    I returned to that first project from my PhD, I wondered if I could implement the entire thing in Julia instead of just the single component. I learned a bit on how Julia code is organised from various sources, here I’ll summarise on what I settled on:

    $ tree .
    .
    ├── LICENSE
    ├── Manifest.toml
    ├── Project.toml
    ├── README.md
    ├── run.jl                   # Entrypoint for my project
    ├── scratch.jl               # A notebook/script for experimenting
    └── src
        ├── NfmParamRanking.jl   # Top-level module
        ├── AnalyseResults.jl    # Submodules
        ├── GenerateData.jl      # ...
        ├── Types.jl
        └── Utils.jl

    My run.jl looks like this:

    using Pkg
    Pkg.activate(".")  # Ensures the environment is active
    
    using NfmParamRanking
    
    function main()
        NfmParamRanking.main()
    end
    
    if !isdefined(Base, :active_repl)
        main()
    end

    This way, I can run my project as $ julia run.jl

    The top-level module NfmParamRanking.jl has this structure:

    module NfmParamRanking
    
    include("./Types.jl")    # Annoyingly, order matters here
    include("./AnalyseResults.jl")
    include("./GenerateData.jl")
    include("./Utils.jl")
    
    using CSV
    using DataFrames
    using DecisionTree
    
    using .Types
    using .AnalyseResults
    using .GenerateData
    using .Utils
    
    function main()
        config = Config(...)
        param_configs, labels, simulations = GenerateData.main(config)
        output = AnalyseResults.main(simulations, ...)
        print(output)
    end

    I break this project into the major steps GenerateData.jl, and AnalyseResults.jl, with Types.jl being a dependency across the top-level module and GenerateData.jl.

    The types are defined and exported in Types.jl:

    module Types
    export ParameterRange, SimulationConfig, ModelConfig, Config
    
    import Base: ==
    
    using Parameters
    
    @with_kw struct ParameterRange
        name::Symbol
        min::Float64
        max::Float64
    end
    
    function ==(a::ParameterRange, b::ParameterRange)
        a.name == b.name && a.min == b.min && a.max == b.max
    end
    
    ...
    
    end module

    And then I can refer to these types in the parent module (which is why we need to include("Types.jl") before include("GenerateData.jl")):

    module GenerateData
    
    # %%
    using QuasiMonteCarlo
    using Random
    using LinearAlgebra
    using DifferentialEquations
    using FFTW
    using Peaks
    using DataFrames
    
    using ..Types
    
    function main(
        config::Config,
    )::Tuple{Matrix{Float64}, Matrix{Float64}, Vector{Vector{Float64}}}
        @info "Generating parameter space"
        param_configs = generate_hypercube(
            config.param_ranges,
            config.N
        )
    
        @info "Solving model for each configuration"
        simulations = []
        for i = 1:config.N
            Y = solve_eq(
                jansen_ritt_wendling!,
                param_configs[i, :],
                config.simulation_config,
            )
            ...
            push!(data, characteristics)
        end
    
        @info "labelling simluations"
        labels = ...
    
        return param_configs, labels, simulations
    end
    
    ...
    
    end

    Exporting and importing namespaces feels unintuitive from a Python perspective, but I can see how this fits with multiple dispatch, I think this is something that will just take practice.

    You can check out the full source of this project here.

    If I were to do this again, I would avoid using a top-level module and I’d reserve the package namespace for storing functions that I’ve designed and pulled out of my notebook during development, then put the content of the top-level module in run.jl instead.

    Recommending Julia

    Would I recommend Julia? I still don’t really have a definitive answer in all honesty.

    Julia absolutely slams Python for CPU-limited workloads, but packages such as torch don’t have this limitations since the Python code calls out to C++ code under the hood. Also while Julia is fast, the pre-compile times are slow, so I’m not sure if any time is saved in the prototyping stage of the project.

    The syntax is relatively friendly, but it still has sharp edges. The type system is fantastic, but this was definitely a hurdle when learning this from the perspective of a Matlab programmer.

    Also the scope of do blocks in Julia was still a bit unclear, but once I figured it out from the documentation, it was fantastic! Nonetheless, I would recommend Julia to Matlab programmer with the caveat of “the syntax is deceptively simple, read the documentation and then read it again”.

    As a Python programmer, it’s pretty simple (just index from 1 instead of 0, of course). The package manager and the virtual environments work so intuitively, it just gets out of your way which is fantastic. As discussed above, organising code with modules can be unintuitive. For an established programmer, I’m not sure why you wouldn’t use C++ or Rust and with Python bindings? I suppose using Julia is more accessible to data scientists than either of those languages.

    But I have to say, multiple dispatch and functional programming gives a nice perspective on designing systems and solving problems. One quote I read (I cannot find the original source, email me if you find it) that really stuck with me:

    Object oriented programming in Python is like adding pages to a cookbook, you have to implement new recipes when you add new ingredients. Julia on the other hand, is like adding notes to the existing recipes, multiple dispatch essentially allows you to re-define functions to use your new ingredients.

    I’m still on the fence with Julia. I love the philosophy and the design, but I think it’s still struggling with widespread adoption outside of niche circles. Some packages such as DifferentialEquations.jl are absolutely fantastic, and it’s worth learning to use these tools. But for general-purpose programming I don’t think it’s practical in many cases… yet. I’ll still be keeping an eye on developments, but for now I’ll be sticking with Python (and maybe figuring out how to call Julia from Python!).

    If you’re a Julia programmer, or if you’d like to share your thoughts on this topic, I’d love to hear from you!

  • TIL How to migrate a python project to UV

    All I need to migrate a legacy Python project to UV is a single uv add command that magically takes care of all the inevitable import errors in one swoop. Sure I could step through each one, but instead of wasting time doing that I decided to waste time to find a one liner to do this task for me.

    Granted, it’s not really wasted — I enjoy tinkering and learning with the shell. Like any instrument, all practice counts. It’s hard to argue this is as much of a waste of time than the manual route.

    I used uvx to launch pipreqs to compile a reqiurements.txt, then used tr and sed to format this list into a uv add command that I could copy and paste to solve this issue. This replaces the existing requirements.txt, but I don’t care about that when migrating my project.

    uvx pipreqs . --force --mode no-pin > /dev/null 2>&1 \
        && ( cat requirements.txt | tr '\n' ' ' | sed 's/^\(.*\)/uv add \1\n/' ) \
        && rm requirements.txt