I have a problem I can't solve in my bundle:
1 hooks-logging captures session.working_dir capability at mount time (during session.initialize())
2 The foreman registers this capability AFTER create_session() returns
3 So hooks-logging sees None and falls back to Path.cwd(), which is wrong for spawned workers
The Fix: Fix in amplifier-foundation
In amplifier_foundation/bundle.py, register the capability BEFORE initialize():
Around line 1033-1039, add this BEFORE initialize():
# Register working directory capability BEFORE initialize() so hooks can use it
# This ensures hooks-logging writes to the correct project directory for spawned sessions
effective_cwd = session_cwd or self.bundle.base_path or Path.cwd()
session.coordinator.register_capability(
"session.working_dir", str(effective_cwd)
)
# Initialize the session (loads all modules)
await session.initialize()