Skip to content

[Feature] Allow defining harness settings (e.g. Claude settings.json) in a custom agent (#73) - #84

Open
jan21deepak wants to merge 1 commit into
mainfrom
cursor/harness-settings-in-agent-47a6
Open

[Feature] Allow defining harness settings (e.g. Claude settings.json) in a custom agent (#73)#84
jan21deepak wants to merge 1 commit into
mainfrom
cursor/harness-settings-in-agent-47a6

Conversation

@jan21deepak

@jan21deepak jan21deepak commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Opened automatically by Cursor Forge as a same-repo PR on jan21deepak/omnigent
after the Cloud Agent pushed cursor/harness-settings-in-agent-47a6 (not against an upstream parent).

Fixes #73.

Cursor agent: bc-0d9a1fcb-ae43-413b-82ef-e796c59947a6


Note

Medium Risk
Changes how Claude Code launch settings are composed (permissions, env, etc.) on both native and SDK paths; merge rules protect hooks and apiKeyHelper but misconfigured agent settings could still alter runtime behavior.

Overview
Agents can declare a harness_settings object under executor.config (parsed as nested YAML) to supply portable Claude Code settings.json fragments—e.g. permissions, env—without duplicating global user settings.

A new harness_agent_settings module extracts that config, serializes it for spawn env, and deep-merges it with Omnigent’s launch-time settings. Framework-owned keys (hooks, statusLine, apiKeyHelper) and other framework values always win; nested dicts (like permissions) merge so launch flags such as --permission-mode still override agent defaults.

Claude-native launches read settings from the spec in orchestration and fold them into the invocation-local --settings payload via build_hook_settings. Claude SDK harnesses receive the same fragment through HARNESS_CLAUDE_SDK_SETTINGS_OVERLAY, applied in ClaudeSDKExecutor alongside apiKeyHelper.

Reviewed by Cursor Bugbot for commit 13a28f5. Configure here.

Add executor.config.harness_settings so agents can declare portable
Claude Code settings.json-shaped configuration (permissions, env, etc.).

- Parse harness_settings as structured YAML in bundle config
- Merge agent settings into claude-native --settings sidecar with
  Omnigent framework keys (hooks, statusLine, apiKeyHelper) winning
- Thread harness_settings to claude-sdk via HARNESS_CLAUDE_SDK_SETTINGS_OVERLAY
- Add unit tests for parsing, merge semantics, and spawn-env threading

Co-authored-by: jan21deepak <jan21deepak@users.noreply.github.com>
@jan21deepak

Copy link
Copy Markdown
Owner Author

bugbot run

json.dumps({"apiKeyHelper": api_key_helper}, separators=(",", ":"))
if api_key_helper
else None
json.dumps(settings_dict, separators=(",", ":")) if settings_dict else None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SDK settings merge inconsistent

Medium Severity

On the claude-sdk harness, agent harness_settings are copied into the CLI settings JSON, while Omnigent’s permission_mode is passed separately and still drives MCP allowlisting and the can_use_tool gate. Unlike the native path, those two permission sources are not merged with framework precedence, so permissions.defaultMode in the overlay can disagree with the executor’s effective permission mode.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 13a28f5. Configure here.

@jan21deepak jan21deepak Aug 10, 2026

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

bugbot run

@jan21deepak

Copy link
Copy Markdown
Owner Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 13a28f5. Configure here.

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.

[Feature] Allow defining harness settings (e.g. Claude settings.json) in a custom agent

2 participants