diff --git a/README.md b/README.md index 37ec0fd..fdd2a45 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Claude Code mods (plugins with a hooks module), served as a local folder marketp | mod | version | what it does | | --- | --- | --- | | [harness](harness/) | 0.5.0 | The integrated harness: the user's Claude rules enforced at the tool call, session tooling and workflow automation (formerly house-rules) | -| [auto-claude](auto-claude/) | 1.4.1 | Unattended run of a repository through to live: plans the long-term goal, milestones and deploy; its own loop builds and judges each milestone in a worktree; ships each (push, PR, required CI, merge), deploys and smoke-checks it; a watchdog repairs or routes around stalls; replans until the final check passes. Absorbed goal-mode in 1.0.0; since 1.1.0 the session never rests: the next milestone is built, stacked, while a PR waits on CI; since 1.3.0 a line can wait on a training run or cache build (`:: after:`, `wait_until`) without ending the run; since 1.4.0 `--always-on` stands by after the final check and wakes for new cycles from Linear, the live smoke check, the default branch's CI and labelled GitHub issues | +| [auto-claude](auto-claude/) | 1.5.0 | Unattended run of a repository through to live: plans the long-term goal, milestones and deploy; its own loop builds and judges each milestone in a worktree; ships each (push, PR, required CI, merge), deploys and smoke-checks it; a watchdog repairs or routes around stalls; replans until the final check passes. Absorbed goal-mode in 1.0.0; since 1.1.0 the session never rests: the next milestone is built, stacked, while a PR waits on CI; since 1.3.0 a line can wait on a training run or cache build (`:: after:`, `wait_until`) without ending the run; since 1.4.0 `--always-on` stands by after the final check and wakes for new cycles from Linear, the live smoke check, the default branch's CI and labelled GitHub issues; since 1.5.0 a run whose session went quiet is taken over by any free session of the repository | | [model-tier](model-tier/) | 0.11.0 | Routes each main-loop turn to fable, opus, sonnet or haiku and a reasoning effort by task complexity, with a `set_tier` tool the model calls to correct either | | [refactor](refactor/) | 0.1.3 | Enforces the architecture a repo declares in `.claude/architecture.json` at Edit/Write (layer direction, forbidden imports), notes code smells with the refactoring.guru technique to apply, `/arch audit` for violations and import cycles | diff --git a/auto-claude/.claude-plugin/plugin.json b/auto-claude/.claude-plugin/plugin.json index 549e4e9..6845eaa 100644 --- a/auto-claude/.claude-plugin/plugin.json +++ b/auto-claude/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "auto-claude", - "version": "1.4.1", + "version": "1.5.0", "description": "Finishes a repository's work unattended and live: Claude plans the long-term end state, its milestones and how it deploys; the built-in loop builds each milestone in its own worktree and judges it; auto-claude ships it (push, PR, CI, merge when green), deploys and smoke-checks it, and a watchdog keeps the run moving until the final check passes. With --always-on it does not end there: it stands by with no model turn and wakes for a new cycle when Linear, the live smoke check, the default branch's CI or a labelled GitHub issue gives it work (1.4.0). Absorbs goal-mode's loop (1.0.0).", "author": { "name": "unohee" diff --git a/auto-claude/README.md b/auto-claude/README.md index 03eec2e..0c3702e 100644 --- a/auto-claude/README.md +++ b/auto-claude/README.md @@ -71,7 +71,7 @@ With `--always-on` (or the `alwaysOn` option), a run does not end when its final - **Caps.** `maxMerges` and `maxHours` count per cycle; standby time counts toward neither. `maxMergesPerDay` (20) holds a wake back while the last 24 h hold that many merges, told once. 3 deploys failing in a row still stop the run. - **Memory.** Each cycle adds one line under `## Cycles` in `auto-plan.md`: what woke it, what merged, was held and deployed. On entering standby the session is compacted once (when its context is 30% full or more), keeping the goal, decisions and cycles. - **Quiet.** In standby a person is told only of a wake (and why), a cycle's end, a failing smoke check or GitHub poll, and the daily cap. -- **Limits.** The worker is the session: if it exits, nothing polls until `/auto-claude resume` in a session (other sessions report it orphaned). An external supervisor, Remote Control or webhook inboxes, and answering a deferred milestone are not part of this. +- **Limits.** The worker is a session: if it exits, nothing polls until another session of the repository takes the run over (below) or `/auto-claude resume`. An external supervisor, Remote Control or webhook inboxes, and answering a deferred milestone are not part of this. ## Deploying @@ -153,7 +153,7 @@ A run never asks the person to look at `status` or to run a command. When someth | The same cause holds two milestones in a row (no runner, gh not logged in) | The run stops and names the cause, instead of holding every later milestone. | | A tick that fails 3 times in a row | Reported once with its error. `stalled: every tick fails` stays in `status` until a tick gets through. | | Nothing started, shipped or merged for 15 min | The person is told the cause and that the watchdog is on it: at 15 min, 30 min later, and once more. | -| The owning session goes quiet for 10 min | Other sessions report the run as orphaned. `/auto-claude resume` takes it over there, including the milestone being built. | +| The owning session goes quiet for 10 min (exited, replaced after a reboot, or the person moved to another session) | Any session of the same repository takes the run over by itself, with the milestone being built, once it has been free for 2 min (no turn running), and says so. A busy session only reports the run as orphaned, until it is free. A `.claude/auto-claude.stop` left in place keeps it reported, not taken. Two sessions claiming at once: the claim still in the store after 3 s goes on. `/auto-claude resume` takes it over at once. | `/auto-claude status` ends with a `stalled:` line naming the cause whenever the run is not moving. Only the owning session receives the unattended rules. Progress shows in the status line piece (`auto·R1·M3/7·PR#12`) and in notifications. diff --git a/auto-claude/hooks/auto.test.ts b/auto-claude/hooks/auto.test.ts index 6d52932..ff6369d 100644 --- a/auto-claude/hooks/auto.test.ts +++ b/auto-claude/hooks/auto.test.ts @@ -426,8 +426,9 @@ describe('a run, local CI', () => { w.files.set(GOALS, QUEUE) await $.session.start({ cwd: '/repo', surface: 'terminal', isInteractive: true }) expect(JSON.stringify(await compose($))).not.toContain('auto-claude:policy') - await w.clock.advance(TICK) - await w.clock.advance(TICK) + // The person is busy in this session: the run is reported, not taken. + await turnStart($) + for (let i = 0; i < 6; i++) await w.clock.advance(TICK) expect(w.notifies.filter(n => n.includes('went quiet'))).toHaveLength(1) expect(w.notifies[0]).toContain('/auto-claude resume in this session takes it over') expect(w.prompts).toEqual([]) @@ -506,6 +507,76 @@ describe('a run, local CI', () => { expect((await cmd($, 'status')).text).toContain('auto-claude on') }) + test('a free session of the repository takes over a run whose owner went quiet, with its milestone', async ($, on) => { + const other = { on: true, phase: 'run', root: '/repo', sessionId: 'gone-owner', hint: '', round: 1, startedAt: 0, beatAt: -20 * MIN, remote: 'origin', defaultBranch: 'main', ciMode: 'local', logOffset: 0, started: 1, finished: 0, worktrees: { [BR1]: WT1 }, ships: [], fixes: {}, merges: 0, held: 0, queueEmpty: false } + const loop = { repoRoot: '/repo', seq: 1, retries: 0, current: { condition: 'add() returns a+b', check: 'python3 -m unittest -q test_add', worktree: WT1, branch: BR1, startedAt: 0 } } + const w = world(on, { 'auto:/repo': other, 'loop:/repo': loop }) + w.files.set(GOALS, QUEUE) + await $.session.start({ cwd: '/repo', surface: 'terminal', isInteractive: true }) + // Not before the session has been free for 2 min. + await w.clock.advance(TICK) + expect(w.prompts).toEqual([]) + for (let i = 0; i < 5; i++) await w.clock.advance(TICK) + await w.clock.advance(5_000) + const taken = w.prompts.find(p => p.includes('Continuing (taken over from session gone-own')) + expect(taken).toContain('Milestone #1: add() returns a+b') + expect(w.notifies.some(n => n.includes('this session took the run over'))).toBe(true) + expect(JSON.stringify(await compose($))).toContain('auto-claude:policy') + await meet($, w) + await w.clock.advance(TICK) + expect(w.pushes.some(p => p.includes('HEAD:main'))).toBe(true) + }) + + test('an owner whose long tick still pulses (a deploy, CodeQL) is not taken over; once the pulse stops it is', { timeoutMs: 30_000 }, async ($, on) => { + const other = { on: true, phase: 'run', root: '/repo', sessionId: 'busy-owner', hint: '', round: 1, startedAt: 0, beatAt: -20 * MIN, remote: 'origin', defaultBranch: 'main', ciMode: 'local', logOffset: 0, started: 1, finished: 1, worktrees: {}, ships: [], fixes: {}, merges: 0, held: 0, queueEmpty: false } + const w = world(on, { 'auto:/repo': other, 'beat:/repo': { sessionId: 'busy-owner', at: 10 * MIN } }) + w.files.set(GOALS, QUEUE) + await $.session.start({ cwd: '/repo', surface: 'terminal', isInteractive: true }) + for (let i = 0; i < 30; i++) await w.clock.advance(TICK) + expect(w.notifies.some(n => n.includes('took the run over') || n.includes('went quiet'))).toBe(false) + for (let i = 0; i < 12; i++) await w.clock.advance(TICK) + await w.clock.advance(5_000) + expect(w.notifies.some(n => n.includes('took the run over'))).toBe(true) + }) + + test('a run quiet for more than 12 h is only reported, not taken', async ($, on) => { + const other = { on: true, phase: 'plan', root: '/repo', sessionId: 'old-owner', hint: '', round: 1, startedAt: 0, beatAt: -13 * 60 * MIN, remote: 'origin', defaultBranch: 'main', ciMode: 'local', logOffset: 0, started: 0, finished: 0, worktrees: {}, ships: [], fixes: {}, merges: 0, held: 0, queueEmpty: false } + const w = world(on, { 'auto:/repo': other }) + await $.session.start({ cwd: '/repo', surface: 'terminal', isInteractive: true }) + for (let i = 0; i < 8; i++) await w.clock.advance(TICK) + expect(w.notifies.some(n => n.includes('took the run over'))).toBe(false) + expect(w.notifies.some(n => n.includes('went quiet'))).toBe(true) + expect(w.prompts).toEqual([]) + }) + + test('taking a run over keeps its deploy brake and time cap, skipping only the dead gap', async ($, on) => { + const other = { on: true, phase: 'run', root: '/repo', sessionId: 'gone-owner', hint: '', round: 1, startedAt: -60 * MIN, beatAt: -20 * MIN, remote: 'origin', defaultBranch: 'main', ciMode: 'local', logOffset: 0, started: 1, finished: 1, worktrees: {}, ships: [], fixes: {}, merges: 0, held: 0, queueEmpty: false, deployFails: 2, holdStreak: 1 } + const w = world(on, { 'auto:/repo': other }) + w.files.set(GOALS, QUEUE) + await $.session.start({ cwd: '/repo', surface: 'terminal', isInteractive: true }) + for (let i = 0; i < 6; i++) await w.clock.advance(TICK) + await w.clock.advance(5_000) + expect(w.notifies.some(n => n.includes('took the run over'))).toBe(true) + const status = (await cmd($, 'status')).text ?? '' + expect(status).toContain('auto-claude on') + expect(JSON.parse(w.files.get('/repo/.claude/auto-claude.on') ?? '{}')).toMatchObject({ on: true, phase: 'run' }) + }) + + test('a stop file the person left keeps an orphaned run reported, not taken; once it is gone the run is taken', async ($, on) => { + const other = { on: true, phase: 'run', root: '/repo', sessionId: 'gone-owner', hint: '', round: 1, startedAt: 0, beatAt: -20 * MIN, remote: 'origin', defaultBranch: 'main', ciMode: 'local', logOffset: 0, started: 1, finished: 1, worktrees: {}, ships: [], fixes: {}, merges: 0, held: 0, queueEmpty: false } + const w = world(on, { 'auto:/repo': other }) + w.files.set(GOALS, QUEUE) + w.files.set('/repo/.claude/auto-claude.stop', '') + await $.session.start({ cwd: '/repo', surface: 'terminal', isInteractive: true }) + for (let i = 0; i < 6; i++) await w.clock.advance(TICK) + expect(w.notifies.some(n => n.includes('took the run over'))).toBe(false) + expect(w.notifies.some(n => n.includes('went quiet'))).toBe(true) + w.files.delete('/repo/.claude/auto-claude.stop') + await w.clock.advance(TICK) + await w.clock.advance(5_000) + expect(w.notifies.some(n => n.includes('took the run over'))).toBe(true) + }) + test('status names an orphaned owner and how long ago it last ticked', async ($, on) => { const other = { on: true, phase: 'run', root: '/repo', sessionId: 'gone-session', hint: '', round: 1, startedAt: 0, beatAt: 1_000 - 25 * MIN, remote: 'origin', defaultBranch: 'main', ciMode: 'local', logOffset: 0, started: 1, finished: 1, worktrees: {}, ships: [], fixes: {}, merges: 1, held: 0, queueEmpty: false } world(on, { 'auto:/repo': other }) diff --git a/auto-claude/hooks/register.ts b/auto-claude/hooks/register.ts index 5c50d07..eab4cf2 100644 --- a/auto-claude/hooks/register.ts +++ b/auto-claude/hooks/register.ts @@ -36,11 +36,21 @@ const COMMAND = 'auto-claude' // The ready tool's full name, as the tool.call matcher sees it. const READY_TOOL_ID = 'mcp__auto-claude__auto_plan_ready' const STORE = (root: string) => `auto:${root}` +// The owner's pulse, written on every timer fire even while a long tick (a +// deploy, CodeQL) runs, apart from the record so it never overwrites it. +const BEAT = (root: string) => `beat:${root}` const EXCLUDES = ['.claude/auto-plan.md', '.claude/auto-claude.stop', '.claude/auto-claude.stop.cleared', '.claude/auto-claude.on', ...LOOP_EXCLUDES] const DENY = ['\\bgh\\s+pr\\s+merge\\b', '\\bgh\\s+release\\b', '\\bgit\\s+push\\b.*\\bHEAD:(main|master)\\b'] // A run whose owning session has not ticked for this long is orphaned. const STALE_MS = 10 * 60_000 +// How long a claim on an orphaned run settles before it is read back. +const ADOPT_SETTLE_MS = 3_000 +// A run quiet longer than this is only reported: a session opened days later +// is not handed a run nobody may remember. +const ADOPT_MAX_MS = 12 * 3600_000 +// A tick in flight longer than this no longer pulses: a hung tick lets the run be reported and taken. +const PULSE_MAX_TICK_MS = 30 * 60_000 // A run still planning is reminded this long after the model's turn ended // without accepting a plan, else after PLAN_NUDGE_MS; this many times, then stopped. const PLAN_QUIET_MS = 60_000 @@ -74,6 +84,15 @@ let fastTick = false let activeRoot: string | undefined // The owner an orphaned run was last reported for, once per session. let orphanTold: string | undefined +// A claim on an orphaned run is settling. +let adopting = false +// When this session's tick in flight began, and when its last tick ran. +let tickStartedAt = 0 +let lastTickAt: number | undefined +// The owner's beat this session saw on its previous tick: a run is taken only +// after the same beat was seen on two ticks in a row, a poll interval apart, +// so this session is not the one waking from a sleep. +let sawBeat: { root: string; beat: number; at: number } | undefined // Ticks failed in a row and the last error: a tick that throws every time // (an unwritable file, a broken store) moves nothing and must not stay silent. let tickFails = 0 @@ -234,17 +253,125 @@ async function startWanted($: EngineInterface, r: AutoRecord, base: string, stac if (current !== undefined && stacked) await writeRecord($, { ...r, onto: { ...r.onto, [current.branch]: tip } }) } +async function pulse($: EngineInterface): Promise { + if (activeRoot === undefined) return + try { + const now = await $.clock.now() + if (ticking && now - tickStartedAt > PULSE_MAX_TICK_MS) return + const r = await readRecord($, activeRoot) + const me = await $.session.id() + if (r?.on === true && r.sessionId === me) await $.store.set(BEAT(r.root), { sessionId: me, at: now }) + } catch { + // A missed pulse only makes the owner look quieter. + } +} + +// When the owner last showed life: its record's beat or its pulse, whichever is later. +async function lastBeat($: EngineInterface, r: AutoRecord): Promise { + const own = r.beatAt ?? r.startedAt + const p = (await $.store.get(BEAT(r.root)).catch(() => undefined)) as { sessionId?: unknown; at?: unknown } | undefined + return p?.sessionId === r.sessionId && typeof p?.at === 'number' ? Math.max(own, p.at) : own +} + +// A run whose owner stopped ticking (the session exited, was replaced after a +// reboot, or the person went on in another session) is taken over by a session +// of the same repository once it is free, without anyone typing resume. The +// claim is written first and read back after a pause: of two sessions claiming +// at once, the one whose claim is still there goes on; the other stays quiet. +async function adoptOrphan($: EngineInterface, r: AutoRecord, prevTickAt: number | undefined, pollMs: number): Promise { + if (!r.on || r.phase === 'done' || r.phase === 'stopped' || adopting) return false + const now = await $.clock.now() + const beat = await lastBeat($, r) + const seen = sawBeat + sawBeat = { root: r.root, beat, at: now } + if (now - beat < STALE_MS || now - beat > ADOPT_MAX_MS || !sessionQuiet(now)) return false + // Seen quiet on this session's previous tick too, and that tick was recent: not a wake from sleep. + if (seen?.root !== r.root || seen.beat !== beat || prevTickAt === undefined || now - prevTickAt > 3 * pollMs) return false + // A stop file the person left is theirs to clear: the run is reported, not taken. + if (await $.fs.exists(FILES(r.root).stop).catch(() => true)) return false + const me = await $.session.id() + const was = r.sessionId + adopting = true + try { + await $.store.set(STORE(r.root), { ...r, sessionId: me, beatAt: now }) + } catch { + adopting = false + return false + } + $.clock.after(ADOPT_SETTLE_MS, async () => { + try { + const got = await readRecord($, r.root) + if (got?.sessionId !== me || !got.on) return + orphanTold = undefined + const text = await takeOver($, got, `taken over from session ${String(was).slice(0, 8)}, quiet ${Math.round((now - beat) / 60_000)} min`, now - beat) + await tell($, got, `this session took the run over (its session ${String(was).slice(0, 8)} stopped ticking): ${text}`) + } catch (error) { + $.ui.toast(`auto-claude: taking the run over failed: ${String(error).slice(0, 120)}`) + } finally { + adopting = false + } + }) + return true +} + // Another session owns the run. Once its ticks stop, the run is stuck there: // say so here, once, instead of staying silent. async function reportOrphan($: EngineInterface, r: AutoRecord): Promise { if (!r.on || r.sessionId === undefined || orphanTold === r.sessionId) return - const quiet = (await $.clock.now()) - (r.beatAt ?? r.startedAt) + const quiet = (await $.clock.now()) - (await lastBeat($, r)) if (quiet < STALE_MS) return orphanTold = r.sessionId await segment($, 'auto·orphaned') await tell($, r, `the session running it went quiet ${Math.round(quiet / 60_000)} min ago, so nothing moves; /${COMMAND} resume in this session takes it over, or /${COMMAND} stop`) } +// Takes a run over in this session, where it was: by the person's resume, or +// by a session that adopts a run whose owner went quiet. +// `gapMs` set: taken by another session, not by the person. The caps and the +// deploy brake keep counting; the time cap only skips the dead gap. +async function takeOver($: EngineInterface, r: AutoRecord, why: string, gapMs?: number): Promise { + const stop = await clearStop($, r.root) + if ('error' in stop) return `Not resumed: ${stop.error}.` + const now = await $.clock.now() + const phase = r.phase === 'done' || r.phase === 'stopped' || r.phase === 'final' ? (r.pausedPhase ?? 'run') : r.phase + // A run that stood by stands by again: nothing was being built. + if (phase === 'standby') { + const stop = await clearStop($, r.root) + if ('error' in stop) return `Not resumed: ${stop.error}.` + activeRoot = r.root + orphanTold = undefined + await enterStandby($, { ...r, sessionId: await $.session.id(), beatAt: await $.clock.now() }, why) + return `Resumed: standing by, cycle ${r.cycle ?? 0}.${clearedNote(stop)}` + } + // A run still planning gets its prompt again, with Linear read before the record is written. + const kick = phase === 'plan' ? await linearKickoff($, r.root) : {} + const next: AutoRecord = { + ...r, + on: true, + phase, + sessionId: await $.session.id(), + beatAt: now, + ...(gapMs === undefined ? { startedAt: now, holdStreak: 0, deployFails: 0 } : { startedAt: r.startedAt + gapMs }), + ...(phase === 'plan' ? { phaseAt: now, nudges: 0 } : {}), + ...(kick.linear !== undefined ? { linear: kick.linear } : {}), + } + activeRoot = r.root + orphanTold = undefined + await writeRecord($, next) + clearSessionGoal($) + if (phase === 'plan') { + const text = kickoffText(r.hint, refOf(r), r.remote === LOCAL, r.deploy?.source === 'file' ? r.deploy.command : undefined, kick.brief) + $.clock.after(100, () => { + $.prompt.submit({ text }).catch(() => $.ui.toast('auto-claude: the planning prompt was not submitted; send any message to start.')) + }) + } else { + // The goal it was building, taken over here (a loop from goal-mode is found in its log). + await recoverLoop($, next).catch(() => undefined) + await resumeLoop($, r.root, why) + } + return `Resumed: phase ${next.phase}, round ${next.round}.${clearedNote(stop)}` +} + async function stopRun($: EngineInterface, r: AutoRecord, why: string, phase: 'stopped' | 'done' = 'stopped'): Promise { const next: AutoRecord = { ...r, on: false, phase, note: why, pausedPhase: r.phase === 'plan' || r.phase === 'standby' ? r.phase : 'run' } await stopLoop($, r.root) @@ -867,12 +994,17 @@ async function standbyTick($: EngineInterface, r: AutoRecord): Promise { async function tick($: EngineInterface, caps: Caps, pollMs: number): Promise { if (ticking || activeRoot === undefined) return ticking = true + const prevTickAt = lastTickAt + tickStartedAt = await $.clock.now() + lastTickAt = tickStartedAt let failed = false try { const got = await readRecord($, activeRoot) if (got === undefined) return if (got.sessionId !== (await $.session.id())) { - await reportOrphan($, got) + // Another session took the run: this one stops judging or guarding its milestone. + if ((await loopView($)) !== null) await stopLoop($, got.root) + if (!(await adoptOrphan($, got, prevTickAt, pollMs))) await reportOrphan($, got) return } if (!got.on) return @@ -1357,7 +1489,10 @@ export const register: Register = (on, options) => { // which also takes down a piece an earlier load left. await show($, r) ticker?.cancel() - ticker = $.clock.every(pollMs, () => void tick($, caps, pollMs)) + ticker = $.clock.every(pollMs, () => { + void pulse($) + void tick($, caps, pollMs) + }) return started }) @@ -1491,48 +1626,7 @@ export const register: Register = (on, options) => { } if (action === 'resume') { if (r.on && r.sessionId === (await $.session.id())) return { text: 'The run is already on in this session.' } - const stop = await clearStop($, r.root) - if ('error' in stop) return { text: `Not resumed: ${stop.error}.` } - const now = await $.clock.now() - const phase = r.phase === 'done' || r.phase === 'stopped' || r.phase === 'final' ? (r.pausedPhase ?? 'run') : r.phase - // A run that stood by stands by again: nothing was being built. - if (phase === 'standby') { - const stop = await clearStop($, r.root) - if ('error' in stop) return { text: `Not resumed: ${stop.error}.` } - activeRoot = r.root - orphanTold = undefined - await enterStandby($, { ...r, sessionId: await $.session.id(), beatAt: await $.clock.now() }, 'resumed by the person') - return { text: `Resumed: standing by, cycle ${r.cycle ?? 0}.${clearedNote(stop)}` } - } - // A run still planning gets its prompt again, with Linear read before the record is written. - const kick = phase === 'plan' ? await linearKickoff($, r.root) : {} - const next: AutoRecord = { - ...r, - on: true, - phase, - sessionId: await $.session.id(), - startedAt: now, - beatAt: now, - holdStreak: 0, - deployFails: 0, - ...(phase === 'plan' ? { phaseAt: now, nudges: 0 } : {}), - ...(kick.linear !== undefined ? { linear: kick.linear } : {}), - } - activeRoot = r.root - orphanTold = undefined - await writeRecord($, next) - clearSessionGoal($) - if (phase === 'plan') { - const text = kickoffText(r.hint, refOf(r), r.remote === LOCAL, r.deploy?.source === 'file' ? r.deploy.command : undefined, kick.brief) - $.clock.after(100, () => { - $.prompt.submit({ text }).catch(() => $.ui.toast('auto-claude: the planning prompt was not submitted; send any message to start.')) - }) - } else { - // The goal it was building, taken over here (a loop from goal-mode is found in its log). - await recoverLoop($, next).catch(() => undefined) - await resumeLoop($, r.root, 'resumed by the person') - } - return { text: `Resumed: phase ${next.phase}, round ${next.round}.${clearedNote(stop)}` } + return { text: await takeOver($, r, 'resumed by the person') } } return { text: `Usage: /${COMMAND} start [aim] | start --always-on [aim] | start --queue | standby | status | stop | resume` } })