contextforge-router

A routing guide for ContextForge, a local system that stores reusable engineering context about repositories, tasks, components, and rules.

In plain words
What is it for?
Use it when starting named tickets, loading task context, linking work to a repository, or capturing durable engineering facts.
Why use it?
It helps coding agents find relevant prior decisions and record important project context for future work.

Cursor rule for Cursor

Install

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.

agentmods
npx agentmods add rules/srmackey/context-forge/contextforge-router
Clone the repo
git clone --depth 1 https://github.com/srmackey/context-forge

Made for: Cursor.

Per session 823 This file is loaded in full into every session.
When invoked 823 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00823 $0.00823
Opus 5 $0.00411 $0.00411
Sonnet 5 $0.00165 $0.00165
Haiku 4.5 $0.00082 $0.00082

Measured yesterday against content hash 34aa6b8b1f54, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

contextforge-router 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.

.cursor/rules/contextforge-router.mdc · 61 lines

How it starts

The opening of the file, as written. The whole thing — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ContextForge router

ContextForge is a local MCP server that stores durable, cross-repo engineering context (Components, Repos, Tasks, Governance) as markdown, indexed in SQLite. This rule is a router — it tells you how to use the tools. It does not contain the knowledge itself.

Act proactively — do not wait to be asked

Use ContextForge on your own initiative; the user should not have to say "add this to ContextForge" or "did you check ContextForge?". In particular:

  • When the user names or starts a ticket (anything matching [A-Z]+-\d+, e.g. TICKET-1234, or phrasing like "starting/working on …"): immediately resolve_ref(query="<id or name>") to see if a task: entity already exists. If it does, get_task_pack(task_slug=...). If it does not, create it now — create_task(slug="<id>", description=...) — and link_task it to the current repo (resolved via get_current_workspace). Do this before starting the work, not after. Never silently create a duplicate of a task that might already exist.
  • Recall aggressively, capture at checkpoints. Loading context is always safe — do it up front. Writing context is higher-stakes — capture durable facts when a decision is reached, a workaround is found, or a unit of work wraps, not on every message.

At the start of planning or coding work

  1. Call get_current_workspace(path=<the open repo's absolute path>). If it resolves to a repo slug, that repo is tracked here.
  2. Load context before planning — do not start from a blank slate:
    • For focused/transient work, prefer a task pack: get_task_pack(task_slug=...) (composes task + linked entities + cascaded governance; focus=True narrows to the most relevant subtopics).
    • Otherwise pull the specific entity/subtopic: get_context(ref="repo:<slug>/local-dev"), get_context(ref="component:<slug>/auth"), etc.
  3. Only pull what the task concerns. Refs listed under dropped in a focused pack can be fetched on demand if they turn out to be relevant — don't preload them.

Read the full file on GitHub · 61 lines

Changes

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.

  1. yesterday First seen · 61 lines · 823 tokens per session scan A 34aa6b8b1f54

Subscribe to this mod's changes

contextforge-router is a cursor rule published in the GitHub repository srmackey/context-forge (1 stars, last pushed 23d ago), licensed MIT. It adds 823 tokens to every session, about $0.0041 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-31.