lietzsche;noether
Pages

updated 2026-11-26·6 min read

Micro-Kernel & Core Isolation

How Noether enforces zero native core leakage through Inversion of Control registries, the NoetherApp service locator, and the Disposable resource pattern.

Noether separates windowing, docking, persistence, and registries inside a strict micro-kernel host, while user-facing features like Graph View, Infinite Canvas, Tasks, Journal, and Backlinks sit on the outside of the SDK boundary as modular extensions, i.e., disabling or hot-reloading a built-in extension never breaks host compilation or leaks internal state.

1. Zero Native Core Leakage

If disabling Graph or Canvas breaks the host build, the extension boundary is fake. Native directories (src/core, src/lib, src/store, src/components, src/types, src/sdk) never import code, types, or models from src/extensions/* (which is also how I could later rip out the 2,524-line built-in sketch extension cleanly without touching the host).

All interaction between the host and extensions runs through three boundaries:

  1. The Noether SDK (src/sdk): Public base classes, interfaces, and hooks (Extension, NoetherApp, Disposable, useViewSuspension).
  2. Inversion of Control (IoC) Registries: Host registries where extensions plug in commands, views, and UI slots.
  3. The Typed EventBus (EventBus): A publish-subscribe channel for lifecycle and document events.
Architectural LayerScope & Subsystems
Noether Extensions LayerModular extensions consuming only the public SDK boundary
Core Built-ins (src/extensions/core/)Backlinks, Bookmarks, Canvas (with its own CanvasCardRegistry), Covers, Graph, History, Journal, Marketplace, More Icons, Outline, Properties, Sync, Tags, Tasks
Community & Custom (Marketplace)Cascade, Copilot, Quicknote, Spaced Repetition (FSRS), Sketch2Text, User Extensions
Public SDK Surface (src/sdk)Extension base class, NoetherApp container, Disposable helpers, useViewSuspension, React UI primitives
Micro-Kernel IoC Registries (src/core/registries/)Central inversion-of-control registries managed by the host application
CommandRegistryPalette commands and hotkey listeners
OmniboxProviderRegistryUniversal command palette search providers (task:, bm:, tag:, etc.)
TabContextMenuRegistryContextual actions on tab headers in SplitTabHeader
TabDecoratorRegistryCustom tab icons, badges, and tooltips
ViewRegistryLeaf views and main content tab types
ActionRailRegistryLeft activity bar icons and action triggers
StatusBarRegistryBottom status bar items and progress indicators
SidebarRegistryLeft and right sidebar panel tabs and file tree decorators
EditorRegistryTipTap extensions, slash commands, headers, footers, and transform hooks
ContextMenuRegistry / FileContextMenuRegistryEditor and file tree context menu actions
ModalRegistry / SlotRegistry / ViewportActionRegistryCustom modal dialogs, React portal slots, and viewport action buttons
PropertyRegistry / SettingRegistry / FileTypeRegistry / IconRegistryFrontmatter property types, extension setting tabs, custom file types, and icon packs
ToolRegistry (MCP)Model Context Protocol tools and prompts
Typed EventBusTyped publish-subscribe channel for document, vault, and extension lifecycle events

Any extension can be toggled off, hot-reloaded, or deleted without breaking host compilation or leaving dead references behind.

2. The Host Application Container (NoetherApp)

Every extension receives a NoetherApp instance (src/core/app/NoetherApp.ts), exposing the host registries alongside workspace, vault, settings, events, vcs, dbManager, and workerPool.

NoetherApp service container (src/core/app/NoetherApp.ts)
export class NoetherApp {
  public commands: CommandRegistry;
  public views: ViewRegistry;
  public actionRail: ActionRailRegistry;
  public sidebars: SidebarRegistry;
  public statusBar: StatusBarRegistry;
  public editor: EditorRegistry;
  public settingsRegistry: SettingRegistry;
  public contextMenu: ContextMenuRegistry;
  public modals: ModalRegistry;
  public properties: PropertyRegistry;
  public tabDecorators: TabDecoratorRegistry;
  public icons: IconRegistry;
  public tools: ToolRegistry;
  public slots: SlotRegistry;
  public fileTypes: FileTypeRegistry;
  public viewportActions: ViewportActionRegistry;
  public fileContextMenus: FileContextMenuRegistry;
  public tabContextMenu: TabContextMenuRegistry;
  public omnibox: OmniboxProviderRegistry;
  public dbManager: ExtensionDatabaseManager;
  public workerPool: ExtensionWorkerPool;
  public events: EventBus;
  public extensions: ExtensionManager;
  public vcs: { /* Git snapshot & history helpers */ };

  public get workspace(): WorkspaceAPI { /* ... */ }
  public get vault(): VaultAPI { /* ... */ }
  public get settings(): SettingsAPI { /* ... */ }
}

3. The Disposable Pattern & Resource Management

When an extension gets disabled mid-session, orphaned event listeners, timers, and DOM widgets turn into zombie UI and leaked memory. Every registration helper on the Extension base class returns and tracks a Disposable ({ dispose: () => void }) automatically.

ExampleExtension lifecycle and Disposable tracking (TS)
import { Extension } from 'noether';

export default class ExampleExtension extends Extension {
  async onload() {
    // 1. Registering a command returns a Disposable tracked by the extension
    this.addCommand({
      id: 'example:greet',
      title: 'Show Greeting',
      action: (app) => app.workspace.showToast('Hello from extension!'),
    });

    // 2. Event subscriptions are also tracked automatically
    this.onEvent('document:saved', (data) => {
      console.log('Saved note:', data.title);
    });

    // 3. Intervals and custom resources can be tracked automatically or manually
    this.registerInterval(() => this.tick(), 60000);
  }

  onunload() {
    // Standard registrations are cleaned up automatically.
    // Custom non-disposable cleanup can be placed here.
  }
}

When app.extensions.disableExtension(id) runs:

  1. extension.unload() calls extension.onunload().
  2. All tracked disposables are invoked and cleared.
  3. Extension-scoped database cascade listeners and Web Workers terminate (dbManager.cleanupExtension() and workerPool.terminateExtension()).

4. Namespacing and Extension Isolation

To avoid name collisions between independent extensions:

  • Action Rail, Sidebar, & Status Bar IDs: Automatically prefixed by Extension methods as ${extensionId}:${itemId} (along with editor plugins and transform hooks).
  • Command IDs: Stored verbatim by CommandRegistry (with extensionId tracked as metadata), so extensions should prefix their own id values (e.g., my-ext:do-thing).
  • MCP Tool & Prompt Names: Automatically prefixed as ${extensionId}_${toolName}.
  • Key-Value Storage: loadData() and saveData() store JSON per extension in localStorage under noether_extension_data_${extensionId}, while installed extension bundles live on disk under .noether/extensions/${extensionId}/.
  • Database Tables: Tables created via this.defineTable() are physically named ext_${extensionId}_${tableName} in SQLite to prevent cross-extension schema collisions.

5. Dark and Light Theme Modes

Noether separates visual themes from dark/light appearance modes:

  • Independent Mode Setting: The appearance setting (themeMode: 'system' | 'dark' | 'light') is separate from the selected theme (activeTheme). Users can switch dark and light modes without resetting their active theme.
  • Theme Mode Support: Themes declare supported modes via modeSupport: 'both' | 'dark-only' | 'light-only'. Single-mode themes enforce their designed aesthetic, while dual-mode themes adapt dynamically to the active mode.
  • Automatic Token Resolution: When activating a theme, resolveThemeTokens() merges base variables with modes.light overrides for light mode sessions, producing a single resolved token tree.
  • Surface Color Generation: Themes compile through generateCssVariables(), which creates consistent surface tokens (--noether-btn-hover-bg, --noether-btn-active-bg, --noether-bg-card, --noether-bg-popover) across both modes.

Search wiki and portfolio

type to search across all entries.