From 0ba7b55532677100116c9c2fc2814c80c4933d8a Mon Sep 17 00:00:00 2001 From: clagentic <10177887+akuehner@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:30:12 -0400 Subject: [PATCH 1/4] feat(cli): add --no-restart flag to suppress crash-supervisor auto-restart When --no-restart is set, onDaemonDied() exits with code 1 instead of restarting after a crash. The dev-mode unexpected-exit handler is also gated so the daemon stays dead for inspection. Useful when debugging crash state and needing the CLI to stay quiet. lr-f0ca Co-Authored-By: Claude Sonnet 4.6 --- .crew/amos.yaml | 1 + bin/cli.js | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.crew/amos.yaml b/.crew/amos.yaml index b7c0d922..86d86a2d 100644 --- a/.crew/amos.yaml +++ b/.crew/amos.yaml @@ -1,5 +1,6 @@ scope: allowed_paths: + - bin/** - lib/** - .crew/** - test/** diff --git a/bin/cli.js b/bin/cli.js index 25af6591..fd12f656 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -58,6 +58,7 @@ var autoYes = false; var cliPin = null; var shutdownMode = false; var restartMode = false; +var noRestart = false; var addPath = null; var removePath = null; var listMode = false; @@ -102,6 +103,8 @@ for (var i = 0; i < args.length; i++) { shutdownMode = true; } else if (args[i] === "--restart") { restartMode = true; + } else if (args[i] === "--no-restart") { + noRestart = true; } else if (args[i] === "--add") { addPath = args[i + 1] || "."; i++; @@ -120,7 +123,7 @@ for (var i = 0; i < args.length; i++) { } else if (args[i] === "--os-users") { osUsersMode = true; } else if (args[i] === "-h" || args[i] === "--help") { - console.log("Usage: clagentic [-p|--port ] [--host
] [--no-https] [--no-update] [--debug] [-y|--yes] [--pin ] [--shutdown] [--restart]"); + console.log("Usage: clagentic [-p|--port ] [--host
] [--no-https] [--no-update] [--debug] [-y|--yes] [--pin ] [--shutdown] [--restart] [--no-restart]"); console.log(" clagentic --add Add a project to the running daemon"); console.log(" clagentic --remove Remove a project from the running daemon"); console.log(" clagentic --list List registered projects"); @@ -137,6 +140,7 @@ for (var i = 0; i < args.length; i++) { console.log(" --pin Set 6-digit PIN (use with --yes)"); console.log(" --shutdown Shut down the running relay daemon"); console.log(" --restart Restart the running relay daemon"); + console.log(" --no-restart Do not auto-restart on crash (useful for debugging crash state)"); console.log(" --add Add a project directory (use '.' for current)"); console.log(" --remove Remove a project directory"); console.log(" --list List all registered projects"); @@ -389,6 +393,19 @@ function onDaemonDied() { return; } + // --no-restart: leave the daemon dead so the developer can inspect crash state + if (noRestart) { + log(""); + log(sym.warn + " " + a.yellow + "Server crashed. --no-restart is set — not restarting." + a.reset); + if (crashInfo.reason) { + log(a.dim + " " + crashInfo.reason.split("\n")[0] + a.reset); + } + log(a.dim + " Check logs: " + a.reset + logPath()); + log(""); + process.exit(1); + return; + } + // Reset backoff counter if enough time has passed since last restart burst var now = Date.now(); if (_restartBackoffStart && now - _restartBackoffStart > 60000) { @@ -1751,7 +1768,12 @@ async function devMode(mode, keepAwake, existingPinHash, wantOsUsers) { process.exit(78); return; } - // Unexpected exit — auto restart + // Unexpected exit — auto restart (suppressed when --no-restart is set) + if (noRestart) { + console.log("\x1b[33m[dev] Daemon exited (code " + code + "). --no-restart is set — not restarting.\x1b[0m"); + process.exit(code || 1); + return; + } console.log("\x1b[33m[dev] Daemon exited (code " + code + "), restarting...\x1b[0m"); setTimeout(spawnDaemon, 500); }); From e33d621192845642f8df6faf2b129d6a5de8123d Mon Sep 17 00:00:00 2001 From: clagentic <10177887+akuehner@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:35:02 -0400 Subject: [PATCH 2/4] fix(brand): replace bare 'clagentic' with correct product name in user-facing strings Usage strings and status line in bin/cli.js used bare 'clagentic' as the command name and product name. Correct forms: 'clagentic-console' (command) and 'Clagentic: Console' (product name). Also adds brand_rules section to .crew/amos.yaml so agents working in this repo have the constraint inline where they read it. Co-Authored-By: Claude Sonnet 4.6 --- .crew/amos.yaml | 16 ++++++++++++++++ bin/cli.js | 10 +++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.crew/amos.yaml b/.crew/amos.yaml index 86d86a2d..d583bd70 100644 --- a/.crew/amos.yaml +++ b/.crew/amos.yaml @@ -12,3 +12,19 @@ branch_conventions: feat: "feat/lr-{task_id}-{slug}" fix: "fix/lr-{task_id}-{slug}" chore: "chore/lr-{task_id}-{slug}" + +brand_rules: + # MANDATORY — violating these is a hard error, not a style note. + # + # Product name (user-facing text, help strings, log output): "Clagentic: Console" + # CLI binary / command: clagentic-console + # npm package: @clagentic/console + # NEVER use bare "clagentic" as a product name or command. + # + # Technical identifiers that ARE correct: + # CLAGENTIC_* (env var prefix) + # ~/.clagentic/ (home dir) + # clagentic-* (hyphenated service names: clagentic-relay, clagentic-router, etc.) + # + # Before committing any change to bin/cli.js or lib/**/*.js, grep for violations: + # grep -n '"clagentic[^-_/@]' bin/cli.js lib/**/*.js diff --git a/bin/cli.js b/bin/cli.js index fd12f656..79c3e9ee 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -123,10 +123,10 @@ for (var i = 0; i < args.length; i++) { } else if (args[i] === "--os-users") { osUsersMode = true; } else if (args[i] === "-h" || args[i] === "--help") { - console.log("Usage: clagentic [-p|--port ] [--host
] [--no-https] [--no-update] [--debug] [-y|--yes] [--pin ] [--shutdown] [--restart] [--no-restart]"); - console.log(" clagentic --add Add a project to the running daemon"); - console.log(" clagentic --remove Remove a project from the running daemon"); - console.log(" clagentic --list List registered projects"); + console.log("Usage: clagentic-console [-p|--port ] [--host
] [--no-https] [--no-update] [--debug] [-y|--yes] [--pin ] [--shutdown] [--restart] [--no-restart]"); + console.log(" clagentic-console --add Add a project to the running daemon"); + console.log(" clagentic-console --remove Remove a project from the running daemon"); + console.log(" clagentic-console --list List registered projects"); console.log(""); console.log("Options:"); console.log(" -p, --port Port to listen on (default: 2633)"); @@ -1985,7 +1985,7 @@ function showMainMenu(config, ip, setupCode) { function afterQr() { // Status line - log(" " + a.dim + "clagentic" + a.reset + " " + a.dim + "v" + currentVersion + a.reset + a.dim + " — " + url + a.reset); + log(" " + a.dim + "Clagentic: Console" + a.reset + " " + a.dim + "v" + currentVersion + a.reset + a.dim + " — " + url + a.reset); var parts = []; parts.push(a.bold + projs.length + a.reset + a.dim + (projs.length === 1 ? " project" : " projects")); parts.push(a.reset + a.bold + totalSessions + a.reset + a.dim + (totalSessions === 1 ? " session" : " sessions")); From 0e3ed76155c89b9356bbdb992334f531e887d8c0 Mon Sep 17 00:00:00 2001 From: clagentic <10177887+akuehner@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:35:30 -0400 Subject: [PATCH 3/4] chore(crew): document ship.py PR workflow and brand rules in amos.yaml AMoS must use ship.py for push+PR, not gh pr create. Add pr_workflow section to .crew/amos.yaml so the constraint is readable from the repo. Co-Authored-By: Claude Sonnet 4.6 --- .crew/amos.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.crew/amos.yaml b/.crew/amos.yaml index d583bd70..9cec981c 100644 --- a/.crew/amos.yaml +++ b/.crew/amos.yaml @@ -13,6 +13,17 @@ branch_conventions: fix: "fix/lr-{task_id}-{slug}" chore: "chore/lr-{task_id}-{slug}" +pr_workflow: + # MANDATORY — do NOT use gh pr create or curl to open PRs. + # The only supported path for push + PR on this repo is ship.py: + # + # python3 /workspace/local-scripts/ship/ship.py clagentic-console --title '...' + # + # ship.py handles push, PR creation, merge, and post-merge cleanup atomically. + # If clagentic-console is missing from ship.py's config, add it to: + # /workspace/local-scripts/ship/config.json + # then run ship.py — do not bypass it. + brand_rules: # MANDATORY — violating these is a hard error, not a style note. # From 23446d6f52b862988b538c1fae115fb6e1a8b628 Mon Sep 17 00:00:00 2001 From: clagentic <10177887+akuehner@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:35:59 -0400 Subject: [PATCH 4/4] chore(crew): remove incorrect ship.py directive from amos.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AMoS uses gh pr create — ship.py is for the main loop / NAOMI, not AMoS. Co-Authored-By: Claude Sonnet 4.6 --- .crew/amos.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.crew/amos.yaml b/.crew/amos.yaml index 9cec981c..d375cdae 100644 --- a/.crew/amos.yaml +++ b/.crew/amos.yaml @@ -13,16 +13,6 @@ branch_conventions: fix: "fix/lr-{task_id}-{slug}" chore: "chore/lr-{task_id}-{slug}" -pr_workflow: - # MANDATORY — do NOT use gh pr create or curl to open PRs. - # The only supported path for push + PR on this repo is ship.py: - # - # python3 /workspace/local-scripts/ship/ship.py clagentic-console --title '...' - # - # ship.py handles push, PR creation, merge, and post-merge cleanup atomically. - # If clagentic-console is missing from ship.py's config, add it to: - # /workspace/local-scripts/ship/config.json - # then run ship.py — do not bypass it. brand_rules: # MANDATORY — violating these is a hard error, not a style note.