<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Riccardo Cataldi</title>
    <description>The latest articles on DEV Community by Riccardo Cataldi (@riccardo_cataldi_871c2360).</description>
    <link>https://dev.to/riccardo_cataldi_871c2360</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3960058%2F4c586785-32e4-42e2-bbcd-af48d9caf927.png</url>
      <title>DEV Community: Riccardo Cataldi</title>
      <link>https://dev.to/riccardo_cataldi_871c2360</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/riccardo_cataldi_871c2360"/>
    <language>en</language>
    <item>
      <title>I taught a music transformer to play jazz with me in real time</title>
      <dc:creator>Riccardo Cataldi</dc:creator>
      <pubDate>Wed, 18 Nov 2026 07:56:59 +0000</pubDate>
      <link>https://dev.to/riccardo_cataldi_871c2360/i-taught-a-music-transformer-to-play-jazz-with-me-in-real-time-1jg2</link>
      <guid>https://dev.to/riccardo_cataldi_871c2360/i-taught-a-music-transformer-to-play-jazz-with-me-in-real-time-1jg2</guid>
      <description>&lt;p&gt;&lt;strong&gt;duetto&lt;/strong&gt; is a jazz partner for a MIDI keyboard. You pick a tune, and a pretrained transformer plays it with you in real time as a trio (solo, chords and walking bass), comping while you play and soloing when you rest.&lt;/p&gt;

&lt;p&gt;This is the model alone on Autumn Leaves at 160 bpm:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/8zIAzVY8O6w" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Code: &lt;a href="https://github.com/RiccardoCataldi/duetto" rel="noopener noreferrer"&gt;github.com/RiccardoCataldi/duetto&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No model was trained or fine-tuned for this. Everything below is about inference: how to take a general-purpose symbolic music model and constrain its decoding until it behaves like a jazz trio that follows a chart and listens to you.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The model and its tokens
&lt;/h2&gt;

&lt;p&gt;duetto uses the &lt;a href="https://github.com/jthickstun/anticipation" rel="noopener noreferrer"&gt;Anticipatory Music Transformer&lt;/a&gt; (AMT, Thickstun et al.), a decoder-only transformer trained on the Lakh MIDI dataset.&lt;/p&gt;

&lt;p&gt;AMT encodes music as a flat sequence of events, each made of three tokens:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;token&lt;/th&gt;
&lt;th&gt;meaning&lt;/th&gt;
&lt;th&gt;resolution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;time&lt;/td&gt;
&lt;td&gt;absolute onset&lt;/td&gt;
&lt;td&gt;10 ms ticks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;duration&lt;/td&gt;
&lt;td&gt;how long the note lasts&lt;/td&gt;
&lt;td&gt;10 ms ticks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;note&lt;/td&gt;
&lt;td&gt;instrument × pitch&lt;/td&gt;
&lt;td&gt;one token per (GM program, MIDI pitch)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The instrument is part of the note token (&lt;code&gt;NOTE_OFFSET + program * MAX_PITCH + pitch&lt;/code&gt;). That has two useful consequences:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A duo is just one sequence.&lt;/strong&gt; The player's notes are written into the context as one instrument, the model's as others. The model continues the sequence; it doesn't need to know which notes are "yours".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Each voice can be a different instrument in the context.&lt;/strong&gt; duetto's bass is written as General MIDI program 32 (acoustic bass), because that is how bass lines are labelled in Lakh MIDI, so the notes it writes under that label move like a bass line. What you actually hear is decided later by the synthesizer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Out of the box, AMT continues a sequence plausibly, in pop-MIDI style. It has no notion of a chart, a beat grid, chord-scale relationships or jazz phrasing, and it often doubles notes, since Lakh MIDI files are full of duplicated tracks. Everything that follows is about adding those constraints.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Constrained decoding, one slot at a time
&lt;/h2&gt;

&lt;p&gt;Each event is sampled as three separate steps, and each step gets its own logit mask before nucleus sampling:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;slot&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;            &lt;span class="c1"&gt;# time, duration, note&lt;/span&gt;
    &lt;span class="n"&gt;logits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_logits&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;# one forward pass, with KV cache&lt;/span&gt;
    &lt;span class="n"&gt;mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;full_like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logits&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'inf'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;                          &lt;span class="c1"&gt;# open only what is allowed in this slot&lt;/span&gt;
    &lt;span class="n"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sample&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;nucleus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logits&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;top_p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;seq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Time slot: when may each voice play?&lt;/strong&gt;&lt;br&gt;
Every voice has a window of allowed onsets, built as a mask over ticks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;not earlier than &lt;code&gt;now + 150 ms&lt;/code&gt;, to cover sampling and network latency;&lt;/li&gt;
&lt;li&gt;not inside a phrase-ending breath for the solo;&lt;/li&gt;
&lt;li&gt;for the walking bass, &lt;strong&gt;only on the next beat&lt;/strong&gt;: the mask opens a single tick;&lt;/li&gt;
&lt;li&gt;for comping under a solo, only inside the slot where the next chord stab falls;&lt;/li&gt;
&lt;li&gt;snapped to the subdivision chosen for the next two bars (eighths, triplets, sixteenths), and never faster than can be articulated at the tune's tempo.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The time mask is the union of all the voices' windows. Which voice actually plays is decided in the next slots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Duration slot.&lt;/strong&gt;&lt;br&gt;
Comped chords are short, or held for one to three beats in a ballad. A solo note is at least a detached eighth. A quoted phrase keeps its original durations, or slightly shorter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note slot: which voice, which pitch?&lt;/strong&gt;&lt;br&gt;
Given the sampled onset, only the voices whose window contains that tick are opened, each limited to its own register. On top of the mask, duetto adds &lt;strong&gt;biases&lt;/strong&gt;, not hard constraints:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;bias&lt;/th&gt;
&lt;th&gt;effect&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;chord tones of the current bar&lt;/td&gt;
&lt;td&gt;+1 logit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;tensions (9, 11/#11, 13)&lt;/td&gt;
&lt;td&gt;+1 logit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;out-of-scale notes for the chord&lt;/td&gt;
&lt;td&gt;pushed down&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;third or seventh on the beat a chord starts (guide tones)&lt;/td&gt;
&lt;td&gt;pushed up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;a chromatic approach off the beat&lt;/td&gt;
&lt;td&gt;allowed, then the target chord tone gets +6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;keys near the player's hands while they play&lt;/td&gt;
&lt;td&gt;−2, so it stays out of the way&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;notes already sounding, or a run about to repeat a third time&lt;/td&gt;
&lt;td&gt;masked&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The distinction between masks and biases is the core design choice. &lt;strong&gt;Masks encode things that are wrong&lt;/strong&gt; (playing the bass off the beat, doubling a note). &lt;strong&gt;Biases encode things that are idiomatic&lt;/strong&gt; (guide tones, chord tones). The model still chooses among the idiomatic options, which keeps the output varied in a way purely rule-based generation is not.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Real time: a one-second lookahead with rollback
&lt;/h2&gt;

&lt;p&gt;The music can't wait for the model, and the model can't know what you'll play next. duetto handles this with a sliding buffer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The server keeps &lt;strong&gt;about one second of music sampled ahead&lt;/strong&gt; of the current time, and streams it to the client as timestamped &lt;code&gt;note&lt;/code&gt; messages.&lt;/li&gt;
&lt;li&gt;When you play, your note is appended to the context and the server sends a &lt;code&gt;cut &amp;lt;onset&amp;gt;&lt;/code&gt; message: everything it had planned after that point is discarded on both sides and resampled, now conditioned on what you played. A &lt;code&gt;commit&lt;/code&gt; window (500 ms by default) keeps the near future fixed unless your note contradicts it, so the accompaniment doesn't stutter at every key you press.&lt;/li&gt;
&lt;li&gt;Rollback is cheap because the &lt;strong&gt;KV cache is cropped&lt;/strong&gt; rather than rebuilt: unwinding &lt;em&gt;n&lt;/em&gt; events removes &lt;em&gt;3n&lt;/em&gt; positions from the cache, and only the new tokens are fed again.&lt;/li&gt;
&lt;li&gt;When the context fills up, or absolute time approaches the model's maximum, the last ~20 s of events are kept and &lt;strong&gt;re-timed to start at 0&lt;/strong&gt;, the way the training sequences start, and the cache is rebuilt once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One less obvious issue: AMT reads a long silence as "this is a sparse piece" and tends to stop playing altogether. duetto caps the silence the model may leave, and after it, forces a note from the solo voice.&lt;/p&gt;

&lt;p&gt;Measured latency per note (one event, three tokens): &lt;strong&gt;~12 ms&lt;/strong&gt; with AMT-medium and ~18 ms with AMT-large on an RTX 3080 Ti; ~90 ms with AMT-large on a Jetson Orin Nano. The model runs on a GPU host behind a small line-based TCP protocol, while the laptop handles MIDI input, FluidSynth and a live piano roll. It also runs on a single machine (CUDA, Apple Silicon or CPU).&lt;/p&gt;
&lt;h2&gt;
  
  
  4. A jazz vocabulary from the Weimar Jazz Database
&lt;/h2&gt;

&lt;p&gt;Chord tones and a beat grid produce correct output, but not idiomatic output. For that, duetto uses the &lt;a href="https://jazzomat.hfm-weimar.de" rel="noopener noreferrer"&gt;Weimar Jazz Database&lt;/a&gt; (WJD), a corpus of hand-transcribed solos by jazz soloists, in two ways.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Statistics.&lt;/strong&gt; Note choice per chord type and melodic interval transitions in bebop lines are extracted from WJD and added as biases: which notes soloists play over a dominant, which intervals follow which.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Licks.&lt;/strong&gt; The solos are cut into phrases of one to four bars, at the boundaries where the soloist started and ended a phrase (including the pickup notes before the bar line). Each phrase is stored key-independently and indexed by the chord progression underneath it. While soloing, duetto can look up a phrase that was played over the same changes as the next bars of the tune, transpose it and quote it.&lt;/p&gt;

&lt;p&gt;Quoting is also done through the masks: for each event of the lick, the time mask opens exactly one tick and the note mask exactly one pitch. The model still runs a forward pass on every quoted note, so its context stays consistent, and when the quote ends it continues from a line that sounds like its own.&lt;/p&gt;

&lt;p&gt;On top of that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Development.&lt;/strong&gt; A quoted phrase can be repeated as is, displaced by a beat, cut to its first half, or inverted, the way soloists develop a motif.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connections.&lt;/strong&gt; Between two licks it inserts a short pickup: a scale walk, a chromatic approach or an enclosure of the next phrase's first note.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tempo filter.&lt;/strong&gt; Licks whose note rate would be unplayable at the current tempo are excluded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your licks.&lt;/strong&gt; Phrases you play over the tune are indexed the same way, so it can quote them back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Arc.&lt;/strong&gt; Density, register and subdivision follow a curve over each chorus, peaking about three quarters through.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  5. Voicings and bass, partly rule-based
&lt;/h2&gt;

&lt;p&gt;Not everything goes through the model's preferences.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Comping&lt;/strong&gt; is biased toward four-note rootless voicings, choosing the inversion closest to the previous one (minimal voice movement). While the player is playing, it reduces them to shells (third and seventh).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Walking bass&lt;/strong&gt; gets a note on every beat from the time mask. The pitch is biased toward the root when a bar or a chord begins, toward a semitone from the next root on the beat before a chord change, and mostly stepwise in between.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bossa&lt;/strong&gt; uses a fixed rhythmic figure (root and fifth with ties, anticipating the next bar's root).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ballads&lt;/strong&gt; plan each solo phrase in advance: a target note (a third, seventh or tension of the chord where the phrase ends) is chosen first, a rhythm is borrowed from a WJD phrase, and the pitches are biased toward the target.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  6. Charts
&lt;/h2&gt;

