mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
feat: auto dream 开启
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
// Auto-generated type stub — replace with real implementation
|
||||
export type DreamTask = any;
|
||||
export type DreamTaskState = any;
|
||||
// Type re-exports for DreamTask — bridges the component tree to the task registry.
|
||||
// The real implementation lives in src/tasks/DreamTask/DreamTask.ts.
|
||||
// Note: Currently unused — BackgroundTasksDialog.tsx imports directly from
|
||||
// src/tasks/DreamTask/DreamTask.js. Kept for decompilation completeness.
|
||||
|
||||
export type { DreamTaskState, DreamPhase, DreamTurn } from '../../../../../tasks/DreamTask/DreamTask.js'
|
||||
export { isDreamTask, registerDreamTask, addDreamTurn, completeDreamTask, failDreamTask, DreamTask } from '../../../../../tasks/DreamTask/DreamTask.js'
|
||||
|
||||
44
src/skills/bundled/dream.ts
Normal file
44
src/skills/bundled/dream.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
// Manual /dream skill — runs the memory consolidation prompt interactively.
|
||||
// Extracted from the KAIROS feature gate so it's available unconditionally
|
||||
// whenever auto-memory is enabled.
|
||||
|
||||
import { getAutoMemPath, isAutoMemoryEnabled } from '../../memdir/paths.js'
|
||||
import { buildConsolidationPrompt } from '../../services/autoDream/consolidationPrompt.js'
|
||||
import { recordConsolidation } from '../../services/autoDream/consolidationLock.js'
|
||||
import { getOriginalCwd } from '../../bootstrap/state.js'
|
||||
import { getProjectDir } from '../../utils/sessionStorage.js'
|
||||
import { registerBundledSkill } from '../bundledSkills.js'
|
||||
|
||||
const DREAM_PROMPT_PREFIX = `# Dream: Memory Consolidation (manual run)
|
||||
|
||||
You are performing a manual dream — a reflective pass over your memory files. Unlike the automatic background dream, this run has full tool permissions and the user is watching. Synthesize what you've learned recently into durable, well-organized memories so that future sessions can orient quickly.
|
||||
|
||||
`
|
||||
|
||||
export function registerDreamSkill(): void {
|
||||
registerBundledSkill({
|
||||
name: 'dream',
|
||||
description:
|
||||
'Manually trigger memory consolidation — review, organize, and prune your auto-memory files.',
|
||||
whenToUse:
|
||||
'Use when the user says /dream or wants to manually consolidate memories, organize memory files, or clean up stale entries.',
|
||||
userInvocable: true,
|
||||
isEnabled: () => isAutoMemoryEnabled(),
|
||||
async getPromptForCommand(args) {
|
||||
const memoryRoot = getAutoMemPath()
|
||||
const transcriptDir = getProjectDir(getOriginalCwd())
|
||||
|
||||
// Stamp the consolidation lock optimistically (same as the KAIROS path).
|
||||
await recordConsolidation()
|
||||
|
||||
const basePrompt = buildConsolidationPrompt(memoryRoot, transcriptDir, '')
|
||||
let prompt = DREAM_PROMPT_PREFIX + basePrompt
|
||||
|
||||
if (args) {
|
||||
prompt += `\n\n## Additional context from user\n\n${args}`
|
||||
}
|
||||
|
||||
return [{ type: 'text', text: prompt }]
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { registerSimplifySkill } from './simplify.js'
|
||||
import { registerSkillifySkill } from './skillify.js'
|
||||
import { registerStuckSkill } from './stuck.js'
|
||||
import { registerLoopSkill } from './loop.js'
|
||||
import { registerDreamSkill } from './dream.js'
|
||||
import { registerUpdateConfigSkill } from './updateConfig.js'
|
||||
import { registerVerifySkill } from './verify.js'
|
||||
|
||||
@@ -34,12 +35,7 @@ export function initBundledSkills(): void {
|
||||
registerBatchSkill()
|
||||
registerStuckSkill()
|
||||
registerLoopSkill()
|
||||
if (feature('KAIROS') || feature('KAIROS_DREAM')) {
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const { registerDreamSkill } = require('./dream.js')
|
||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||
registerDreamSkill()
|
||||
}
|
||||
registerDreamSkill()
|
||||
if (feature('REVIEW_ARTIFACT')) {
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const { registerHunterSkill } = require('./hunter.js')
|
||||
|
||||
Reference in New Issue
Block a user