Grand Diomande Research · Full HTML Reader

Enriched Spawn — Context-Aware Sub-Agent Orchestration

When using `sessions_spawn`, sub-agents receive only the raw task text. They don't get: - AGENTS.md (behavioral guidelines) - SOUL.md (personality/values) - MEMORY.md (historical context) - Skills (specialized knowledge) - Governance (checklists, standards) - Tool guidance (how to use tools properly)

Agents That Account for Themselves research note experiment writeup candidate score 32 .md

Full Public Reader

---
name: enriched-spawn
description: Spawn sub-agents with full context inheritance - skills, governance, memory, and quality gates
user-invocable: true
command-dispatch: spawn
metadata.clawdbot: {"governance": true, "quality_gates": true, "version": "1.0.0"}
---

Enriched Spawn — Context-Aware Sub-Agent Orchestration

> Sub-agents should inherit the soul, not just the task.

The Problem

When using `sessions_spawn`, sub-agents receive only the raw task text. They don't get:
- AGENTS.md (behavioral guidelines)
- SOUL.md (personality/values)
- MEMORY.md (historical context)
- Skills (specialized knowledge)
- Governance (checklists, standards)
- Tool guidance (how to use tools properly)

This leads to inconsistent outputs and missed standards.

The Solution

Enriched Spawn wraps `sessions_spawn` to automatically inject:

1. Core Context — AGENTS.md, SOUL.md excerpts
2. Relevant Skills — Auto-detected from task keywords
3. Governance Preamble — Project charter, checklist, standards
4. Memory Context — Recent relevant decisions/work
5. Quality Gates — Validation requirements before completion
6. Completion Protocol — Structured output format

Architecture

Main Session
     │
     ├── Task: "Add authentication"
     │
     ▼
┌─────────────────────────────────────────┐
│         ENRICHED SPAWNER                │
│  ┌───────────────────────────────────┐  │
│  │ 1. Context Builder                │  │
│  │    - Load AGENTS.md excerpt       │  │
│  │    - Load SOUL.md values          │  │
│  │    - Query MEMORY.md context      │  │
│  └───────────────────────────────────┘  │
│  ┌───────────────────────────────────┐  │
│  │ 2. Skill Matcher                  │  │
│  │    - Detect relevant skills       │  │
│  │    - Inject skill instructions    │  │
│  └───────────────────────────────────┘  │
│  ┌───────────────────────────────────┐  │
│  │ 3. Governance Loader              │  │
│  │    - Find .governance/ files      │  │
│  │    - Extract current phase        │  │
│  │    - Include standards            │  │
│  └───────────────────────────────────┘  │
│  ┌───────────────────────────────────┐  │
│  │ 4. Quality Gate Injector          │  │
│  │    - Add validation requirements  │  │
│  │    - Define completion criteria   │  │
│  └───────────────────────────────────┘  │
└─────────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────────┐
│     ENRICHED TASK (sent to sub-agent)   │
│                                         │
│  ## INHERITED CONTEXT                   │
│  [AGENTS.md excerpt]                    │
│  [SOUL.md values]                       │
│                                         │
│  ## SKILLS TO REFERENCE                 │
│  - Read: [home-path]  │
│  - Read: [home-path]  │
│                                         │
│  ## GOVERNANCE                          │
│  [Project charter]                      │
│  [Current checklist status]             │
│                                         │
│  ## TASK                                │
│  [Original task]                        │
│                                         │
│  ## QUALITY GATES                       │
│  Before completing, verify:             │
│  - [ ] Code compiles/builds             │
│  - [ ] Follows existing patterns        │
│  - [ ] Conventional commit format       │
│  - [ ] Governance updated               │
│                                         │
│  ## COMPLETION FORMAT                   │
│  Report: files, commits, status         │
└─────────────────────────────────────────┘
     │
     ▼
Sub-Agent Session (with full context)
     │
     ▼
┌─────────────────────────────────────────┐
│         QUALITY VALIDATOR               │
│  - Check completion format              │
│  - Verify commits exist                 │
│  - Validate governance updates          │
│  - Score output quality                 │
└─────────────────────────────────────────┘

Usage

Basic

/spawn @project "Add user authentication"

With Options

/spawn @project "task" --skills expo-mobile,governance-framework --strict

Programmatic

python
from enriched_spawn import spawn_with_context

result = await spawn_with_context(
    task="Add authentication",
    project_path="[home-path]
    skills=["expo-mobile"],
    quality_gates=["build", "lint", "commit"],
    strict=True
)

Enriched Task Template

markdown
# ENRICHED SUB-AGENT TASK

## INHERITED CONTEXT

You are a sub-agent of the main Clawdbot session. Inherit these values:

### From AGENTS.md
- Be genuinely helpful, not performatively helpful
- Have opinions and preferences
- Be resourceful before asking
- Commit changes after edits

### From SOUL.md
- Skip filler words, just help
- Be concise when needed, thorough when it matters
- Not a corporate drone, not a sycophant

## SKILLS TO REFERENCE

Before starting, read these for specialized knowledge:
- `[home-path]`
- `[home-path]`

## PROJECT GOVERNANCE

**Project:** {project_name}
**Path:** {project_path}
**Charter:** {charter_path} (read if exists)
**Checklist:** {checklist_path}
**Current Phase:** {phase}

## MEMORY CONTEXT

Recent relevant work:
{memory_context}

## TASK

{original_task}

## QUALITY GATES

Before marking complete, verify:
- [ ] Code compiles without errors
- [ ] Follows existing project patterns
- [ ] Uses conventional commit format
- [ ] Updates governance checklist
- [ ] No hardcoded secrets or paths

## COMPLETION REPORT FORMAT

When done, report:

COMPLETION REPORT

Status: ✅ Complete | ⚠️ Partial | ❌ Blocked

Files Changed:
- path/to/file1.ts (created)
- path/to/file2.ts (modified)

Commits:
- abc1234 feat(scope): description

Quality Gates:
- [x] Build passes
- [x] Patterns followed
- [x] Governance updated

Notes:
Any blockers, decisions, or follow-ups

Skill Matching

Task KeywordsSkills Auto-Added
expo, react native, mobileexpo-mobile, expo-preview
swift, ios, xcodegam:mfp (if game), governance-framework
pulse, autonomousbot:pulse, pulse-v2
dream, incubatebot:dream-weaver
voice, speak, audioSpeak skill, voice-transcription
api, backend, servercoding-agent
creative, designart:creative, frontend-design

Quality Gates

### Built-in Gates
- `build` — Run build command, check exit code
- `lint` — Run linter, check for errors
- `test` — Run tests, check pass rate
- `commit` — Verify conventional commit format
- `governance` — Check checklist was updated
- `patterns` — Verify code matches project style

Custom Gates

yaml
quality_gates:
  - name: custom-check
    command: npm run custom-check
    required: true
    timeout: 60

Validation

After sub-agent completes, the enriched spawner:

1. Parses completion report — Extracts status, files, commits
2. Verifies commits — Checks git log for expected commits
3. Validates governance — Confirms checklist updated
4. Scores quality — 0-100 based on gates passed
5. Reports to main — Structured result with quality score

Files

FilePurpose
`SKILL.md`This documentation
`spawner.py`Core enriched spawn logic
`context_builder.py`Context extraction
`skill_matcher.py`Skill detection
`quality_gates.py`Validation logic
`templates/`Task templates

Promotion Decision

Attach run IDs, datasets, metrics, and reproduction commands.

Source Anchor

homelab/clawdbot/skills/enriched-spawn/SKILL.md

Detected Structure

Method · Evaluation · References · Code Anchors · Architecture