Skip to content

feat: inherit embedded AGENTS.md operating rules for sub-agents#1490

Merged
Aaronontheweb merged 3 commits into
devfrom
feature/subagent-identity-inheritance
Jun 25, 2026
Merged

feat: inherit embedded AGENTS.md operating rules for sub-agents#1490
Aaronontheweb merged 3 commits into
devfrom
feature/subagent-identity-inheritance

Conversation

@petabridge-netclaw

@petabridge-netclaw petabridge-netclaw Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Problem

Sub-agents spawned via spawn_agent do not receive the embedded AGENTS.md operating rules layer that main-agent sessions get. They only receive their own markdown body, optional project instructions, and the hardcoded HeadlessExecutionContract.

This means sub-agents operate without the core safety guardrails that main agents inherit:

  • Grounding rules (e.g., "Never state runtime facts without checking with a tool")
  • Search/citation policy (inline hyperlink requirements)
  • Safety boundaries (Resource Hard Deny awareness)
  • Proactive check-back expectations
  • Search decision rules

Solution

Sub-agents now inherit the embedded AGENTS.md operating rules alongside their existing context:

Changes

ISystemPromptProvider.cs

  • Added GetOperatingRules(TrustAudience) to the interface
  • Implemented in FileSystemPromptProvider (substituted embedded AGENTS.md for Team/Personal, null for Public)
  • Added stub null implementations to StaticSystemPromptProvider and NullSystemPromptProvider

SubAgentProtocol.cs

  • Added OperatingRules property to SubAgentDefinition record

SubAgentSpawner.cs

  • Added ResolveOperatingRules() that calls _promptProvider.GetOperatingRules(context.Audience)
  • Passes operating rules into SubAgentDefinition at spawn time

SubAgentActor.cs

  • Updated BuildSystemPrompt() to assemble the full identity stack:
    1. Embedded AGENTS.md via SystemPromptAssembler.Assemble(agents: definition.OperatingRules, ...)
    2. Sub-agent markdown body + skill overlay appended on top
    3. HeadlessExecutionContract always appended at the bottom

Notes

@Aaronontheweb Aaronontheweb added subagents spawn_agent, SubAgentActor, definition loader, discovery context layer, and related features context-pipeline LLM context assembly: prompt layers, dynamic injection, memory recall, temporal grounding labels Jun 25, 2026
@Aaronontheweb Aaronontheweb marked this pull request as ready for review June 25, 2026 16:55
@Aaronontheweb Aaronontheweb force-pushed the feature/subagent-identity-inheritance branch from 92a6e92 to 2b31957 Compare June 25, 2026 16:59
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) June 25, 2026 17:42
@Aaronontheweb Aaronontheweb merged commit c69cc4d into dev Jun 25, 2026
21 checks passed
@Aaronontheweb Aaronontheweb deleted the feature/subagent-identity-inheritance branch June 25, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

context-pipeline LLM context assembly: prompt layers, dynamic injection, memory recall, temporal grounding subagents spawn_agent, SubAgentActor, definition loader, discovery context layer, and related features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sub-agents missing embedded AGENTS.md (operating rules, grounding, safety policy)

1 participant