Skip to content

feat(agents): set Claude project defaults - #4943

Open
atishpatel wants to merge 3 commits into
mainfrom
workerbee/claude-settings-acp-usage
Open

feat(agents): set Claude project defaults#4943
atishpatel wants to merge 3 commits into
mainfrom
workerbee/claude-settings-acp-usage

Conversation

@atishpatel

Copy link
Copy Markdown
Contributor

Why

Claude Code agents need a safe project-scoped default for compaction without moving user-level Claude authentication, history, or preferences.

What

  • write missing defaults to the Buzz nest project file: autoCompactWindow: 200000 and alwaysThinkingEnabled: true
  • preserve existing project values and unrelated settings, so the defaults remain user-overridable
  • reject malformed or non-object settings files without overwriting them; log failures without blocking a spawn
  • apply only to the known Claude runtime

Validation

  • cargo fmt --check
  • git diff --check
  • cd desktop && pnpm check:file-sizes
  • cargo test --manifest-path desktop/src-tauri/Cargo.toml — 2,213 passed, 13 ignored; 3 integration tests passed
  • pre-push desktop-tauri-checks passed

Generated with WorkerBeeGPT

@atishpatel
atishpatel force-pushed the workerbee/claude-settings-acp-usage branch 3 times, most recently from 1361f71 to bb9dae8 Compare August 5, 2026 19:50
@atishpatel
atishpatel marked this pull request as ready for review August 5, 2026 20:02
@atishpatel
atishpatel requested a review from a team as a code owner August 5, 2026 20:02
@atishpatel
atishpatel force-pushed the workerbee/claude-settings-acp-usage branch 3 times, most recently from 62c1545 to 016b1eb Compare August 5, 2026 21:31

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing on Wes Billman's behalf. Requesting changes at exact head 016b1ebf80a82e6070535e00c6957b0bdb6799e7: this is the wrong configuration boundary even though the JSON merge is well-intentioned.

  1. [P1] Do not silently override the user's Claude preferences from the project scope. configure() writes missing keys to <workdir>/.claude/settings.json on every Claude spawn (claude_settings.rs:13-50, called from runtime.rs:588-590). Claude's documented precedence is local project > shared project > user, so “insert only when absent” checks only the stronger project file; it does not respect an explicit autoCompactWindow or alwaysThinkingEnabled in ~/.claude/settings.json. Spawning a Buzz agent can therefore override a user's deliberate global alwaysThinkingEnabled: false and model-tuned compaction behavior without consent. It also changes manually launched Claude sessions in the Buzz nest. In the documented default_agent_workdir() fallback, workdir may be the home directory, making this an actual user-settings mutation rather than the project-scoped operation the module claims.

    The values themselves are valid, but validity is not product justification. Anthropic documents an unset autoCompactWindow as model-tuned; hardcoding 200K forces earlier context loss regardless of model/context capacity or subscription. Enabling extended thinking also changes latency and token usage. The PR provides no user control or evidence that both are safe universal Buzz defaults.

  2. [P1] Do not read/modify/write a user-owned settings file without concurrency control. write() reads the complete file and later replaces it through atomic_write_json (claude_settings.rs:19-50). Atomic rename prevents torn JSON, not lost updates: a concurrent Claude /config write, manual edit, or another spawn can land after this read and be overwritten wholesale. The helper additionally uses the fixed sibling settings.json.tmp (storage.rs:601-606), so concurrent spawns contend for one temporary path. The tests exercise only a single writer.

Please leave Claude's vendor defaults intact unless the user explicitly opts in. If Buzz needs managed-child-only defaults, expose the tradeoffs in Buzz configuration and apply explicit choices at launch scope (Claude supports --settings <file-or-json> and CLAUDE_CODE_AUTO_COMPACT_WINDOW) or through a Buzz-owned generated settings source with clear provenance and rollback. Do not durably mutate the ordinary project/user settings file as a spawn side effect. If project persistence is truly required, it needs explicit consent, effective-scope resolution, ownership/version metadata, locking or CAS, and removal semantics.

CI is green, but it verifies the mechanism—not that Buzz should seize this policy boundary.

Set a 200,000-token automatic-compaction default through the environment of Buzz-spawned Claude ACP children. Parent and persona environment values take precedence, preserving user choices without mutating Claude project settings.

Co-authored-by: Atish Patel <atish@squareup.com>
Signed-off-by: Atish Patel <atish@squareup.com>
@atishpatel
atishpatel force-pushed the workerbee/claude-settings-acp-usage branch from 016b1eb to f2c92d4 Compare August 5, 2026 23:21
@atishpatel

Copy link
Copy Markdown
Contributor Author

Updated by Hardworking Honey 🤖

The review's configuration-boundary concern was correct. The settings-file implementation has been deleted: Buzz no longer creates, reads, or writes .claude/settings.json in any scope. That removes both the user/home settings override hazard and the read-modify-write lost-update race rather than attempting to control either.

The PR now applies CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000 only to recognized Claude ACP children through default_agent_env(). Claude resolves this environment setting ahead of settings and caps it to model capacity; Buzz applies the default only if the parent has not already set the variable, and persona extra_env can override it. alwaysThinkingEnabled was removed because this PR has no basis to force that spend/latency policy.

The new tests cover Claude command identities, the spawned child receiving 200000, a persona override receiving 300000, and Codex/Goose receiving no Claude variable. The 200k value itself remains a policy assumption to revisit with observed telemetry; this change is limited to using the non-persistent, child-scoped configuration boundary.

Fast Fizz added 2 commits August 5, 2026 22:06
Co-authored-by: Fast Fizz <3477b86404413a37d7d55365cc85167ad4d52eb8b8b6587df7fd59fc2b6575d8@buzz.block.builderlab.xyz>
Signed-off-by: Fast Fizz <3477b86404413a37d7d55365cc85167ad4d52eb8b8b6587df7fd59fc2b6575d8@buzz.block.builderlab.xyz>
…ings-acp-usage

* origin/main:
  fix(desktop): virtualize channel member lists (#4991)
  fix(desktop): enforce owner-only access in internal builds (#4053)
  test(desktop): match attachment button label (#4993)
  fix(acp): pace observer telemetry at 1/s with per-channel batch envelopes (#4917)
  fix(desktop): enable the content security policy (#4614)

Signed-off-by: Fast Fizz <3477b86404413a37d7d55365cc85167ad4d52eb8b8b6587df7fd59fc2b6575d8@buzz.block.builderlab.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants