Amplifier × Kepler

The Kepler Refactor

606 lines of dead code removed. 104 new tests added.
A disciplined, AI-assisted 5-phase migration.

February 2026
Active
Context

Kepler is Amplifier's desktop GUI

An Electron-based application that gives users a native desktop experience for Amplifier—session management, provider configuration, artifact editing, and more.

Desktop Native

Electron app with full OS integration—tray icon, native menus, file system access, local sidecar process.

Full-Featured

Session creation, provider management, settings configuration, onboarding flows, artifact preview and editing.

Growing Fast

67 commits, 3 contributors, rapid feature development. But rapid growth was creating architectural debt.

The Problem

Kepler was rebuilding
what Distro already had

Duplicated Infrastructure

Provider registry, session lifecycle, and config management were all rebuilt independently inside Kepler—logic that already existed in the distro platform.

Missed Platform Features

Sessions didn't get distro's handoff injection, preflight checks, or streaming hooks. Kepler users got a degraded experience.

Divergence Risk

Two codebases evolving the same concerns independently. Every distro improvement required a separate Kepler update—or was simply missed.

The Insight

Kepler should be a surface,
not a second platform

Architecturally equivalent to distro's Slack bridge, Voice bridge, and Web Chat. Kepler should consume the platform, not rebuild it.

Before: Direct Coupling
After: Platform Consumer
Kepler → amplifier-foundation directly
Kepler → distro Bridge API
Own provider registry module
distro catalog (shared with all surfaces)
Custom settings.yaml parser
distro.yaml config (single source of truth)
Custom onboarding validation
distro preflight checks
647-line amplifier_hooks.py
41-line thin adapter
The Approach

Not speed.
Discipline.

A methodical 5-phase refactor. Each phase building on the last.
Design docs before code. Tests after every change. AI planning the migration.

Five Phases

The refactor roadmap

Phase 1

Bridge API

Replace direct session creation with distro LocalBridge

+469 / -304
Phase 2

Catalog

Replace provider registry with distro catalog

+47 / -44
Phase 3

Settings

Migrate settings to distro.yaml config

+405 / -69
Phase 4

Onboarding

Integrate with distro preflight and identity

+105 / -13
Phase 5

Cleanup

Remove dead code, delete deprecated files, restructure

-1,188 lines
Phase 1 — Feb 11, 4:56 PM

Replace session creation
with distro Bridge

The biggest single change. Session lifecycle now goes through LocalBridge instead of direct amplifier-foundation calls.

# Before: Direct coupling to amplifier-foundation
from amplifier_foundation import Session
session = Session(config=compose_mount_plan(...))
inject_settings_into_mount_plan(session, FEATURE_MODULES)

# After: Clean platform consumption
from amplifier_distro.bridge import LocalBridge
bridge = LocalBridge(distro_path)
session = bridge.create_session(project_path)

Key deletion: inject_settings_into_mount_plan, compose_mount_plan, and the entire FEATURE_MODULES constant—all replaced by a single bridge call.

Phases 2–4 — Feb 11, 5:45–6:12 PM

Systematic replacement,
one concern at a time

5:50 PM

Phase 2: Provider Catalog

All provider lookups moved to amplifier_distro.features.PROVIDERS. Zero remaining provider_registry imports. Surgical: just 3 files, +47/-44 lines.

6:07 PM

Phase 3: Settings Migration

New distro_config.py adapter bridges Settings interface to distro.yaml. Backward compatible—legacy settings.yaml fallback preserved.

6:12 PM

Phase 4: Onboarding Preflight

Onboarding routes now use distro's run_preflight() and detect_github_identity(). All distro calls non-blocking with graceful fallback.

Design principle: Each phase was independently deployable. No phase required the next one to work. Backward compatibility preserved at every step.

Phase 5 — The Cleanup

−606 lines

With all four replacement phases complete, the dead code was surgically identified and removed in three passes.

Pass 1: Mark

Deprecated create_bridge, mount_bridge_hooks, create_forwarder, entire provider_registry.py and settings.py.

+224 / -101

Pass 2: Remove

amplifier_hooks.py: 647 → 41 lines. Dead FEATURE_MODULES, dead composer routes, stale tests—all gone.

-689 lines

Pass 3: Eliminate

Deleted 3 entire files: provider_registry.py (138 lines), events.py (68 lines), settings.py (222 lines).

-503 lines
Phase 5 Bonus

Proper package structure

The final commit restructured sidecar-shared from a loose directory with sys.path hacks into a proper Python package.

# Before: sys.path manipulation
sys.path.insert(0, os.path.join(HERE, '..', 'sidecar-shared'))
from amplifier_hooks import create_bridge
from provider_registry import get_providers
from settings import load_settings

