Agentic coding

My workflow is based on devenv and git worktree. In this post, I’ll use a Rails application as an example.

Context engineering #

Project context #

cd my_app
git worktree add -b <branch> ../my_app-feature-a develop
cd ../my_app-feature-a
direnv allow
dev

In this way, it’s easy to develop across multiple branches while preserving context for code agents.

Log context #

Always truncate the development.log file1 when starting the server to ensure agents have a clear and relevant log context.

bin/dev #

#!/usr/bin/env sh

truncate -s 0 log/development.log
exec bundle exec foreman start -f Procfile.dev "$@"

Procfile.dev #

web: bundle exec rails s -p 3000
js: bundle exec webpacker-dev-server