feat(#1866): agent-side self-load of configured agent_skills

Each of the 22 consumer agents now self-loads its configured agent_skills
in its mandatory init step, so .planning/config.json agent_skills.<type>
reaches the agent on every runtime — including Cursor and /gsd-autonomous,
where Skill()-delegated workflow bash init did not reliably execute.

- gsd-core/references/agent-skills-bootstrap.md: shared contract
  (query + Read + dedup guard that skips when <agent_skills> is already
  in the prompt, so Claude's orchestrator-side injection never doubles)
- 22 agents/gsd-*.md: one self-load line naming the agent's own type
- gsd-core/workflows/autonomous.md: note that delegated agents self-load
- tests/agent-skills-bootstrap.test.cjs: regression + parity (CONSUMER_AGENTS
  bijection + fast-check property) — Generative-Fix-Divergence guard
- docs: ADR-1866, CONFIGURATION dual-injection How It Works, INVENTORY
  row, Changed changeset

Closes #1866
This commit is contained in:
Tom Boucher
2026-07-01 12:51:04 -04:00
parent c32698dc9e
commit 3c13903dcd
48 changed files with 736 additions and 417 deletions

View File

@@ -19,6 +19,8 @@ Spawned by `discuss-phase` via `Task()`. You do NOT present output directly to t
@~/.claude/gsd-core/references/untrusted-input-boundary.md
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
<documentation_lookup>
@~/.claude/gsd-core/references/research-documentation-lookup.md
</documentation_lookup>

View File

@@ -20,6 +20,8 @@ Spawned by `discuss-phase-assumptions` via `Task()`. You do NOT present output d
@~/.claude/gsd-core/references/untrusted-input-boundary.md
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
<input>
Agent receives via prompt:

View File

@@ -24,6 +24,8 @@ Before fixing code, discover project context:
**Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions during fixes.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during implementation

View File

@@ -40,6 +40,8 @@ Before reviewing, discover project context:
**Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions during review.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during review

View File

@@ -29,6 +29,8 @@ If the prompt contains a `<required_reading>` block, you MUST use the `Read` too
**Context budget:** Load project skills first (lightweight). Read implementation files incrementally — load only what each check requires, not the full codebase upfront.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during implementation

View File

@@ -40,6 +40,8 @@ Your job: Find the root cause through hypothesis testing, maintain debug file st
- Load `rules/*.md` as needed during **investigation and fix**.
- Follow skill rules relevant to the bug being investigated and the fix being applied.
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
<philosophy>
@~/.claude/gsd-core/references/debugger-philosophy.md

View File

@@ -34,6 +34,8 @@ If the prompt contains a `<required_reading>` block, you MUST use the `Read` too
**Context budget:** Load project skills first (lightweight). Read implementation files incrementally — load only what each check requires, not the full codebase upfront.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during implementation

View File

@@ -39,6 +39,8 @@ Read `~/.claude/gsd-core/references/ai-evals.md` before auditing. This is your s
**Context budget:** Load project skills first (lightweight). Read implementation files incrementally — load only what each check requires, not the full codebase upfront.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during implementation

View File

@@ -64,6 +64,8 @@ Before executing, discover project context:
- Load `rules/*.md` as needed during **implementation**.
- Follow skill rules relevant to the task you are about to commit.
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
**CLAUDE.md enforcement:** If `./CLAUDE.md` exists, treat its directives as hard constraints during execution. Before committing each task, verify that code changes do not violate CLAUDE.md rules (forbidden patterns, required conventions, mandated tools). If a task action would contradict a CLAUDE.md directive, apply the CLAUDE.md rule — it takes precedence over plan instructions. Document any CLAUDE.md-driven adjustments as deviations (Rule 2: auto-add missing critical functionality).
</project_context>

View File

@@ -35,6 +35,8 @@ Every expected cross-phase connection must resolve to WIRED (verified end-to-end
**Context budget:** Load project skills first (lightweight). Read implementation files incrementally — load only what each check requires, not the full codebase upfront.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during implementation

View File

@@ -51,6 +51,8 @@ Read ALL files from `<required_reading>`. Extract:
**Context budget:** Load project skills first (lightweight). Read implementation files incrementally — load only what each check requires, not the full codebase upfront.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during implementation

View File

@@ -50,6 +50,8 @@ Before researching, discover project context:
- Load `rules/*.md` as needed during **research**.
- Research output should account for project skill patterns and conventions.
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
**CLAUDE.md enforcement:** If `./CLAUDE.md` exists, extract all actionable directives (required tools, forbidden patterns, coding conventions, testing rules, security requirements). Include a `## Project Constraints (from CLAUDE.md)` section in RESEARCH.md listing these directives so the planner can verify compliance. Treat CLAUDE.md directives with the same authority as locked decisions from CONTEXT.md — research should not recommend approaches that contradict them.
</project_context>

View File

@@ -54,6 +54,8 @@ Before verifying, discover project context:
**Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during verification

View File

@@ -46,6 +46,8 @@ Before planning, discover project context:
**Project skills:** @~/.claude/gsd-core/references/project-skills-discovery.md
- Load `rules/*.md` as needed during **planning**.
- Ensure plans account for project skill patterns and conventions.
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
</project_context>
<context_fidelity>

View File

@@ -34,6 +34,8 @@ Your files feed the roadmap:
@~/.claude/gsd-core/references/untrusted-input-boundary.md
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
<documentation_lookup>
@~/.claude/gsd-core/references/research-documentation-lookup.md
</documentation_lookup>

View File

@@ -34,6 +34,8 @@ If the prompt contains a `<required_reading>` block, you MUST use the `Read` too
@~/.claude/gsd-core/references/untrusted-input-boundary.md
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
<downstream_consumer>
Your SUMMARY.md is consumed by the gsd-roadmapper agent which uses it to:

View File

@@ -26,6 +26,8 @@ If the prompt contains a `<required_reading>` block, you MUST use the `Read` too
**Context budget:** Load project skills first (lightweight). Read implementation files incrementally — load only what each check requires, not the full codebase upfront.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during implementation

View File

@@ -51,6 +51,8 @@ Read ALL files from `<required_reading>`. Extract:
**Context budget:** Load project skills first (lightweight). Read implementation files incrementally — load only what each check requires, not the full codebase upfront.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during implementation

View File

@@ -49,6 +49,8 @@ Before auditing, discover project context:
**Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill
3. Do NOT load full `AGENTS.md` files (100KB+ context cost)

View File

@@ -30,6 +30,8 @@ Before verifying, discover project context:
**Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during verification

View File

@@ -39,6 +39,8 @@ Before researching, discover project context:
**Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
**Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
1. List available skills (subdirectories)
2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
3. Load specific `rules/*.md` files as needed during research

View File

@@ -52,14 +52,16 @@ Before verifying, discover project context:
**Project skills:** @~/.claude/gsd-core/references/project-skills-discovery.md
- Load `rules/*.md` as needed during **verification**.
- Apply skill rules when scanning for anti-patterns and verifying quality.
**agent_skills:** self-load per @~/.claude/gsd-core/references/agent-skills-bootstrap.md
</project_context>
<core_principle>
**Task completion ≠ Goal achievement**
A task "create chat component" can be marked complete when the component is a placeholder. The task was done — a file was created — but the goal "working chat interface" was not achieved.
A "create chat component" task can be complete with a placeholder file — task done, goal "working chat interface" missed.
Goal-backward verification starts from the outcome and works backwards:
Start from the outcome and work backwards:
1. What must be TRUE for the goal to be achieved?
2. What must EXIST for those truths to hold?