# After: Clean package imports
from sidecar.shared.distro_config import DistroConfig
from sidecar.shared.stream_events import StreamHandler
from sidecar.shared.session_lifecycle import SessionManager

13 files touched, eliminating all sys.path manipulation. Modules became discoverable, testable, importable.

Proving It Works

+104 tests

Five new test files covering every refactored integration point. Total suite: 211 tests (104 new + 107 pre-existing).

test_distro_config.py

31
tests

test_stream_events.py

33
tests

test_session_lifecycle.py

13
tests

test_tool_lookup.py

8
tests

test_onboarding_preflight.py

19
tests
Config
31 / 31
Streaming
33 / 33
Sessions
13 / 13
Tools
8 / 8
Onboarding
19 / 19
By the Numbers

Development velocity

5
Phases
12
Commits
17
Hours
~48
AI Sessions*

*From project narrative; not independently verified via git

Contributors: Michael J. Jabbour (38 commits, 58%) • Marc Goodner (15 commits, 23%) • Sam Schillace (12 commits, 18%)

Architecture Impact
606
Dead Lines Removed
104
New Tests Added
3
Files Deleted Entirely

amplifier_hooks.py
647 lines → 41 lines

While We Were At It

UX improvements shipped alongside

The refactor wasn't just internal. Multiple user-facing fixes were included in the same development period.

Artifacts Editor

Unified code editor, restored folder open, hardened parsing and preview behavior.

Sidebar & Composer

Tightened sidebar controls, added folder actions, improved composer UX flow.

API Key Config

Fixed missing API key fields and "Not configured" false positives after fresh database.

13 bugs fixed in a single commit alongside the refactor. Discipline doesn't mean ignoring UX—it means handling both.

AI-Assisted Engineering

Amplifier didn't just write code.
It planned the migration.

Design Phase

3 design documents totaling 1,064 lines were produced before a single line of code changed:

DISTRO_INTEGRATION_DESIGN.md
IMPLEMENTATION_TASKS.md
IMPLEMENTATION_HANDOFF.md

Execution Phase

Every commit co-authored by Amplifier. 48 sessions orchestrated the work across all 5 phases.

Co-Authored-By: Amplifier
🤖 Generated with Amplifier

# The handoff doc explicitly described
# orchestration by an AI session:
IMPLEMENTATION_HANDOFF.md
"Handoff to implementation
 orchestrator session"
The Lesson
AI-assisted doesn't mean undisciplined. It means you can afford to do it right.

Design docs before code. One concern per phase. Backward compatibility at every step. Tests after every change. Dead code identified, marked, then removed. This is what disciplined AI-assisted engineering looks like.

Complete Timeline

17 hours, start to finish

4:56 PM

Design docs committed

3 documents, 1,064 lines. Architecture, tasks, and AI handoff spec.

5:41 PM

Phase 1: Bridge API

Session lifecycle migrated to LocalBridge. +469/-304 lines.

5:50 PM

Phase 2: Provider Catalog

All provider lookups moved to distro. +47/-44 lines.

6:07 PM

Phase 3: Settings Migration

New distro_config.py adapter with backward compatibility. +405/-69 lines.

6:12 PM

Phase 4: Onboarding Preflight

Non-blocking distro preflight with graceful fallback. +105/-13 lines.

6:17 PM

Phase 5a: Mark deprecated

Deprecated functions and modules flagged. +224/-101 lines.

8:43 PM

Phase 5b: Remove 606 lines

amplifier_hooks.py: 647 → 41. Dead routes, stale tests gone. +7/-689 lines.

+9:15 AM

Phase 5c: Eliminate tech debt

3 files deleted entirely. Compat shims removed. +24/-503 lines.

+9:25 AM

Restructure to proper package

sidecar-shared → sidecar/shared/ Python package. 13 files. +95/-112 lines.

+9:59 AM

104 new tests committed

5 test files, 1,984 lines. Total suite: 211 tests, all passing.

Sources

Research Methodology

Data as of: February 20, 2026

Feature status: Active

Research performed:

Gaps & estimates:

Primary contributors: Michael J. Jabbour (38 commits, 58%), Marc Goodner (15 commits, 23%), Sam Schillace (12 commits, 18%)

Get Started

Less code.
More tests.
Better architecture.

The Kepler refactor is a template for disciplined AI-assisted migration.
Design first. Migrate phase by phase. Test everything. Delete fearlessly.

amplifier-distro-kepler  •  5 phases  •  12 commits  •  ~48 Amplifier sessions
More Amplifier Stories