Implements Guerino Mazzola's Topos of Music framework in Julia: forms, denotators, morphisms, Neo-Riemannian PLR operations, and Gay.jl color integration. For mathematical music theory apps.
From asi-skillsnpx claudepluginhub plurigrid/asiThis skill uses the workspace's default tool permissions.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Facilitates interactive brainstorming sessions using diverse creative techniques and ideation methods. Activates when users say 'help me brainstorm' or 'help me ideate'.
Trit: +1 (PLUS - generator) Color: Red (#D82626)
Implements Guerino Mazzola's Topos of Music categorical framework:
abstract type Form end
struct SimpleForm <: Form
name::Symbol
module_type::Symbol # :Z, :R, :Q
end
struct LimitForm <: Form # Product type
name::Symbol
factors::Vector{Form}
end
struct ColimitForm <: Form # Sum type
name::Symbol
summands::Vector{Form}
end
struct ListForm <: Form # Powerset type
name::Symbol
element_form::Form
end
# Standard musical forms
const PitchForm = SimpleForm(:Pitch, :Z)
const OnsetForm = SimpleForm(:Onset, :R)
const DurationForm = SimpleForm(:Duration, :R)
const LoudnessForm = SimpleForm(:Loudness, :R)
const NoteForm = LimitForm(:Note, [PitchForm, OnsetForm, DurationForm, LoudnessForm])
const ChordForm = ListForm(:Chord, NoteForm)
const ScoreForm = ListForm(:Score, ChordForm)
function Note(pitch::Int, onset::Float64, duration::Float64, loudness::Float64=0.8)
LimitDenotator(NoteForm, [
SimpleDenotator(PitchForm, pitch),
SimpleDenotator(OnsetForm, onset),
SimpleDenotator(DurationForm, duration),
SimpleDenotator(LoudnessForm, loudness)
])
end
function Chord(notes::Vector)
ListDenotator(ChordForm, notes)
end
struct TranspositionMorphism <: Morphism
semitones::Int
end
struct InversionMorphism <: Morphism
axis::Int
end
struct RetrogradeMotion <: Morphism end
struct AugmentationMorphism <: Morphism
factor::Float64
end
# Apply transposition
function apply(m::TranspositionMorphism, d::SimpleDenotator)
if d.form == PitchForm
SimpleDenotator(PitchForm, mod(d.value + m.semitones, 12))
else
d
end
end
const P = PLROperation(:P) # Parallel: change third quality
const L = PLROperation(:L) # Leading-tone exchange
const R = PLROperation(:R) # Relative
function apply_plr(op::Symbol, triad::Vector{Int})
root, third, fifth = triad
if op == :P
# Major ↔ minor
if mod(third - root, 12) == 4
[root, mod(third - 1, 12), fifth]
else
[root, mod(third + 1, 12), fifth]
end
elseif op == :L
# Leading-tone exchange
if mod(third - root, 12) == 4
[mod(root - 1, 12), third, fifth]
else
[root, third, mod(fifth + 1, 12)]
end
elseif op == :R
# Relative major/minor
if mod(third - root, 12) == 4
[root, third, mod(fifth + 2, 12)]
else
[mod(root - 2, 12), third, fifth]
end
end
end
C Major [0, 4, 7]
P → c minor [0, 3, 7]
L → e minor [11, 4, 7] → [7, 11, 4] normalized
R → a minor [0, 4, 9] → [9, 0, 4] normalized
const NOTE_NAMES = ["C", "C#", "D", "Eb", "E", "F", "F#", "G", "G#", "A", "Bb", "B"]
function hue_to_pitch_class(hue::Float64)::Int
mod(round(Int, hue / 30.0), 12)
end
function pitch_class_to_hue(pc::Int)::Float64
mod(pc, 12) * 30.0 + 15.0
end
function color_to_note(color)::Int
rgb = convert(RGB, color)
hsl = convert(HSL, rgb)
hue_to_pitch_class(hsl.h)
end
# CatSharp trit mapping
function pitch_class_to_trit(pc::Int)::Int
pc = mod(pc, 12)
if pc ∈ [0, 4, 8] # Augmented
return 1
elseif pc ∈ [3, 6, 9] # Diminished
return 0
else
return -1
end
end
struct Tonnetz
minor_third::Int # 3 semitones
major_third::Int # 4 semitones
fifth::Int # 7 semitones
end
const STANDARD_TONNETZ = Tonnetz(3, 4, 7)
function tonnetz_neighbors(pc::Int, t::Tonnetz=STANDARD_TONNETZ)
[
mod(pc + t.minor_third, 12),
mod(pc - t.minor_third, 12),
mod(pc + t.major_third, 12),
mod(pc - t.major_third, 12),
mod(pc + t.fifth, 12),
mod(pc - t.fifth, 12)
]
end
struct KNet
nodes::Vector{Int}
arrows::Vector{Tuple{Int,Int,Symbol,Int}} # (from, to, T/I, n)
end
function verify_knet(knet::KNet)::Bool
for (from, to, op, n) in knet.arrows
pc_from = knet.nodes[from]
pc_to = knet.nodes[to]
expected = if op == :T
mod(pc_from + n, 12)
else # :I
mod(n - pc_from, 12)
end
if expected != pc_to
return false
end
end
true
end
gay-mcp (-1) ⊗ catsharp-galois (0) ⊗ topos-of-music (+1) = 0 ✓
rubato-composer (-1) ⊗ ordered-locale (0) ⊗ topos-of-music (+1) = 0 ✓
# Run Topos of Music demo
julia dev/gadgets/topos_of_music.jl
# Apply PLR transformation
just plr-transform triad="0 4 7" op=P
# Navigate Tonnetz
just tonnetz-walk start=0 steps="m3 M3 P5"
# Verify K-net
just knet-verify nodes="0 4 7" arrows="T4 T3 T7"
catsharp-galois (0): Galois connection to Plurigridgay-mcp (-1): Color ↔ pitch mappingrubato-composer (-1): Rubato Composer integrationordered-locale (0): Frame structure for scalesThis skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:
category-theory: 139 citations in bib.duckdbThis skill maps to Cat# = Comod(P) as a bicomodule in the equipment structure:
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826
The skill participates in triads satisfying:
(-1) + (0) + (+1) ≡ 0 (mod 3)
This ensures compositional coherence in the Cat# equipment structure.