Skip to content

Support native Pi session directory naming for cross-client compatibility #114

Description

@nevenduranec

Problem

On Unix, pi-web encodes project paths differently from native Pi when creating session directories.

Example for:

/home/neven/code/xyz.net

Native Pi uses:

--home-neven-code-xyz.net--

pi-web currently uses:

--home_-neven_-code_-xyz.net--

This means sessions created in pi-web are valid Pi JSONL sessions and can be opened directly with pi --session <file>, but native Pi clients that discover sessions by the standard per-project directory name (for example pi-web-ui) do not see them automatically.

I verified that changing EncodeProjectName() in internal/sessions/session.go to use Pi's native encoding fixes the issue globally: new sessions created from pi-web immediately appear in native Pi / pi-web-ui without symlinks or bind mounts.

Proposed change

Please consider either:

  1. Use Pi's native session-directory encoding by default on Unix, matching the coding agent's SessionManager, or
  2. Add an opt-in compatibility setting, for example:

PI_WEB_SESSION_DIR_ENCODING=native

Native Pi's encoding is effectively:

  • remove one leading path separator
  • replace /, \, and : with -
  • wrap the result in --

Example:

/home/neven/code/xyz.net

--home-neven-code-xyz.net--

pi-web already supports decoding/reading legacy/native directory names, so this would mainly make newly created sessions interoperable with other Pi clients.

Why this matters

The JSONL format itself is already compatible. The incompatibility is only the project-directory naming, but it prevents seamless sharing of sessions between:

  • pi-web
  • native Pi CLI/TUI
  • other Pi SDK clients such as pi-web-ui

A native-compatible write mode would remove the need for per-project bind mounts/symlinks or maintaining a patched build.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions