@muggleai/works 5.26.0-staging.203 → 5.26.0-staging.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2680,7 +2680,7 @@ var PREFERENCES_SCHEMA = {
2680
2680
  description: "When muggle init runs in a repository, or /muggle-do opens a PR in one, that lacks .github/workflows/muggle-walkthrough.yml, add it \u2014 the CI check that fails a PR whose E2E walkthrough is missing or reports a failed or inconclusive test case"
2681
2681
  },
2682
2682
  ["autoInstallWatchService" /* AutoInstallWatchService */]: {
2683
- description: "When muggle works installs or upgrades, register or refresh the Muggle Watch scheduled task \u2014 it tracks sessions and PR watchers, resumes the owner of a dead watcher, and brings idle sessions onto the installed build"
2683
+ description: "When muggle works installs or upgrades, schedule or refresh the Muggle Watch job (Task Scheduler, launchd, a systemd user timer or cron) \u2014 it tracks sessions and PR watchers, resumes the owner of a dead watcher, and brings idle sessions onto the installed build"
2684
2684
  },
2685
2685
  ["reusePreparePlan" /* ReusePreparePlan */]: {
2686
2686
  description: "Reuse the saved prepare plan for this stack (skip discovery, jump to check-running + smoke-test) instead of rediscovering from scratch"
@@ -9428,7 +9428,7 @@ var ONBOARDING_CHOICE_GROUPS = [
9428
9428
  optionLabels: [
9429
9429
  { value: "always" /* Always */, label: "Always \u2014 install it now and refresh it on every upgrade" },
9430
9430
  { value: "ask" /* Ask */, label: "Ask me later" },
9431
- { value: "never" /* Never */, label: "Never \u2014 I'll run scripts/muggle-watch/install-muggle-watch.ps1 myself" }
9431
+ { value: "never" /* Never */, label: "Never \u2014 I'll run muggle watch install myself" }
9432
9432
  ]
9433
9433
  },
9434
9434
  {
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-7NGYZIG7.js';
3
- import './chunk-3XUP6R6P.js';
2
+ import { runCli } from './chunk-HGN35NEP.js';
3
+ import './chunk-ZR7KLGHQ.js';
4
4
 
5
5
  // src/cli/main.ts
6
6
  runCli().catch((error) => {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-7NGYZIG7.js';
2
- export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-3XUP6R6P.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-HGN35NEP.js';
2
+ export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-ZR7KLGHQ.js';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
4
- "version": "5.26.0-staging.203",
4
+ "version": "5.26.0-staging.205",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.26.0-staging.203",
7
+ "@muggleai/works@5.26.0-staging.205",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.26.0-staging.203",
3
+ "version": "5.26.0-staging.205",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
5
  "author": {
6
6
  "name": "Muggle AI",
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
- "version": "5.26.0-staging.203",
5
+ "version": "5.26.0-staging.205",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.26.0-staging.203",
7
+ "@muggleai/works@5.26.0-staging.205",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -22,7 +22,7 @@ Read the `DRAIN` lines it prints: they are the outstanding work the monitor will
22
22
 
23
23
  Otherwise **claim the slot for this session** before starting anything: write `owner.json` ([`state-schemas.md`](state-schemas.md#ownerjson)) with `session_id` from `$CLAUDE_CODE_SESSION_ID` and `claimed_at` now. Arming is what establishes ownership, so every arming point records it here rather than each caller remembering to. If `$CLAUDE_CODE_SESSION_ID` is unset, write no `owner.json` — an unidentifiable owner is worse than none, since [`reconcile.md`](reconcile.md) would read a bogus id as some other session's claim and could never recover the slot.
24
24
 
25
- The same claim **registers the slot with the muggle watch service**: `pr-watch-arm.sh` writes [`watch-registration.json`](state-schemas.md#watch-registrationjson) beside `owner.json`. The service is a per-user scheduled task that runs outside every session. When a registered slot's loop is gone while its owner session is down, it resumes that owner in the background (`claude --resume <owner> --bg`), and the owner's own reconcile re-arms the watch. A slot armed any other way is registered with `muggle watch register --slot <slot>`. `muggle watch unregister --slot <slot>` keeps a slot session-scoped. The service still reports on it, but never resumes its owner.
25
+ The same claim **registers the slot with the muggle watch service**: `pr-watch-arm.sh` writes [`watch-registration.json`](state-schemas.md#watch-registrationjson) beside `owner.json`. The service is a per-user scheduled job that runs outside every session. When a registered slot's loop is gone while its owner session is down, it resumes that owner in the background (`claude --resume <owner> --bg`), and the owner's own reconcile re-arms the watch. A slot armed any other way is registered with `muggle watch register --slot <slot>`. `muggle watch unregister --slot <slot>` keeps a slot session-scoped. The service still reports on it, but never resumes its owner.
26
26
 
27
27
  Then start the watch as a **persistent background monitor** in the orchestrating session, with the script path resolved to an absolute path at arm time (from `${CLAUDE_PLUGIN_ROOT}/scripts/`) so it still resolves after the arming session is gone. `pr-watch-arm.sh` performs Steps 1-2 and then execs the loop, so the monitor's command is the arm script:
28
28
 
@@ -18,7 +18,7 @@ Two invariants hold on every trigger, however the sweep was reached: it never se
18
18
 
19
19
  A watcher lives and dies with its session: monitors and `/loop` crons are both session-bound, so a session that ends or hits its usage limit takes every watch down with it. No poller outlives its session to act on a PR. This is deliberate: a review is addressed only inside a session that carries the context to address it, never by a headless process that would reply without that context.
20
20
 
21
- What does run out of session is the muggle watch service (`muggle watch`, a per-user scheduled task). It addresses nothing on any PR. For a slot registered in [`watch-registration.json`](state-schemas.md#watch-registrationjson) whose loop is gone while its owner is down, it resumes the **owning** session in the background. That session's reconcile, this procedure, re-arms the watch with its own context. Restarting an idle owner onto a newly installed build goes the same way — stop, then resume on reconcile — so the watchers come back with it. A slot whose PR went terminal while neither its loop nor its owner is running it finalizes itself, as Step 3 would, leaving the post-merge cleanup unrun. Everything else it finds (a dead watcher under a running owner, red CI, a stale branch) it only reports.
21
+ What does run out of session is the muggle watch service (`muggle watch`, a per-user scheduled job). It addresses nothing on any PR. For a slot registered in [`watch-registration.json`](state-schemas.md#watch-registrationjson) whose loop is gone while its owner is down, it resumes the **owning** session in the background. That session's reconcile, this procedure, re-arms the watch with its own context. Restarting an idle owner onto a newly installed build goes the same way — stop, then resume on reconcile — so the watchers come back with it. A slot whose PR went terminal while neither its loop nor its owner is running it finalizes itself, as Step 3 would, leaving the post-merge cleanup unrun. Everything else it finds (a dead watcher under a running owner, red CI, a stale branch) it only reports.
22
22
 
23
23
  **Ownership is session-scoped too, and that is what bounds recovery.** Each slot records the session that armed it in [`owner.json`](state-schemas.md#ownerjson). Step 3.6 re-arms only slots the running session owns — watchers it armed itself, whose poller died under it. A slot owned by another session, or by none, is **never** re-armed here however dead its poller looks. The same argument that forbids a headless daemon forbids a fresh session inheriting a stranger's PR: it would be picking up review work it has no context for, on a branch it never built, and every push it made would be as context-blind as the daemon the design already rejected. Adoption exists precisely so that step is a deliberate act by the owner ([`adopt.md`](adopt.md)) rather than a side effect of starting a session.
24
24
 
@@ -50,7 +50,7 @@ Distinct from [`watch.pid`](#watchpid), and the two are not interchangeable. `wa
50
50
 
51
51
  ## `watch-registration.json`
52
52
 
53
- The slot's opt-in to recovery by the muggle watch service (`muggle watch`, a per-user scheduled task). `pr-watch-arm.sh` writes it beside `owner.json` on every arm that writes an owner. `muggle watch register --slot <slot>` writes it for a slot armed another way, and `muggle watch unregister --slot <slot>` removes it.
53
+ The slot's opt-in to recovery by the muggle watch service (`muggle watch`, a per-user scheduled job). `pr-watch-arm.sh` writes it beside `owner.json` on every arm that writes an owner. `muggle watch register --slot <slot>` writes it for a slot armed another way, and `muggle watch unregister --slot <slot>` removes it.
54
54
 
55
55
  ```json
56
56
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "release": "5.18.0",
3
- "buildId": "run-203-1",
4
- "commitSha": "9a6d967a9926a036eb0d0bdf7ab007a3c584b2ae",
5
- "buildTime": "2026-10-26T05:14:44Z",
3
+ "buildId": "run-205-1",
4
+ "commitSha": "d7032f006ff463d7d350020e912d613888ecd5a8",
5
+ "buildTime": "2026-10-26T07:16:39Z",
6
6
  "serviceName": "muggle-ai-works-mcp"
7
7
  }
@@ -1 +1 @@
1
- export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, CheckoutFreshnessVerdict, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, MAX_LISTED_INHERITED_COMMITS, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, evaluateCheckoutFreshness, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir2 as getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, mcp_exports as mcp, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, toDisplayRef, toolRequiresAuth, validatePreference, verifyFileChecksum, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-3XUP6R6P.js';
1
+ export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, CheckoutFreshnessVerdict, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, MAX_LISTED_INHERITED_COMMITS, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, evaluateCheckoutFreshness, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir2 as getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, mcp_exports as mcp, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, toDisplayRef, toolRequiresAuth, validatePreference, verifyFileChecksum, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-ZR7KLGHQ.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@muggleai/works",
3
3
  "mcpName": "io.github.multiplex-ai/muggle",
4
- "version": "5.26.0-staging.203",
4
+ "version": "5.26.0-staging.205",
5
5
  "description": "13 years of Microsoft hyperscale engineering, packaged as a harness for your AI coding agent.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
4
- "version": "5.26.0-staging.203",
4
+ "version": "5.26.0-staging.205",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.26.0-staging.203",
7
+ "@muggleai/works@5.26.0-staging.205",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.26.0-staging.203",
3
+ "version": "5.26.0-staging.205",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
5
  "author": {
6
6
  "name": "Muggle AI",
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
- "version": "5.26.0-staging.203",
5
+ "version": "5.26.0-staging.205",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
package/plugin/.mcp.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.26.0-staging.203",
7
+ "@muggleai/works@5.26.0-staging.205",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -22,7 +22,7 @@ Read the `DRAIN` lines it prints: they are the outstanding work the monitor will
22
22
 
23
23
  Otherwise **claim the slot for this session** before starting anything: write `owner.json` ([`state-schemas.md`](state-schemas.md#ownerjson)) with `session_id` from `$CLAUDE_CODE_SESSION_ID` and `claimed_at` now. Arming is what establishes ownership, so every arming point records it here rather than each caller remembering to. If `$CLAUDE_CODE_SESSION_ID` is unset, write no `owner.json` — an unidentifiable owner is worse than none, since [`reconcile.md`](reconcile.md) would read a bogus id as some other session's claim and could never recover the slot.
24
24
 
25
- The same claim **registers the slot with the muggle watch service**: `pr-watch-arm.sh` writes [`watch-registration.json`](state-schemas.md#watch-registrationjson) beside `owner.json`. The service is a per-user scheduled task that runs outside every session. When a registered slot's loop is gone while its owner session is down, it resumes that owner in the background (`claude --resume <owner> --bg`), and the owner's own reconcile re-arms the watch. A slot armed any other way is registered with `muggle watch register --slot <slot>`. `muggle watch unregister --slot <slot>` keeps a slot session-scoped. The service still reports on it, but never resumes its owner.
25
+ The same claim **registers the slot with the muggle watch service**: `pr-watch-arm.sh` writes [`watch-registration.json`](state-schemas.md#watch-registrationjson) beside `owner.json`. The service is a per-user scheduled job that runs outside every session. When a registered slot's loop is gone while its owner session is down, it resumes that owner in the background (`claude --resume <owner> --bg`), and the owner's own reconcile re-arms the watch. A slot armed any other way is registered with `muggle watch register --slot <slot>`. `muggle watch unregister --slot <slot>` keeps a slot session-scoped. The service still reports on it, but never resumes its owner.
26
26
 
27
27
  Then start the watch as a **persistent background monitor** in the orchestrating session, with the script path resolved to an absolute path at arm time (from `${CLAUDE_PLUGIN_ROOT}/scripts/`) so it still resolves after the arming session is gone. `pr-watch-arm.sh` performs Steps 1-2 and then execs the loop, so the monitor's command is the arm script:
28
28
 
@@ -18,7 +18,7 @@ Two invariants hold on every trigger, however the sweep was reached: it never se
18
18
 
19
19
  A watcher lives and dies with its session: monitors and `/loop` crons are both session-bound, so a session that ends or hits its usage limit takes every watch down with it. No poller outlives its session to act on a PR. This is deliberate: a review is addressed only inside a session that carries the context to address it, never by a headless process that would reply without that context.
20
20
 
21
- What does run out of session is the muggle watch service (`muggle watch`, a per-user scheduled task). It addresses nothing on any PR. For a slot registered in [`watch-registration.json`](state-schemas.md#watch-registrationjson) whose loop is gone while its owner is down, it resumes the **owning** session in the background. That session's reconcile, this procedure, re-arms the watch with its own context. Restarting an idle owner onto a newly installed build goes the same way — stop, then resume on reconcile — so the watchers come back with it. A slot whose PR went terminal while neither its loop nor its owner is running it finalizes itself, as Step 3 would, leaving the post-merge cleanup unrun. Everything else it finds (a dead watcher under a running owner, red CI, a stale branch) it only reports.
21
+ What does run out of session is the muggle watch service (`muggle watch`, a per-user scheduled job). It addresses nothing on any PR. For a slot registered in [`watch-registration.json`](state-schemas.md#watch-registrationjson) whose loop is gone while its owner is down, it resumes the **owning** session in the background. That session's reconcile, this procedure, re-arms the watch with its own context. Restarting an idle owner onto a newly installed build goes the same way — stop, then resume on reconcile — so the watchers come back with it. A slot whose PR went terminal while neither its loop nor its owner is running it finalizes itself, as Step 3 would, leaving the post-merge cleanup unrun. Everything else it finds (a dead watcher under a running owner, red CI, a stale branch) it only reports.
22
22
 
23
23
  **Ownership is session-scoped too, and that is what bounds recovery.** Each slot records the session that armed it in [`owner.json`](state-schemas.md#ownerjson). Step 3.6 re-arms only slots the running session owns — watchers it armed itself, whose poller died under it. A slot owned by another session, or by none, is **never** re-armed here however dead its poller looks. The same argument that forbids a headless daemon forbids a fresh session inheriting a stranger's PR: it would be picking up review work it has no context for, on a branch it never built, and every push it made would be as context-blind as the daemon the design already rejected. Adoption exists precisely so that step is a deliberate act by the owner ([`adopt.md`](adopt.md)) rather than a side effect of starting a session.
24
24
 
@@ -50,7 +50,7 @@ Distinct from [`watch.pid`](#watchpid), and the two are not interchangeable. `wa
50
50
 
51
51
  ## `watch-registration.json`
52
52
 
53
- The slot's opt-in to recovery by the muggle watch service (`muggle watch`, a per-user scheduled task). `pr-watch-arm.sh` writes it beside `owner.json` on every arm that writes an owner. `muggle watch register --slot <slot>` writes it for a slot armed another way, and `muggle watch unregister --slot <slot>` removes it.
53
+ The slot's opt-in to recovery by the muggle watch service (`muggle watch`, a per-user scheduled job). `pr-watch-arm.sh` writes it beside `owner.json` on every arm that writes an owner. `muggle watch register --slot <slot>` writes it for a slot armed another way, and `muggle watch unregister --slot <slot>` removes it.
54
54
 
55
55
  ```json
56
56
  {
@@ -1,6 +1,6 @@
1
1
  # muggle watch service
2
2
 
3
- A standing per-user scheduled task that runs `muggle watch tick` every few minutes, outside any agent session. Each tick:
3
+ A standing per-user scheduled job that runs `muggle watch tick` every few minutes, outside any agent session, on Windows, macOS and Linux. Each tick:
4
4
 
5
5
  - **Tracks** active Claude Code sessions (`claude agents --json`) and Codex sessions (recent `~/.codex/sessions` rollouts). It also tracks their processes: claude, codex, muggle MCP servers, and PR watch loops. Each live Claude session is stamped with when it last loaded its plugins (its process start, or its newest muggle MCP server start after a `/reload-plugins`) and the muggle works build installed then, read off `~/.muggle-ai/postinstall.log`.
6
6
  - **Checks every open PR-watch slot** under `~/.muggle-ai/muggle-do/sessions/`. Is its loop running, and heard by a live session? Is CI red? Is the branch behind or conflicting? Are review threads unresolved?
@@ -9,17 +9,30 @@ A standing per-user scheduled task that runs `muggle watch tick` every few minut
9
9
  - **Keeps sessions on the installed build.** A session loaded before the newest global install (or a later user-scope plugin update) is behind. Idle background sessions are restarted onto the new build, up to 3 per tick: a session that owns open PR watches is stopped and resumed on `/muggle:muggle-pr-followup reconcile`, so its watchers come back with it; any other is respawned. Before either, a throwaway background launch in the session's workspace confirms Claude will bring it back; a workspace that refuses is left running and named once. Busy or waiting sessions wait for a later tick, and terminal sessions get one notification to run `/reload-plugins`. No interface runs a slash command inside another session.
10
10
  - **Records and alerts.** Results go to `status.json` (last snapshot, with open-PR coverage per repo), `state.json` (active findings, recovery attempts, reload progress) and `events.jsonl` (raise/clear/resume/respawn/close-out history) under `~/.muggle-ai/watch/`. New alerts raise one desktop notification per tick.
11
11
 
12
- ## Install (Windows)
12
+ ## Install
13
13
 
14
- Requires the global package (`npm install -g @muggleai/works`), plus `claude` and `gh` on PATH.
14
+ Requires the global package (`npm install -g @muggleai/works`), plus `claude` and `gh` on PATH. The same command works on every platform:
15
15
 
16
16
  ```sh
17
- muggle watch install
17
+ muggle watch install # schedule it and run one tick now
18
+ muggle watch install --no-wait # schedule it only; the first tick follows within the interval
19
+ muggle watch install --uninstall # remove it; the ledger is kept
18
20
  ```
19
21
 
20
- The `autoInstallWatchService` preference (asked by `muggle init` and `/muggle-upgrade`) makes this automatic: on `always` every global install or upgrade registers the task, and an already-registered task is refreshed on any value but `never`.
22
+ The `autoInstallWatchService` preference (asked by `muggle init` and `/muggle-upgrade`) makes this automatic: on `always` every global install or upgrade schedules the watch, and a watch already scheduled is refreshed on any value but `never`.
21
23
 
22
- The installer itself takes flags:
24
+ | Platform | Scheduler | Entry | Output |
25
+ | :------- | :-------- | :---- | :----- |
26
+ | Windows | Task Scheduler | task `MuggleWatch`, via `wscript.exe` on a copied shim, so no console window flashes | `~/.muggle-ai/watch/tick.log` |
27
+ | macOS | launchd | agent `ai.muggle.watch` in `~/Library/LaunchAgents` | `~/.muggle-ai/watch/tick.log` |
28
+ | Linux | systemd user timer | `muggle-watch.service` + `.timer` in `$XDG_CONFIG_HOME/systemd/user` | `~/.muggle-ai/watch/tick.log` |
29
+ | Linux without a systemd user session (containers, BSDs) | cron | one crontab line ending `# muggle-watch` | `~/.muggle-ai/watch/tick.log` |
30
+
31
+ Re-installing replaces the entry in place. On macOS and Linux every scheduler runs one copied launcher, `~/.muggle-ai/watch/bin/muggle-watch-tick.sh`. Schedulers start jobs with a minimal PATH, so the launcher restores the PATH of the shell that ran the install from `watch-env.sh` beside it. Re-run the install after `claude`, `gh` or `node` moves. The log is capped at 1 MB on every platform.
32
+
33
+ A systemd user timer runs only while you are logged in. On a headless machine, `loginctl enable-linger $USER` keeps it running after logout.
34
+
35
+ On Windows the PowerShell installer also takes flags directly:
23
36
 
24
37
  ```powershell
25
38
  & "$(npm root -g)\@muggleai\works\scripts\muggle-watch\install-muggle-watch.ps1" -IntervalMinutes 5
@@ -34,23 +47,13 @@ The installer itself takes flags:
34
47
  | `-MuggleEntry <path>` | Run a specific `bin\muggle.js` instead of the global install |
35
48
  | `-Uninstall` | Remove the task; the ledger is kept |
36
49
 
37
- Re-running the installer replaces the task in place. The task runs `wscript.exe` on a copied shim, so no console window flashes. Its output goes to `~/.muggle-ai/watch/tick.log`.
38
-
39
- ## macOS / Linux
40
-
41
- There is no installer yet. Add a crontab line:
42
-
43
- ```sh
44
- */2 * * * * muggle watch tick >> ~/.muggle-ai/watch/tick.log 2>&1
45
- ```
46
-
47
50
  ## Commands
48
51
 
49
52
  ```sh
50
53
  muggle watch status # last snapshot: sessions and their builds, processes, PR watches, coverage, findings
51
54
  muggle watch tick # one pass now
52
55
  muggle watch reload-plugins # restart every idle session onto the plugins on disk now (--dry-run to preview)
53
- muggle watch install # register or refresh the scheduled task (--uninstall, --no-wait)
56
+ muggle watch install # schedule the watch or refresh it in place (--uninstall, --no-wait)
54
57
  muggle watch register --slot <dir> # opt a slot into recovery
55
58
  muggle watch unregister --slot <dir> # keep a slot session-scoped
56
59
  ```
@@ -0,0 +1,33 @@
1
+ #!/bin/sh
2
+ # Launcher for `muggle watch tick` on macOS and Linux, run by the launchd agent,
3
+ # the systemd user timer, or the crontab line that `muggle watch install` sets up.
4
+ #
5
+ # Arguments: <node> <muggle.js> [extra tick flags...]
6
+ #
7
+ # Schedulers start jobs with a minimal PATH, so the PATH of the shell that ran
8
+ # the install is restored from watch-env.sh beside this script; without it the
9
+ # tick cannot find claude or gh. Output is appended to tick.log in the watch dir,
10
+ # capped at 1 MB by starting over, since the snapshot and events ledger are the
11
+ # record and the log only needs the recent failures.
12
+ #
13
+ # Keep this file ASCII with LF line endings: sh reads it byte for byte.
14
+
15
+ [ "$#" -ge 2 ] || exit 2
16
+ node_path=$1
17
+ muggle_entry=$2
18
+ shift 2
19
+
20
+ bin_dir=$(cd "$(dirname "$0")" && pwd)
21
+ watch_dir=$(dirname "$bin_dir")
22
+ log_path="$watch_dir/tick.log"
23
+ log_cap_bytes=1048576
24
+
25
+ if [ -f "$bin_dir/watch-env.sh" ]; then
26
+ . "$bin_dir/watch-env.sh"
27
+ fi
28
+
29
+ if [ -f "$log_path" ] && [ "$(wc -c < "$log_path")" -gt "$log_cap_bytes" ]; then
30
+ rm -f "$log_path"
31
+ fi
32
+
33
+ exec "$node_path" "$muggle_entry" watch tick "$@" >> "$log_path" 2>&1