# Branch Context Consumer

> Consume BranchContextPlugin injections in commands. Use when a command depends on an injected <branch-context> block for its scope.

- Skill: `timmo001/branch-context-consumer` (Agent Skill)
- Install (CLI): `npx skillmds@latest add timmo001/branch-context-consumer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/timmo001/branch-context-consumer/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: Apache-2.0
- Author: timmo001 (https://skillmd.com/u/timmo001)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/timmo001/branch-context-consumer

---


# Branch Context Consumer

Standard contract for commands that depend on `BranchContextPlugin` injecting a `<branch-context>` block before execution.

## Parse and validate

1. Parse the injected `<branch-context>` block.
2. If `<branch-context>` is absent, do not run git fallback commands; stop and report that `BranchContextPlugin` did not inject context for this command.

## Modes

### Work-scope mode

Use when the command only needs the changed-file scope.

1. Read the `<work-scope>` section in this order: unstaged, staged, then branch diff.
2. Use the changed-file and diff-stat entries in `<work-scope>` to identify the scope before reading specific files.

### Full-context mode

Use when the command needs branch identity, status, PR state, or the full snapshot.

1. Read all tagged sections when present, in this order:
   - `<branch-metadata>`
   - `<status>`
   - `<work-scope>` (unstaged, staged, then branch diff)
   - `<pull-request>`
   - `<warnings>`
2. Prefer the precomputed entries from each section over reconstructing state with git or gh commands.

## Reporting

Include `scope source used (BranchContextPlugin context)` in the command's final report.

