@wolfx/oh-my-openagent 4.1.1 → 4.2.0-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +2 -1
- package/README.ko.md +2 -1
- package/README.md +2 -1
- package/README.ru.md +2 -1
- package/README.zh-cn.md +2 -1
- package/dist/agents/atlas/default-prompt-sections.d.ts +3 -3
- package/dist/agents/atlas/gemini-prompt-sections.d.ts +2 -2
- package/dist/agents/atlas/gpt-prompt-sections.d.ts +2 -2
- package/dist/agents/atlas/kimi-prompt-sections.d.ts +3 -3
- package/dist/agents/atlas/opus-4-7-prompt-sections.d.ts +3 -3
- package/dist/agents/momus.d.ts +1 -1
- package/dist/agents/prometheus/behavioral-summary.d.ts +1 -1
- package/dist/agents/prometheus/high-accuracy-mode.d.ts +1 -1
- package/dist/agents/prometheus/identity-constraints.d.ts +1 -1
- package/dist/agents/prometheus/plan-generation.d.ts +1 -1
- package/dist/agents/prometheus/plan-template.d.ts +1 -1
- package/dist/config/schema/team-mode.d.ts +1 -1
- package/dist/features/background-agent/error-classifier.d.ts +1 -0
- package/dist/features/background-agent/fallback-retry-handler.d.ts +15 -0
- package/dist/features/background-agent/manager.d.ts +11 -8
- package/dist/features/background-agent/parent-wake-notifier.d.ts +74 -0
- package/dist/features/background-agent/process-cleanup.d.ts +2 -0
- package/dist/features/background-agent/session-route.d.ts +12 -0
- package/dist/features/background-agent/spawner.d.ts +2 -2
- package/dist/features/background-agent/task-registry.d.ts +6 -0
- package/dist/features/background-agent/types.d.ts +2 -0
- package/dist/features/boulder-state/constants.d.ts +4 -4
- package/dist/features/boulder-state/storage.d.ts +1 -1
- package/dist/features/builtin-commands/templates/init-deep.d.ts +1 -1
- package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
- package/dist/features/context-injector/injector.d.ts +1 -1
- package/dist/features/opencode-skill-loader/git-master-template-injection.d.ts +18 -0
- package/dist/features/run-continuation-state/constants.d.ts +1 -1
- package/dist/features/team-mode/team-layout-tmux/resolve-caller-tmux-session.d.ts +3 -1
- package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +3 -3
- package/dist/features/team-mode/tools/messaging.d.ts +1 -0
- package/dist/features/team-mode/types.d.ts +2 -2
- package/dist/features/tmux-subagent/attachable-session-status.d.ts +1 -1
- package/dist/features/tmux-subagent/manager.d.ts +6 -0
- package/dist/features/tmux-subagent/pane-state-parser.d.ts +2 -0
- package/dist/features/tmux-subagent/polling-manager.d.ts +6 -2
- package/dist/features/tmux-subagent/types.d.ts +4 -0
- package/dist/hooks/atlas/boulder-continuation-injector.d.ts +1 -0
- package/dist/hooks/atlas/omo-path.d.ts +6 -0
- package/dist/hooks/atlas/tool-execute-after.d.ts +3 -0
- package/dist/hooks/atlas/tool-progress.d.ts +14 -0
- package/dist/hooks/atlas/types.d.ts +7 -0
- package/dist/hooks/auto-slash-command/detector.d.ts +2 -0
- package/dist/hooks/auto-update-checker/cache.d.ts +8 -1
- package/dist/hooks/auto-update-checker/checker/cached-version.d.ts +8 -1
- package/dist/hooks/background-notification/hook.d.ts +0 -6
- package/dist/hooks/compaction-context-injector/types.d.ts +1 -0
- package/dist/hooks/interactive-bash-session/state-manager.d.ts +1 -1
- package/dist/hooks/json-error-recovery/hook.d.ts +1 -1
- package/dist/hooks/keyword-detector/detector.d.ts +1 -0
- package/dist/hooks/keyword-detector/ultrawork/default.d.ts +1 -1
- package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +1 -1
- package/dist/hooks/keyword-detector/ultrawork/planner.d.ts +1 -1
- package/dist/hooks/prometheus-md-only/constants.d.ts +1 -1
- package/dist/hooks/prometheus-md-only/path-policy.d.ts +3 -3
- package/dist/hooks/ralph-loop/completion-promise-detector-test-input.d.ts +11 -0
- package/dist/hooks/ralph-loop/constants.d.ts +1 -1
- package/dist/hooks/ralph-loop/continuation-prompt-injector.d.ts +4 -0
- package/dist/hooks/ralph-loop/iteration-continuation.d.ts +5 -0
- package/dist/hooks/ralph-loop/loop-state-controller.d.ts +3 -3
- package/dist/hooks/ralph-loop/pending-verification-handler.d.ts +2 -1
- package/dist/hooks/ralph-loop/ralph-loop-event-handler.d.ts +2 -2
- package/dist/hooks/ralph-loop/storage.d.ts +2 -2
- package/dist/hooks/ralph-loop/types.d.ts +4 -0
- package/dist/hooks/ralph-loop/verification-failure-handler.d.ts +2 -2
- package/dist/hooks/rules-injector/injector.d.ts +9 -2
- package/dist/hooks/rules-injector/matcher.d.ts +5 -0
- package/dist/hooks/rules-injector/project-root-finder.d.ts +4 -0
- package/dist/hooks/rules-injector/rule-scan-cache.d.ts +9 -2
- package/dist/hooks/runtime-fallback/constants.d.ts +10 -0
- package/dist/hooks/runtime-fallback/first-prompt-watchdog.d.ts +25 -0
- package/dist/hooks/runtime-fallback/hook.d.ts +14 -1
- package/dist/hooks/runtime-fallback/last-user-retry-parts.d.ts +10 -2
- package/dist/hooks/runtime-fallback/types.d.ts +10 -0
- package/dist/hooks/session-recovery/detect-error-type.d.ts +1 -1
- package/dist/hooks/session-recovery/hook.d.ts +1 -0
- package/dist/hooks/session-recovery/interrupted-idle-message-fetch-timeout.d.ts +7 -0
- package/dist/hooks/session-recovery/recover-tool-result-missing.d.ts +6 -1
- package/dist/hooks/session-recovery/types.d.ts +12 -0
- package/dist/hooks/shared/prompt-async-gate.d.ts +1 -0
- package/dist/hooks/shared/session-idle-settle.d.ts +1 -11
- package/dist/hooks/sisyphus-junior-notepad/constants.d.ts +1 -1
- package/dist/hooks/team-mode-status-injector/hook.d.ts +2 -1
- package/dist/hooks/todo-continuation-enforcer/pending-question-detection.d.ts +2 -0
- package/dist/hooks/todo-continuation-enforcer/session-state.d.ts +3 -4
- package/dist/hooks/todo-continuation-enforcer/types.d.ts +2 -3
- package/dist/hooks/tool-pair-validator/hook.d.ts +7 -2
- package/dist/hooks/unstable-agent-babysitter/task-message-analyzer.d.ts +1 -0
- package/dist/hooks/write-existing-file-guard/tool-execute-before-handler.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +41902 -70602
- package/dist/mcp/index.d.ts +3 -1
- package/dist/mcp/lsp.d.ts +13 -0
- package/dist/mcp/types.d.ts +1 -0
- package/dist/plugin/build-team-idle-wake-hint-client.d.ts +12 -0
- package/dist/plugin/chat-message.d.ts +1 -1
- package/dist/plugin/tool-registry.d.ts +1 -2
- package/dist/plugin-dispose.d.ts +0 -3
- package/dist/shared/agent-sort-shim.d.ts +1 -0
- package/dist/shared/delegated-child-session-bootstrap.d.ts +25 -0
- package/dist/shared/dynamic-truncator.d.ts +2 -0
- package/dist/shared/host-skill-config.d.ts +2 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/internal-initiator-marker.d.ts +25 -0
- package/dist/shared/legacy-workspace-migration.d.ts +5 -0
- package/dist/shared/logger.d.ts +12 -0
- package/dist/shared/model-error-classifier.d.ts +2 -0
- package/dist/shared/model-resolution-pipeline.d.ts +4 -0
- package/dist/shared/opencode-http-api.d.ts +9 -0
- package/dist/shared/prompt-async-gate.d.ts +82 -0
- package/dist/shared/replace-tool-args.d.ts +13 -0
- package/dist/shared/session-idle-settle.d.ts +11 -0
- package/dist/shared/tmux/tmux-utils/pane-activate.d.ts +1 -0
- package/dist/shared/tmux/tmux-utils/pane-close.d.ts +10 -0
- package/dist/shared/tmux/tmux-utils/pane-command.d.ts +2 -0
- package/dist/shared/tmux/tmux-utils/pane-replace.d.ts +11 -1
- package/dist/shared/tmux/tmux-utils/pane-spawn.d.ts +1 -1
- package/dist/shared/tmux/tmux-utils/server-health.d.ts +12 -1
- package/dist/shared/tmux/tmux-utils/session-spawn.d.ts +2 -2
- package/dist/shared/tmux/tmux-utils/window-spawn.d.ts +1 -1
- package/dist/shared/tmux/tmux-utils.d.ts +2 -0
- package/dist/testing/create-plugin-module.d.ts +41 -0
- package/dist/tools/background-task/constants.d.ts +1 -1
- package/dist/tools/background-task/with-sdk-call-timeout.d.ts +7 -0
- package/dist/tools/call-omo-agent/session-creator.d.ts +2 -1
- package/dist/tools/call-omo-agent/sync-executor.d.ts +2 -2
- package/dist/tools/delegate-task/subagent-discovery.d.ts +2 -0
- package/dist/tools/delegate-task/sync-prompt-sender.d.ts +2 -1
- package/dist/tools/delegate-task/sync-session-creator.d.ts +2 -0
- package/dist/tools/delegate-task/sync-task.d.ts +1 -1
- package/dist/tools/index.d.ts +0 -3
- package/dist/tools/interactive-bash/tools.d.ts +5 -0
- package/package.json +17 -8
- package/dist/hooks/atlas/sisyphus-path.d.ts +0 -6
- package/dist/tools/lsp/client.d.ts +0 -3
- package/dist/tools/lsp/config.d.ts +0 -3
- package/dist/tools/lsp/constants.d.ts +0 -6
- package/dist/tools/lsp/diagnostics-tool.d.ts +0 -2
- package/dist/tools/lsp/directory-diagnostics.d.ts +0 -1
- package/dist/tools/lsp/find-references-tool.d.ts +0 -2
- package/dist/tools/lsp/goto-definition-tool.d.ts +0 -2
- package/dist/tools/lsp/index.d.ts +0 -8
- package/dist/tools/lsp/infer-extension.d.ts +0 -1
- package/dist/tools/lsp/language-config.d.ts +0 -1
- package/dist/tools/lsp/language-mappings.d.ts +0 -3
- package/dist/tools/lsp/lsp-client-connection.d.ts +0 -4
- package/dist/tools/lsp/lsp-client-transport.d.ts +0 -22
- package/dist/tools/lsp/lsp-client-wrapper.d.ts +0 -9
- package/dist/tools/lsp/lsp-client.d.ts +0 -17
- package/dist/tools/lsp/lsp-formatters.d.ts +0 -13
- package/dist/tools/lsp/lsp-manager-process-cleanup.d.ts +0 -15
- package/dist/tools/lsp/lsp-manager-temp-directory-cleanup.d.ts +0 -8
- package/dist/tools/lsp/lsp-process.d.ts +0 -29
- package/dist/tools/lsp/lsp-server.d.ts +0 -24
- package/dist/tools/lsp/rename-tools.d.ts +0 -3
- package/dist/tools/lsp/server-config-loader.d.ts +0 -25
- package/dist/tools/lsp/server-definitions.d.ts +0 -3
- package/dist/tools/lsp/server-installation.d.ts +0 -1
- package/dist/tools/lsp/server-path-bases.d.ts +0 -1
- package/dist/tools/lsp/server-resolution.d.ts +0 -15
- package/dist/tools/lsp/symbols-tool.d.ts +0 -2
- package/dist/tools/lsp/tools.d.ts +0 -5
- package/dist/tools/lsp/types.d.ts +0 -123
- package/dist/tools/lsp/workspace-edit.d.ts +0 -8
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import { collectGitDiffStats, formatFileChanges } from "../../shared/git-worktree";
|
|
2
3
|
import type { PendingTaskRef, SessionState } from "./types";
|
|
3
4
|
import type { ToolExecuteAfterInput, ToolExecuteAfterOutput } from "./types";
|
|
4
5
|
export declare function createToolExecuteAfterHandler(input: {
|
|
@@ -9,4 +10,6 @@ export declare function createToolExecuteAfterHandler(input: {
|
|
|
9
10
|
autoCommit: boolean;
|
|
10
11
|
getState: (sessionID: string) => SessionState;
|
|
11
12
|
isCallerOrchestrator?: (sessionID: string | undefined) => Promise<boolean>;
|
|
13
|
+
collectGitDiffStats?: typeof collectGitDiffStats;
|
|
14
|
+
formatFileChanges?: typeof formatFileChanges;
|
|
12
15
|
}): (toolInput: ToolExecuteAfterInput, toolOutput: ToolExecuteAfterOutput | undefined) => Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SessionState } from "./types";
|
|
2
|
+
export declare const MAX_BOULDER_CONTINUATION_NO_TOOL_PROGRESS = 3;
|
|
3
|
+
export type ToolProgressOutput = {
|
|
4
|
+
title?: string;
|
|
5
|
+
output?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function isTangibleProgressTool(toolName: string): boolean;
|
|
8
|
+
export declare function didToolMakeProgress(output: ToolProgressOutput): boolean;
|
|
9
|
+
export declare function recordToolProgress(state: SessionState, now?: number): void;
|
|
10
|
+
export declare function resetStallStateForPlanChange(state: SessionState, planPath: string): void;
|
|
11
|
+
export declare function markContinuationInjectedAwaitingToolProgress(state: SessionState): void;
|
|
12
|
+
export declare function updateNoToolProgressIterations(state: SessionState): number;
|
|
13
|
+
export declare function shouldAbortForNoToolProgress(state: SessionState): boolean;
|
|
14
|
+
export declare function markContinuationStalled(state: SessionState, planName: string, planPath: string): void;
|
|
@@ -54,4 +54,11 @@ export interface SessionState {
|
|
|
54
54
|
pendingFinalWaveTaskCount?: number;
|
|
55
55
|
approvedFinalWaveTaskCount?: number;
|
|
56
56
|
boulderCompletionNudgedAt?: Record<string, number>;
|
|
57
|
+
awaitingToolProgressAfterContinuation?: boolean;
|
|
58
|
+
iterationsSinceLastToolProgress?: number;
|
|
59
|
+
lastToolProgressAt?: number;
|
|
60
|
+
stalledContinuationReason?: string;
|
|
61
|
+
stalledContinuationPlanPath?: string;
|
|
62
|
+
/** The plan path the in-progress no-tool-progress counter is keyed to. Changes here reset the counter. */
|
|
63
|
+
activeContinuationPlanPath?: string;
|
|
57
64
|
}
|
|
@@ -6,8 +6,10 @@ export declare function detectSlashCommand(text: string): ParsedSlashCommand | n
|
|
|
6
6
|
export declare function extractPromptText(parts: Array<{
|
|
7
7
|
type: string;
|
|
8
8
|
text?: string;
|
|
9
|
+
synthetic?: boolean;
|
|
9
10
|
}>): string;
|
|
10
11
|
export declare function findSlashCommandPartIndex(parts: Array<{
|
|
11
12
|
type: string;
|
|
12
13
|
text?: string;
|
|
14
|
+
synthetic?: boolean;
|
|
13
15
|
}>): number;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
interface InvalidatePackageOptions {
|
|
2
|
+
acceptedPackageNames?: readonly string[];
|
|
3
|
+
cacheDir?: string;
|
|
4
|
+
defaultPackageName?: string;
|
|
5
|
+
userConfigDir?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function invalidatePackage(packageName?: string, options?: InvalidatePackageOptions): boolean;
|
|
2
8
|
/** @deprecated Use invalidatePackage instead - this nukes ALL plugins */
|
|
3
9
|
export declare function invalidateCache(): boolean;
|
|
10
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
interface CachedVersionOptions {
|
|
2
|
+
packageJsonCandidates?: readonly string[];
|
|
3
|
+
findPackageJson?: (startPath: string) => string | null;
|
|
4
|
+
currentDir?: string | null;
|
|
5
|
+
execDir?: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function getCachedVersion(options?: CachedVersionOptions): string | null;
|
|
8
|
+
export {};
|
|
@@ -16,12 +16,6 @@ interface ChatMessageOutput {
|
|
|
16
16
|
[key: string]: unknown;
|
|
17
17
|
}>;
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Background notification hook - handles event routing to BackgroundManager.
|
|
21
|
-
*
|
|
22
|
-
* Notifications are now delivered directly via session.prompt({ noReply })
|
|
23
|
-
* from the manager, so this hook only needs to handle event routing.
|
|
24
|
-
*/
|
|
25
19
|
export declare function createBackgroundNotificationHook(manager: BackgroundManager): {
|
|
26
20
|
"chat.message": (input: ChatMessageInput, output: ChatMessageOutput) => Promise<void>;
|
|
27
21
|
event: ({ event }: EventInput) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { InteractiveBashSessionState } from "./types";
|
|
2
2
|
export declare function getOrCreateState(sessionID: string, sessionStates: Map<string, InteractiveBashSessionState>): InteractiveBashSessionState;
|
|
3
|
-
export declare function isOmoSession(sessionName: string | null):
|
|
3
|
+
export declare function isOmoSession(sessionName: string | null): sessionName is string;
|
|
4
4
|
export declare function killAllTrackedSessions(state: InteractiveBashSessionState): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
export declare const JSON_ERROR_TOOL_EXCLUDE_LIST: readonly ["bash", "read", "glob", "grep", "webfetch", "look_at", "grep_app_searchgithub", "websearch_web_search_exa"];
|
|
2
|
+
export declare const JSON_ERROR_TOOL_EXCLUDE_LIST: readonly ["bash", "read", "glob", "grep", "webfetch", "look_at", "grep_app_searchgithub", "websearch_web_search_exa", "todowrite", "todoread"];
|
|
3
3
|
export declare const JSON_ERROR_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
4
4
|
export declare const JSON_ERROR_REMINDER = "\n[JSON PARSE ERROR - IMMEDIATE ACTION REQUIRED]\n\nYou sent invalid JSON arguments. The system could not parse your tool call.\nSTOP and do this NOW:\n\n1. LOOK at the error message above to see what was expected vs what you sent.\n2. CORRECT your JSON syntax (missing braces, unescaped quotes, trailing commas, etc).\n3. RETRY the tool call with valid JSON.\n\nDO NOT repeat the exact same invalid call.\n";
|
|
5
5
|
export declare function createJsonErrorRecoveryHook(_ctx: PluginInput): {
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* - Parallel execution emphasized - fire agents and continue working
|
|
7
7
|
* - Simple workflow: EXPLORES → GATHER → PLAN → DELEGATE
|
|
8
8
|
*/
|
|
9
|
-
export declare const ULTRAWORK_DEFAULT_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Ultrathink before acting.\n\n## **ABSOLUTE CERTAINTY REQUIRED - DO NOT SKIP THIS**\n\n**YOU MUST NOT START ANY IMPLEMENTATION UNTIL YOU ARE 100% CERTAIN.**\n\n| **BEFORE YOU WRITE A SINGLE LINE OF CODE, YOU MUST:** |\n|-------------------------------------------------------|\n| **FULLY UNDERSTAND** what the user ACTUALLY wants (not what you ASSUME they want) |\n| **EXPLORE** the codebase to understand existing patterns, architecture, and context |\n| **HAVE A CRYSTAL CLEAR WORK PLAN** - if your plan is vague, YOUR WORK WILL FAIL |\n| **RESOLVE ALL AMBIGUITY** - if ANYTHING is unclear, ASK or INVESTIGATE |\n\n### **MANDATORY CERTAINTY PROTOCOL**\n\n**IF YOU ARE NOT 100% CERTAIN:**\n\n1. **THINK DEEPLY** - What is the user's TRUE intent? What problem are they REALLY trying to solve?\n2. **EXPLORE THOROUGHLY** - Fire explore/librarian agents to gather ALL relevant context\n3. **CONSULT SPECIALISTS** - For hard/complex tasks, DO NOT struggle alone. Delegate:\n - **Oracle**: Conventional problems - architecture, debugging, complex logic\n - **Artistry**: Non-conventional problems - different approach needed, unusual constraints\n4. **ASK THE USER** - If ambiguity remains after exploration, ASK. Don't guess.\n\n**SIGNS YOU ARE NOT READY TO IMPLEMENT:**\n- You're making assumptions about requirements\n- You're unsure which files to modify\n- You don't understand how existing code works\n- Your plan has \"probably\" or \"maybe\" in it\n- You can't explain the exact steps you'll take\n\n**WHEN IN DOUBT:**\n```\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"I'm implementing [TASK DESCRIPTION] and need to understand [SPECIFIC KNOWLEDGE GAP]. Find [X] patterns in the codebase - show file paths, implementation approach, and conventions used. I'll use this to [HOW RESULTS WILL BE USED]. Focus on src/ directories, skip test files unless test patterns are specifically needed. Return concrete file paths with brief descriptions of what each file does.\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"I'm working with [LIBRARY/TECHNOLOGY] and need [SPECIFIC INFORMATION]. Find official documentation and production-quality examples for [Y] - specifically: API reference, configuration options, recommended patterns, and common pitfalls. Skip beginner tutorials. I'll use this to [DECISION THIS WILL INFORM].\", run_in_background=true)\ntask(subagent_type=\"oracle\", load_skills=[], prompt=\"I need architectural review of my approach to [TASK]. Here's my plan: [DESCRIBE PLAN WITH SPECIFIC FILES AND CHANGES]. My concerns are: [LIST SPECIFIC UNCERTAINTIES]. Please evaluate: correctness of approach, potential issues I'm missing, and whether a better alternative exists.\", run_in_background=false)\n```\n\n**ONLY AFTER YOU HAVE:**\n- Gathered sufficient context via agents\n- Resolved all ambiguities\n- Created a precise, step-by-step work plan\n- Achieved 100% confidence in your understanding\n\n**...THEN AND ONLY THEN MAY YOU BEGIN IMPLEMENTATION.**\n\n---\n\n## **NO EXCUSES. NO COMPROMISES. DELIVER WHAT WAS ASKED.**\n\n**THE USER'S ORIGINAL REQUEST IS SACRED. YOU MUST FULFILL IT EXACTLY.**\n\n| VIOLATION | CONSEQUENCE |\n|-----------|-------------|\n| \"I couldn't because...\" | **UNACCEPTABLE.** Find a way or ask for help. |\n| \"This is a simplified version...\" | **UNACCEPTABLE.** Deliver the FULL implementation. |\n| \"You can extend this later...\" | **UNACCEPTABLE.** Finish it NOW. |\n| \"Due to limitations...\" | **UNACCEPTABLE.** Use agents, tools, whatever it takes. |\n| \"I made some assumptions...\" | **UNACCEPTABLE.** You should have asked FIRST. |\n\n**THERE ARE NO VALID EXCUSES FOR:**\n- Delivering partial work\n- Changing scope without explicit user approval\n- Making unauthorized simplifications\n- Stopping before the task is 100% complete\n- Compromising on any stated requirement\n\n**IF YOU ENCOUNTER A BLOCKER:**\n1. **DO NOT** give up\n2. **DO NOT** deliver a compromised version\n3. **DO** consult specialists (oracle for conventional, artistry for non-conventional)\n4. **DO** ask the user for guidance\n5. **DO** explore alternative approaches\n\n**THE USER ASKED FOR X. DELIVER EXACTLY X. PERIOD.**\n\n---\n\nYOU MUST LEVERAGE ALL AVAILABLE AGENTS / **CATEGORY + SKILLS** TO THEIR FULLEST POTENTIAL.\nTELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.\n\n## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE)\n\n**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.**\n\n| Condition | Action |\n|-----------|--------|\n| Task has 2+ steps | MUST call plan agent |\n| Task scope unclear | MUST call plan agent |\n| Implementation required | MUST call plan agent |\n| Architecture decision needed | MUST call plan agent |\n\n```\ntask(subagent_type=\"plan\", load_skills=[], run_in_background=false, prompt=\"<gathered context + user request>\")\n```\n\n**WHY PLAN AGENT IS MANDATORY:**\n- Plan agent analyzes dependencies and parallel execution opportunities\n- Plan agent outputs a **parallel task graph** with waves and dependencies\n- Plan agent provides structured TODO list with category + skills per task\n- YOU are an orchestrator, NOT an implementer\n\n### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)\n\n**Plan agent returns a task_id. USE IT for follow-up interactions.**\n\n| Scenario | Action |\n|----------|--------|\n| Plan agent asks clarifying questions | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"<your answer>\")` |\n| Need to refine the plan | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Please adjust: <feedback>\")` |\n| Plan needs more detail | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Add more detail to Task N\")` |\n\n**WHY TASK_ID IS CRITICAL:**\n- Plan agent retains FULL conversation context\n- No repeated exploration or context gathering\n- Saves 70%+ tokens on follow-ups\n- Maintains interview continuity until plan is finalized\n\n```\n// WRONG: Starting fresh loses all context\ntask(subagent_type=\"plan\", load_skills=[], run_in_background=false, prompt=\"Here's more info...\")\n\n// CORRECT: Resume preserves everything\ntask(task_id=\"ses_abc123\", load_skills=[], run_in_background=false, prompt=\"Here's my answer to your question: ...\")\n```\n\n**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**\n\n---\n\n## AGENTS / **CATEGORY + SKILLS** UTILIZATION PRINCIPLES\n\n**DEFAULT BEHAVIOR: DELEGATE. DO NOT WORK YOURSELF.**\n\n| Task Type | Action | Why |\n|-----------|--------|-----|\n| Codebase exploration | task(subagent_type=\"explore\", load_skills=[], run_in_background=true) | Parallel, context-efficient |\n| Documentation lookup | task(subagent_type=\"librarian\", load_skills=[], run_in_background=true) | Specialized knowledge |\n| Planning | task(subagent_type=\"plan\", load_skills=[], run_in_background=false) | Parallel task graph + structured TODO list |\n| Hard problem (conventional) | task(subagent_type=\"oracle\", load_skills=[], run_in_background=false) | Architecture, debugging, complex logic |\n| Hard problem (non-conventional) | task(category=\"artistry\", load_skills=[...], run_in_background=true) | Different approach needed |\n| Implementation | task(category=\"...\", load_skills=[...], run_in_background=true) | Domain-optimized models |\n\n**CATEGORY + SKILL DELEGATION:**\n```\n// Frontend work\ntask(category=\"visual-engineering\", load_skills=[\"frontend-ui-ux\"], run_in_background=true)\n\n// Complex logic\ntask(category=\"ultrabrain\", load_skills=[\"typescript-programmer\"], run_in_background=true)\n\n// Quick fixes\ntask(category=\"quick\", load_skills=[\"git-master\"], run_in_background=true)\n```\n\n**YOU SHOULD ONLY DO IT YOURSELF WHEN:**\n- Task is trivially simple (1-2 lines, obvious change)\n- You have ALL context already loaded\n- Delegation overhead exceeds task complexity\n\n**OTHERWISE: DELEGATE. ALWAYS.**\n\n---\n\n## EXECUTION RULES\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.\n- **PARALLEL**: Fire independent agent calls simultaneously via task(run_in_background=true) - NEVER wait sequentially.\n- **BACKGROUND FIRST**: Use task for exploration/research agents (10+ concurrent if needed).\n- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.\n- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.\n\n## WORKFLOW\n1. Analyze the request and identify required capabilities\n2. Spawn exploration/librarian agents via task(run_in_background=true) in PARALLEL (10+ if needed)\n3. Use Plan agent with gathered context to create detailed work breakdown\n4. Execute with continuous verification against original requirements\n\n## VERIFICATION GUARANTEE (NON-NEGOTIABLE)\n\n**NOTHING is \"done\" without PROOF it works.**\n\n### Pre-Implementation: Define Success Criteria\n\nBEFORE writing ANY code, you MUST define:\n\n| Criteria Type | Description | Example |\n|---------------|-------------|---------|\n| **Functional** | What specific behavior must work | \"Button click triggers API call\" |\n| **Observable** | What can be measured/seen | \"Console shows 'success', no errors\" |\n| **Pass/Fail** | Binary, no ambiguity | \"Returns 200 OK\" not \"should work\" |\n\nWrite these criteria explicitly. **Record them in your TODO/Task items.** Each task MUST include a \"QA: [how to verify]\" field. These criteria are your CONTRACT - work toward them, verify against them.\n\n### Test Plan Template (MANDATORY for non-trivial tasks)\n\n```\n## Test Plan\n### Objective: [What we're verifying]\n### Prerequisites: [Setup needed]\n### Test Cases:\n1. [Test Name]: [Input] \u2192 [Expected Output] \u2192 [How to verify]\n2. ...\n### Success Criteria: ALL test cases pass\n### How to Execute: [Exact commands/steps]\n```\n\n### Execution & Evidence Requirements\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| **Build** | Run build command | Exit code 0, no errors |\n| **Test** | Execute test suite | All tests pass (screenshot/output) |\n| **Manual Verify** | Test the actual feature | Demonstrate it works (describe what you observed) |\n| **Regression** | Ensure nothing broke | Existing tests still pass |\n\n**WITHOUT evidence = NOT verified = NOT done.**\n\n<MANUAL_QA_MANDATE>\n### YOU MUST EXECUTE MANUAL QA YOURSELF. THIS IS NOT OPTIONAL.\n\n**YOUR FAILURE MODE**: You finish coding, run lsp_diagnostics, and declare \"done\" without actually TESTING the feature. lsp_diagnostics catches type errors, NOT functional bugs. Your work is NOT verified until you MANUALLY test it.\n\n**WHAT MANUAL QA MEANS - execute ALL that apply:**\n\n| If your change... | YOU MUST... |\n|---|---|\n| Adds/modifies a CLI command | Run the command with Bash. Show the output. |\n| Changes build output | Run the build. Verify the output files exist and are correct. |\n| Modifies API behavior | Call the endpoint. Show the response. |\n| Changes UI rendering | Describe what renders. Use a browser tool if available. |\n| Adds a new tool/hook/feature | Test it end-to-end in a real scenario. |\n| Modifies config handling | Load the config. Verify it parses correctly. |\n\n**UNACCEPTABLE QA CLAIMS:**\n- \"This should work\" - RUN IT.\n- \"The types check out\" - Types don't catch logic bugs. RUN IT.\n- \"lsp_diagnostics is clean\" - That's a TYPE check, not a FUNCTIONAL check. RUN IT.\n- \"Tests pass\" - Tests cover known cases. Does the ACTUAL FEATURE work as the user expects? RUN IT.\n\n**You have Bash, you have tools. There is ZERO excuse for not running manual QA.**\n**Manual QA is the FINAL gate before reporting completion. Skip it and your work is INCOMPLETE.**\n</MANUAL_QA_MANDATE>\n\n### TDD Workflow (when test infrastructure exists)\n\n1. **SPEC**: Define what \"working\" means (success criteria above)\n2. **RED**: Write failing test \u2192 Run it \u2192 Confirm it FAILS\n3. **GREEN**: Write minimal code \u2192 Run test \u2192 Confirm it PASSES\n4. **REFACTOR**: Clean up \u2192 Tests MUST stay green\n5. **VERIFY**: Run full test suite, confirm no regressions\n6. **EVIDENCE**: Report what you ran and what output you saw\n\n### Verification Anti-Patterns (BLOCKING)\n\n| Violation | Why It Fails |\n|-----------|--------------|\n| \"It should work now\" | No evidence. Run it. |\n| \"I added the tests\" | Did they pass? Show output. |\n| \"Fixed the bug\" | How do you know? What did you test? |\n| \"Implementation complete\" | Did you verify against success criteria? |\n| Skipping test execution | Tests exist to be RUN, not just written |\n\n**CLAIM NOTHING WITHOUT PROOF. EXECUTE. VERIFY. SHOW EVIDENCE.**\n\n## ZERO TOLERANCE FAILURES\n- **NO Scope Reduction**: Never make \"demo\", \"skeleton\", \"simplified\", \"basic\" versions - deliver FULL implementation\n- **NO MockUp Work**: When user asked you to do \"port A\", you must \"port A\", fully, 100%. No Extra feature, No reduced feature, no mock data, fully working 100% port.\n- **NO Partial Completion**: Never stop at 60-80% saying \"you can extend this...\" - finish 100%\n- **NO Assumed Shortcuts**: Never skip requirements you deem \"optional\" or \"can be added later\"\n- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified\n- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.\n\nTHE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.\n\n1. EXPLORES + LIBRARIANS\n2. GATHER -> PLAN AGENT SPAWN\n3. WORK BY DELEGATING TO ANOTHER AGENTS\n\nNOW.\n\n</ultrawork-mode>\n\n";
|
|
9
|
+
export declare const ULTRAWORK_DEFAULT_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Ultrathink before acting.\n\n## **ABSOLUTE CERTAINTY REQUIRED - DO NOT SKIP THIS**\n\n**YOU MUST NOT START ANY IMPLEMENTATION UNTIL YOU ARE 100% CERTAIN.**\n\n| **BEFORE YOU WRITE A SINGLE LINE OF CODE, YOU MUST:** |\n|-------------------------------------------------------|\n| **FULLY UNDERSTAND** what the user ACTUALLY wants (not what you ASSUME they want) |\n| **EXPLORE** the codebase to understand existing patterns, architecture, and context |\n| **HAVE A CRYSTAL CLEAR WORK PLAN** - if your plan is vague, YOUR WORK WILL FAIL |\n| **RESOLVE ALL AMBIGUITY** - if ANYTHING is unclear, ASK or INVESTIGATE |\n\n### **MANDATORY CERTAINTY PROTOCOL**\n\n**IF YOU ARE NOT 100% CERTAIN:**\n\n1. **THINK DEEPLY** - What is the user's TRUE intent? What problem are they REALLY trying to solve?\n2. **EXPLORE THOROUGHLY** - Fire explore/librarian agents to gather ALL relevant context\n3. **CONSULT SPECIALISTS** - For hard/complex tasks, DO NOT struggle alone. Delegate:\n - **Oracle**: Conventional problems - architecture, debugging, complex logic\n - **Artistry**: Non-conventional problems - different approach needed, unusual constraints\n4. **ASK THE USER** - If ambiguity remains after exploration, ASK. Don't guess.\n\n**SIGNS YOU ARE NOT READY TO IMPLEMENT:**\n- You're making assumptions about requirements\n- You're unsure which files to modify\n- You don't understand how existing code works\n- Your plan has \"probably\" or \"maybe\" in it\n- You can't explain the exact steps you'll take\n\n**WHEN IN DOUBT:**\n```\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"I'm implementing [TASK DESCRIPTION] and need to understand [SPECIFIC KNOWLEDGE GAP]. Find [X] patterns in the codebase - show file paths, implementation approach, and conventions used. I'll use this to [HOW RESULTS WILL BE USED]. Focus on src/ directories, skip test files unless test patterns are specifically needed. Return concrete file paths with brief descriptions of what each file does.\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"I'm working with [LIBRARY/TECHNOLOGY] and need [SPECIFIC INFORMATION]. Find official documentation and production-quality examples for [Y] - specifically: API reference, configuration options, recommended patterns, and common pitfalls. Skip beginner tutorials. I'll use this to [DECISION THIS WILL INFORM].\", run_in_background=true)\ntask(subagent_type=\"oracle\", load_skills=[], prompt=\"I need architectural review of my approach to [TASK]. Here's my plan: [DESCRIBE PLAN WITH SPECIFIC FILES AND CHANGES]. My concerns are: [LIST SPECIFIC UNCERTAINTIES]. Please evaluate: correctness of approach, potential issues I'm missing, and whether a better alternative exists.\", run_in_background=false)\n```\n\n**ONLY AFTER YOU HAVE:**\n- Gathered sufficient context via agents\n- Resolved all ambiguities\n- Created a precise, step-by-step work plan\n- Achieved 100% confidence in your understanding\n\n**...THEN AND ONLY THEN MAY YOU BEGIN IMPLEMENTATION.**\n\n---\n\n## **NO EXCUSES. NO COMPROMISES. DELIVER WHAT WAS ASKED.**\n\n**THE USER'S ORIGINAL REQUEST IS SACRED. YOU MUST FULFILL IT EXACTLY.**\n\n| VIOLATION | CONSEQUENCE |\n|-----------|-------------|\n| \"I couldn't because...\" | **UNACCEPTABLE.** Find a way or ask for help. |\n| \"This is a simplified version...\" | **UNACCEPTABLE.** Deliver the FULL implementation. |\n| \"You can extend this later...\" | **UNACCEPTABLE.** Finish it NOW. |\n| \"Due to limitations...\" | **UNACCEPTABLE.** Use agents, tools, whatever it takes. |\n| \"I made some assumptions...\" | **UNACCEPTABLE.** You should have asked FIRST. |\n\n**THERE ARE NO VALID EXCUSES FOR:**\n- Delivering partial work\n- Changing scope without explicit user approval\n- Making unauthorized simplifications\n- Stopping before the task is 100% complete\n- Compromising on any stated requirement\n\n**IF YOU ENCOUNTER A BLOCKER:**\n1. **DO NOT** give up\n2. **DO NOT** deliver a compromised version\n3. **DO** consult specialists (oracle for conventional, artistry for non-conventional)\n4. **DO** ask the user for guidance\n5. **DO** explore alternative approaches\n\n**THE USER ASKED FOR X. DELIVER EXACTLY X. PERIOD.**\n\n---\n\nYOU MUST LEVERAGE ALL AVAILABLE AGENTS / **CATEGORY + SKILLS** TO THEIR FULLEST POTENTIAL.\nTELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.\n\n## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE)\n\n**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.**\n\n| Condition | Action |\n|-----------|--------|\n| Task has 2+ steps | MUST call plan agent |\n| Task scope unclear | MUST call plan agent |\n| Implementation required | MUST call plan agent |\n| Architecture decision needed | MUST call plan agent |\n\n```\ntask(subagent_type=\"plan\", load_skills=[], run_in_background=false, prompt=\"<gathered context + user request>\")\n```\n\n**WHY PLAN AGENT IS MANDATORY:**\n- Plan agent analyzes dependencies and parallel execution opportunities\n- Plan agent outputs a **parallel task graph** with waves and dependencies\n- Plan agent provides structured TODO list with category + skills per task\n- YOU are an orchestrator, NOT an implementer\n\n### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)\n\n**Plan agent output includes a continuation ID (`ses_...`). USE IT for follow-up interactions via `task(task_id=\"ses_...\", ...)`.**\n\n| Scenario | Action |\n|----------|--------|\n| Plan agent asks clarifying questions | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"<your answer>\")` |\n| Need to refine the plan | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Please adjust: <feedback>\")` |\n| Plan needs more detail | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Add more detail to Task N\")` |\n\n**WHY TASK_ID IS CRITICAL:**\n- Plan agent retains FULL conversation context\n- No repeated exploration or context gathering\n- Saves 70%+ tokens on follow-ups\n- Maintains interview continuity until plan is finalized\n\n```\n// WRONG: Starting fresh loses all context\ntask(subagent_type=\"plan\", load_skills=[], run_in_background=false, prompt=\"Here's more info...\")\n\n// CORRECT: Resume preserves everything\ntask(task_id=\"ses_abc123\", load_skills=[], run_in_background=false, prompt=\"Here's my answer to your question: ...\")\n```\n\n**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**\n\n---\n\n## AGENTS / **CATEGORY + SKILLS** UTILIZATION PRINCIPLES\n\n**DEFAULT BEHAVIOR: DELEGATE. DO NOT WORK YOURSELF.**\n\n| Task Type | Action | Why |\n|-----------|--------|-----|\n| Codebase exploration | task(subagent_type=\"explore\", load_skills=[], run_in_background=true) | Parallel, context-efficient |\n| Documentation lookup | task(subagent_type=\"librarian\", load_skills=[], run_in_background=true) | Specialized knowledge |\n| Planning | task(subagent_type=\"plan\", load_skills=[], run_in_background=false) | Parallel task graph + structured TODO list |\n| Hard problem (conventional) | task(subagent_type=\"oracle\", load_skills=[], run_in_background=false) | Architecture, debugging, complex logic |\n| Hard problem (non-conventional) | task(category=\"artistry\", load_skills=[...], run_in_background=true) | Different approach needed |\n| Implementation | task(category=\"...\", load_skills=[...], run_in_background=true) | Domain-optimized models |\n\n**CATEGORY + SKILL DELEGATION:**\n```\n// Frontend work\ntask(category=\"visual-engineering\", load_skills=[\"frontend-ui-ux\"], run_in_background=true)\n\n// Complex logic\ntask(category=\"ultrabrain\", load_skills=[\"typescript-programmer\"], run_in_background=true)\n\n// Quick fixes\ntask(category=\"quick\", load_skills=[\"git-master\"], run_in_background=true)\n```\n\n**YOU SHOULD ONLY DO IT YOURSELF WHEN:**\n- Task is trivially simple (1-2 lines, obvious change)\n- You have ALL context already loaded\n- Delegation overhead exceeds task complexity\n\n**OTHERWISE: DELEGATE. ALWAYS.**\n\n---\n\n## EXECUTION RULES\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.\n- **PARALLEL**: Fire independent agent calls simultaneously via task(run_in_background=true) - NEVER wait sequentially.\n- **BACKGROUND FIRST**: Use task for exploration/research agents (10+ concurrent if needed).\n- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.\n- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.\n\n## WORKFLOW\n1. Analyze the request and identify required capabilities\n2. Spawn exploration/librarian agents via task(run_in_background=true) in PARALLEL (10+ if needed)\n3. Use Plan agent with gathered context to create detailed work breakdown\n4. Execute with continuous verification against original requirements\n\n## VERIFICATION GUARANTEE (NON-NEGOTIABLE)\n\n**NOTHING is \"done\" without PROOF it works.**\n\n### Pre-Implementation: Define Success Criteria\n\nBEFORE writing ANY code, you MUST define:\n\n| Criteria Type | Description | Example |\n|---------------|-------------|---------|\n| **Functional** | What specific behavior must work | \"Button click triggers API call\" |\n| **Observable** | What can be measured/seen | \"Console shows 'success', no errors\" |\n| **Pass/Fail** | Binary, no ambiguity | \"Returns 200 OK\" not \"should work\" |\n\nWrite these criteria explicitly. **Record them in your TODO/Task items.** Each task MUST include a \"QA: [how to verify]\" field. These criteria are your CONTRACT - work toward them, verify against them.\n\n### Test Plan Template (MANDATORY for non-trivial tasks)\n\n```\n## Test Plan\n### Objective: [What we're verifying]\n### Prerequisites: [Setup needed]\n### Test Cases:\n1. [Test Name]: [Input] \u2192 [Expected Output] \u2192 [How to verify]\n2. ...\n### Success Criteria: ALL test cases pass\n### How to Execute: [Exact commands/steps]\n```\n\n### Execution & Evidence Requirements\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| **Build** | Run build command | Exit code 0, no errors |\n| **Test** | Execute test suite | All tests pass (screenshot/output) |\n| **Manual Verify** | Test the actual feature | Demonstrate it works (describe what you observed) |\n| **Regression** | Ensure nothing broke | Existing tests still pass |\n\n**WITHOUT evidence = NOT verified = NOT done.**\n\n<MANUAL_QA_MANDATE>\n### YOU MUST EXECUTE MANUAL QA YOURSELF. THIS IS NOT OPTIONAL.\n\n**YOUR FAILURE MODE**: You finish coding, run lsp_diagnostics, and declare \"done\" without actually TESTING the feature. lsp_diagnostics catches type errors, NOT functional bugs. Your work is NOT verified until you MANUALLY test it.\n\n**WHAT MANUAL QA MEANS - execute ALL that apply:**\n\n| If your change... | YOU MUST... |\n|---|---|\n| Adds/modifies a CLI command | Run the command with Bash. Show the output. |\n| Changes build output | Run the build. Verify the output files exist and are correct. |\n| Modifies API behavior | Call the endpoint. Show the response. |\n| Changes UI rendering | Describe what renders. Use a browser tool if available. |\n| Adds a new tool/hook/feature | Test it end-to-end in a real scenario. |\n| Modifies config handling | Load the config. Verify it parses correctly. |\n\n**UNACCEPTABLE QA CLAIMS:**\n- \"This should work\" - RUN IT.\n- \"The types check out\" - Types don't catch logic bugs. RUN IT.\n- \"lsp_diagnostics is clean\" - That's a TYPE check, not a FUNCTIONAL check. RUN IT.\n- \"Tests pass\" - Tests cover known cases. Does the ACTUAL FEATURE work as the user expects? RUN IT.\n\n**You have Bash, you have tools. There is ZERO excuse for not running manual QA.**\n**Manual QA is the FINAL gate before reporting completion. Skip it and your work is INCOMPLETE.**\n</MANUAL_QA_MANDATE>\n\n### TDD Workflow (when test infrastructure exists)\n\n1. **SPEC**: Define what \"working\" means (success criteria above)\n2. **RED**: Write failing test \u2192 Run it \u2192 Confirm it FAILS\n3. **GREEN**: Write minimal code \u2192 Run test \u2192 Confirm it PASSES\n4. **REFACTOR**: Clean up \u2192 Tests MUST stay green\n5. **VERIFY**: Run full test suite, confirm no regressions\n6. **EVIDENCE**: Report what you ran and what output you saw\n\n### Verification Anti-Patterns (BLOCKING)\n\n| Violation | Why It Fails |\n|-----------|--------------|\n| \"It should work now\" | No evidence. Run it. |\n| \"I added the tests\" | Did they pass? Show output. |\n| \"Fixed the bug\" | How do you know? What did you test? |\n| \"Implementation complete\" | Did you verify against success criteria? |\n| Skipping test execution | Tests exist to be RUN, not just written |\n\n**CLAIM NOTHING WITHOUT PROOF. EXECUTE. VERIFY. SHOW EVIDENCE.**\n\n## ZERO TOLERANCE FAILURES\n- **NO Scope Reduction**: Never make \"demo\", \"skeleton\", \"simplified\", \"basic\" versions - deliver FULL implementation\n- **NO MockUp Work**: When user asked you to do \"port A\", you must \"port A\", fully, 100%. No Extra feature, No reduced feature, no mock data, fully working 100% port.\n- **NO Partial Completion**: Never stop at 60-80% saying \"you can extend this...\" - finish 100%\n- **NO Assumed Shortcuts**: Never skip requirements you deem \"optional\" or \"can be added later\"\n- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified\n- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.\n\nTHE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.\n\n1. EXPLORES + LIBRARIANS\n2. GATHER -> PLAN AGENT SPAWN\n3. WORK BY DELEGATING TO ANOTHER AGENTS\n\nNOW.\n\n</ultrawork-mode>\n\n";
|
|
10
10
|
export declare function getDefaultUltraworkMessage(): string;
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* - GPT self-delegates appropriately; Gemini tries to do everything itself
|
|
14
14
|
* - GPT respects MUST NOT; Gemini treats constraints as suggestions
|
|
15
15
|
*/
|
|
16
|
-
export declare const ULTRAWORK_GEMINI_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Ultrathink before acting.\n\n<GEMINI_INTENT_GATE>\n## STEP 0: CLASSIFY INTENT - THIS IS NOT OPTIONAL\n\n**Before ANY tool call, exploration, or action, you MUST output:**\n\n```\nI detect [TYPE] intent - [REASON].\nMy approach: [ROUTING DECISION].\n```\n\nWhere TYPE is one of: research | implementation | investigation | evaluation | fix | open-ended\n\n**SELF-CHECK (answer each before proceeding):**\n\n1. Did the user EXPLICITLY ask me to build/create/implement something? \u2192 If NO, do NOT implement.\n2. Did the user say \"look into\", \"check\", \"investigate\", \"explain\"? \u2192 RESEARCH only. Do not code.\n3. Did the user ask \"what do you think?\" \u2192 EVALUATE and propose. Do NOT execute.\n4. Did the user report an error/bug? \u2192 MINIMAL FIX only. Do not refactor.\n\n**YOUR FAILURE MODE: You see a request and immediately start coding. STOP. Classify first.**\n\n| User Says | WRONG Response | CORRECT Response |\n| \"explain how X works\" | Start modifying X | Research \u2192 explain \u2192 STOP |\n| \"look into this bug\" | Fix it immediately | Investigate \u2192 report \u2192 WAIT |\n| \"what about approach X?\" | Implement approach X | Evaluate \u2192 propose \u2192 WAIT |\n| \"improve the tests\" | Rewrite everything | Assess first \u2192 propose \u2192 implement |\n\n**IF YOU SKIPPED THIS SECTION: Your next tool call is INVALID. Go back and classify.**\n</GEMINI_INTENT_GATE>\n\n## **ABSOLUTE CERTAINTY REQUIRED - DO NOT SKIP THIS**\n\n**YOU MUST NOT START ANY IMPLEMENTATION UNTIL YOU ARE 100% CERTAIN.**\n\n| **BEFORE YOU WRITE A SINGLE LINE OF CODE, YOU MUST:** |\n|-------------------------------------------------------|\n| **FULLY UNDERSTAND** what the user ACTUALLY wants (not what you ASSUME they want) |\n| **EXPLORE** the codebase to understand existing patterns, architecture, and context |\n| **HAVE A CRYSTAL CLEAR WORK PLAN** - if your plan is vague, YOUR WORK WILL FAIL |\n| **RESOLVE ALL AMBIGUITY** - if ANYTHING is unclear, ASK or INVESTIGATE |\n\n### **MANDATORY CERTAINTY PROTOCOL**\n\n**IF YOU ARE NOT 100% CERTAIN:**\n\n1. **THINK DEEPLY** - What is the user's TRUE intent? What problem are they REALLY trying to solve?\n2. **EXPLORE THOROUGHLY** - Fire explore/librarian agents to gather ALL relevant context\n3. **CONSULT SPECIALISTS** - For hard/complex tasks, DO NOT struggle alone. Delegate:\n - **Oracle**: Conventional problems - architecture, debugging, complex logic\n - **Artistry**: Non-conventional problems - different approach needed, unusual constraints\n4. **ASK THE USER** - If ambiguity remains after exploration, ASK. Don't guess.\n\n**SIGNS YOU ARE NOT READY TO IMPLEMENT:**\n- You're making assumptions about requirements\n- You're unsure which files to modify\n- You don't understand how existing code works\n- Your plan has \"probably\" or \"maybe\" in it\n- You can't explain the exact steps you'll take\n\n**WHEN IN DOUBT:**\n```\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"I'm implementing [TASK DESCRIPTION] and need to understand [SPECIFIC KNOWLEDGE GAP]. Find [X] patterns in the codebase - show file paths, implementation approach, and conventions used. I'll use this to [HOW RESULTS WILL BE USED]. Focus on src/ directories, skip test files unless test patterns are specifically needed. Return concrete file paths with brief descriptions of what each file does.\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"I'm working with [LIBRARY/TECHNOLOGY] and need [SPECIFIC INFORMATION]. Find official documentation and production-quality examples for [Y] - specifically: API reference, configuration options, recommended patterns, and common pitfalls. Skip beginner tutorials. I'll use this to [DECISION THIS WILL INFORM].\", run_in_background=true)\ntask(subagent_type=\"oracle\", load_skills=[], prompt=\"I need architectural review of my approach to [TASK]. Here's my plan: [DESCRIBE PLAN WITH SPECIFIC FILES AND CHANGES]. My concerns are: [LIST SPECIFIC UNCERTAINTIES]. Please evaluate: correctness of approach, potential issues I'm missing, and whether a better alternative exists.\", run_in_background=false)\n```\n\n**ONLY AFTER YOU HAVE:**\n- Gathered sufficient context via agents\n- Resolved all ambiguities\n- Created a precise, step-by-step work plan\n- Achieved 100% confidence in your understanding\n\n**...THEN AND ONLY THEN MAY YOU BEGIN IMPLEMENTATION.**\n\n---\n\n## **NO EXCUSES. NO COMPROMISES. DELIVER WHAT WAS ASKED.**\n\n**THE USER'S ORIGINAL REQUEST IS SACRED. YOU MUST FULFILL IT EXACTLY.**\n\n| VIOLATION | CONSEQUENCE |\n|-----------|-------------|\n| \"I couldn't because...\" | **UNACCEPTABLE.** Find a way or ask for help. |\n| \"This is a simplified version...\" | **UNACCEPTABLE.** Deliver the FULL implementation. |\n| \"You can extend this later...\" | **UNACCEPTABLE.** Finish it NOW. |\n| \"Due to limitations...\" | **UNACCEPTABLE.** Use agents, tools, whatever it takes. |\n| \"I made some assumptions...\" | **UNACCEPTABLE.** You should have asked FIRST. |\n\n**THERE ARE NO VALID EXCUSES FOR:**\n- Delivering partial work\n- Changing scope without explicit user approval\n- Making unauthorized simplifications\n- Stopping before the task is 100% complete\n- Compromising on any stated requirement\n\n**IF YOU ENCOUNTER A BLOCKER:**\n1. **DO NOT** give up\n2. **DO NOT** deliver a compromised version\n3. **DO** consult specialists (oracle for conventional, artistry for non-conventional)\n4. **DO** ask the user for guidance\n5. **DO** explore alternative approaches\n\n**THE USER ASKED FOR X. DELIVER EXACTLY X. PERIOD.**\n\n---\n\n<TOOL_CALL_MANDATE>\n## YOU MUST USE TOOLS. THIS IS NOT OPTIONAL.\n\n**The user expects you to ACT using tools, not REASON internally.** Every response to a task MUST contain tool_use blocks. A response without tool calls is a FAILED response.\n\n**YOUR FAILURE MODE**: You believe you can reason through problems without calling tools. You CANNOT.\n\n**RULES (VIOLATION = BROKEN RESPONSE):**\n1. **NEVER answer about code without reading files first.** Read them AGAIN.\n2. **NEVER claim done without `lsp_diagnostics`.** Your confidence is wrong more often than right.\n3. **NEVER skip delegation.** Specialists produce better results. USE THEM.\n4. **NEVER reason about what a file \"probably contains.\"** READ IT.\n5. **NEVER produce ZERO tool calls when action was requested.** Thinking is not doing.\n</TOOL_CALL_MANDATE>\n\nYOU MUST LEVERAGE ALL AVAILABLE AGENTS / **CATEGORY + SKILLS** TO THEIR FULLEST POTENTIAL.\nTELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.\n\n## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE)\n\n**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.**\n\n| Condition | Action |\n|-----------|--------|\n| Task has 2+ steps | MUST call plan agent |\n| Task scope unclear | MUST call plan agent |\n| Implementation required | MUST call plan agent |\n| Architecture decision needed | MUST call plan agent |\n\n```\ntask(subagent_type=\"plan\", load_skills=[], run_in_background=false, prompt=\"<gathered context + user request>\")\n```\n\n### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)\n\n**Plan agent returns a task_id. USE IT for follow-up interactions.**\n\n| Scenario | Action |\n|----------|--------|\n| Plan agent asks clarifying questions | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"<your answer>\")` |\n| Need to refine the plan | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Please adjust: <feedback>\")` |\n| Plan needs more detail | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Add more detail to Task N\")` |\n\n**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**\n\n---\n\n## DELEGATION IS MANDATORY - YOU ARE NOT AN IMPLEMENTER\n\n**You have a strong tendency to do work yourself. RESIST THIS.**\n\n**DEFAULT BEHAVIOR: DELEGATE. DO NOT WORK YOURSELF.**\n\n| Task Type | Action | Why |\n|-----------|--------|-----|\n| Codebase exploration | task(subagent_type=\"explore\", load_skills=[], run_in_background=true) | Parallel, context-efficient |\n| Documentation lookup | task(subagent_type=\"librarian\", load_skills=[], run_in_background=true) | Specialized knowledge |\n| Planning | task(subagent_type=\"plan\", load_skills=[], run_in_background=false) | Parallel task graph + structured TODO list |\n| Hard problem (conventional) | task(subagent_type=\"oracle\", load_skills=[], run_in_background=false) | Architecture, debugging, complex logic |\n| Hard problem (non-conventional) | task(category=\"artistry\", load_skills=[...], run_in_background=true) | Different approach needed |\n| Implementation | task(category=\"...\", load_skills=[...], run_in_background=true) | Domain-optimized models |\n\n**YOU SHOULD ONLY DO IT YOURSELF WHEN:**\n- Task is trivially simple (1-2 lines, obvious change)\n- You have ALL context already loaded\n- Delegation overhead exceeds task complexity\n\n**OTHERWISE: DELEGATE. ALWAYS.**\n\n---\n\n## EXECUTION RULES\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.\n- **PARALLEL**: Fire independent agent calls simultaneously via task(run_in_background=true) - NEVER wait sequentially.\n- **BACKGROUND FIRST**: Use task for exploration/research agents (10+ concurrent if needed).\n- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.\n- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.\n\n## WORKFLOW\n1. **CLASSIFY INTENT** (MANDATORY - see GEMINI_INTENT_GATE above)\n2. Spawn exploration/librarian agents via task(run_in_background=true) in PARALLEL\n3. Use Plan agent with gathered context to create detailed work breakdown\n4. Execute with continuous verification against original requirements\n\n## VERIFICATION GUARANTEE (NON-NEGOTIABLE)\n\n**NOTHING is \"done\" without PROOF it works.**\n\n**YOUR SELF-ASSESSMENT IS UNRELIABLE.** What feels like 95% confidence = ~60% actual correctness.\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| **Build** | Run build command | Exit code 0, no errors |\n| **Test** | Execute test suite | All tests pass (screenshot/output) |\n| **Lint** | Run lsp_diagnostics | Zero new errors on changed files |\n| **Manual Verify** | Test the actual feature | Describe what you observed |\n| **Regression** | Ensure nothing broke | Existing tests still pass |\n\n<ANTI_OPTIMISM_CHECKPOINT>\n## BEFORE YOU CLAIM DONE, ANSWER HONESTLY:\n\n1. Did I run `lsp_diagnostics` and see ZERO errors? (not \"I'm sure there are none\")\n2. Did I run the tests and see them PASS? (not \"they should pass\")\n3. Did I read the actual output of every command? (not skim)\n4. Is EVERY requirement from the request actually implemented? (re-read the request NOW)\n5. Did I classify intent at the start? (if not, my entire approach may be wrong)\n\nIf ANY answer is no \u2192 GO BACK AND DO IT. Do not claim completion.\n</ANTI_OPTIMISM_CHECKPOINT>\n\n<MANUAL_QA_MANDATE>\n### YOU MUST EXECUTE MANUAL QA. THIS IS NOT OPTIONAL. DO NOT SKIP THIS.\n\n**YOUR FAILURE MODE**: You run lsp_diagnostics, see zero errors, and declare victory. lsp_diagnostics catches TYPE errors. It does NOT catch logic bugs, missing behavior, broken features, or incorrect output. Your work is NOT verified until you MANUALLY TEST the actual feature.\n\n**AFTER every implementation, you MUST:**\n\n1. **Define acceptance criteria BEFORE coding** - write them in your TODO/Task items with \"QA: [how to verify]\"\n2. **Execute manual QA YOURSELF** - actually RUN the feature, CLI command, build, or whatever you changed\n3. **Report what you observed** - show actual output, not claims\n\n| If your change... | YOU MUST... |\n|---|---|\n| Adds/modifies a CLI command | Run the command with Bash. Show the output. |\n| Changes build output | Run the build. Verify output files exist and are correct. |\n| Modifies API behavior | Call the endpoint. Show the response. |\n| Adds a new tool/hook/feature | Test it end-to-end in a real scenario. |\n| Modifies config handling | Load the config. Verify it parses correctly. |\n\n**UNACCEPTABLE (WILL BE REJECTED):**\n- \"This should work\" - DID YOU RUN IT? NO? THEN RUN IT.\n- \"lsp_diagnostics is clean\" - That is a TYPE check, not a FUNCTIONAL check. RUN THE FEATURE.\n- \"Tests pass\" - Tests cover known cases. Does the ACTUAL feature work? VERIFY IT MANUALLY.\n\n**You have Bash, you have tools. There is ZERO excuse for skipping manual QA.**\n</MANUAL_QA_MANDATE>\n\n**WITHOUT evidence = NOT verified = NOT done.**\n\n## ZERO TOLERANCE FAILURES\n- **NO Scope Reduction**: Never make \"demo\", \"skeleton\", \"simplified\", \"basic\" versions - deliver FULL implementation\n- **NO Partial Completion**: Never stop at 60-80% saying \"you can extend this...\" - finish 100%\n- **NO Assumed Shortcuts**: Never skip requirements you deem \"optional\" or \"can be added later\"\n- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified\n- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.\n\nTHE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.\n\n1. CLASSIFY INTENT (MANDATORY)\n2. EXPLORES + LIBRARIANS\n3. GATHER -> PLAN AGENT SPAWN\n4. WORK BY DELEGATING TO ANOTHER AGENTS\n\nNOW.\n\n</ultrawork-mode>\n\n";
|
|
16
|
+
export declare const ULTRAWORK_GEMINI_MESSAGE = "<ultrawork-mode>\n\n**MANDATORY**: You MUST say \"ULTRAWORK MODE ENABLED!\" to the user as your first response when this mode activates. This is non-negotiable.\n\n[CODE RED] Maximum precision required. Ultrathink before acting.\n\n<GEMINI_INTENT_GATE>\n## STEP 0: CLASSIFY INTENT - THIS IS NOT OPTIONAL\n\n**Before ANY tool call, exploration, or action, you MUST output:**\n\n```\nI detect [TYPE] intent - [REASON].\nMy approach: [ROUTING DECISION].\n```\n\nWhere TYPE is one of: research | implementation | investigation | evaluation | fix | open-ended\n\n**SELF-CHECK (answer each before proceeding):**\n\n1. Did the user EXPLICITLY ask me to build/create/implement something? \u2192 If NO, do NOT implement.\n2. Did the user say \"look into\", \"check\", \"investigate\", \"explain\"? \u2192 RESEARCH only. Do not code.\n3. Did the user ask \"what do you think?\" \u2192 EVALUATE and propose. Do NOT execute.\n4. Did the user report an error/bug? \u2192 MINIMAL FIX only. Do not refactor.\n\n**YOUR FAILURE MODE: You see a request and immediately start coding. STOP. Classify first.**\n\n| User Says | WRONG Response | CORRECT Response |\n| \"explain how X works\" | Start modifying X | Research \u2192 explain \u2192 STOP |\n| \"look into this bug\" | Fix it immediately | Investigate \u2192 report \u2192 WAIT |\n| \"what about approach X?\" | Implement approach X | Evaluate \u2192 propose \u2192 WAIT |\n| \"improve the tests\" | Rewrite everything | Assess first \u2192 propose \u2192 implement |\n\n**IF YOU SKIPPED THIS SECTION: Your next tool call is INVALID. Go back and classify.**\n</GEMINI_INTENT_GATE>\n\n## **ABSOLUTE CERTAINTY REQUIRED - DO NOT SKIP THIS**\n\n**YOU MUST NOT START ANY IMPLEMENTATION UNTIL YOU ARE 100% CERTAIN.**\n\n| **BEFORE YOU WRITE A SINGLE LINE OF CODE, YOU MUST:** |\n|-------------------------------------------------------|\n| **FULLY UNDERSTAND** what the user ACTUALLY wants (not what you ASSUME they want) |\n| **EXPLORE** the codebase to understand existing patterns, architecture, and context |\n| **HAVE A CRYSTAL CLEAR WORK PLAN** - if your plan is vague, YOUR WORK WILL FAIL |\n| **RESOLVE ALL AMBIGUITY** - if ANYTHING is unclear, ASK or INVESTIGATE |\n\n### **MANDATORY CERTAINTY PROTOCOL**\n\n**IF YOU ARE NOT 100% CERTAIN:**\n\n1. **THINK DEEPLY** - What is the user's TRUE intent? What problem are they REALLY trying to solve?\n2. **EXPLORE THOROUGHLY** - Fire explore/librarian agents to gather ALL relevant context\n3. **CONSULT SPECIALISTS** - For hard/complex tasks, DO NOT struggle alone. Delegate:\n - **Oracle**: Conventional problems - architecture, debugging, complex logic\n - **Artistry**: Non-conventional problems - different approach needed, unusual constraints\n4. **ASK THE USER** - If ambiguity remains after exploration, ASK. Don't guess.\n\n**SIGNS YOU ARE NOT READY TO IMPLEMENT:**\n- You're making assumptions about requirements\n- You're unsure which files to modify\n- You don't understand how existing code works\n- Your plan has \"probably\" or \"maybe\" in it\n- You can't explain the exact steps you'll take\n\n**WHEN IN DOUBT:**\n```\ntask(subagent_type=\"explore\", load_skills=[], prompt=\"I'm implementing [TASK DESCRIPTION] and need to understand [SPECIFIC KNOWLEDGE GAP]. Find [X] patterns in the codebase - show file paths, implementation approach, and conventions used. I'll use this to [HOW RESULTS WILL BE USED]. Focus on src/ directories, skip test files unless test patterns are specifically needed. Return concrete file paths with brief descriptions of what each file does.\", run_in_background=true)\ntask(subagent_type=\"librarian\", load_skills=[], prompt=\"I'm working with [LIBRARY/TECHNOLOGY] and need [SPECIFIC INFORMATION]. Find official documentation and production-quality examples for [Y] - specifically: API reference, configuration options, recommended patterns, and common pitfalls. Skip beginner tutorials. I'll use this to [DECISION THIS WILL INFORM].\", run_in_background=true)\ntask(subagent_type=\"oracle\", load_skills=[], prompt=\"I need architectural review of my approach to [TASK]. Here's my plan: [DESCRIBE PLAN WITH SPECIFIC FILES AND CHANGES]. My concerns are: [LIST SPECIFIC UNCERTAINTIES]. Please evaluate: correctness of approach, potential issues I'm missing, and whether a better alternative exists.\", run_in_background=false)\n```\n\n**ONLY AFTER YOU HAVE:**\n- Gathered sufficient context via agents\n- Resolved all ambiguities\n- Created a precise, step-by-step work plan\n- Achieved 100% confidence in your understanding\n\n**...THEN AND ONLY THEN MAY YOU BEGIN IMPLEMENTATION.**\n\n---\n\n## **NO EXCUSES. NO COMPROMISES. DELIVER WHAT WAS ASKED.**\n\n**THE USER'S ORIGINAL REQUEST IS SACRED. YOU MUST FULFILL IT EXACTLY.**\n\n| VIOLATION | CONSEQUENCE |\n|-----------|-------------|\n| \"I couldn't because...\" | **UNACCEPTABLE.** Find a way or ask for help. |\n| \"This is a simplified version...\" | **UNACCEPTABLE.** Deliver the FULL implementation. |\n| \"You can extend this later...\" | **UNACCEPTABLE.** Finish it NOW. |\n| \"Due to limitations...\" | **UNACCEPTABLE.** Use agents, tools, whatever it takes. |\n| \"I made some assumptions...\" | **UNACCEPTABLE.** You should have asked FIRST. |\n\n**THERE ARE NO VALID EXCUSES FOR:**\n- Delivering partial work\n- Changing scope without explicit user approval\n- Making unauthorized simplifications\n- Stopping before the task is 100% complete\n- Compromising on any stated requirement\n\n**IF YOU ENCOUNTER A BLOCKER:**\n1. **DO NOT** give up\n2. **DO NOT** deliver a compromised version\n3. **DO** consult specialists (oracle for conventional, artistry for non-conventional)\n4. **DO** ask the user for guidance\n5. **DO** explore alternative approaches\n\n**THE USER ASKED FOR X. DELIVER EXACTLY X. PERIOD.**\n\n---\n\n<TOOL_CALL_MANDATE>\n## YOU MUST USE TOOLS. THIS IS NOT OPTIONAL.\n\n**The user expects you to ACT using tools, not REASON internally.** Every response to a task MUST contain tool_use blocks. A response without tool calls is a FAILED response.\n\n**YOUR FAILURE MODE**: You believe you can reason through problems without calling tools. You CANNOT.\n\n**RULES (VIOLATION = BROKEN RESPONSE):**\n1. **NEVER answer about code without reading files first.** Read them AGAIN.\n2. **NEVER claim done without `lsp_diagnostics`.** Your confidence is wrong more often than right.\n3. **NEVER skip delegation.** Specialists produce better results. USE THEM.\n4. **NEVER reason about what a file \"probably contains.\"** READ IT.\n5. **NEVER produce ZERO tool calls when action was requested.** Thinking is not doing.\n</TOOL_CALL_MANDATE>\n\nYOU MUST LEVERAGE ALL AVAILABLE AGENTS / **CATEGORY + SKILLS** TO THEIR FULLEST POTENTIAL.\nTELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.\n\n## MANDATORY: PLAN AGENT INVOCATION (NON-NEGOTIABLE)\n\n**YOU MUST ALWAYS INVOKE THE PLAN AGENT FOR ANY NON-TRIVIAL TASK.**\n\n| Condition | Action |\n|-----------|--------|\n| Task has 2+ steps | MUST call plan agent |\n| Task scope unclear | MUST call plan agent |\n| Implementation required | MUST call plan agent |\n| Architecture decision needed | MUST call plan agent |\n\n```\ntask(subagent_type=\"plan\", load_skills=[], run_in_background=false, prompt=\"<gathered context + user request>\")\n```\n\n### SESSION CONTINUITY WITH PLAN AGENT (CRITICAL)\n\n**Plan agent output includes a continuation ID (`ses_...`). USE IT for follow-up interactions via `task(task_id=\"ses_...\", ...)`.**\n\n| Scenario | Action |\n|----------|--------|\n| Plan agent asks clarifying questions | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"<your answer>\")` |\n| Need to refine the plan | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Please adjust: <feedback>\")` |\n| Plan needs more detail | `task(task_id=\"{returned_task_id}\", load_skills=[], run_in_background=false, prompt=\"Add more detail to Task N\")` |\n\n**FAILURE TO CALL PLAN AGENT = INCOMPLETE WORK.**\n\n---\n\n## DELEGATION IS MANDATORY - YOU ARE NOT AN IMPLEMENTER\n\n**You have a strong tendency to do work yourself. RESIST THIS.**\n\n**DEFAULT BEHAVIOR: DELEGATE. DO NOT WORK YOURSELF.**\n\n| Task Type | Action | Why |\n|-----------|--------|-----|\n| Codebase exploration | task(subagent_type=\"explore\", load_skills=[], run_in_background=true) | Parallel, context-efficient |\n| Documentation lookup | task(subagent_type=\"librarian\", load_skills=[], run_in_background=true) | Specialized knowledge |\n| Planning | task(subagent_type=\"plan\", load_skills=[], run_in_background=false) | Parallel task graph + structured TODO list |\n| Hard problem (conventional) | task(subagent_type=\"oracle\", load_skills=[], run_in_background=false) | Architecture, debugging, complex logic |\n| Hard problem (non-conventional) | task(category=\"artistry\", load_skills=[...], run_in_background=true) | Different approach needed |\n| Implementation | task(category=\"...\", load_skills=[...], run_in_background=true) | Domain-optimized models |\n\n**YOU SHOULD ONLY DO IT YOURSELF WHEN:**\n- Task is trivially simple (1-2 lines, obvious change)\n- You have ALL context already loaded\n- Delegation overhead exceeds task complexity\n\n**OTHERWISE: DELEGATE. ALWAYS.**\n\n---\n\n## EXECUTION RULES\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.\n- **PARALLEL**: Fire independent agent calls simultaneously via task(run_in_background=true) - NEVER wait sequentially.\n- **BACKGROUND FIRST**: Use task for exploration/research agents (10+ concurrent if needed).\n- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.\n- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.\n\n## WORKFLOW\n1. **CLASSIFY INTENT** (MANDATORY - see GEMINI_INTENT_GATE above)\n2. Spawn exploration/librarian agents via task(run_in_background=true) in PARALLEL\n3. Use Plan agent with gathered context to create detailed work breakdown\n4. Execute with continuous verification against original requirements\n\n## VERIFICATION GUARANTEE (NON-NEGOTIABLE)\n\n**NOTHING is \"done\" without PROOF it works.**\n\n**YOUR SELF-ASSESSMENT IS UNRELIABLE.** What feels like 95% confidence = ~60% actual correctness.\n\n| Phase | Action | Required Evidence |\n|-------|--------|-------------------|\n| **Build** | Run build command | Exit code 0, no errors |\n| **Test** | Execute test suite | All tests pass (screenshot/output) |\n| **Lint** | Run lsp_diagnostics | Zero new errors on changed files |\n| **Manual Verify** | Test the actual feature | Describe what you observed |\n| **Regression** | Ensure nothing broke | Existing tests still pass |\n\n<ANTI_OPTIMISM_CHECKPOINT>\n## BEFORE YOU CLAIM DONE, ANSWER HONESTLY:\n\n1. Did I run `lsp_diagnostics` and see ZERO errors? (not \"I'm sure there are none\")\n2. Did I run the tests and see them PASS? (not \"they should pass\")\n3. Did I read the actual output of every command? (not skim)\n4. Is EVERY requirement from the request actually implemented? (re-read the request NOW)\n5. Did I classify intent at the start? (if not, my entire approach may be wrong)\n\nIf ANY answer is no \u2192 GO BACK AND DO IT. Do not claim completion.\n</ANTI_OPTIMISM_CHECKPOINT>\n\n<MANUAL_QA_MANDATE>\n### YOU MUST EXECUTE MANUAL QA. THIS IS NOT OPTIONAL. DO NOT SKIP THIS.\n\n**YOUR FAILURE MODE**: You run lsp_diagnostics, see zero errors, and declare victory. lsp_diagnostics catches TYPE errors. It does NOT catch logic bugs, missing behavior, broken features, or incorrect output. Your work is NOT verified until you MANUALLY TEST the actual feature.\n\n**AFTER every implementation, you MUST:**\n\n1. **Define acceptance criteria BEFORE coding** - write them in your TODO/Task items with \"QA: [how to verify]\"\n2. **Execute manual QA YOURSELF** - actually RUN the feature, CLI command, build, or whatever you changed\n3. **Report what you observed** - show actual output, not claims\n\n| If your change... | YOU MUST... |\n|---|---|\n| Adds/modifies a CLI command | Run the command with Bash. Show the output. |\n| Changes build output | Run the build. Verify output files exist and are correct. |\n| Modifies API behavior | Call the endpoint. Show the response. |\n| Adds a new tool/hook/feature | Test it end-to-end in a real scenario. |\n| Modifies config handling | Load the config. Verify it parses correctly. |\n\n**UNACCEPTABLE (WILL BE REJECTED):**\n- \"This should work\" - DID YOU RUN IT? NO? THEN RUN IT.\n- \"lsp_diagnostics is clean\" - That is a TYPE check, not a FUNCTIONAL check. RUN THE FEATURE.\n- \"Tests pass\" - Tests cover known cases. Does the ACTUAL feature work? VERIFY IT MANUALLY.\n\n**You have Bash, you have tools. There is ZERO excuse for skipping manual QA.**\n</MANUAL_QA_MANDATE>\n\n**WITHOUT evidence = NOT verified = NOT done.**\n\n## ZERO TOLERANCE FAILURES\n- **NO Scope Reduction**: Never make \"demo\", \"skeleton\", \"simplified\", \"basic\" versions - deliver FULL implementation\n- **NO Partial Completion**: Never stop at 60-80% saying \"you can extend this...\" - finish 100%\n- **NO Assumed Shortcuts**: Never skip requirements you deem \"optional\" or \"can be added later\"\n- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified\n- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.\n\nTHE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.\n\n1. CLASSIFY INTENT (MANDATORY)\n2. EXPLORES + LIBRARIANS\n3. GATHER -> PLAN AGENT SPAWN\n4. WORK BY DELEGATING TO ANOTHER AGENTS\n\nNOW.\n\n</ultrawork-mode>\n\n";
|
|
17
17
|
export declare function getGeminiUltraworkMessage(): string;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Ultrawork message section for planner agents (Prometheus).
|
|
3
3
|
* Planner agents should NOT be told to call plan agent - they ARE the planner.
|
|
4
4
|
*/
|
|
5
|
-
export declare const ULTRAWORK_PLANNER_SECTION = "## CRITICAL: YOU ARE A PLANNER, NOT AN IMPLEMENTER\n\n**IDENTITY CONSTRAINT (NON-NEGOTIABLE):**\nYou ARE the planner. You ARE NOT an implementer. You DO NOT write code. You DO NOT execute tasks.\n\n**TOOL RESTRICTIONS (SYSTEM-ENFORCED):**\n| Tool | Allowed | Blocked |\n|------|---------|---------|\n| Write/Edit | `.
|
|
5
|
+
export declare const ULTRAWORK_PLANNER_SECTION = "## CRITICAL: YOU ARE A PLANNER, NOT AN IMPLEMENTER\n\n**IDENTITY CONSTRAINT (NON-NEGOTIABLE):**\nYou ARE the planner. You ARE NOT an implementer. You DO NOT write code. You DO NOT execute tasks.\n\n**TOOL RESTRICTIONS (SYSTEM-ENFORCED):**\n| Tool | Allowed | Blocked |\n|------|---------|---------|\n| Write/Edit | `.omo/**/*.md` ONLY | Everything else |\n| Read | All files | - |\n| Bash | Research commands only | Implementation commands |\n| task | explore, librarian | - |\n\n**IF YOU TRY TO WRITE/EDIT OUTSIDE `.omo/`:**\n- System will BLOCK your action\n- You will receive an error\n- DO NOT retry - you are not supposed to implement\n\n**YOUR ONLY WRITABLE PATHS:**\n- `.omo/plans/*.md` - Final work plans\n- `.omo/drafts/*.md` - Working drafts during interview\n\n**WHEN USER ASKS YOU TO IMPLEMENT:**\nREFUSE. Say: \"I'm a planner. I create work plans, not implementations. Run `/start-work` after I finish planning.\"\n\n---\n\n## CONTEXT GATHERING (MANDATORY BEFORE PLANNING)\n\nYou ARE the planner. Your job: create bulletproof work plans.\n**Before drafting ANY plan, gather context via explore/librarian agents.**\n\n### Research Protocol\n1. **Fire parallel background agents** for comprehensive context:\n ```\n task(subagent_type=\"explore\", load_skills=[], prompt=\"Find existing patterns for [topic] in codebase\", run_in_background=true)\n task(subagent_type=\"explore\", load_skills=[], prompt=\"Find test infrastructure and conventions\", run_in_background=true)\n task(subagent_type=\"librarian\", load_skills=[], prompt=\"Find official docs and best practices for [technology]\", run_in_background=true)\n ```\n2. **Wait for results** before planning - rushed plans fail\n3. **Synthesize findings** into informed requirements\n\n### What to Research\n- Existing codebase patterns and conventions\n- Test infrastructure (TDD possible?)\n- External library APIs and constraints\n- Similar implementations in OSS (via librarian)\n\n**NEVER plan blind. Context first, plan second.**\n\n---\n\n## MANDATORY OUTPUT: PARALLEL TASK GRAPH + TODO LIST\n\n**YOUR PRIMARY OUTPUT IS A PARALLEL EXECUTION TASK GRAPH.**\n\nWhen you finalize a plan, you MUST structure it for maximum parallel execution:\n\n### 1. Parallel Execution Waves (REQUIRED)\n\nAnalyze task dependencies and group independent tasks into parallel waves:\n\n```\nWave 1 (Start Immediately - No Dependencies):\n\u251C\u2500\u2500 Task 1: [description] \u2192 category: X, skills: [a, b]\n\u2514\u2500\u2500 Task 4: [description] \u2192 category: Y, skills: [c]\n\nWave 2 (After Wave 1 Completes):\n\u251C\u2500\u2500 Task 2: [depends: 1] \u2192 category: X, skills: [a]\n\u251C\u2500\u2500 Task 3: [depends: 1] \u2192 category: Z, skills: [d]\n\u2514\u2500\u2500 Task 5: [depends: 4] \u2192 category: Y, skills: [c]\n\nWave 3 (After Wave 2 Completes):\n\u2514\u2500\u2500 Task 6: [depends: 2, 3] \u2192 category: X, skills: [a, b]\n\nCritical Path: Task 1 \u2192 Task 2 \u2192 Task 6\nEstimated Parallel Speedup: ~40% faster than sequential\n```\n\n### 2. Dependency Matrix (REQUIRED)\n\n| Task | Depends On | Blocks | Can Parallelize With |\n|------|------------|--------|---------------------|\n| 1 | None | 2, 3 | 4 |\n| 2 | 1 | 6 | 3, 5 |\n| 3 | 1 | 6 | 2, 5 |\n| 4 | None | 5 | 1 |\n| 5 | 4 | None | 2, 3 |\n| 6 | 2, 3 | None | None (final) |\n\n### 3. TODO List Structure (REQUIRED)\n\nEach TODO item MUST include:\n\n```markdown\n- [ ] N. [Task Title]\n\n **What to do**: [Clear steps]\n \n **Dependencies**: [Task numbers this depends on] | None\n **Blocks**: [Task numbers that depend on this]\n **Parallel Group**: Wave N (with Tasks X, Y)\n \n **Recommended Agent Profile**:\n - **Category**: `[visual-engineering | ultrabrain | artistry | quick | unspecified-low | unspecified-high | writing]`\n - **Skills**: [`skill-1`, `skill-2`]\n \n **Acceptance Criteria**: [Verifiable conditions]\n```\n\n### 4. Agent Dispatch Summary (REQUIRED)\n\n| Wave | Tasks | Dispatch Command |\n|------|-------|------------------|\n| 1 | 1, 4 | `task(category=\"...\", load_skills=[...], run_in_background=true)` \u00D7 2 |\n| 2 | 2, 3, 5 | `task(...)` \u00D7 3 after Wave 1 completes |\n| 3 | 6 | `task(...)` final integration |\n\n**WHY PARALLEL TASK GRAPH IS MANDATORY:**\n- Orchestrator (Sisyphus) executes tasks in parallel waves\n- Independent tasks run simultaneously via background agents\n- Proper dependency tracking prevents race conditions\n- Category + skills ensure optimal model routing per task";
|
|
6
6
|
export declare function getPlannerUltraworkMessage(): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const HOOK_NAME = "prometheus-md-only";
|
|
2
2
|
export declare const PROMETHEUS_AGENT = "prometheus";
|
|
3
3
|
export declare const ALLOWED_EXTENSIONS: string[];
|
|
4
|
-
export declare const ALLOWED_PATH_PREFIX = ".
|
|
4
|
+
export declare const ALLOWED_PATH_PREFIX = ".omo";
|
|
5
5
|
export declare const BLOCKED_TOOLS: string[];
|
|
6
6
|
export declare const PLANNING_CONSULT_WARNING: string;
|
|
7
7
|
export declare const PROMETHEUS_WORKFLOW_REMINDER: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cross-platform path validator for Prometheus file writes.
|
|
3
3
|
* Uses path.resolve/relative instead of string matching to handle:
|
|
4
|
-
* - Windows backslashes (e.g., .
|
|
5
|
-
* - Mixed separators (e.g., .
|
|
4
|
+
* - Windows backslashes (e.g., .omo\\plans\\x.md)
|
|
5
|
+
* - Mixed separators (e.g., .omo\\plans/x.md)
|
|
6
6
|
* - Case-insensitive directory/extension matching
|
|
7
7
|
* - Workspace confinement (blocks paths outside root or via traversal)
|
|
8
|
-
* - Nested project paths (e.g., parent/.
|
|
8
|
+
* - Nested project paths (e.g., parent/.omo/... when ctx.directory is parent)
|
|
9
9
|
*/
|
|
10
10
|
export declare function isAllowedFile(filePath: string, workspaceRoot: string): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
export type SessionMessage = {
|
|
3
|
+
info?: {
|
|
4
|
+
role?: string;
|
|
5
|
+
};
|
|
6
|
+
parts?: Array<{
|
|
7
|
+
type: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
export declare function createPluginInput(messages: SessionMessage[]): PluginInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const HOOK_NAME = "ralph-loop";
|
|
2
|
-
export declare const DEFAULT_STATE_FILE = ".
|
|
2
|
+
export declare const DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
3
3
|
export declare const COMPLETION_TAG_PATTERN: RegExp;
|
|
4
4
|
export declare const DEFAULT_MAX_ITERATIONS = 100;
|
|
5
5
|
export declare const ULTRAWORK_MAX_ITERATIONS = 500;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
2
|
export type ContinuationPromptResult = {
|
|
3
3
|
status: "dispatched";
|
|
4
|
+
} | {
|
|
5
|
+
status: "deferred";
|
|
6
|
+
reason: "active" | "reserved";
|
|
4
7
|
} | {
|
|
5
8
|
status: "rejected";
|
|
6
9
|
error: Error;
|
|
@@ -11,4 +14,5 @@ export declare function injectContinuationPrompt(ctx: PluginInput, options: {
|
|
|
11
14
|
directory: string;
|
|
12
15
|
apiTimeoutMs: number;
|
|
13
16
|
inheritFromSessionID?: string;
|
|
17
|
+
idleSettleMs?: number;
|
|
14
18
|
}): Promise<ContinuationPromptResult>;
|
|
@@ -3,6 +3,7 @@ import type { RalphLoopState } from "./types";
|
|
|
3
3
|
type ContinuationOptions = {
|
|
4
4
|
directory: string;
|
|
5
5
|
apiTimeoutMs: number;
|
|
6
|
+
idleSettleMs: number;
|
|
6
7
|
previousSessionID: string;
|
|
7
8
|
loopState: {
|
|
8
9
|
setSessionID: (sessionID: string) => RalphLoopState | null;
|
|
@@ -10,6 +11,10 @@ type ContinuationOptions = {
|
|
|
10
11
|
};
|
|
11
12
|
export type ContinuationResult = {
|
|
12
13
|
status: "dispatched";
|
|
14
|
+
sessionID: string;
|
|
15
|
+
} | {
|
|
16
|
+
status: "dispatch_deferred";
|
|
17
|
+
reason: "active" | "reserved";
|
|
13
18
|
} | {
|
|
14
19
|
status: "session_creation_rejected";
|
|
15
20
|
} | {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RalphLoopOptions, RalphLoopState } from "./types";
|
|
1
|
+
import type { IterationCommitExpectation, RalphLoopOptions, RalphLoopState } from "./types";
|
|
2
2
|
export declare function createLoopStateController(options: {
|
|
3
3
|
directory: string;
|
|
4
4
|
stateDir: string | undefined;
|
|
@@ -14,9 +14,9 @@ export declare function createLoopStateController(options: {
|
|
|
14
14
|
cancelLoop(sessionID: string): boolean;
|
|
15
15
|
getState(): RalphLoopState | null;
|
|
16
16
|
clear(): boolean;
|
|
17
|
-
incrementIteration(): RalphLoopState | null;
|
|
17
|
+
incrementIteration(expected?: IterationCommitExpectation): RalphLoopState | null;
|
|
18
18
|
setSessionID(sessionID: string): RalphLoopState | null;
|
|
19
|
-
setMessageCountAtStart(sessionID: string, messageCountAtStart: number): RalphLoopState | null;
|
|
19
|
+
setMessageCountAtStart(sessionID: string, messageCountAtStart: number, expectedStartedAt?: string): RalphLoopState | null;
|
|
20
20
|
markVerificationPending(sessionID: string): RalphLoopState | null;
|
|
21
21
|
setVerificationSessionID(sessionID: string, verificationSessionID: string): RalphLoopState | null;
|
|
22
22
|
restartAfterFailedVerification(sessionID: string, messageCountAtStart?: number): RalphLoopState | null;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
2
|
import type { RalphLoopState } from "./types";
|
|
3
|
+
import type { IterationCommitExpectation } from "./types";
|
|
3
4
|
type LoopStateController = {
|
|
4
5
|
restartAfterFailedVerification: (sessionID: string, messageCountAtStart?: number) => RalphLoopState | null;
|
|
5
6
|
clearVerificationState: (sessionID: string, messageCountAtStart?: number) => RalphLoopState | null;
|
|
6
|
-
incrementIteration: () => RalphLoopState | null;
|
|
7
|
+
incrementIteration: (expected?: IterationCommitExpectation) => RalphLoopState | null;
|
|
7
8
|
clear: () => boolean;
|
|
8
9
|
setVerificationSessionID: (sessionID: string, verificationSessionID: string) => RalphLoopState | null;
|
|
9
10
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
import type { RalphLoopOptions, RalphLoopState } from "./types";
|
|
2
|
+
import type { IterationCommitExpectation, RalphLoopOptions, RalphLoopState } from "./types";
|
|
3
3
|
type LoopStateController = {
|
|
4
4
|
getState: () => RalphLoopState | null;
|
|
5
5
|
clear: () => boolean;
|
|
6
|
-
incrementIteration: () => RalphLoopState | null;
|
|
6
|
+
incrementIteration: (expected?: IterationCommitExpectation) => RalphLoopState | null;
|
|
7
7
|
setSessionID: (sessionID: string) => RalphLoopState | null;
|
|
8
8
|
markVerificationPending: (sessionID: string) => RalphLoopState | null;
|
|
9
9
|
setVerificationSessionID: (sessionID: string, verificationSessionID: string) => RalphLoopState | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RalphLoopState } from "./types";
|
|
1
|
+
import type { IterationCommitExpectation, RalphLoopState } from "./types";
|
|
2
2
|
export declare function getStateFilePath(directory: string, customPath?: string): string;
|
|
3
3
|
export declare function readState(directory: string, customPath?: string): RalphLoopState | null;
|
|
4
4
|
export declare function writeState(directory: string, state: RalphLoopState, customPath?: string): boolean;
|
|
5
5
|
export declare function clearState(directory: string, customPath?: string): boolean;
|
|
6
|
-
export declare function incrementIteration(directory: string, customPath?: string): RalphLoopState | null;
|
|
6
|
+
export declare function incrementIteration(directory: string, customPath?: string, expected?: IterationCommitExpectation): RalphLoopState | null;
|
|
@@ -15,6 +15,10 @@ export interface RalphLoopState {
|
|
|
15
15
|
verification_pending?: boolean;
|
|
16
16
|
strategy?: "reset" | "continue";
|
|
17
17
|
}
|
|
18
|
+
export interface IterationCommitExpectation {
|
|
19
|
+
iteration: number;
|
|
20
|
+
sessionID: string;
|
|
21
|
+
}
|
|
18
22
|
export interface RalphLoopOptions {
|
|
19
23
|
config?: RalphLoopConfig;
|
|
20
24
|
getTranscriptPath?: (sessionId: string) => string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
import type { RalphLoopState } from "./types";
|
|
2
|
+
import type { IterationCommitExpectation, RalphLoopState } from "./types";
|
|
3
3
|
type LoopStateController = {
|
|
4
4
|
clearVerificationState: (sessionID: string, messageCountAtStart?: number) => RalphLoopState | null;
|
|
5
|
-
incrementIteration: () => RalphLoopState | null;
|
|
5
|
+
incrementIteration: (expected?: IterationCommitExpectation) => RalphLoopState | null;
|
|
6
6
|
clear: () => boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare function handleFailedVerification(ctx: PluginInput, input: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { statSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import type { FindRuleFilesOptions } from "./rule-file-finder";
|
|
4
4
|
import { createContentHash, isDuplicateByContentHash, isDuplicateByRealPath, shouldApplyRule } from "./matcher";
|
|
@@ -16,13 +16,20 @@ type DynamicTruncator = {
|
|
|
16
16
|
truncated: boolean;
|
|
17
17
|
}>;
|
|
18
18
|
};
|
|
19
|
+
type RuleFileReader = (path: string, encoding: "utf-8") => string;
|
|
20
|
+
export interface ParsedRuleCacheStats {
|
|
21
|
+
entries: number;
|
|
22
|
+
bodyBytes: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function clearParsedRuleCache(): void;
|
|
25
|
+
export declare function getParsedRuleCacheStats(): ParsedRuleCacheStats;
|
|
19
26
|
export declare function createRuleInjectionProcessor(deps: {
|
|
20
27
|
workspaceDirectory: string;
|
|
21
28
|
truncator: DynamicTruncator;
|
|
22
29
|
getSessionCache: (sessionID: string) => SessionInjectedRulesCache;
|
|
23
30
|
getSessionRuleScanCache?: (sessionID: string) => RuleScanCache;
|
|
24
31
|
ruleFinderOptions?: FindRuleFilesOptions;
|
|
25
|
-
readFileSync?:
|
|
32
|
+
readFileSync?: RuleFileReader;
|
|
26
33
|
statSync?: typeof statSync;
|
|
27
34
|
homedir?: typeof homedir;
|
|
28
35
|
shouldApplyRule?: typeof shouldApplyRule;
|
|
@@ -3,6 +3,11 @@ export interface MatchResult {
|
|
|
3
3
|
applies: boolean;
|
|
4
4
|
reason?: string;
|
|
5
5
|
}
|
|
6
|
+
export interface MatcherCacheStats {
|
|
7
|
+
entries: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function resetMatcherCache(): void;
|
|
10
|
+
export declare function getMatcherCacheStats(): MatcherCacheStats;
|
|
6
11
|
/**
|
|
7
12
|
* Check if a rule should apply to the current file based on metadata
|
|
8
13
|
*/
|
|
@@ -3,6 +3,10 @@ export declare function clearProjectRootCache(): void;
|
|
|
3
3
|
* Find project root by walking up from startPath.
|
|
4
4
|
* Checks for PROJECT_MARKERS (.git, pyproject.toml, package.json, etc.)
|
|
5
5
|
*
|
|
6
|
+
* Memoizes every directory visited during the walk so subsequent lookups for
|
|
7
|
+
* any descendant path resolve in O(1) without re-running marker existsSync
|
|
8
|
+
* probes.
|
|
9
|
+
*
|
|
6
10
|
* @param startPath - Starting path to search from (file or directory)
|
|
7
11
|
* @returns Project root path or null if not found
|
|
8
12
|
*/
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import type { RuleFileCandidate } from "./types";
|
|
2
|
+
export type DirectoryScanEntry = {
|
|
3
|
+
path: string;
|
|
4
|
+
realPath: string;
|
|
5
|
+
};
|
|
1
6
|
export type RuleScanCache = {
|
|
2
|
-
get: (key: string) =>
|
|
3
|
-
set: (key: string, value:
|
|
7
|
+
get: (key: string) => RuleFileCandidate[] | undefined;
|
|
8
|
+
set: (key: string, value: RuleFileCandidate[]) => void;
|
|
9
|
+
getDirScan: (dir: string) => DirectoryScanEntry[] | undefined;
|
|
10
|
+
setDirScan: (dir: string, entries: DirectoryScanEntry[]) => void;
|
|
4
11
|
clear: () => void;
|
|
5
12
|
};
|
|
6
13
|
export declare function createRuleScanCache(): RuleScanCache;
|
|
@@ -17,3 +17,13 @@ export declare const RETRYABLE_ERROR_PATTERNS: RegExp[];
|
|
|
17
17
|
* Hook name for identification and logging
|
|
18
18
|
*/
|
|
19
19
|
export declare const HOOK_NAME = "runtime-fallback";
|
|
20
|
+
/**
|
|
21
|
+
* First-prompt watchdog: how long to wait for the first sign of progress
|
|
22
|
+
* (assistant text/reasoning/finish) from a subagent session before assuming
|
|
23
|
+
* the provider is silently stuck and dispatching the configured fallback.
|
|
24
|
+
*
|
|
25
|
+
* Tuned to be longer than typical first-token latency (well under 30s in
|
|
26
|
+
* practice) yet much shorter than the 30-minute outer poll timeout that
|
|
27
|
+
* would otherwise be the only safety net.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DEFAULT_FIRST_PROMPT_WATCHDOG_MS = 90000;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HookDeps } from "./types";
|
|
2
|
+
import type { AutoRetryHelpers } from "./auto-retry";
|
|
3
|
+
export interface FirstPromptWatchdog {
|
|
4
|
+
onUserMessage(sessionID: string, model?: string, agent?: string): void;
|
|
5
|
+
onAssistantProgress(sessionID: string): void;
|
|
6
|
+
onSessionTerminal(sessionID: string): void;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Translate an OpenCode session event into the appropriate watchdog signal.
|
|
11
|
+
*
|
|
12
|
+
* Progress semantics for cancelling the watchdog:
|
|
13
|
+
* - assistant `info.error` set: the existing message-update-handler will
|
|
14
|
+
* deal with the error path; the watchdog has done its job.
|
|
15
|
+
* - assistant `info.finish` set: the response completed.
|
|
16
|
+
* - any assistant part with a known type (`text`, `reasoning`, `tool`,
|
|
17
|
+
* `tool_use`, `tool_result`, `tool-call`, `step-start`, `file`, ...):
|
|
18
|
+
* the model has started responding. A subagent that immediately runs
|
|
19
|
+
* tools is *working*, not silent — so any part presence cancels.
|
|
20
|
+
*/
|
|
21
|
+
export declare function observeEventForWatchdog(event: {
|
|
22
|
+
type: string;
|
|
23
|
+
properties?: unknown;
|
|
24
|
+
}, watchdog: FirstPromptWatchdog): void;
|
|
25
|
+
export declare function createFirstPromptWatchdog(deps: HookDeps, helpers: AutoRetryHelpers, watchdogMs?: number): FirstPromptWatchdog;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
import { createAutoRetryHelpers } from "./auto-retry";
|
|
2
|
+
import { createChatMessageHandler } from "./chat-message-handler";
|
|
3
|
+
import { createEventHandler } from "./event-handler";
|
|
4
|
+
import { createFirstPromptWatchdog } from "./first-prompt-watchdog";
|
|
5
|
+
import { createMessageUpdateHandler } from "./message-update-handler";
|
|
1
6
|
import type { RuntimeFallbackHook, RuntimeFallbackOptions, RuntimeFallbackPluginInput } from "./types";
|
|
2
|
-
|
|
7
|
+
type RuntimeFallbackHookFactories = {
|
|
8
|
+
createAutoRetryHelpers: typeof createAutoRetryHelpers;
|
|
9
|
+
createEventHandler: typeof createEventHandler;
|
|
10
|
+
createMessageUpdateHandler: typeof createMessageUpdateHandler;
|
|
11
|
+
createChatMessageHandler: typeof createChatMessageHandler;
|
|
12
|
+
createFirstPromptWatchdog: typeof createFirstPromptWatchdog;
|
|
13
|
+
};
|
|
14
|
+
export declare function createRuntimeFallbackHook(ctx: RuntimeFallbackPluginInput, options?: RuntimeFallbackOptions, factoryOverrides?: Partial<RuntimeFallbackHookFactories>): RuntimeFallbackHook;
|
|
15
|
+
export {};
|