Skip to content

Honor XDG Base Directory paths on Linux #10810

Description

@repparw

Problem

T3 Code currently keeps most persistent files under ~/.t3. T3CODE_HOME / --home-dir makes that tree relocatable, but configuration, state, logs, worktrees, attachments, caches, etc. still share one root.

#748 / #826 solved the configurable-base-directory problem, but not XDG Base Directory separation.

On Linux, it would be useful for T3 Code to honor the standard XDG locations when T3CODE_HOME is not explicitly set.

Possible layout

The exact classification depends on the semantics of the existing files, but roughly:

$XDG_CONFIG_HOME/t3/   configuration
$XDG_STATE_HOME/t3/    database/state, logs, possibly managed worktrees
$XDG_DATA_HOME/t3/     durable application/user data and attachments
$XDG_CACHE_HOME/t3/    regenerable caches
$XDG_RUNTIME_DIR/t3/   sockets/other runtime-only files, if applicable

with the standard fallbacks (~/.config, ~/.local/state, ~/.local/share, ~/.cache) when those variables are unset.

T3CODE_HOME could remain as an explicit override/backwards-compatible way to keep everything under one root.

Worktrees are a special case: for T3-managed worktrees, $XDG_STATE_HOME/t3/worktrees seems like a reasonable default because they are persistent machine/project-specific application state rather than cache. However, they can contain user changes, so independently configurable placement is useful regardless of the default; #9681 is addressing that part.

Related

Drafted with GPT-5.6 Sol via ChatGPT.

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

    enhancementRequested improvement or new capability.needs-juliusvia-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions