DEV Community

Cover image for try: Can You Find Your 2 AM Epiphany the Next Morning? — An Experimental Directory Management Tool by an ADHD Developer
tumf
tumf

Posted on • Originally published at blog.tumf.dev

try: Can You Find Your 2 AM Epiphany the Next Morning? — An Experimental Directory Management Tool by an ADHD Developer

Original article (Japanese): try: 深夜2時のひらめきを翌朝見つけられるか? — ADHD開発者が作った実験ディレクトリ管理ツール

try: Can You Find Your 2 AM Epiphany the Next Morning?

Trying out a small idea that comes to mind late at night, creating directories haphazardly, writing code haphazardly, and going to sleep haphazardly.

The next morning, you find yourself wondering, "Where did I put that thing from yesterday?" This happens so often that it becomes a subtle source of stress. Projects multiply, yet the local file system never seems to get any smarter.

The title of this blog is Fragments of verbose memory (fragments of redundant memory), but if you leave fragments of trial and error unattended, they truly disappear. Or rather, they become unfindable.

try is a tool that helps reduce the "unfindable". It seamlessly connects the creation, search, and navigation of experimental directories, allowing you to return before things start getting messy. It's also interesting that the creator is Tobi Lütke, the CEO of Shopify.

What is try? — A Management Tool Specializing in "Experimental Directories"

try is a Ruby-based CLI tool for centralized management of experimental project directories.

The official site clearly states "Built for developers with ADHD by developers with ADHD", highlighting its design that considers cognitive traits.

Main features:

  • Fuzzy Search: Instantly find redis-connection-pool with try pool
  • Time-Based Scoring: Recently accessed directories are displayed at the top
  • Automatic Date Prefix: Organize with date prefixes like 2025-01-19-redis-experiment
  • Git Worktree Integration: Create a detached HEAD worktree with try . <name>
  • TUI (Terminal UI): Intuitive operation with arrow keys

Why Not z or autojump?

Existing directory jump tools (z, autojump, zoxide) specialize in "quickly moving to directories visited in the past".

In contrast, try focuses on "creating and managing experimental directories".

Feature z/autojump try
Jump to existing directories
Create new directories ✅ (with date prefix)
Time-based scoring ✅ (recently accessed ones are at the top)
Git worktree integration
Management of experiment-specific directories

In other words, try is a tool that manages the "entire lifecycle of experiments".

Installation

RubyGems (Recommended)

gem install try-cli
Enter fullscreen mode Exit fullscreen mode

Add the following to your shell settings:

# Bash/Zsh - .zshrc または .bashrc に追加
eval "$(try init)"

# Fish - config.fish に追加
eval (try init | string collect)
Enter fullscreen mode Exit fullscreen mode

Homebrew

brew tap tobi/try https://github.com/tobi/try
brew install try
Enter fullscreen mode Exit fullscreen mode

After installation, add the above shell settings.

Basic Usage

1. Create an Experimental Directory

try redis-pool
Enter fullscreen mode Exit fullscreen mode

This alone creates ~/src/tries/2025-01-19-redis-pool and moves to that directory.

2. Use Fuzzy Search to Find Existing Experiments

try
Enter fullscreen mode Exit fullscreen mode

Running without arguments launches the TUI, displaying all experimental directories.

→ 2025-01-18-redis-connection-pool    2h, 18.5
  2025-01-03-thread-pool              3d, 12.1
  2024-12-22-db-pooling               2w, 8.3
  + Create new: pool
Enter fullscreen mode Exit fullscreen mode
  • is the currently selected directory
  • 2h indicates it was accessed 2 hours ago
  • 18.5 is the fuzzy search score (higher means more relevant)

3. Create (and Remove) an Experimental Environment with Git Worktree

try . is a feature that extracts an "additional working directory" from the current Git repository and cd there.

Git's git worktree allows you to open the same repository in multiple directories simultaneously.

  • Unlike git clone, .git generally shares history
  • Simply switching directories allows you to work on different branches (or commits) concurrently
  • You can "physically separate" experiments and verifications (no mixing of node_modules or build artifacts)

What is the Worktree Created by try? (Detached HEAD)

try .
Enter fullscreen mode Exit fullscreen mode

try creates a directory with a date prefix based on the current repository and treats it as a worktree.

For example, executing try . feature-test with ~/projects/my-app creates:

~/src/tries/2025-01-19-feature-test/
Enter fullscreen mode Exit fullscreen mode

The detached HEAD refers to a state where a commit is checked out without being tied to a branch name.

  • Advantages: Convenient for experiments (doesn't mess up branches)
  • Caution: Commits can easily go missing if left as is (explained later)

If You Want to Keep the Experiment (Branching)

You can commit even with a detached HEAD, but it's safer to branch it for easier discovery later.

git switch -c feature-test
Enter fullscreen mode Exit fullscreen mode

The chances of your "2 AM epiphany" surviving until the next morning increase.

Checking Which Worktrees Exist

If you find yourself wondering, "Which directory is the worktree?", you can check on the original repository side.

git worktree list
Enter fullscreen mode Exit fullscreen mode

How to Remove a Worktree? (Recommended Procedure)

It's safer to let Git "detach" it rather than simply rm -rf the directory.

  1. First, check for uncommitted changes on the worktree side
   git status
Enter fullscreen mode Exit fullscreen mode
  1. Delete the worktree from the original repository side
   git worktree remove ~/src/tries/2025-01-19-feature-test
Enter fullscreen mode Exit fullscreen mode
  1. If you accidentally delete the directory first, clean up the references
   git worktree prune
Enter fullscreen mode Exit fullscreen mode

Cautions:

  • You may not be able to delete if there are uncommitted changes in the worktree. In such cases, it's prudent to commit or stash with git stash before deleting.
  • Commits made with a detached HEAD may be subject to garbage collection unless branched. If you want to keep them, it's recommended to git switch -c.

Supplementary:

  • Deleting try itself (Ctrl-D) does not currently handle up to Git's git worktree remove equivalent. It simply deletes the directory, so worktree references may remain on the original repository side.
  • However, the feeling that "it's scary for an experimental directory management tool to tamper with Git's internal state" is understandable, so there's room for discussion in the design (I think the current compromise is also valid).

4. Clone a GitHub Repository

try clone https://github.com/tobi/try.git
Enter fullscreen mode Exit fullscreen mode

This clones to ~/src/tries/2025-01-19-tobi-try.

"Structure Breeds Freedom" — The Design Philosophy of try

The official site features the seemingly contradictory expression "Structure Breeds Freedom".

This philosophy suggests that a well-organized system allows for free-thinking.

In practice, using try:

  • Lowers the barrier to trying new ideas: You can start with just try new-idea
  • Easily review past experiments: Instantly discover with fuzzy search
  • Reduces fear of failure: All experiments are saved with dates, so "failure is also research"

Rust Port Also Available

The original is Ruby-based, but a community-developed Rust port (try-rs) is also available.

cargo install try-cli
Enter fullscreen mode Exit fullscreen mode

While maintaining the same functionality as the Ruby version, it operates as a native binary, making it even faster.

Conclusion: Can You Find Your 2 AM Epiphany the Next Morning?

try is not just a directory management tool but embodies a philosophy to support experimental thinking.

  • Gives every experiment a place: No need for names like test, test2
  • Organized by timeline: Naturally organized with date prefixes
  • Fearless of failure: Every trial is preserved as a record

Whether you can find your "2 AM epiphany" the next morning is not a tool issue but a system issue. try provides that system.

If you're interested, please give it a try.

Reference Links

Top comments (0)