/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.4context: fork5argument-hint: "--for <role-name> [--max-tokens N]"6---78# /context-load — Per-Role Context Slice910Extract 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.1112## When to use1314- Inside an orchestrator about to spawn a subagent — load just the slice that role needs15- During `/feature-design` Wave 1 — feed each agent its targeted context (vs full project dump)16- Before any G7 spawn payload assembly — populates `state_slice.related_artefacts`1718Reduces per-agent input tokens vs sending full CLAUDE.md to every subagent.1920## Invocation2122```23/context-load --for db-engineer24/context-load --for ui-ux-designer --max-tokens 200025/context-load --for security-engineer --include-memory26```2728## Arguments2930| Flag | Default | Effect |31|---|---|---|32| `--for <role>` | required | One of the 26 plugin agent names |33| `--max-tokens N` | 2000 | Hard cap on output token count |34| `--include-memory` | off | Also include relevant L4 `learnings.md` excerpts |35| `--include-architecture` | on | Include `ARCHITECTURE.md` if exists |3637## Behavior38391. Validate `--for <role>` matches one of `plugin/agents/<name>.md` (else error with list of valid roles).402. Read source files (G1 wrap each per `untrusted-content-wrapping.md`):41 - `<repo>/CLAUDE.md` — extract sections matching role keywords42 - `<repo>/AGENTS.md` (if exists) — extract role-specific subsection43 - `<repo>/ARCHITECTURE.md` (if exists, `--include-architecture`) — extract role-relevant parts44 - L4 `learnings.md` (if `--include-memory`) — entries tagged with role or with role-domain keywords453. Role-keyword extraction map (examples):46 - `db-engineer` → sections matching `database`, `schema`, `migration`, `query`, `index`, `transaction`47 - `frontend-engineer` → `frontend`, `UI`, `component`, `routing`, `bundler`, `accessibility`48 - `security-engineer` → `auth`, `authentication`, `authorization`, `secrets`, `encryption`, `vulnerability`, `OWASP`49 - `devops-engineer` → `deploy`, `docker`, `kubernetes`, `helm`, `terraform`, `CI`, `pipeline`504. Trim to `--max-tokens`:51 - First trim: drop excerpts below relevance threshold52 - Second trim: truncate longest excerpts proportionally53 - Always preserve at least one snippet per source file (unless source had nothing role-relevant)545. Format output:5556```57# Project context for `<role>` (loaded by /context-load, ~N tokens)5859## From CLAUDE.md60<wrapped excerpt>6162## From AGENTS.md63<wrapped excerpt>6465## From ARCHITECTURE.md66<wrapped excerpt>6768## From L4 memory (if --include-memory)69<wrapped excerpt>7071---72Sources: CLAUDE.md (lines X-Y), AGENTS.md (section "Z"), ARCHITECTURE.md (sections A,B), .ai-skills-memory/learnings.md (3 entries)73```7475## Failure modes7677- **Invalid role:** error with full list of 26 valid agent names78- **No source files exist:** return "No project context available — skipping context load" (not an error)79- **Token budget too small for any meaningful excerpt:** return shortest possible plus warning that budget was insufficient8081## Memory writes8283This skill is **read-only** — no memory writes.8485## Integration8687- **Reads**: `<repo>/CLAUDE.md` (L2), `<repo>/AGENTS.md`, `<repo>/ARCHITECTURE.md`, L4 `learnings.md` (if `--include-memory`)88- **Validates against**: `plugin/agents/*.md` for role name lookup89- **Rules**: `untrusted-content-wrapping` (G1 wrap on every source excerpt)90- **Used by**: orchestrator skills (`/feature-design`, `/develop`, `/team-bugfix`) — feeds `state_slice` of G7 spawn payloads91- **Companion**: `/subagent-spawn` (constructs full G7 payload using context-load output)92- **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.