Skip to content

[GPT 5.4 v3 — PR 6/6] Add Google Gemini execution guidance via prompt overlay #66352

Description

@100yenadmin

Parent: #66345 — GPT 5.4 Enhancement v3: Hermes Parity Sprint

Priority: P2 — LOW
Type: Feature / Provider Support

Problem

Hermes Agent includes Gemini/Gemma-specific operational guidance (GOOGLE_MODEL_OPERATIONAL_GUIDANCE in prompt_builder.py lines 256-276) that addresses known Gemini failure modes: relative paths, missing dependency checks, interactive CLI prompts hanging, and sequential-when-parallel tool calls.

OpenClaw's Google extension (extensions/google/) has no prompt-overlay.ts and doesn't use resolveSystemPromptContribution. Gemini models on OpenClaw get the generic execution bias only.

Hermes Reference

GOOGLE_MODEL_OPERATIONAL_GUIDANCE = (
    "# Google model operational directives\n"
    "Follow these operational rules strictly:\n"
    "- **Absolute paths:** Always construct and use absolute file paths...\n"
    "- **Verify first:** Use read_file/search_files to check file contents...\n"
    "- **Dependency checks:** Never assume a library is available...\n"
    "- **Conciseness:** Keep explanatory text brief...\n"
    "- **Parallel tool calls:** When you need to perform multiple independent "
    "operations, make all the tool calls in a single response...\n"
    "- **Non-interactive commands:** Use flags like -y, --yes, --non-interactive...\n"
    "- **Keep going:** Work autonomously until the task is fully resolved...\n"
)

Proposed Implementation

New File: extensions/google/prompt-overlay.ts

export const GOOGLE_GEMINI_EXECUTION_GUIDANCE = `## Gemini Operational Directives

Follow these operational rules strictly:
- **Absolute paths:** Always construct and use absolute file paths for all file system operations.
- **Verify first:** Use read or search tools to check file contents and project structure before making changes.
- **Dependency checks:** Never assume a library is available. Check package.json, requirements.txt, etc.
- **Parallel tool calls:** When performing multiple independent operations, make all tool calls in a single response.
- **Non-interactive commands:** Use flags like -y, --yes, --non-interactive to prevent CLI tools from hanging.
- **Keep going:** Work autonomously until the task is fully resolved.`;

export function resolveGoogleSystemPromptContribution(params) {
  // Returns { sectionOverrides: { tool_enforcement: GOOGLE_GEMINI_EXECUTION_GUIDANCE } }
  // Only for Google provider IDs
}

File: extensions/google/provider-registration.ts

Wire resolveSystemPromptContribution into the provider:

import { resolveGoogleSystemPromptContribution } from "./prompt-overlay.js";

// In registerGoogleProvider:
api.registerProvider({
  ...existingConfig,
  resolveSystemPromptContribution: (ctx) =>
    resolveGoogleSystemPromptContribution({
      modelProviderId: "google",
      modelId: ctx.modelId,
    }),
});

Architecture

  ┌─────────────────────────────────────────────────────┐
  │  Provider Prompt Overlay Pattern                     │
  │                                                      │
  │  extensions/openai/prompt-overlay.ts  (exists)       │
  │  ├── GPT-5 execution bias                            │
  │  ├── GPT-5 tool enforcement                          │
  │  ├── GPT-5 output contract                           │
  │  └── Friendly personality overlay                    │
  │                                                      │
  │  extensions/google/prompt-overlay.ts  (NEW)          │
  │  └── Gemini operational directives                   │
  │      (absolute paths, verify first, parallel calls)  │
  │                                                      │
  │  Both use: sectionOverrides.tool_enforcement         │
  │  from PR 3's first-class section                     │
  └─────────────────────────────────────────────────────┘

Dependencies

Verification

  • Test: Gemini models receive operational directives in system prompt
  • Test: Non-Google models don't receive Gemini directives
  • Manual: Run Gemini on a file-manipulation task, verify it uses absolute paths

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions