role-aware-context-slimming
Trim user and system context based on the agent\u2019s role so read-only helpers don\u2019t inherit stale git or CLAUDE metadata.
What it does
SKILL: Role-Aware Context Slimming
Domain: context-management
Trigger: When an agent declares omitClaudeMd or runs as an Explore/Plan helper, slim the context before handing it to runAgent.
Source Pattern: Distilled from reviewed context, compaction, and memory-governance patterns.
Core Method
Use the omitClaudeMd flag (and the tengu_slim_subagent_claudemd feature gate) to strip claudeMd from the user context unless an override was explicitly provided. For read-only helpers such as Explore or Plan, drop the gitStatus entry from the system context because it is stale and bloats the payload. Always compute new context objects instead of mutating the originals so other agents can still read the full metadata set.
Key Rules
- Only remove
claudeMdwhenagentDefinition.omitClaudeMdis true, no user override is present, and the feature flag allows it, so you do not throw away intentional user context edits. - Derive
userContextNoClaudeMdby destructuring the base context and omittingclaudeMdbefore assigningresolvedUserContext. - Drop
gitStatusfromresolvedSystemContextany timeagentDefinition.agentTypeisExploreorPlan, while leaving other system keys intact. - Preserve the original contexts for the parent agent so they can continue to see the full metadata when needed.
Example Application
When the CLI launches an Explore subagent, apply this skill to create resolvedUserContext without claudeMd and resolvedSystemContext without gitStatus, saving dozens of tokens and preventing stale git information from confusing the helper.
Anti-Patterns (What NOT to do)
- Stripping
claudeMdeven though the caller supplied an override user context; that override often carries explicit corrections or clarifications. - Forgetting to remove
gitStatusfor Explore/Plan agents, which bloats the prompt with stale files and slows down the API call.
Capabilities
Install
Quality
deterministic score 0.47 from registry signals: · indexed on github topic:agent-skills · 34 github stars · SKILL.md body (1,932 chars)