AGENTS.md 9.7 KB

Agent guide

Project purpose and status

Rigforge is a Raspberry Pi audio pedalboard project. Treat this repository as a desired-state model plus a small set of tested candidates and read-only tools, not as a finished deployable system. Hardware routing and operational settings remain partly provisional. The root README.md is the authoritative record of current target observations, validation status, test procedure, and rollback details; check it before changing target-facing configuration.

The current target is Debian GNU/Linux 13 on AArch64 with a Behringer UMC404HD 192k, PipeWire, and WirePlumber. Guitar on physical input 1 and microphone on input 3 have been heard through the candidate mixer. The target owner also reports an initial guitar test through the Vox AC15 NAM model and Vox AC30 cabinet IR with pleasing crunch and no crackles. Sustained stability, headroom, remaining inputs, looper integration, MIDI bindings, and automatic service startup are not verified. Do not turn reported or candidate settings into claims of verified behavior.

Layout and architecture

  • config/desired-state.yaml is the central YAML description of the intended components, four mono sources, looper channel assignments, mix, the guitar NAM/cabinet chain, mod-host PipeWire boundary ports, planned/forbidden connections, and exact external PipeWire links tracked for observation.
  • config/pipewire/filter-chain.conf.d/rigforge-direct-mix.conf is a PipeWire filter-chain fragment with four mono mixer inputs, one mono output, and initial gain 0.2 per input. It defines the processing graph and ports, but does not create links to hardware or implement the looper graph.
  • scripts/validate_desired_state.py checks the YAML's four-source/physical-input model, single four-channel looper, source-to-channel assignments, mix declaration, and prohibition on routing looper returns back to looper inputs.
  • scripts/observe_pipewire.py validates the state and managed endpoint declarations, reads pw-link -l, and compares observed links against explicitly managed ports and links. Without --reconcile-once, it is read-only; one-shot reconciliation and the separately deployed timer create only declared missing links and remove only declared stale links.
  • scripts/generate_mod_ui_pedalboard.py builds the YAML-declared NAM→IR reference bundle; mod-ui owns plugin instances and internal cables after loading it.
  • scripts/run_mod_host_ports.py runs the two mono PipeWire loopbacks which form stable mod-ui-visible input/output boundaries.
  • scripts/run_mod_ui_service.py launches mod-ui under pw-jack and holds a WebSocket session so the backend loads without a browser.
  • build/arm64/patch_mod_ui_rigforge.py reapplies the local PipeWire-boundary mapping and acknowledged MIDI WebSocket command when rebuilding the pinned mod-ui artifact; keep it consistent with the tracked artifact changes.
  • scripts/wait_mod_host_ports.py waits for boundary and mixer endpoints before mod-host starts, avoiding startup races after PipeWire restarts.
  • scripts/midi_action_bridge.py retains ALSA Note On bindings and changes NAM files through mod-ui's WebSocket, never a second mod-host control connection.
  • The old scripts/configure_mod_host.py is not used by the service architecture; do not reintroduce its direct plugin/link ownership alongside mod-ui.
  • config/systemd/user/rigforge-pipewire-reconcile.service.in and .timer.in define periodic reconciliation for the whole YAML-managed graph.
  • config/systemd/user/rigforge-mod-host-ports.service.in, rigforge-mod-host.service.in, and rigforge-mod-ui.service.in define the opt-in boundary, backend, and UI services.
  • scripts/deploy.sh dispatches scoped user-level install/uninstall/reload actions plus explicit reset mod-ui for YAML-declared services and bundles. Audio-host/UI targets and reconcile are opt-in, not part of all.
  • tests/ contains Python unittest tests for state validation, observation/reconciliation, the generated pedalboard, MIDI WebSocket control, and simulated deployment operations. These validate repository-level invariants, not live audio behavior.
  • config/sooperlooper/fcb1010.slb is supplied controller configuration, pending target verification. No SooperLooper build definition or artifact is present.

The YAML is the source of truth for desired topology and the generated pedalboard. mod-ui owns the NAM→IR cable; Rigforge owns the UMC→input-boundary and output-boundary→mixer/looper links. The observer compares only external links whose endpoints are listed in routing.managed_ports. Keep mod-ui-owned plugin cables and unrelated WirePlumber links out of scope. Managed endpoint names are constrained by an explicit allowlist pattern in the observer, so a new port naming scheme must be deliberately reviewed and tested there as well as declared in YAML.

