Bug Description
When a user starts with one objective (e.g., "如何开始target模式") but then shifts to completely different tasks (filing issues, pushing code), the rootObjective in Context Harness remains unchanged. This causes the system to treat all subsequent work as refinements of the original objective, leading to incorrect activeInstruction and taskEpoch management.
Reproduction
- Start OpenHorse, ask "如何开始target模式"
rootObjective is set to "如何开始target模式"
- User then says "帮我提个issue给官方" — a clearly new task
- User then says "push项目" — another new task
- Check Context Harness:
rootObjective is still "如何开始target模式", taskEpoch has not incremented properly
Root Cause
In intent.js, rootObjectiveChanged depends on classified.kind === "new_task", but the intent classifier (classifyIntent) uses simple keyword matching and often classifies new tasks as refine_current_task instead of new_task. This prevents rootObjective from being updated.
// Only updates root objective if classified as new_task
if (classified.kind === "new_task" && currentRootObjective !== newObjective) {
rootObjectiveChanged = true;
}
Expected Behavior
- When user intent clearly shifts (e.g., from "how to use target mode" to "file an issue"),
rootObjective should update
taskEpoch should increment to reflect the new task phase
activeInstruction should reflect the current task, not the original one
Suggested Fix
- Improve intent classification to better detect task shifts (not just keyword matching)
- Add a secondary check: if the current user message has low semantic similarity to
rootObjective, consider it a new task
- Allow
rootObjective to be updated on refine_current_task when the refinement is clearly unrelated to the original objective
- Simple heuristic: if none of the key nouns/verbs in the current message overlap with
rootObjective, flag as potential task shift
Environment
- OpenHorse: v0.2.24
- Node.js: v22.23.1
- macOS Darwin
Bug Description
When a user starts with one objective (e.g., "如何开始target模式") but then shifts to completely different tasks (filing issues, pushing code), the
rootObjectivein Context Harness remains unchanged. This causes the system to treat all subsequent work as refinements of the original objective, leading to incorrectactiveInstructionandtaskEpochmanagement.Reproduction
rootObjectiveis set to "如何开始target模式"rootObjectiveis still "如何开始target模式",taskEpochhas not incremented properlyRoot Cause
In
intent.js,rootObjectiveChangeddepends onclassified.kind === "new_task", but the intent classifier (classifyIntent) uses simple keyword matching and often classifies new tasks asrefine_current_taskinstead ofnew_task. This preventsrootObjectivefrom being updated.Expected Behavior
rootObjectiveshould updatetaskEpochshould increment to reflect the new task phaseactiveInstructionshould reflect the current task, not the original oneSuggested Fix
rootObjective, consider it a new taskrootObjectiveto be updated onrefine_current_taskwhen the refinement is clearly unrelated to the original objectiverootObjective, flag as potential task shiftEnvironment