-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
[Bug]: Bootstrap files in agentDir are silently ignored — only workspace directory files are injected into system prompt #29387
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
When per-agent
agentDiris configured (e.g.~/.openclaw/agents/main/agent/), placing bootstrap.mdfiles (SOUL.md, AGENTS.md, TOOLS.md, USER.md) inside that directory has no effect. Only files under the sharedworkspacedirectory (~/.openclaw/workspace/) are loaded into the system prompt. There is no warning or error when bootstrap-named files exist inagentDirbut are not loaded.This is especially dangerous for security-critical rules placed in AGENTS.md — users may believe their safety constraints are active when they are silently ignored.
Steps to reproduce
{ "agents": { "defaults": { "workspace": "~/.openclaw/workspace" }, "list": [ { "id": "main", "agentDir": "~/.openclaw/agents/main/agent" } ] } }SOUL.mdwith distinctive content in the agent's directory:Start a session with the
mainagent and ask: "What language should you respond in?"Observe: The agent does not follow the SOUL.md from
agentDir. It only follows whatever is in~/.openclaw/workspace/SOUL.md.Expected behavior
One of the following:
Option A (preferred): Per-agent
agentDirbootstrap files override or merge with workspace-level files, allowing per-agent customization of SOUL.md, AGENTS.md, etc.Option B: If
agentDirfiles are intentionally not loaded, OpenClaw should emit a startup warning when it detects bootstrap-named.mdfiles inagentDirthat are not being used, e.g.:Actual behavior
agentDirare silently ignored — no warning, no error, no log entry.workspacedirectory files are injected viaresolveBootstrapContextForRun().agentDirandworkspaceas separate paths but does not clarify that onlyworkspacefiles are used for bootstrap injection.Impact:
Security: Users placing access-control rules or safety constraints in
agentDir/AGENTS.mdhave zero enforcement — the agent runs without those rules.Multi-agent setups**: Users who want different SOUL.md / AGENTS.md per agent cannot achieve this through
agentDir.Silent failure: No diagnostic output means users may run for days/weeks before discovering their customizations were never active.
Related issues: #19984 (subagent bindings don't load AGENTS.md), #3775 (bootstrap files not injected for openai-completions API)
Suggested fix:
agentDirbut not inworkspace, log a warning.agentDir→workspacefile merging.agentDiris for runtime state only.OpenClaw version
2026.2.26
Operating system
macOS 15 (Apple Silicon, Mac Mini M4)
Install method
npm global
Logs, screenshots, and evidence
Impact and severity
Affected: All users with multi-agent setups using per-agent agentDir configuration
Severity: High (security rules silently ignored — agents run without intended safety constraints)
Frequency: 100% repro — any .md file in agentDir is always ignored
Consequence: Users believe their AGENTS.md safety rules are active when they have zero effect; no warning is emitted
Additional information
Workaround: Move all bootstrap
.mdfiles fromagentDirtoworkspacedirectory. For multi-agent setups needing per-agent customization, this means all agents share the same bootstrap files — no per-agent differentiation is possible.Node version: v22.x
Agent count: 4 (main + 3 sub-agents)
Related issues: