mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-04 14:39:42 +02:00
perf: speed up session creation by ~500ms — remove redundant sleep, reduce tmux wait, fire-and-forget config
This commit is contained in:
@@ -96,6 +96,23 @@ const BUILTIN_RESPAWN_PRESETS = [
|
||||
builtIn: true,
|
||||
createdAt: 0,
|
||||
},
|
||||
{
|
||||
id: 'ralph-todo',
|
||||
name: 'Ralph/Todo',
|
||||
description: 'Ralph Loop task list — works through todos with progress tracking',
|
||||
config: {
|
||||
idleTimeoutMs: 8000,
|
||||
updatePrompt: 'update CLAUDE.md with discoveries and progress notes, mark completed tasks in @fix_plan.md, write a brief summary so the next cycle can continue seamlessly.',
|
||||
interStepDelayMs: 3000,
|
||||
sendClear: true,
|
||||
sendInit: true,
|
||||
kickstartPrompt: 'read @fix_plan.md for task status, continue on the next uncompleted task. When ALL tasks are complete, output <promise>COMPLETE</promise>.',
|
||||
autoAcceptPrompts: true,
|
||||
},
|
||||
durationMinutes: 480,
|
||||
builtIn: true,
|
||||
createdAt: 0,
|
||||
},
|
||||
{
|
||||
id: 'overnight-autonomous',
|
||||
name: 'Overnight',
|
||||
|
||||
+27
-22
@@ -4635,37 +4635,42 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Helper to get global Nice priority config from settings
|
||||
private async getGlobalNiceConfig(): Promise<NiceConfig | undefined> {
|
||||
// Read ~/.claudeman/settings.json once and return the parsed object.
|
||||
// Cached for 2s to avoid redundant reads during session creation bursts.
|
||||
private _settingsCache: { data: Record<string, unknown>; ts: number } | null = null;
|
||||
private async readSettings(): Promise<Record<string, unknown>> {
|
||||
const now = Date.now();
|
||||
if (this._settingsCache && now - this._settingsCache.ts < 2000) {
|
||||
return this._settingsCache.data;
|
||||
}
|
||||
const settingsPath = join(homedir(), '.claudeman', 'settings.json');
|
||||
|
||||
try {
|
||||
const content = await fs.readFile(settingsPath, 'utf-8');
|
||||
const settings = JSON.parse(content);
|
||||
if (settings.nice && settings.nice.enabled) {
|
||||
return {
|
||||
enabled: settings.nice.enabled ?? false,
|
||||
niceValue: settings.nice.niceValue ?? DEFAULT_NICE_CONFIG.niceValue,
|
||||
};
|
||||
}
|
||||
} catch (err) {
|
||||
if ((err as NodeJS.ErrnoException).code !== 'ENOENT') {
|
||||
console.error('Failed to read Nice priority settings:', err);
|
||||
}
|
||||
const data = JSON.parse(content) as Record<string, unknown>;
|
||||
this._settingsCache = { data, ts: now };
|
||||
return data;
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// Helper to get global Nice priority config from settings
|
||||
private async getGlobalNiceConfig(): Promise<NiceConfig | undefined> {
|
||||
const settings = await this.readSettings();
|
||||
const nice = settings.nice as { enabled?: boolean; niceValue?: number } | undefined;
|
||||
if (nice && nice.enabled) {
|
||||
return {
|
||||
enabled: nice.enabled ?? false,
|
||||
niceValue: nice.niceValue ?? DEFAULT_NICE_CONFIG.niceValue,
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Helper to get model configuration from settings
|
||||
private async getModelConfig(): Promise<{ defaultModel?: string; agentTypeOverrides?: Record<string, string> } | null> {
|
||||
const settingsPath = join(homedir(), '.claudeman', 'settings.json');
|
||||
|
||||
try {
|
||||
const content = await fs.readFile(settingsPath, 'utf-8');
|
||||
return JSON.parse(content).modelConfig || null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
const settings = await this.readSettings();
|
||||
return (settings.modelConfig as { defaultModel?: string; agentTypeOverrides?: Record<string, string> }) || null;
|
||||
}
|
||||
|
||||
private async startScheduledRun(prompt: string, workingDir: string, durationMinutes: number): Promise<ScheduledRun> {
|
||||
|
||||
Reference in New Issue
Block a user