&lt;p&gt;A tune is a plain-text chart: title, key, tempo, chords bar by bar, and an optional melody that the solo can paraphrase.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;title: Autumn Leaves
key: G minor
bpm: 120
Cm7 | F7 | Bbmaj7 | Ebmaj7 | Am7b5 | D7 | Gm6 | % |
&amp;gt; Eb5:4 | -:1 F4:1 G4:1 A4:1 | D5:2 D5:2 | ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The chord symbols are parsed into root, quality and scale, and these feed the masks and biases above. Style (swing, bossa, even eighths, ballad), part (comp, solo, duet) and around a dozen "character" controls (density, harmony, groove, vocabulary...) adjust the same parameters live.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd take away
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A pretrained general model plus &lt;strong&gt;constrained decoding&lt;/strong&gt; gets surprisingly far in a domain it wasn't trained for, without any fine-tuning data.&lt;/li&gt;
&lt;li&gt;Separate &lt;strong&gt;hard constraints (masks)&lt;/strong&gt; from &lt;strong&gt;stylistic preferences (biases)&lt;/strong&gt;. Masks keep the output valid, biases make it idiomatic, and the model supplies the variation.&lt;/li&gt;
&lt;li&gt;For real-time generation, &lt;strong&gt;sample ahead and roll back&lt;/strong&gt; with KV-cache cropping, rather than generating on demand.&lt;/li&gt;
&lt;li&gt;A small annotated corpus (WJD) is more useful as &lt;strong&gt;retrievable material and statistics&lt;/strong&gt; than as training data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code is open source under a noncommercial license: &lt;a href="https://github.com/RiccardoCataldi/duetto" rel="noopener noreferrer"&gt;github.com/RiccardoCataldi/duetto&lt;/a&gt;. If you play, I'd like to hear what it gets wrong musically. If you work on generative models, feedback on the decoding approach is welcome too.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>python</category>
      <category>music</category>
      <category>opensource</category>
    </item>
    <item>
      <title>I could not point Claude Code at localhost, so I MITM Bedrock on loopback</title>
      <dc:creator>Riccardo Cataldi</dc:creator>
      <pubDate>Fri, 04 Sep 2026 14:36:21 +0000</pubDate>
      <link>https://dev.to/riccardo_cataldi_871c2360/i-could-not-point-claude-code-at-localhost-so-i-mitm-bedrock-on-loopback-5e1</link>
      <guid>https://dev.to/riccardo_cataldi_871c2360/i-could-not-point-claude-code-at-localhost-so-i-mitm-bedrock-on-loopback-5e1</guid>
      <description>&lt;p&gt;Claude Code on Amazon Bedrock does not send invokes to &lt;code&gt;ANTHROPIC_BASE_URL&lt;/code&gt;. The client talks to &lt;code&gt;bedrock-runtime&lt;/code&gt; with SigV4. I wanted the JSON, the EU on-demand dollars, and a hold/edit step, so I built &lt;a href="https://github.com/RiccardoCataldi/claude_sniff" rel="noopener noreferrer"&gt;claude-sniff&lt;/a&gt;: one Python process, mitmproxy on &lt;code&gt;127.0.0.1:9090&lt;/code&gt;, UI on &lt;code&gt;8765&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I am the author. MIT. Python 3.12, &lt;code&gt;uv&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you actually run
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uv &lt;span class="nb"&gt;sync
&lt;/span&gt;uv run python main.py &lt;span class="nt"&gt;--aws-profile&lt;/span&gt; your-profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, in the same shell as Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;HTTP_PROXY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://127.0.0.1:9090
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;HTTPS_PROXY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://127.0.0.1:9090
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Proxy and Intercept start &lt;strong&gt;off&lt;/strong&gt;. Usage still reads &lt;code&gt;~/.claude/projects&lt;/code&gt;. Turn Proxy on only when you want decrypt; then export the mitmproxy CA and restart &lt;code&gt;claude&lt;/code&gt;. Intercept holds Bedrock &lt;code&gt;invoke&lt;/code&gt; / &lt;code&gt;invoke-with-response-stream&lt;/code&gt; that carry &lt;code&gt;x-claude-code-session-id&lt;/code&gt;. Untouched JSON is resumed as-is. Edited JSON is re-signed. Drop never calls Bedrock.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuocrabkdrtdv1ajz3fqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuocrabkdrtdv1ajz3fqc.png" alt="Sessions" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not a reverse proxy
&lt;/h2&gt;

&lt;p&gt;I tried the Anthropic-API pattern first. It never fired. The interesting part of the code is not “run mitmproxy”; it is sniffing event streams, mapping three model families for EU list prices, and re-signing after an edit without copying static AWS keys into the repo. Inference-profile ids are account-scoped — you pass them in env; the repo ships none.&lt;/p&gt;

&lt;p&gt;Logs live in &lt;code&gt;logs/&lt;/code&gt; (gitignored). JSONL strips &lt;code&gt;Authorization&lt;/code&gt; and &lt;code&gt;x-amz-security-token&lt;/code&gt;. Bodies stay as-is, so treat that directory as toxic.&lt;/p&gt;

&lt;p&gt;If you only want cost, leave Proxy off. If you want to rewrite a system prompt for one request, turn Intercept on, edit the head, Forward.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/RiccardoCataldi/claude_sniff" rel="noopener noreferrer"&gt;https://github.com/RiccardoCataldi/claude_sniff&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>showdev</category>
      <category>aws</category>
    </item>
    <item>
      <title>I built a TUI dotfile browser in Go – here's why and how</title>
      <dc:creator>Riccardo Cataldi</dc:creator>
      <pubDate>Sat, 30 May 2026 14:11:17 +0000</pubDate>
      <link>https://dev.to/riccardo_cataldi_871c2360/i-built-a-tui-dotfile-browser-in-go-heres-why-and-how-4jp2</link>
      <guid>https://dev.to/riccardo_cataldi_871c2360/i-built-a-tui-dotfile-browser-in-go-heres-why-and-how-4jp2</guid>
      <description>&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/RiccardoCataldi" rel="noopener noreferrer"&gt;
        RiccardoCataldi
      &lt;/a&gt; / &lt;a href="https://github.com/RiccardoCataldi/dotty" rel="noopener noreferrer"&gt;
        dotty
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      TUI dashboard for browsing and previewing dotfiles in your home directory. Fuzzy search, tree view, zero config.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;dotty&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Terminal UI for browsing dotfiles under your home directory. Run it from anywhere — it always scans &lt;code&gt;~&lt;/code&gt;, shows an expandable tree on the left, file preview on the right, and a fuzzy finder to jump to any path quickly.&lt;/p&gt;
&lt;p&gt;
  &lt;a rel="noopener noreferrer" href="https://github.com/RiccardoCataldi/dotty/docs/demo/screenshot-tree.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FRiccardoCataldi%2Fdotty%2FHEAD%2Fdocs%2Fdemo%2Fscreenshot-tree.png" width="900" alt="dotty tree view and file preview"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
  &lt;a rel="noopener noreferrer" href="https://github.com/RiccardoCataldi/dotty/docs/demo/screenshot-fuzzy.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FRiccardoCataldi%2Fdotty%2FHEAD%2Fdocs%2Fdemo%2Fscreenshot-fuzzy.png" width="900" alt="dotty fuzzy finder"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Install&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;Run &lt;code&gt;dotty&lt;/code&gt; from any directory once the binary is on your &lt;code&gt;PATH&lt;/code&gt;.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Pre-built binary (recommended)&lt;/h3&gt;
&lt;/div&gt;

&lt;p&gt;Download from &lt;a href="https://github.com/RiccardoCataldi/dotty/releases" rel="noopener noreferrer"&gt;Releases&lt;/a&gt;. Replace &lt;code&gt;VERSION&lt;/code&gt; with the latest tag (e.g. &lt;code&gt;v0.1.1&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;&lt;div class="table-wrapper-paragraph"&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;table&gt;

&lt;thead&gt;

&lt;tr&gt;

&lt;th&gt;Platform&lt;/th&gt;

&lt;th&gt;Asset&lt;/th&gt;

&lt;/tr&gt;

&lt;/thead&gt;

&lt;tbody&gt;

&lt;tr&gt;

&lt;td&gt;Linux x86_64&lt;/td&gt;

&lt;td&gt;&lt;code&gt;dotty_Linux_x86_64.tar.gz&lt;/code&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;Linux ARM64&lt;/td&gt;

&lt;td&gt;&lt;code&gt;dotty_Linux_arm64.tar.gz&lt;/code&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;macOS Intel&lt;/td&gt;

&lt;td&gt;&lt;code&gt;dotty_Darwin_x86_64.tar.gz&lt;/code&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;macOS Apple Silicon&lt;/td&gt;

&lt;td&gt;&lt;code&gt;dotty_Darwin_arm64.tar.gz&lt;/code&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/tbody&gt;

&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;VERSION=v0.1.1
curl -sL &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;https://github.com/RiccardoCataldi/dotty/releases/download/&lt;span class="pl-smi"&gt;${VERSION}&lt;/span&gt;/dotty_Linux_x86_64.tar.gz&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt; &lt;span class="pl-k"&gt;|&lt;/span&gt; tar xz
install -m 755 dotty &lt;span class="pl-k"&gt;~&lt;/span&gt;/bin/   &lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; or: sudo install -m 755 dotty /usr/local/bin/&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Ensure &lt;code&gt;~/bin&lt;/code&gt; or &lt;code&gt;/usr/local/bin&lt;/code&gt; is on your &lt;code&gt;PATH&lt;/code&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;From source&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;Requires Go 1.22+.&lt;/p&gt;

&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;git clone https://github.com/RiccardoCataldi/dotty.git
&lt;span class="pl-c1"&gt;cd&lt;/span&gt; dotty
go install ./cmd/dotty&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The binary is installed to &lt;code&gt;$(go env GOPATH)/bin/dotty&lt;/code&gt; (usually &lt;code&gt;~/go/bin/dotty&lt;/code&gt;). Add that directory to your…&lt;/p&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/RiccardoCataldi/dotty" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
My home directory has 140+ hidden files and folders.&lt;br&gt;&lt;br&gt;
.aws/credentials, .ssh/config, .cursor/rules, .config/nvim/, .gitconfig, Claude's JSON config somewhere in .config... Every time I needed to tweak something I had to remember where it lived, cd there, find the right file, open it. Then repeat the next time I forgot.&lt;br&gt;&lt;br&gt;
I looked for a tool that would solve this. chezmoi and stow are great but they solve a different problem — syncing dotfiles across machines. File managers like yazi are generic and don't give you a unified view of just your config files. Nothing gave me what I wanted: a single command that aggregates all my dotfiles in one searchable view, from wherever I am in the terminal.&lt;br&gt;&lt;br&gt;
So I built dotty.&lt;/p&gt;

&lt;p&gt;What it does&lt;br&gt;
Run dotty from any directory. It scans ~ and gives you:&lt;/p&gt;

&lt;p&gt;An expandable tree of every dotfile and dot-directory&lt;br&gt;
Live file preview on the right panel&lt;br&gt;
Fuzzy finder (/) to jump to any config in seconds&lt;br&gt;
e to open in $EDITOR&lt;br&gt;
y to copy the path to clipboard&lt;/p&gt;

&lt;p&gt;Single static binary, zero config, works over SSH and inside tmux.&lt;/p&gt;

&lt;p&gt;Why Go&lt;br&gt;
This was my first real Go project shipped end to end. I chose Go for two reasons:&lt;br&gt;
Single static binary. No runtime dependencies, no Python virtualenv, no Node modules. go build → one file → move it to /usr/local/bin/ → done. This matters for a tool you want to install and forget about.&lt;br&gt;
Bubble Tea. Charmbracelet's TUI framework for Go is exactly what I needed. It follows the Elm architecture (Model, Update, View) which makes TUI state management surprisingly clean. Tools like lazygit, lazydocker, and k9s are all built on similar patterns — I wanted that same feel.&lt;/p&gt;

&lt;p&gt;The stack&lt;/p&gt;

&lt;p&gt;Bubble Tea — TUI framework, Elm architecture&lt;br&gt;
Bubbles — pre-built TUI components (viewport, textinput)&lt;br&gt;
Lipgloss — CSS-like terminal styling&lt;br&gt;
GoReleaser + GitHub Actions — multi-platform releases (Linux + macOS, x86 + ARM)&lt;/p&gt;

&lt;p&gt;What I learned&lt;br&gt;
Bubble Tea's model is great once it clicks. The idea is that your entire application state lives in one struct, and every keypress goes through a pure Update function that returns a new state. Coming from imperative code it feels weird at first, then it feels obvious.&lt;br&gt;
Terminal layout is harder than it looks. Getting two panels to resize correctly when the terminal window changes, keeping scroll state in sync with the selected file, handling edge cases like empty directories or binary files — there's more surface area than I expected.&lt;br&gt;
GoReleaser is worth learning. Setting up multi-platform builds with checksums, a proper install script, and GitHub Release assets took maybe two hours but now releases are one git tag away. Should have done this from day one.&lt;/p&gt;

&lt;p&gt;What's next&lt;br&gt;
The current version covers navigation and preview. What's missing for a complete workflow:&lt;/p&gt;

&lt;p&gt;Rename and delete directly from the TUI&lt;br&gt;
Grep across all dotfile content&lt;br&gt;
Syntax highlighting in the preview panel&lt;/p&gt;

&lt;p&gt;If you work a lot in the terminal and have the same dotfile chaos problem, give it a try:&lt;br&gt;
bashgo install github.com/RiccardoCataldi/dotty/cmd/dotty@latest&lt;br&gt;
Or grab a pre-built binary from the releases page.&lt;br&gt;
Feedback welcome — especially on the Go code itself, since this is my first shipped Go project.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>opensource</category>
      <category>learning</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
