Skip to content

Bare /resume hides device saves outside cwd and looks like session loss #712

Description

@yxlyx

Problem

Bare /resume and /sessions only inspect .graff/sessions relative to the process cwd. When the current folder has no saves, /resume reports:

(no saved sessions in cwd — /save creates one)

This makes valid sessions elsewhere on the same device undiscoverable and looks like data loss. It is especially confusing for users who previously launched graff from $HOME: those saves remain under ~/.graff/sessions, but starting graff inside a repository hides all of them.

This is distinct from #109, which improved labels for sessions that are already in the current picker.

Reproduction

  1. From $HOME, start graff, create a conversation, and /save home-test.
  2. Confirm ~/.graff/sessions/home-test.session.json exists.
  3. mkdir /tmp/empty-project && cd /tmp/empty-project.
  4. Start graff and run bare /resume (or /sessions).
  5. The picker says there are no saved sessions in cwd and provides no route to the existing home-test save.

Observed on macOS arm64 with graff 0.0.282. On the affected machine, 45 *.session.json files existed under ~/.graff/sessions while the new project had none at the time of the diagnostic.

Current implementation

  • src/session_index.zig defines sessions_dir = ".graff/sessions" and opens it through Io.Dir.cwd().
  • src/commands_resume.zig turns an empty cwd-local list into the “no saved sessions in cwd” diagnostic.
  • Existing saved files do not persist an originating cwd, so the UI cannot currently explain where older saves came from.

This appears to be longstanding cwd-scoped behavior rather than a new 0.0.282 deletion/regression, but the resulting UX is a harness-level discoverability limitation.

Expected behavior

Provide a device-wide discovery path while preserving workspace safety. Any of these would address the core issue:

  • Make bare /resume include device-wide saves, grouped/labeled by originating workspace; or
  • Add an explicit /resume --all / /sessions --all, and mention it in the empty-cwd diagnostic; or
  • Maintain a device-level index that points to cwd-local session files.

Cross-workspace results should show the saved session title, session key, and originating cwd. Resuming one should clearly switch/confirm the workspace or explicitly state that it will restore conversation history into the current cwd, so tools are not silently run against the wrong project.

For legacy saves without cwd metadata (including saves under ~/.graff/sessions), provide a compatible fallback rather than leaving them invisible.

Acceptance criteria

  • A user in a new/empty cwd can discover existing sessions elsewhere on the same device.
  • The empty-cwd message points to the device-wide discovery command/path if cwd-local scope remains the default.
  • Cross-workspace entries identify their originating directory and do not silently bind tools to the wrong workspace.
  • Existing cwd-local resume behavior and old saved-session files remain compatible.

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