CEO: copy runtime config files (opencode.json, .mcp.json) to agent cwd

The agents repo is not the agent's cwd — opencode.json and .mcp.json
must exist in the cwd at runtime for permissions and MCP access.
CEO now copies these files from the repo to each agent's cwd during
the sync step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 21:39:45 -04:00
parent 34f4e2a8cb
commit 779a9ac73e
+12
View File
@@ -61,6 +61,18 @@ For each agent whose files changed in the diff:
- ALWAYS preserve `env` values that contain secrets — the repo may have redacted placeholders, do NOT overwrite live secrets with redacted values
- For `claude_local` agents: ensure `instructionsFilePath` is always present in the merged config
**Copy runtime config files to agent cwd:**
After patching the API, copy any runtime config files (`opencode.json`, `.mcp.json`) from the agent's directory in this repo to their `cwd` (from `CONFIG.md` adapter config). These files must exist in the agent's working directory at runtime — the repo is not the cwd.
# For each agent with an opencode.json or .mcp.json in their repo directory:
AGENT_CWD=$(jq -r '.cwd' <<< "$ADAPTER_CONFIG")
mkdir -p "$AGENT_CWD"
cp /paperclip/privilegedescalation/agents/engineering/<agent>/opencode.json "$AGENT_CWD/" 2>/dev/null || true
cp /paperclip/privilegedescalation/agents/engineering/<agent>/.mcp.json "$AGENT_CWD/" 2>/dev/null || true
This applies to all `opencode_local` agents (they need `opencode.json` in cwd for permissions and MCP config) and `claude_local` agents with `.mcp.json` (for MCP server access).
**Handling new agents (placeholder IDs):**
If an agent directory exists in the diff but its `CONFIG.md` contains `<AGENT_ID_PLACEHOLDER>` (or any `<..._PLACEHOLDER>` value) instead of a real UUID, this is a **new hire** that needs to be created: