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 skills/kastalien-research/thoughtbox/code-modenpx skills add Kastalien-Research/thoughtbox --skill code-modegit clone --depth 1 https://github.com/Kastalien-Research/thoughtboxWhat 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.00145 | $0.03065 |
| Opus 5 | $0.00072 | $0.01533 |
| Sonnet 5 | $0.00029 | $0.00613 |
| Haiku 4.5 | $0.00015 | $0.00307 |
Grade A, and why
mcp-code-mode 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 2d 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 — 364 lines — stays where its author put it; the contents beside it link to each section on GitHub.
MCP Code Mode
What Code Mode Is
Code Mode is a server-side MCP architecture where the LLM writes code to orchestrate API calls instead of calling individual tools one at a time.
Standard MCP has two scaling problems:
-
Context bloat: Every tool definition loads into the LLM's context upfront. Hundreds of tools = tens of thousands of tokens spent before the first user token. Cloudflare's full API would require 1.17 million tokens as individual tools — exceeding most model context windows entirely.
-
Round-trip overhead: Every tool call is a full inference round-trip. A 20-step task means 20 back-and-forth cycles, each burning latency and tokens on intermediate results that only exist to feed the next step.
Code Mode solves both by collapsing the entire API surface into two meta-tools:
search(discovery tool): The LLM writes an executable code snippet to find relevant operations on demand, without the full spec ever entering context.execute(code execution tool): The LLM writes a script that chains API calls, handles conditionals and pagination, and returns only the final result. The script runs in a secure sandbox server-side.
The result: Typically ~1,000 tokens for discovery setup before task payloads, rather than loading every tool definition up front. One execution call can replace 20+ round-trips. API keys stay server-side and never appear in tool parameters.
Why LLMs write code better than they call tools
LLMs are trained on millions of lines of real-world code. Tool-calling schemas are mostly synthetic training examples. Code is the LLM's native orchestration language — it can express conditionals, loops, error handling, and data transformation that tool-calling schemas cannot.
The Two Core Tools
Every Code Mode implementation, regardless of language or framework, converges on the same two-tool surface:
Tool 1: Discovery / Search
Purpose: Let the LLM execute code to find what operations exist without loading the full catalog.
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.
- 2d ago First seen · 364 lines · 145 tokens per session scan A 1de3cc8a8fa8
mcp-code-mode is a skill published in the GitHub repository Kastalien-Research/thoughtbox (64 stars, last pushed 1mo ago), licensed MIT. It adds 145 tokens to every session and 3,065 once invoked, about $0.0007 per session on Opus 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-08-30.
Other skills, from other repositories
reasoning
Use BEFORE answering analytical, diagnostic, planning, or multi-step reasoning questions. Trigger phrases include "should I X or Y", "why is X happening", "what's the best approach", "what are the tradeoffs", "help me think through", "diagnose", "root cause", "plan/design X", "what are the implications of", "compare…
opik-diagnose
Surface the Opik traces worth a developer's attention, ranked by signal — errors, failed tool calls, latency, regressions, and low online-eval scores — plus Diagnostics issues. Reads live/production traces via the SDK (searchtraces and agentinsights) and works with no MCP; uses the MCP issue entity when connected.…
client-scripts
Write ServiceNow client scripts (onLoad/onChange/onSubmit/onCellEdit) using gform, guser, GlideAjax, field visibility/mandatory toggles, and validation with debounced server calls.
agoragentic-transaction-assurance
Prepare, evaluate, and reconcile autonomous agent transactions without self-granting payment or owner authority. Use when an agent must bind principal authority, seller terms, payment evidence, execution, delivered outcome, and reconciliation; handle paid retries safely; or prepare an authority request for owner…
linkding
Manage bookmarks with Linkding. Use when the user asks to "save a bookmark", "add link", "search bookmarks", "list my bookmarks", "find saved links", "tag a bookmark", "archive bookmark", "check if URL is saved", "list tags", "create bundle", or mentions Linkding bookmark management.
maya-shot-export
Pipeline stage — shot-level export: frame ranges, cameras, FBX / Alembic packaging for editorial. Use when packaging shot data for downstream departments. Not for full pipeline publish (maya-pipeline) or scene assembly (maya-scene-assembly).