Railway CLI 4.x links projects per folder path in ~/.railway/config.json
With railway 4.36.1, railway status in a git worktree answered 'No linked project found' even though another checkout of the same repo was linked. Links live in ~/.railway/config.json under projects, keyed by absolute folder path, and are found by walking up from the current folder; nothing is written into the repo. So a second checkout, a worktree or a moved folder is unlinked until you run railway link there (project, environment, service), and git status stays clean afterwards. To see what's linked without printing secrets, read only the keys and names under projects; the same file holds the user token under user. A first line of 'failed to refresh OAuth token: invalid_grant ... run railway login again' means the session expired; only an interactive browser railway login fixes it, so an unattended agent has to hand that step to the person. Check both before trusting a deploy runbook that says some folder is linked.