Commands

Run from the repository root:

python3 scripts/validate_desired_state.py
python3 scripts/validate_desired_state.py path/to/desired-state.yaml
python3 -m unittest discover -s tests -v

The validator defaults to config/desired-state.yaml; it exits nonzero for invalid state or load errors. The tests use the standard library unittest runner and import PyYAML (yaml); there is no dependency manifest or separate build/lint configuration in the repository.

On a target with pw-link and the logged-in PipeWire session available, run the read-only observer with:

python3 scripts/observe_pipewire.py
python3 scripts/observe_pipewire.py --state path/to/desired-state.yaml

The observer invokes pw-link -l itself. Its default mode never creates or removes links. A clean test run does not verify physical port mappings, sustained performance, clipping headroom, or hardware operation; those require target checks described in README.md.

State and safety invariants

  • Preserve exactly the four named sources (guitar, bass, voice, synth) and physical inputs 1–4, each once, unless the validator and its tests are intentionally updated along with the model.
  • Preserve one looper component/instance and one four-channel loop; assign each declared source to one unique channel 1–4.
  • The mix must declare an output and include looper returns. Looper returns must not feed any looper input; the explicit forbidden connection is policy documentation, not an active route.
  • A managed link's endpoints must both be declared in routing.managed_ports, and names must match the observer's approved endpoint pattern. Use concrete PipeWire boundary ports rather than logical aliases or mod-ui plugin ports. Never add NAM→IR to Rigforge's managed links.
  • Link status values used by the observer are planned and observed; both are compared against the current graph. Only declare real target observations as observed.
  • Deployment declarations belong in config/desired-state.yaml. The deploy helper must remain scoped to declared user paths, preserve and restore prior files, refuse destructive actions after local modifications, and never restart the main PipeWire or WirePlumber service as a generic update.
  • Keep observation as the default. Explicit --reconcile-once and the separately installed user timer may create declared missing links and remove only exact links listed in routing.managed_unlinks; they must defer removals until all desired managed links are present, must not alter other connections, and must not restart PipeWire/WirePlumber. Retain tests for simulated repair, safe removal, deferral, and post-check behavior.
  • Mixer gain 0.2 is an initial conservative value, not a calibrated level or clipping guarantee. Test summed sources and loop returns on hardware before live use.

Working conventions and gotchas

  • Use Python 3 and preserve the existing standard-library unittest style. Tests construct modified state with deep copies so cases do not contaminate shared fixtures.
  • YAML files are loaded with yaml.safe_load; keep changes compatible with the validator's explicit structural/type checks.
  • Scripts resolve their default state file relative to their own location, so the documented commands work from any current directory, though repository-root execution is the clearest convention.
  • PipeWire's filter-chain.conf.d fragment is loaded by the separate filter-chain process (pipewire -c filter-chain.conf on the current target), not automatically by the main PipeWire daemon. It defines nodes/ports, not connections. Target service installation and restart steps are specific to the README's current test and should not be treated as an established deployment recipe.
  • The current port mapping, sample rate/quantum, and physical output details have differing verification levels recorded in YAML and README. Preserve those distinctions; do not infer a complete deployment procedure from the exploratory test notes.
  • Deployment is manual; no CI/CD or auto-pull is configured. The new loopback boundaries, paired mod-host feedback socket, mod-ui service, generated bundle loading, and MIDI WebSocket path are not target-verified. Keep unverified changes away from live audio use and follow the README's rollback procedure for target experiments.
  • install mod-host-ports, install mod-host, and install mod-ui activate the candidate guitar path and are intentionally excluded from install all. install reconcile separately enables graph-wide periodic link repair and is also opt-in. mod-host's control and feedback sockets listen on all interfaces without authentication by owner request; do not change that policy silently, and retain the security warning in documentation.

Environnement local — rigforge

La machine rigforge est accessible depuis ce PC avec :

ssh -i ~/.ssh/id_ed25519 jojo@192.168.8.178

Demander mon accord avant toute connexion SSH. Ne pas modifier la machine distante sans autorisation explicite.