Handoff input filter
Skill kjuhwa/skills-hub/skills/llm-agents/handoff-input-filter
Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.
npx -y skills add kjuhwa/skills-hub --skill handoff-input-filterAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Filter or transform the conversation history passed to a specialist agent on handoff.
SKILL.md
2.5 KB, 439 tokens by cl100k_base, as published. Nobody here has run it
handoff-input-filter
Pass input_filter to handoff() to control what conversation history the specialist agent receives. Use built-in filters from agents.extensions.handoff_filters or write custom ones.
When to apply
When specialist agents need a clean context (e.g., remove tool calls, trim early history, remove PII) rather than the full accumulated conversation from the triage agent.
Core snippet
from agents import Agent, HandoffInputData, Runner, handoff, trace
from agents.extensions import handoff_filters
def my_handoff_filter(data: HandoffInputData) -> HandoffInputData:
# Remove all tool-related messages from history
data = handoff_filters.remove_all_tools(data)
# Optionally trim early history
history = (
tuple(data.input_history[2:])
if isinstance(data.input_history, tuple)
else data.input_history
)
return HandoffInputData(
input_history=history,
pre_handoff_items=tuple(data.pre_handoff_items),
new_items=tuple(data.new_items),
)
specialist = Agent(
name="Spanish Assistant",
instructions="You only speak Spanish and are extremely concise.",
handoff_description="A Spanish-speaking assistant.",
)
triage = Agent(
name="Assistant",
instructions="If the user speaks Spanish, handoff to the Spanish assistant.",
handoffs=[handoff(specialist, input_filter=my_handoff_filter)],
)
Built-in filters
from agents.extensions import handoff_filters
handoff_filters.remove_all_tools(data) # Strip tool calls and outputs
handoff_filters.keep_last_n_items(data, 5) # Keep only recent items
Key notes
HandoffInputDatahas.input_history,.pre_handoff_items,.new_items,.run_context- Use
.clone(**kwargs)to create a modified copy - Filters run synchronously; keep them fast
nest_handoff_historyonhandoff()controls whether history is nested under the new agent's turn
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.