I've been using pi-optchat, might want to give that a try. Manually connecting subagents to the main agent keeps them open indefinitely. https://github.com/jonaslsaa/pi-optchat