Repository navigation
Description
Why
The #668 probe measured that a claude attach loads the user's local-scope MCP servers only when cwd is the directory they were added in. ai-buddy attached with cwd = ai_buddy_core::memory::data_dir(), a folder no user has ever run claude mcp add in. Grok's project .grok/config.toml walk and opencode's project config key off cwd the same way per their docs. User-scope servers and claude.ai connectors already load; only the local and project scope is lost, and the cause is our cwd.
Findings: docs/research/harness-tools-under-acp-probe.md, option 1.
What
- Pick the attach
cwdfrom a setting (Settings → Development → Working directory/AI_BUDDY_HARNESS_CWD). - Empty default is the platform data folder (
dirs::data_dir()/ai-buddy: XDG~/.local/share/ai-buddy, macOS Application Support,%APPDATA%\ai-buddy) — not$HOME, and not a top-level~/.ai-buddydotdir. Home-dotdir pollution is bad OS citizenship; classical dotdirs are for config, not durable app data. Local/project MCP is therefore opt-in: set Working directory (or the env) to the folder where the user ranclaude mcp add/ keeps project config. - Separate the session file and Action Log location from attach
cwdfirst (SessionDataDirvsAttachCwd). Their paths may coincide when empty, but neither is derived from the other (ADR-0030). - Keep the
probesub-folder forscripts/probe-harness.shso a probe does not pollute a real session.
Done when
- Attach cwd is configurable; empty resolves to
data_dir(); absolute paths are kept; relative paths are refused. - A
claudeattach with a local-scope server added in an explicitly chosen directory lists it in the Agent SDKinit.mcp_servers(probe / live check). Empty /data_dir()need not list local-scope servers. - Session file and Action Log still land in the data folder, independent of attach cwd.
- ADR-0003, ADR-0018 and ADR-0023 are untouched. The MCP entry we hand over on
session/newmerges with whatcwdbrings in.
Decision note (2026-09-18)
Earlier draft of this issue named $HOME as the empty default. Product lock: keep empty → data_dir() so a blank setting stays repository-neutral and does not flavour the buddy with home project files. #827 implements that lock.
— Cursor agent (Architect), on @omesser's behalf.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Activity
omesser commentedon Sep 17, 2026
Reopened: #819 closed this incorrectly.
That PR only added
docs/adr/0030-harness-cwd-is-project-scope.mdon main. It did not change attachcwd, did not separate session/Action Log paths, and its body explicitly said it does not close this issue. Acceptance for #782 is still unmet.— Cursor agent (Coder), on @omesser's behalf.
omesser commentedon Sep 17, 2026
Shipped on main via #827 (
1583a5d).Acceptance met:
Settings → Development → Working directory/AI_BUDDY_HARNESS_CWD); empty/whitespace resolves todata_dir(); absolute kept; relative refused.SessionsplitsAttachCwd(child + ACPsession/new/session/loadcwd) fromSessionDataDir(harness-session.json + Action Log); probe still usesdata_dir()/probe.caveman-shrinklisted ininit.mcp_serverswhen cwd was/Users/oded; absent atdata_dir().Closing as completed.
— Cursor agent (Coder), on @omesser's behalf.
omesser commentedon Sep 17, 2026
Landed on main via #827 (
1583a5d).Attach cwd is configurable (
Settings → Development → Working directory/AI_BUDDY_HARNESS_CWD); empty resolves todata_dir(); session file and Action Log stay underSessionDataDir. Live Claude check on macOS listed local-scope MCP when cwd was an explicit home path.Acceptance met; leaving closed.
— Cursor agent (Coder), on @omesser's behalf.