Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/humanerd-drew/opencode-drewgentnpx agentmods add skills/humanerd-drew/opencode-drewgent/gateway-module-extractionWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/gateway-module-extraction)<a href="https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/gateway-module-extraction"><img src="https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/gateway-module-extraction/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/gateway-module-extraction"><img src="https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/gateway-module-extraction.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What 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.1 | $0.00046 | $0.08111 |
| Opus 5.5 | $0.00018 | $0.03244 |
| Sonnet 5.5 | $0.00009 | $0.01622 |
| Haiku 4.5 | $0.00005 | $0.00811 |
Grade A, and why
gateway-module-extraction 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 3mo ago.
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 — 616 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Skill: Extracting Modules from gateway/run.py
When to Use
When splitting GatewayRunner methods into separate modules under gateway/ and the extracted class needs to read/write the runner's many attributes (adapters, session_store, hooks, task_manager, _running_agents, etc.).
Three Things That Bite
1. stdlib name collision
Dispatcher clashes with asyncio.Dispatcher (or any stdlib symbol you forgot). Symptom: mysterious AttributeError or TypeError at import time, not at use time. Fix: prefix with the domain — MessageDispatcher, SessionLifecycle, CronRunner. Always grep stdlib before naming:
python3 -c "import asyncio; print(hasattr(asyncio, 'Dispatcher'))"
2. circular reference via runner
Extracted class needs self.adapters, self._running_agents_ts, etc. Two ways to give it access:
a) Pass runner in __init__ and store as self.runner:
class SentinelGuard:
def __init__(self, runner):
self.runner = runner # NOT self.run_agent
def is_sentinel(self, session_key):
return self.runner._running_agents.get(session_key) is _SENTINEL
b) Pass the specific attributes the class needs (cleaner but verbose).
For {{AGENT_NAME}} gateway, use (a) — 51 attribute references would make (b) painful.
3. Mock fixture sync order
After extracting modules, tests fail because mock_gateway_runner (built via object.__new__(GatewayRunner)) doesn't have the new attributes. Order matters:
- First: replace the original method body with
self._new_module.method()delegate - Then: update mock fixture to set the new attributes
- Then: run tests
Doing fixture first leaves the real runner working but the mock broken. Doing tests first leaves everything broken. Delegate-first means the wiring is provably correct before any test changes.
references/pyc-staleness-pitfall.md—.pycstaleness masking extraction errors (stale bytecode loads instead of modified source). Always clear__pycache__after modifying multiple Python files during extraction.
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 3mo ago First seen · 616 lines · 0 tokens per session scan A 903288dac67c
gateway-module-extraction is a skill published in the GitHub repository humanerd-drew/opencode-drewgent (3 stars, last pushed 4mo ago), licensed MIT. It adds 46 tokens to every session and 8,111 once invoked, about $0.0002 per session on Opus 5.5. 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-09-03.
gateway-module-extraction compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| gateway-module-extractionhumanerd-drew/opencode-drewgent | Skill | 3 | 4mo ago | MIT | A | 46 | Claude Code, Codex |
| mem0-oss-to-platformmem0ai/mem0 | Skill | 70k | 7d ago | Apache-2.0 | A | 217 | Claude Code, Codex |
| tao-run-inference-serviceNVIDIA/skills | Skill | 4.3k | yesterday | Apache-2.0 | A | 92 | Claude Code |
| azure-mgmt-botservice-dotnetmicrosoft/skills | Skill | 3.3k | yesterday | MIT | A | 78 | Claude Code |
| fastapi-router-pymicrosoft/skills | Skill | 3.3k | yesterday | MIT | A | 46 | Claude Code |
| dev-runtimelangwatch/langwatch | Skill | 5.1k | today | Apache-2.0 | A | 172 | Claude Code |
| api-designericrisco/rsc-harness | Skill | 707 | 2d ago | MIT | A | 105 | Claude Code, Codex |