Skip to content

install-hooks: verify whether pi/omp extension paths should honor PI_CODING_AGENT_DIR #406

Description

@akitaonrails

Found while auditing config-path resolution after #75376ac (CODEX_HOME).

The question

install_hooks.rs hardcodes these:

  • pi_extension_path()~/.pi/agent/extensions/ai-memory.ts
  • omp_extension_path()~/.omp/agent/extensions/ai-memory.ts

Meanwhile ai-memory-workstream's harness adapter does honor env overrides for the same two agents when locating transcripts:

ManagedHarness::Pi  => value("PI_CODING_AGENT_SESSION_DIR")
                        .or_else(|| value("PI_CODING_AGENT_DIR").map(|d| d.join("sessions"))),
ManagedHarness::Omp => value("PI_CODING_AGENT_DIR").map(|d| d.join("sessions")),

That is the same shape as the CODEX_HOME bug: one half of an install honors a home variable, the other half hardcodes $HOME, so with the variable set the hooks land where the agent never reads them and capture silently does nothing.

Why this is not simply fixed the same way

The internal evidence is contradictory, so I did not want to guess:

  • The harness derives $PI_CODING_AGENT_DIR/sessions, while the extension path is ~/.pi/**agent**/extensions — different nesting under the supposed same root. If PI_CODING_AGENT_DIR relocates ~/.pi, the extension path should become $PI_CODING_AGENT_DIR/agent/extensions, but that does not follow from the sessions path alone.
  • PI_CODING_AGENT_DIR governing OMP's ~/.omp is odd on its face and may be an unrelated reuse.

Guessing wrong reproduces the exact bug being fixed — writing extensions somewhere the agent will not load them — so this needs Pi's and OMP's own documentation rather than inference from this codebase.

What to check

  1. Does PI_CODING_AGENT_DIR relocate Pi's whole config home, or only its session storage?
  2. Is there a separate variable for the extensions directory?
  3. Does OMP honor PI_CODING_AGENT_DIR, or does it have its own?

If the answer is "it relocates the home", the fix mirrors codex_hooks_path_in: resolve via path_util::agent_config_home, add a two-branch test, and uninstall picks it up for free since it delegates to the same resolver.

Not affected

opencode_plugin_path and zero_hooks_path hardcode ~/.config deliberately — both carry a comment stating the policy, and install-hooks --config-file covers non-default XDG setups (verified working). Those are not part of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions