Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/pr1m8/haive/patternsgit clone --depth 1 https://github.com/pr1m8/haiveWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.01400 |
| Opus 5 | $0.00000 | $0.00700 |
| Sonnet 5 | $0.00000 | $0.00280 |
| Haiku 4.5 | $0.00000 | $0.00140 |
Grade A, and why
patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 234 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Reusable Agent Patterns
Pattern: Basic Agent Structure
from haive.agents.base import Agent
from haive.core.schema import StateSchema
from haive.core.graph import BaseGraph
from pydantic import Field
from typing import List, Dict, Any, Optional
class CustomAgentState(StateSchema):
"""State schema for custom agent."""
messages: List[str] = Field(default_factory=list)
context: Dict[str, Any] = Field(default_factory=dict)
class CustomAgent(Agent[CustomAgentState]):
"""Custom agent implementation."""
def __init__(
self,
name: str,
engine: Any,
**kwargs
) -> None:
super().__init__(
name=name,
state_schema=CustomAgentState,
**kwargs
)
self.engine = engine
def setup_agent(self) -> None:
"""Initialize agent components."""
self._sync_fields_from_engine()
self._setup_schemas()
self._build_initial_graph()
def build_graph(self) -> BaseGraph:
"""Define agent workflow."""
graph = BaseGraph()
# Add your nodes here
graph.add_node("start", self._process_input)
graph.add_node("end", self._generate_output)
# Define edges
graph.add_edge("start", "end")
graph.set_entry_point("start")
return graph.compile()
Pattern: Multi-Engine Agent
class MultiEngineAgent(Agent[MultiEngineState]):
"""Agent using multiple engines for different tasks."""
def __init__(
self,
name: str,
main_engine: Any,
tool_engine: Any,
**kwargs
) -> None:
super().__init__(name=name, **kwargs)
self.main_engine = main_engine
self.tool_engine = tool_engine
# Register engines
registry = EngineRegistry.get_instance()
registry.register(main_engine)
registry.register(tool_engine)
def build_graph(self) -> BaseGraph:
"""Build graph with engine routing."""
graph = BaseGraph()
# Router node decides which engine
graph.add_node("router", self._route_request)
graph.add_node("main", self._use_main_engine)
graph.add_node("tools", self._use_tool_engine)
# Conditional routing
graph.add_conditional_edge(
"router",
self._needs_tools,
{
True: "tools",
False: "main"
}
)
return graph.compile()
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 234 lines · 0 tokens per session scan A 89c6b1a78f69
patterns is an agent published in the GitHub repository pr1m8/haive (23 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,400 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
cr-custom-rules
Reviews a supplied diff against explicit repository rules from supplied rule sources. Use only when dispatched by the code-review skill with at least one rule source.
cr-security
Reviews a supplied diff for introduced, practically exploitable security vulnerabilities. Use only when dispatched by the code-review skill.
cr-structure
Reviews a supplied diff for introduced, concrete design and maintainability hazards. Use only when dispatched by the code-review skill.
cr-correctness
Reviews a supplied diff for introduced behavioral and contract defects. Use only when dispatched by the code-review skill.
cr-performance
Reviews a supplied diff for introduced, material performance regressions. Use only when dispatched by the code-review skill.
code-reviewer
Idun coding-guideline review against the active rule set.