Skip to content

feat: support TRACHE_HOME env var for shared cache directory#2

Open
antitree wants to merge 1 commit into
OG-Drizzles:mainfrom
antitree:main
Open

feat: support TRACHE_HOME env var for shared cache directory#2
antitree wants to merge 1 commit into
OG-Drizzles:mainfrom
antitree:main

Conversation

@antitree
Copy link
Copy Markdown

Summary

  • Adds support for a TRACHE_HOME environment variable that overrides the default .trache directory lookup
  • When TRACHE_HOME is set, trache uses that path as its root regardless of the current working directory
  • Falls back to .trache in cwd when unset — fully backwards compatible, no behaviour change for existing users

Motivation

Currently trache always looks for .trache/ relative to the current working directory. This means users who run trache from multiple locations (different project dirs, scripts, AI agent sessions) need a separate .trache/ copy in each one, or must always cd to the same directory first.

Setting TRACHE_HOME to a fixed path (e.g. in ~/.zshrc) solves this cleanly:

export TRACHE_HOME="$HOME/projects/my-trache-store/.trache"

Change

One-line change in cli/_context.py:

# Before
TRACHE_ROOT = Path(".trache")

# After
TRACHE_ROOT = Path(os.environ["TRACHE_HOME"]) if "TRACHE_HOME" in os.environ else Path(".trache")

Test plan

  • With TRACHE_HOME unset: existing behaviour unchanged, .trache/ resolved from cwd
  • With TRACHE_HOME set to an absolute path: trache board list, trache card list, trache status all work correctly from any directory
  • Tested manually from /tmp with TRACHE_HOME pointing at an existing cache — boards and cards resolved correctly

🤖 Generated with Claude Code

Allows users to set TRACHE_HOME to a fixed path so trache works
from any working directory without needing a .trache/ folder in each one.
Falls back to .trache in cwd when unset, preserving existing behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant