Agent forgets current location in folderstructure

I have a very simple project structure

  • projectname
    • backend
    • frontend
    • landingpage

Almost every time when the agent wants to start a command / script it is struggling with executing in the correct folder. When is is already in backend, it tries to run script with cd backend && node script.js or do node backend/script.js. Also running something in frontend it struggles to get there.

I think agent has no clue of where it is in the structure, and just tries several options - sometimes gets there after many tries. Here is a nice example taking 8 attempts to get it right - while it was in the correct directory from the start -

  1. cd backend && node scripts/clone-prod-with-schema-changes.js
  2. node backend/scripts/clone-prod-with-schema-changes.js
  3. Let me check the current directory and run the script correctly:
  4. pwd
  5. Get-Location
  6. ls
  7. Good, I’m in the backend directory. Now let me run the script:
  8. node scripts/clone-prod-with-schema-changes.js