Skip to content

Spawned agents don't inherit construct context — SKILL.md / rules invisible to teammates #184

@zkSoju

Description

@zkSoju

Problem

When the Loa framework is active and constructs are composed, the main agent sees CLAUDE.md, SKILL.md files, and construct rules. But agents spawned via Claude Code's Agent tool / TeamCreate don't inherit any of this context.

This creates a gap where:

  • Construct-specific tool mandates (e.g., k-hole's "MUST use dig-search.ts") are ignored
  • Gate rules (review, audit) don't apply to teammates
  • Composition declarations are invisible to the team

Observed Behavior

In project-purupuru session 52:

  1. Main agent (team lead) has full construct context — k-hole, artisan, operator OS all loaded
  2. Lead spawns a research agent via Agent tool with subagent_type: "general-purpose"
  3. The spawned agent uses WebSearch instead of the mandated dig-search.ts
  4. SKILL.md line 73-75 says "MUST run dig-search script" — agent never sees it
  5. Lead must kill agent and redo work manually

This happened 2 out of 3 DIG dispatches in a single session.

Expected Behavior

When an agent is spawned under a construct's context, it should inherit:

  1. Tool mandates — "use X script, not Y tool"
  2. Rules — zone restrictions, gate requirements
  3. Skill instructions — the SKILL.md for the active skill/mode

Impact

  • Wasted tokens and time (kill + redo pattern)
  • Quality degradation (WebSearch < Gemini-grounded search)
  • Construct enforcement is only as strong as the lead's memory
  • Safety hooks (zone-system, write guards) DO work for teammates, but construct-level rules don't

Architecture Gap

The current stack:

  • .claude/rules/ → loaded for ALL agents ✅ (hooks enforce these)
  • .claude/hooks/ → fire for ALL agents ✅ (PreToolUse/PostToolUse)
  • CLAUDE.md → loaded for main agent only ⚠️ (spawned agents may not see it)
  • SKILL.md → loaded when skill is invoked ❌ (never loaded for spawned agents)
  • construct.yaml → read by resolver scripts ❌ (spawned agents don't call resolver)

Possible Solutions

L1: Prompt injection (low effort)

When a skill dispatches work to an Agent, automatically inject the skill's key constraints into the agent prompt. The skill's SKILL.md could have a ## Agent Context section that gets included in any spawn prompt.

L2: Rules-based (medium effort)

Constructs with tool mandates could declare them in .claude/rules/ format:

# .claude/rules/k-hole-research.md
When performing research tasks, ALWAYS use `bunx tsx scripts/dig-search.ts` via Bash.
Do NOT use WebSearch or WebFetch for research.

Rules in .claude/rules/ are loaded for all agents including teammates.

L3: Construct-aware agent spawning (high effort)

The framework's agent team reference (.claude/loa/reference/agent-teams-reference.md) could define a protocol where the lead agent includes active construct context when spawning teammates. The TeamCreate workflow would bundle relevant SKILL.md excerpts.

L4: Hook enforcement (medium effort)

A PreToolUse:WebSearch hook that checks if a construct mandates a specific tool and blocks/warns when the wrong tool is used. Similar to existing team-skill-guard.sh.

Related

  • k-hole issue: "Agent skill inheritance gap — spawned agents don't use dig-search.ts"
  • Loa v1.39.0 Agent Teams constraints (already handle zone/beads/git serialization)
  • The gap is specifically at the SKILL.md / construct context layer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions