--- title: "Guide: lifecycle" description: "smabar plugin reference: Guide: lifecycle" canonical: "https://smabar.com/docs/plugin-ref-guide-lifecycle/" lang: en --- # Guide: lifecycle > smabar plugin reference: Guide: lifecycle Canonical HTML version: https://smabar.com/docs/plugin-ref-guide-lifecycle/ · Language: en · Publisher: smabar (https://smabar.com) --- [Build my plugin](https://smabar.com/build-my-plugin.md) · [All references](https://smabar.com/docs/plugin-ref-index.md) · [Install the ZIP](https://smabar.com/docs/install-plugin-zip.md) Source: smabar 1.5.0, revision `a019f2563965edc37a5e8d84742ea1ff2fa6f824`. [Export metadata and checksums](https://smabar.com/plugin-reference/export.json). This is an offline reference. MCP calls quoted below describe the connected workflow; use the linked documents and create local files instead. Live state, installed plugins, available providers and the user's active theme are unknown. Never claim a live check. Read with [styling](https://smabar.com/docs/plugin-ref-styling.md) and [examples](https://smabar.com/docs/plugin-ref-examples.md). ## order ```json "The core sends initialize (id, data_dir, plugin_dir, settings, language, advertised providers) → available provider subscriptions are set up → @app.on_ready runs → @app.every timers start → the plugin serves until shutdown." ``` ## concurrency ```json "All handlers share ONE lock: exactly one runs at a time. A slow handler blocks every timer and action of that plugin, so move anything long (network, subprocesses, big files) into a thread and only publish the result back into your state." ``` ## errors ```json "A handler exception is logged as an error and the plugin keeps running. Crashing at import time is different: the process is restarted with a backoff and gives up after repeated failures." ``` ## shutdown ```json "There is NO shutdown hook. Code after app.run() runs on a graceful stop, but not on a kill. If you spawn child processes, make them safe on their own (own process group plus a timeout) — smabar signals the plugin's process group, so well-behaved children die with it." ``` ## reload ```json "Writing any file in your CODE folder (app.plugin_dir) restarts the plugin — that is hot reload. A malformed replacement manifest is the exception: smabar logs it and keeps the last valid instance running. Writing in app.data_dir never restarts. State in memory is lost on a successful restart; anything that must survive belongs in app.data_dir or settings." ``` ## tileChanges ```json "A manifest that declares fewer tiles than before removes the dropped ones from the bar immediately — no restart needed." ``` ## capabilities ```json "initialize.capabilities advertises commands, popups and audio when supported. Older hosts may omit it; desktop SDK calls reject unavailable services. The host assigns session identities; audio/toasts are cleaned up after stop, crash, reload or deactivation." ``` ## uninstall ```json "All plugins, including bundled ones, can be removed. A previously seeded plugin that is absent stays absent on restart and after bundle updates; explicitly reinstall its folder to use it again." ```