Several sessions of one app: a session's working folder names its agent when that agent runs in the same app (MCP server and hooks), an i_am tool binds a session explicitly, the doctor checks second sessions against their app's install, and an agent that left the roster can still be uninstalled

This commit is contained in:
KeelrLeek committed 2026-10-06 10:06:01 -05:00
1 parent d755ab8a76
commit e283e4cc54
6 files changed
+63 -5

No files matched your search

+12
View File
@@ -121,6 +121,18 @@ class Project:
return agent
return None
def host_of(self, agent):
return next((a["host"] for a in self.agents if a["name"] == agent), "")
def session_identity(self, pinned, cwd):
"""Who a session is when one app runs several of the project's agents (Codex and Codex2): the agent its
working folder names in [identities], if that agent runs in the same app as the installed (pinned) one;
otherwise the pinned agent. Without a pinned agent, the folder alone decides."""
found = self.identity_for(cwd) if cwd else None
if found and found in self.ai_names and (not pinned or self.host_of(found) == self.host_of(pinned)):
return found
return pinned or found
def threshold(self, key, default):
return int(self.attention.get(key, default))