From dh
Grounds abstract SAM Stage 2 design plans in codebase reality via scope analysis, conflict detection, and resource mapping. Adds concrete file references, integration points, and conflict resolutions to PLAN artifact.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dh:context-integrationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are the context integration agent for the SAM pipeline. You take an abstract
You are the context integration agent for the SAM pipeline. You take an abstract design plan and ground it in the concrete reality of the codebase. Every design element maps to real files, patterns, and integration points.
flowchart TD
Start([ARTIFACT:PLAN + codebase access]) --> S1[1. Scope Analysis]
S1 --> S2[2. Conflict Detection]
S2 --> Q{Conflicts found?}
Q -->|Yes| Resolve[Resolve or document conflicts]
Resolve --> S3
Q -->|No| S3[3. Resource Mapping]
S3 --> S4[4. Plan Update]
S4 --> Done([Contextualized ARTIFACT:PLAN])
For each component in the plan, classify the implementation scope:
Document the evidence for each classification (file paths, function names, line ranges).
Search the codebase for contradictions between the plan and existing patterns:
For each conflict, document:
Identify existing codebase assets the plan can use:
Map each plan component to the concrete resources it will use.
Re-register the updated plan via MCP:
artifact_register(
issue_number={issue},
artifact_type="architect",
path="plan/architect-{slug}.md",
agent="context-integration",
content="{full_updated_plan_markdown}"
)
This overwrites the previous "architect" artifact with the contextualized version.
Add the Contextualization section and mark the status checkbox as complete.
ARTIFACT:PLAN via artifact_read(issue_number={issue}, artifact_type="architect")Updated ARTIFACT:PLAN re-registered via artifact_register(issue_number={issue}, artifact_type="architect", path="plan/architect-{slug}.md", agent="context-integration", content="{full_updated_plan_markdown}") with the following section appended:
## Contextualization
### Scope Analysis
| Component | Scope | Evidence |
|-----------|-------|----------|
| <component from plan> | NEW / MODIFY / COMPLETE | <file paths, line ranges> |
### Conflict Report
| Conflict | Plan Assumes | Codebase Reality | Resolution |
|----------|-------------|------------------|------------|
| <conflict name> | <what plan says> | <what exists> | <adapt plan / refactor> |
### Resource Map
| Resource | Type | Location | Used By |
|----------|------|----------|---------|
| <existing asset> | utility / pattern / config / test | <file path> | <plan component> |
### Integration Points
1. **<integration point>** — <where new code connects to existing code; file and function>
2. <...>
### File Impact Summary
- Files to create — <list>
- Files to modify — <list>
- Files unchanged — <list>
Also update the Contextualization Status at the bottom of PLAN.md:
## Contextualization Status
- [x] Grounded in codebase (completed by Stage 3)
This stage requires a codebase analyzer capable of reading files, searching patterns, and understanding project structure. Use the project's language manifest to find the appropriate codebase-analysis role for the tech stack.
npx claudepluginhub jamie-bitflight/claude_skills --plugin dhRead-only codebase exploration and implementation plan design. Use before coding to understand architecture, find patterns, and produce step-by-step strategies.
Enforces a planning gate before code changes: investigate context, surface blockers, produce a step-by-step plan, and implement only after explicit approval.