Skip to content

fix(mcp,cli): session directory empty when not specified via --directory #239

@alexandervazquez98

Description

@alexandervazquez98

Pre-flight Checks

Bug Description

When or MCP is called without the flag, sessions are created with (empty string) instead of falling back to the current working directory.

This affects 3 locations in the codebase:

Location Function Directory Source
cmd/engram/main.go:876 cmdSave Hardcoded ""
internal/mcp/mcp.go:792 handleSave Hardcoded "" (ignores detRes.Path)
internal/mcp/mcp.go:1228 handleSessionStart Request arg only (ignores detRes.Path)

The infrastructure exists to detect the correct directory via which returns , but this value is never used for session creation.

Steps to Reproduce

  1. Run without
  2. Check — it's empty ("")
  3. Run — fails with "session payload directory is required"

Expected Behavior

When is not specified, session creation should fall back to or use from .

Actual Behavior

Session created with — causes sync failures downstream.

Environment

  • Engram Version: 1.13.1
  • Agent: OpenCode / any MCP agent

Proposed Fix

Add fallback in all 3 locations:

Related Issues

Tags

  • bug
  • cloud-sync
  • session

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