Skip to content

Commit fe2cdb0

Browse files
committed
a
1 parent a07e04c commit fe2cdb0

18 files changed

Lines changed: 771 additions & 67 deletions

.github/copilot-instructions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Modules self-register at load time. Two registries:
3838
- **`crossLayerRegistry`** - `register(name, module, scopes)` where scopes ⊆ `['all','section','phrase']`
3939
- **`conductorIntelligence`** - `registerDensityBias`, `registerTensionBias`, `registerFlickerModifier`, `registerRecorder`, `registerStateProvider`, `registerModule`
4040

41+
11 hypermeta self-calibrating controllers auto-tune coupling targets, regime distribution, pipeline centroids, flicker range, trust starvation, coherent relaxation, entropy amplification, progressive strength, gain budgets, meta-telemetry, and inter-controller conflict detection. Never manually tune constants that a meta-controller already manages.
42+
4143
To add a module: write the file, self-register at end of IIFE, require from subsystem `index.js`.
4244

4345
### 4. Single-Manager Hub per Subsystem
@@ -72,6 +74,7 @@ Each subsystem `index.js`: helpers first, then manager/orchestrator last.
7274
- **Conductor cannot mutate cross-layer state** - read-only access via getters is fine; writes are banned (ESLint `local/no-direct-crosslayer-write-from-conductor`).
7375
- **Signal reading:** always through `signalReader`, never `conductorIntelligence.getSignalSnapshot()` directly.
7476
- **New feedback loops** must register with `feedbackRegistry` to prevent catastrophic resonance.
77+
- **Meta-controller constants** (coupling targets, coherent relaxation, progressive strength, flicker dampening base) are managed by hypermeta self-calibrating controllers. Never hand-tune these; modify the controller logic instead.
7578
- **Inter-module communication** via `absoluteTimeGrid` channels, not direct calls.
7679

7780
## Custom ESLint Rules

README.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ TypeScript (^5.9.3), ESLint (^9.0.0), and related tooling are dev dependencies.
5757

5858
Polychron does not hardcode musical structure — it steers it. The system generates compositions through a three-layer nervous system:
5959

60-
**Conductor** — 42 intelligence modules cast multiplicative bias votes for density, tension, and flicker. Products are dampened, normalized, and committed to state. `signalReader` is the ONE read API for all consumers.
60+
**Conductor** — 42 intelligence modules cast multiplicative bias votes for density, tension, and flicker. Products are dampened, normalized, and committed to state. 11 hypermeta self-calibrating controllers auto-tune constants that previously required manual adjustment; a meta-controller watchdog detects and resolves inter-controller conflicts. `signalReader` is the ONE read API for all consumers.
6161

6262
v getSignals() / signalReader.*() ^ explainabilityBus (diagnostic only)
6363

@@ -111,7 +111,7 @@ Core infrastructure consumed by every other subsystem.
111111
- **`instrumentation`** — Runtime instrumentation and timing
112112
- **`modeQualityMap`** — Canonical mode-to-quality map shared by priors modules
113113
- **`priorsHelpers`**`resolvePhase`, `resolveWeightOrDefault`, `weightedAdjustment`
114-
- **`moduleLifecycle`** — Scoped-reset registry (`create(ownerName)` reset by scope: `all`/`section`/`phrase`)
114+
- **`moduleLifecycle`** — Scoped-reset registry (`create(ownerName)` - reset by scope: `all`/`section`/`phrase`)
115115
- **`beatCache`** — Deduplication — `create(fn)` ensures at most one evaluation per beat
116116
- **`feedbackRegistry`** — Coordinates closed-loop controllers to prevent catastrophic resonance
117117
- **`closedLoopController`** — Base controller abstraction for feedback-enrolled modules
@@ -122,15 +122,15 @@ Core infrastructure consumed by every other subsystem.
122122

123123
### `src/conductor/` — Intelligence & Signal (127 files across 10 subdirectories)
124124

125-
The brainof the system. 42 modules register with `conductorIntelligence`, contributing 29 density biases, 19 tension biases, 14 flicker modifiers, 29 recorders, and 56 state providers. Organized into specialized domains:
125+
The brain of the system. 42 modules register with `conductorIntelligence`, contributing 30 density biases, 20 tension biases, 14 flicker modifiers, 29 recorders, and 56 state providers. Organized into specialized domains:
126126

127127
**Top-level orchestration:**
128128

129129
- **`conductorIntelligence`** — Central registry — `registerDensityBias`, `registerTensionBias`, `registerFlickerModifier`, `registerRecorder`, `registerStateProvider`, `registerModule`
130130
- **`globalConductor`** — Orchestrates system-wide coherence — motif density, stutter, play probabilities
131131
- **`globalConductorUpdate`** — Per-beat collection of all registered bias products
132132
- **`conductorState`** — Committed signal state snapshot
133-
- **`conductorDampening`** — Progressive deviation dampening — regime-aware gravity + dimensionality-aware strength
133+
- **`conductorDampening`** — Progressive deviation dampening — regime-aware gravity + dimensionality-aware strength + centroid controller (density/tension only) + flicker range elasticity (3x accelerated) + meta-telemetry with watchdog feed
134134
- **`dynamismEngine`** / **`dynamismPulse`** — Dynamic energy tracking and pulse detection
135135
- **`PhraseArcManager`** / **`phraseArcProfiler`** — Phrase-level arc shaping (attack/sustain/release)
136136
- **`textureBlender`** — Blends texture signals across layers
@@ -145,7 +145,7 @@ The brainof the system. 42 modules register with `conductorIntelligence`, contri
145145
- **`melodic/`** (15) — Ambitus migration, counterpoint motion, interval balance, melodic contour, register migration, tessiture pressure, thematic recall, voice-leading efficiency
146146
- **`rhythmic/`** (15) — Accent patterns, attack density, onset regularity, rhythmic complexity, syncopation density, temporal proportions
147147
- **`texture/`** (20) — Articulation profiling, layer coherence, motivic density, orchestration weight, repetition fatigue, rest density, structural form, textural gradients, voice density
148-
- **`signal/`** (16 + `output/`) — Pipeline infrastructure — see [Diagnostic & Telemetry](#diagnostic--telemetry)
148+
- **`signal/`** (17 + `output/`) — Pipeline infrastructure — see [Diagnostic & Telemetry](#diagnostic--telemetry)
149149
- **`journey/`** (5) — Harmonic journey planning — key/mode selection across sections
150150
- **`profiles/`** (15) — Conductor config profiles (default, minimal, atmospheric, explosive, restrained, rhythmic drive) + merging/validation/tuning
151151

@@ -258,13 +258,13 @@ The top-level composition engine.
258258

259259
Each pipeline collects multiplicative bias votes from registered modules:
260260

261-
- **Density** (29 biases) — Controls note output probability
262-
- **Tension** (19 biases) — Shapes harmonic tension and resolution
261+
- **Density** (30 biases) — Controls note output probability
262+
- **Tension** (20 biases) — Shapes harmonic tension and resolution
263263
- **Flicker** (14 modifiers) — Drives rhythmic variation and stutter
264264

265265
All three are dampened + normalized.
266266

267-
Biases are multiplied together (not summed), dampened by `conductorDampening` (regime-aware gravity), normalized by `pipelineNormalizer` (adaptive soft-envelope), and decorrelated by `pipelineCouplingManager` (self-tuning gain nudges when correlation exceeds targets).
267+
Biases are multiplied together (not summed), dampened by `conductorDampening` (regime-aware gravity + centroid correction + flicker range elasticity), normalized by `pipelineNormalizer` (adaptive soft-envelope), and decorrelated by `pipelineCouplingManager` (self-calibrating targets + adaptive coherent relaxation + gain budget management).
268268

269269
### Feedback Loops
270270

@@ -274,10 +274,26 @@ Five closed-loop feedback systems maintain compositional coherence:
274274
- **Entropy steering** (`entropyRegulator`) — Steers cross-layer systems toward a section-position-driven entropy target. Scale clamp [0.3, 2.0].
275275
- **Condition hints** (`profileAdaptation`) — Detects sustained low-density / high-tension / flat-flicker streaks; advisory hints for `conductorConfig`. Streak trigger at 6 beats.
276276
- **Trust governance** (`adaptiveTrustScores`) — EMA-based weights (0.4–1.8) per cross-layer module. 8 scored systems: `stutterContagion`, `phaseLock`, `cadenceAlignment`, `feedbackOscillator`, `coherenceMonitor`, `convergence`, `entropyRegulator`, `restSynchronizer`.
277-
- **Decorrelation** (`pipelineCouplingManager`) — Self-tuning decorrelation for 6 compositional-dimension pairs. Adaptive gain, regime-aware.
277+
- **Decorrelation** (`pipelineCouplingManager`) — Self-tuning decorrelation for 15 dimension pairs. Self-calibrating targets, adaptive gain, regime-aware.
278278

279279
All controllers are enrolled with `feedbackRegistry` to prevent catastrophic resonance.
280280

281+
### Hypermeta Self-Calibrating Controllers
282+
283+
10 meta-controllers auto-tune parameters that previously required manual adjustment between runs:
284+
285+
1. **Self-Calibrating Coupling Targets** (`pipelineCouplingManager`) — Per-pair rolling |r| EMA. Intractable correlations relax targets upward; easily resolved pairs tighten toward baseline. Product-feedback guard freezes tightening when density product drops below 0.75.
286+
2. **Regime Distribution Equilibrator** (`regimeReactiveDamping`) — 64-beat rolling histogram vs target budget {exploring:35%, coherent:35%, evolving:20%}. Strength 0.25 with squared penalty when exploring exceeds 60%. Tension pin relief valve relaxes ceiling on sustained saturation.
287+
3. **Pipeline Product Centroid Controller** (`conductorDampening`) — 20-beat product EMA per pipeline. Corrective multiplier (±25%) counteracts chronic drift from 1.0. Density and tension only — flicker axis excluded to avoid fighting elasticity controller.
288+
4. **Flicker Range Elasticity Controller** (`conductorDampening`) — 32-beat rolling flicker range. 3x accelerated adjustment rate (0.015/beat). Compressed range reduces dampening base; excessive range increases it.
289+
5. **Trust Starvation Auto-Nourishment** (`adaptiveTrustScores`) — Per-system trust velocity EMA (50-beat horizon). Injects synthetic payoff when velocity stagnates for 100+ beats. Hysteresis: disengages only when velocity exceeds 3x threshold for 50 beats. Nourishment strength decays 10% per application (floor 0.05).
290+
6. **Adaptive Coherent Relaxation** (`pipelineCouplingManager`) — Derives coherent-regime coupling relaxation from rolling regime share instead of static constant.
291+
7. **Entropy PI Controller** (`systemDynamicsProfiler`) — Integral term + adaptive alpha + anti-windup (Ki=0.05, clamp ±3.0). Freezes integral accumulation when P and I terms have opposite signs.
292+
8. **Progressive Strength Auto-Scaling** (`conductorDampening`) — Derives dampening strength from active contributor count instead of hardcoded pipeline-specific multipliers.
293+
9. **Coupling Gain Budget Manager** (`pipelineCouplingManager`) — Per-axis budget cap (0.24, flicker 0.36) prevents coupling manager from dominating any single pipeline. Product-feedback guard on density axis.
294+
10. **Meta-Observation Telemetry** (`conductorDampening`) — Per-beat snapshots of meta-controller state emitted to `explainabilityBus` and fed to the meta-controller watchdog.
295+
11. **Meta-Controller Interaction Watchdog** (`conductorMetaWatchdog`) — Runs every 50 beats, detects opposing correction patterns between controllers on the same axis. Attenuates the weaker controller by 50% when conflict exceeds 30/50 beats. Self-heals when conflict resolves.
296+
281297
For constant values, interaction partners, and cross-constant invariants, see [TUNING_MAP.md](TUNING_MAP.md).
282298

283299
### Regime Detection
@@ -292,7 +308,7 @@ For constant values, interaction partners, and cross-constant invariants, see [T
292308
- **`fragmented`** — Multiple signals pulling in different directions
293309
- **`stagnant`** — Flat signals — musical stasis
294310

295-
Regime classification drives dampening strength, decorrelation aggressiveness, and profile adaptation behavior.
311+
Regime classification drives dampening strength, decorrelation aggressiveness, and profile adaptation behavior. The **regime distribution equilibrator** tracks a 64-beat rolling histogram and auto-modulates bias directions (strength 0.25, squared penalty above 60% exploring) to prevent any single regime from dominating. A **tension pin relief valve** relaxes the tension ceiling when sustained saturation is detected.
296312

297313
## Conductor Intelligence
298314

@@ -311,9 +327,9 @@ conductorIntelligence.registerModule('myModule', { reset() { /* ... */ } }, ['al
311327

312328
1. Module votes (multiplicative biases)
313329
2. `conductorIntelligence` collects products
314-
3. `conductorDampening` limits deviation (regime-aware)
330+
3. `conductorDampening` limits deviation (regime-aware, centroid-corrected density/tension, flicker-elastic)
315331
4. `pipelineNormalizer` smooths (adaptive envelope)
316-
5. `pipelineCouplingManager` decorrelates (pair targets)
332+
5. `pipelineCouplingManager` decorrelates (self-calibrating targets, gain budget, product-feedback guard)
317333
6. `pipelineBalancer` self-regulates (attribution-driven, deadband 0.25)
318334
7. `conductorState` commits final signals
319335
8. `signalReader` exposes to consumers
@@ -325,7 +341,7 @@ conductorIntelligence.registerModule('myModule', { reset() { /* ... */ } }, ['al
325341
- **Melodic** (15) — Contour, intervals, register, tessiture, counterpoint, thematic recall
326342
- **Rhythmic** (15) — Accent, onset, syncopation, complexity, symmetry, temporal proportions
327343
- **Texture** (20) — Articulation, layer coherence, motivic density, rest density, structural form
328-
- **Signal** (16) — Pipeline health, dynamics profiling, coupling, normalization, coherence
344+
- **`Signal`** (17 + 11 meta-controllers) — Pipeline health, dynamics profiling, coupling, normalization, coherence, self-calibrating hypermeta controllers, interaction watchdog
329345
- **Journey** (5) — Harmonic journey planning — key/mode selection, harmonic rhythm
330346

331347
## Cross-Layer Coordination
@@ -343,7 +359,7 @@ conductorIntelligence.registerModule('myModule', { reset() { /* ... */ } }, ['al
343359
- **`entropyRegulator`** — Entropy tracking accuracy
344360
- **`restSynchronizer`** — Meaningful shared rest success
345361

346-
Trust formula: `score = score * 0.9 + payoff * 0.1` (EMA). Weight: `1 + score * 0.75`, clamped to [0.4, 1.8]. `negotiationEngine` consumes these weights to gate which systems get influence.
362+
Trust formula: `score = score * 0.9 + payoff * 0.1` (EMA). Weight: `1 + score * 0.75`, clamped to [0.4, 1.8]. Trust ceilinged at 0.75. Trust starvation auto-nourishment injects synthetic payoffs when per-system velocity stagnates for 100+ beats; hysteresis prevents premature disengagement (3x threshold for 50 beats). Nourishment strength decays 10% per application (floor 0.05) to prevent trust inflation. `negotiationEngine` consumes these weights to gate which systems get influence.
347363

348364
### Negotiation Engine
349365

@@ -502,7 +518,7 @@ Central hub of tunable constants, annotated with sensitivity tiers:
502518
- **`DIVISIONS`** / **`SUBDIVS`** / **`SUBSUBDIVS`** — Beat subdivision weight distributions
503519
- **`BINAURAL`** — Binaural beat configuration
504520
- **`TENSION_SMOOTHING`** — Tension EMA factor (0.25)
505-
- **`FLICKER_SMOOTHING`** — Flicker EMA factor (0.15)
521+
- **`FLICKER_SMOOTHING`** — Flicker EMA factor (0.30)
506522

507523
### Conductor Profiles
508524

scripts/verify-boot-order.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ function scanConsumed(filePath, globalSet) {
299299
// ---- Derive subsystem from relative path ----
300300

301301
function subsystemOf(relPath) {
302-
// src/<subsystem>/... subsystem
302+
// src/<subsystem>/... - subsystem
303303
const match = relPath.match(/^src\/([^/]+)\//);
304304
return match ? match[1] : null;
305305
}

0 commit comments

Comments
 (0)