Skip to content

Support a user-editable ~/.netclaw/identity/AGENTS.md layered on the embedded operating rules (and inherited by sub-agents) #1620

Description

@Aaronontheweb

Summary

The embedded AGENTS.md (compiled into the assembly, per-audience) standardizes NetClaw's core operating/safety/grounding rules — great for consistency and benchmarking. But there is no user-editable counterpart for deployment-specific operating guidance. Add support for a disk ~/.netclaw/identity/AGENTS.md that layers on top of the embedded operating rules and is inherited by sub-agents.

The gap

An operator needs per-deployment operating guidance that is (a) editable without recompiling, (b) present on every turn, and (c) inherited by sub-agents. Today the only user-editable, every-turn identity files are SOUL.md and TOOLING.md — and neither reaches sub-agents:

  • SubAgentSpawner.ResolveOperatingRules (~SubAgentSpawner.cs:337-341): sub-agents inherit the embedded AGENTS operating rules from the parent "…without exposing personal identity layers (SOUL.md, TOOLING.md)."
  • So the AGENTS layer is the only identity layer sub-agents receive, and it is currently embedded-only — an operator has no way to add guidance that binds sub-agents.

This matters because fan-out sub-agents do real outward-facing work (e.g. composing customer-facing content), so deployment-specific etiquette/house-rules must constrain them too — but there's no user-editable place those rules can live and reach the sub-agents.

Current implementation

  • ISystemPromptProvider.GetSystemPrompt (ISystemPromptProvider.cs:187-210): soul from disk, tooling from disk, but agents from the embedded resource (CachedAgents / CachedAgentsPublic); projectInstructions from the project dir.
  • ISystemPromptProvider.GetOperatingRules(audience) (ISystemPromptProvider.cs:28-33): returns the embedded AGENTS operating rules; consumed by sub-agents via SubAgentSpawner.ResolveOperatingRulesSubAgentActor.BuildSystemPrompt (SubAgentActor.cs:1333, layer 1).
  • NetclawPaths.AgentsPath (NetclawPaths.cs:21) already defines ~/.netclaw/identity/AGENTS.md, but nothing reads it.

Proposal

  1. Read the disk AgentsPath and append it after the embedded operating rules — embedded first, so the standardized/safety core stays authoritative and cannot be weakened by the user layer; the disk file is purely additive deployment guidance.
  2. Do the compose in a shared helper used by both the agents assembly in GetSystemPrompt and GetOperatingRules(audience), so the user layer reaches main sessions and sub-agents through the single existing seam (no separate wiring for sub-agents).
  3. Missing file → silently skipped, consistent with SOUL.md/TOOLING.md.
  4. Audience handling: layer for Team/Personal; for Public, suppress the disk layer by default (or support an explicit AGENTS.public.md disk variant) to avoid leaking internal operating guidance to a public audience.
  5. Apply the same placeholder substitution to the disk layer as the embedded content, for consistency.

Non-goals / notes

  • The embedded AGENTS.md remains the authoritative safety/grounding core; the disk layer is additive and must not be able to relax it.
  • Per-entity data/facts still belong in live tools, not this file — this is for durable operating guidance, not data.

Anchors: ISystemPromptProvider.cs:28-33,187-210 · NetclawPaths.cs:21 · SubAgentSpawner.cs:337-341 · SubAgentActor.cs:1333

Metadata

Metadata

Assignees

No one assigned

    Labels

    context-pipelineLLM context assembly: prompt layers, dynamic injection, memory recall, temporal grounding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions