mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
feat: 添加 /goal 命令,支持长时间运行任务的目标管理 (#1222)
* feat: 添加 /goal 命令,支持长时间运行任务的目标管理 从 Codex 项目移植 /goal 命令到 Claude Code,实现: - Goal 状态管理模块(active/paused/budget_limited/complete) - /goal 斜杠命令(set/clear/pause/resume/complete) - Goal 模型工具(get/set/complete) - Continuation prompt 自动注入系统提示 - Token 用量自动追踪 Co-Authored-By: mimo-v2.5-pro <XiaomiMiMo@claude-code-best.win> * fix: goal 状态改为 session-scoped,避免多会话泄漏 将 currentGoal 单例替换为 Map<string, GoalState>,按 sessionId 隔离, 遵循 sessionIngress.ts 的模式。所有函数支持可选 sessionId 参数。 Co-Authored-By: mimo-v2.5-pro <XiaomiMiMo@claude-code-best.win> * fix: 对 goal 的 tokenBudget/tokensUsed 添加数值校验 setGoal 中 tokenBudget 非 finite 或负数时归零; updateGoalTokens 中 usage 非 finite 或负数时归零。 Co-Authored-By: mimo-v2.5-pro <XiaomiMiMo@claude-code-best.win> * fix: 暂停期间 goal 时间不再继续计数 新增 pausedAt/accumulatedActiveMs 字段,pauseGoal 累积已活跃时间, resumeGoal 重置 startTime,计时统一使用 getActiveElapsedMs()。 Co-Authored-By: mimo-v2.5-pro <XiaomiMiMo@claude-code-best.win> --------- Co-authored-by: mimo-v2.5-pro <XiaomiMiMo@claude-code-best.win>
This commit is contained in:
@@ -57,6 +57,7 @@ import {
|
||||
resolveSystemPromptSections,
|
||||
} from './systemPromptSections.js'
|
||||
import { SLEEP_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/SleepTool/prompt.js'
|
||||
import { getGoalContinuationPrompt } from '../services/goal/goalState.js'
|
||||
import { TICK_TAG } from './xml.js'
|
||||
import { logForDebugging } from '../utils/debug.js'
|
||||
import { loadMemoryPrompt } from '../memdir/memdir.js'
|
||||
@@ -505,6 +506,11 @@ ${CYBER_RISK_INSTRUCTION}`,
|
||||
...(feature('KAIROS') || feature('KAIROS_BRIEF')
|
||||
? [systemPromptSection('brief', () => getBriefSection())]
|
||||
: []),
|
||||
DANGEROUS_uncachedSystemPromptSection(
|
||||
'goal_continuation',
|
||||
() => getGoalContinuationPrompt(),
|
||||
'Goal state changes between turns',
|
||||
),
|
||||
]
|
||||
|
||||
const resolvedDynamicSections =
|
||||
|
||||
Reference in New Issue
Block a user