Use when a session is approaching token budget limits, processing large codebases, multi-ticket sprint runs, or multi-scanner security triages where context growth could exhaust the token budget mid-task.
How this skill is triggered — by the user, by Claude, or both
Slash command
/guardrails-coding-agent:context-compactThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Reduces active context size during long agent sessions without losing progress.
Reduces active context size during long agent sessions without losing progress. Core principle: checkpoint first, then prune — never discard work that has not been written to disk.
Invoke when any of the following is true:
budget-monitor emits P3 INFO at 80% token budgetBefore pruning anything from active context, write current work state to disk:
| Agent family | Checkpoint file |
|---|---|
| Sprint | sprint-plan.json (partial — save completed tickets) |
| Security | .security-triage-state.json (findings processed so far) |
| Backend / Frontend / DB / DevOps | .agent-checkpoint.json (completed + pending subtasks) |
| Guardrails | .guardrails-audit.jsonl (streaming — no extra step needed) |
Minimal checkpoint format:
{
"sessionId": "backend-coding-agent-20260317T102300Z",
"completedTasks": ["task-a", "task-b"],
"pendingTasks": ["task-c"],
"lastProcessedItem": "PROJ-142",
"summaryNotes": "Auth service refactored; tests passing. Next: API gateway."
}
Use the Agent tool for any task that would require reading many files or producing large outputs. Subagents run in isolated context — their result returns as a compact summary.
When to delegate:
The result arrives in ~50 tokens instead of burning 2,000+ tokens of raw file content.
| Instead of | Use |
|---|---|
| Read entire file (800 lines) | Read file offset=N limit=50 |
| Read config to find one key | Grep pattern="key:" file=config.json |
| Read all test files | Glob *.test.ts then read only the failing ones |
When a large tool output has been processed, replace it in working memory with a 1–3 line summary before moving to the next task. Do not refer back to the raw output.
Example — after reading 300 lines of a Go file:
"Reviewed
auth/service.go: RS256 JWT validation, no refresh-token logic, 3 methods need unit tests."
When moving between major work units (e.g., ticket-to-ticket in a sprint run, scanner-to-scanner in a security triage):
This is not a new Claude Code session — it is a deliberate context boundary within the same session.
budget-monitor)This fires based on the raw context window fill, independent of the token budget config. It is a harder signal — act immediately:
PARTIAL: prefix and pointer to the checkpoint file.At 100% of maxTokensPerSession, budget-monitor blocks. If context-compact was applied at 80%/90%, all progress is already on disk and the next session can resume from the checkpoint.
| Signal | Action |
|---|---|
P3 INFO from budget-monitor (80% token budget) | Checkpoint → switch to subagent delegation |
| Context window 90% fill (compact warning) | Checkpoint → stop new reads → emit PARTIAL: output now |
| File >200 lines needed | Subagent or selective read with offset/limit |
| Sprint run with 8+ tickets | Process in 4-ticket batches; checkpoint after each batch |
| Multi-scanner triage | One scanner per logical unit; checkpoint between scanners |
| Tool output >500 lines | Summarise inline; discard raw output from active context |
| Moving to next major task | Write unit output to disk before loading next unit |
npx claudepluginhub gagandeepp/software-agent-teams --plugin guardrails-coding-agentGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.