/context-load — Per-Role Context Slice
Extract role-relevant excerpts from project documentation. Trim to a token budget. Wrap in <untrusted_content> envelope per G1. Output: paste-ready Markdown for subagent prompt assembly.
When to use
- Inside an orchestrator about to spawn a subagent — load just the slice that role needs
- During
/feature-design Wave 1 — feed each agent its targeted context (vs full project dump)
- Before any G7 spawn payload assembly — populates
state_slice.related_artefacts
Reduces per-agent input tokens vs sending full CLAUDE.md to every subagent.
Invocation
/context-load --for db-engineer
/context-load --for ui-ux-designer --max-tokens 2000
/context-load --for security-engineer --include-memory
Arguments
| Flag |
Default |
Effect |
--for <role> |
required |
One of the 26 plugin agent names |
--max-tokens N |
2000 |
Hard cap on output token count |
--include-memory |
off |
Also include relevant L4 learnings.md excerpts |
--include-architecture |
on |
Include ARCHITECTURE.md if exists |
Behavior
- Validate
--for <role> matches one of plugin/agents/<name>.md (else error with list of valid roles).
- Read source files (G1 wrap each per
untrusted-content-wrapping.md):
<repo>/CLAUDE.md — extract sections matching role keywords
<repo>/AGENTS.md (if exists) — extract role-specific subsection
<repo>/ARCHITECTURE.md (if exists, --include-architecture) — extract role-relevant parts
- L4
learnings.md (if --include-memory) — entries tagged with role or with role-domain keywords
- Role-keyword extraction map (examples):
db-engineer → sections matching database, schema, migration, query, index, transaction
frontend-engineer → frontend, UI, component, routing, bundler, accessibility
security-engineer → auth, authentication, authorization, secrets, encryption, vulnerability, OWASP
devops-engineer → deploy, docker, kubernetes, helm, terraform, CI, pipeline
- Trim to
--max-tokens:
- First trim: drop excerpts below relevance threshold
- Second trim: truncate longest excerpts proportionally
- Always preserve at least one snippet per source file (unless source had nothing role-relevant)
- Format output:
# Project context for `<role>` (loaded by /context-load, ~N tokens)
## From CLAUDE.md
<wrapped excerpt>
## From AGENTS.md
<wrapped excerpt>
## From ARCHITECTURE.md
<wrapped excerpt>
## From L4 memory (if --include-memory)
<wrapped excerpt>
---
Sources: CLAUDE.md (lines X-Y), AGENTS.md (section "Z"), ARCHITECTURE.md (sections A,B), .ai-skills-memory/learnings.md (3 entries)
Failure modes
- Invalid role: error with full list of 26 valid agent names
- No source files exist: return "No project context available — skipping context load" (not an error)
- Token budget too small for any meaningful excerpt: return shortest possible plus warning that budget was insufficient
Memory writes
This skill is read-only — no memory writes.
Integration
- Reads:
<repo>/CLAUDE.md (L2), <repo>/AGENTS.md, <repo>/ARCHITECTURE.md, L4 learnings.md (if --include-memory)
- Validates against:
plugin/agents/*.md for role name lookup
- Rules:
untrusted-content-wrapping (G1 wrap on every source excerpt)
- Used by: orchestrator skills (
/feature-design, /develop, /team-bugfix) — feeds state_slice of G7 spawn payloads
- Companion:
/subagent-spawn (constructs full G7 payload using context-load output)
- Layer model:
plugin/docs/concepts/memory.md documents the L0–L5 layers (L0 Cowork host, L1 plugin templates, L2 CLAUDE.md, L3 session run-logs, L4 project memory, L5 user-global memory). This skill reads from L2 + L4.
1---2name: context-load3description: Use this skill when assembling a subagent prompt and you need its context kept small and on-topic (db-engineer gets DB sections, ui-ux-designer gets UI/UX sections, etc.) — to load a per-role slice of project context from CLAUDE.md / AGENTS.md / ARCHITECTURE.md / project memory and return Markdown ready to embed in a subagent prompt.4---56# /context-load — Per-Role Context Slice78Extract role-relevant excerpts from project documentation. Trim to a token budget. Wrap in `<untrusted_content>` envelope per G1. Output: paste-ready Markdown for subagent prompt assembly.910## When to use1112- Inside an orchestrator about to spawn a subagent — load just the slice that role needs13- During `/feature-design` Wave 1 — feed each agent its targeted context (vs full project dump)14- Before any G7 spawn payload assembly — populates `state_slice.related_artefacts`1516Reduces per-agent input tokens vs sending full CLAUDE.md to every subagent.1718## Invocation1920```21/context-load --for db-engineer22/context-load --for ui-ux-designer --max-tokens 200023/context-load --for security-engineer --include-memory24```2526## Arguments2728| Flag | Default | Effect |29|---|---|---|30| `--for <role>` | required | One of the 26 plugin agent names |31| `--max-tokens N` | 2000 | Hard cap on output token count |32| `--include-memory` | off | Also include relevant L4 `learnings.md` excerpts |33| `--include-architecture` | on | Include `ARCHITECTURE.md` if exists |3435## Behavior36371. Validate `--for <role>` matches one of `plugin/agents/<name>.md` (else error with list of valid roles).382. Read source files (G1 wrap each per `untrusted-content-wrapping.md`):39 - `<repo>/CLAUDE.md` — extract sections matching role keywords40 - `<repo>/AGENTS.md` (if exists) — extract role-specific subsection41 - `<repo>/ARCHITECTURE.md` (if exists, `--include-architecture`) — extract role-relevant parts42 - L4 `learnings.md` (if `--include-memory`) — entries tagged with role or with role-domain keywords433. Role-keyword extraction map (examples):44 - `db-engineer` → sections matching `database`, `schema`, `migration`, `query`, `index`, `transaction`45 - `frontend-engineer` → `frontend`, `UI`, `component`, `routing`, `bundler`, `accessibility`46 - `security-engineer` → `auth`, `authentication`, `authorization`, `secrets`, `encryption`, `vulnerability`, `OWASP`47 - `devops-engineer` → `deploy`, `docker`, `kubernetes`, `helm`, `terraform`, `CI`, `pipeline`484. Trim to `--max-tokens`:49 - First trim: drop excerpts below relevance threshold50 - Second trim: truncate longest excerpts proportionally51 - Always preserve at least one snippet per source file (unless source had nothing role-relevant)525. Format output:5354```55# Project context for `<role>` (loaded by /context-load, ~N tokens)5657## From CLAUDE.md58<wrapped excerpt>5960## From AGENTS.md61<wrapped excerpt>6263## From ARCHITECTURE.md64<wrapped excerpt>6566## From L4 memory (if --include-memory)67<wrapped excerpt>6869---70Sources: CLAUDE.md (lines X-Y), AGENTS.md (section "Z"), ARCHITECTURE.md (sections A,B), .ai-skills-memory/learnings.md (3 entries)71```7273## Failure modes7475- **Invalid role:** error with full list of 26 valid agent names76- **No source files exist:** return "No project context available — skipping context load" (not an error)77- **Token budget too small for any meaningful excerpt:** return shortest possible plus warning that budget was insufficient7879## Memory writes8081This skill is **read-only** — no memory writes.8283## Integration8485- **Reads**: `<repo>/CLAUDE.md` (L2), `<repo>/AGENTS.md`, `<repo>/ARCHITECTURE.md`, L4 `learnings.md` (if `--include-memory`)86- **Validates against**: `plugin/agents/*.md` for role name lookup87- **Rules**: `untrusted-content-wrapping` (G1 wrap on every source excerpt)88- **Used by**: orchestrator skills (`/feature-design`, `/develop`, `/team-bugfix`) — feeds `state_slice` of G7 spawn payloads89- **Companion**: `/subagent-spawn` (constructs full G7 payload using context-load output)90- **Layer model**: `plugin/docs/concepts/memory.md` documents the L0–L5 layers (L0 Cowork host, L1 plugin templates, L2 CLAUDE.md, L3 session run-logs, L4 project memory, L5 user-global memory). This skill reads from L2 + L4.