Skip to content

Support the CodeGraph UserPromptSubmit hook in Codex CLI #3335

Open

Description

@passanger68

Feature request

Extend codegraph install --target=codex to offer the same prompt-time CodeGraph context that the Claude Code target offers. Codex CLI now supports UserPromptSubmit. It sends prompt and cwd in the hook stdin JSON and adds plain-text stdout to the model's context.

Current behavior

In CodeGraph v1.6.3, the installer offers the front-load hook only when Claude Code is selected. The Codex target registers the MCP server and adds AGENTS.md guidance. Codex still decides whether to make an MCP call. With the prompt hook registered, a matching structural question can get CodeGraph context before the model picks its first tool.

Compatibility check

On Windows x64 with CodeGraph v1.6.3 and Codex CLI 0.169.0, I passed a Codex-shaped UserPromptSubmit payload directly to the existing hook command:

@{
    hook_event_name = 'UserPromptSubmit'
    cwd = (Get-Location).Path
    prompt = 'Where is the Flutter app entry point main?'
} | ConvertTo-Json -Compress | codegraph.cmd prompt-hook

Run this from an indexed Flutter project. In my test the command returned a plain-text <codegraph_context> block. This verifies the command's input and output directly. I have not yet tested registration and context delivery in a live Codex turn.

Proposed behavior

  • Offer Codex prompt-hook setup alongside the existing MCP and instructions setup, reusing codegraph prompt-hook (codegraph.cmd prompt-hook on Windows).
  • Register it for UserPromptSubmit at the selected user or project scope. Preserve existing hooks and remove only the CodeGraph entry on uninstall.
  • Document Codex's hook review and trust step via /hooks and keep the existing behavior for prompts and projects that produce no CodeGraph context.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions