Skip to content

feat(harness): Attach the Harness in a directory the user's own configuration keys on #782

Closed

Description

@omesser

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 cwd from 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-buddy dotdir. 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 ran claude mcp add / keeps project config.
  • Separate the session file and Action Log location from attach cwd first (SessionDataDir vs AttachCwd). Their paths may coincide when empty, but neither is derived from the other (ADR-0030).
  • Keep the probe sub-folder for scripts/probe-harness.sh so 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 claude attach with a local-scope server added in an explicitly chosen directory lists it in the Agent SDK init.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/new merges with what cwd brings 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.

Activity

  1. added this to the V1 milestone on Sep 16, 2026
  2. added
    p1Next up: the default for work that should happen
    on Sep 17, 2026
  3. self-assigned this
    on Sep 17, 2026
  4. moved this from 👷 Todo to 🏗 In Progress in Fidgeton Sep 17, 2026
  5. moved this from 🏗 In Progress to 🏁 Done in Fidgeton Sep 17, 2026
  6. omesser commented on Sep 17, 2026

    @omesser
    OwnerAuthor

    Reopened: #819 closed this incorrectly.

    That PR only added docs/adr/0030-harness-cwd-is-project-scope.md on main. It did not change attach cwd, 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.

  7. moved this from 🏁 Done to 🏗 In Progress in Fidgeton Sep 17, 2026
  8. moved this from 🏗 In Progress to 🏁 Done in Fidgeton Sep 17, 2026
  9. omesser commented on Sep 17, 2026

    @omesser
    OwnerAuthor

    Shipped on main via #827 (1583a5d).

    Acceptance met:

    • Attach cwd is configurable (Settings → Development → Working directory / AI_BUDDY_HARNESS_CWD); empty/whitespace resolves to data_dir(); absolute kept; relative refused.
    • Session splits AttachCwd (child + ACP session/new/session/load cwd) from SessionDataDir (harness-session.json + Action Log); probe still uses data_dir()/probe.
    • Live Claude check on macOS: local-scope caveman-shrink listed in init.mcp_servers when cwd was /Users/oded; absent at data_dir().

    Closing as completed.

    — Cursor agent (Coder), on @omesser's behalf.

  10. omesser commented on Sep 17, 2026

    @omesser
    OwnerAuthor

    Landed on main via #827 (1583a5d).

    Attach cwd is configurable (Settings → Development → Working directory / AI_BUDDY_HARNESS_CWD); empty resolves to data_dir(); session file and Action Log stay under SessionDataDir. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestharnessp1Next up: the default for work that should happen

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions