Instability Problem in Open Economy with Endog. Borr Limit

Hi Kay my model is very close to yours (without adj costs and with the borrowing constraint as a function of past capital). My model works if I do not have foreign goods, while BK conditions are not met once I add foreign goods, giving a role to the exchange rate. Here the link to my post

I had a look at your code and I have a couple suggestions:
-You forgot chi in the definition of marginal utility
-The steady state of labor is really low, usually it should be around 1/3 of output.

I do not know if this solves the problem, I hope it can help you.
Good luck!
Valerio