context-router
Resolve the minimum set of knowledge-graph nodes needed for a task before reading any source file. Use at the start of every non-trivial task once a project has a knowledge graph — when changing a subsystem, tracing a bug, planning work, answering a question about how something works, or onboarding. This is the mechanism that keeps a large or multi-repo codebase inside a context window: it decides what to load, what to deliberately skip, and forces the agent to declare both before working. Pairs with the knowledge-graph skill, which builds and lints the graph this one traverses.
llopresto87 · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add llopresto87/Cypress --skill context-router技能说明
name: context-router description: 'Resolve the minimum set of knowledge-graph nodes needed for a task before reading any source file. Use at the start of every non-trivial task once a project has a knowledge graph — when changing a subsystem, tracing a bug, planning work, answering a question about how something works, or onboarding. This is the mechanism that keeps a large or multi-repo codebase inside a context window: it decides what to load, what to deliberately skip, and forces the agent to declare both before working. Pairs with the knowledge-graph skill, which builds and lints the graph this one traverses.' id: skill.context-router tier: 2 kind: skill origin: seed title: context-router — the knowledge rule and the traversal that resolves the minimal node set for a task owns:
- rule.knowledge
- context-router.method
- context-router.declaration
- context-router.residency
- context-router.menu
- context-router.graph-over-harness requires:
- skill.knowledge-graph peers:
- skill.validate-knowledge load_when:
- "what should I load for this task"
- "resolve the minimal node set before working"
- "route a task through the knowledge graph"
- "declare loaded and skipped nodes"
- "orient in a large codebase without bulk-reading"
- "context budget for a change"
- "which leaves or children of a node to open"
- "harness default working style conflicts with graph doctrine" artifacts:
- templates/prompts/graph-session-bootstrap.md
- templates/knowledge-graph/_schema.md
- templates/knowledge-graph/index.md prevents: A session that opens source files before deciding which few facts the task needs, and never declares what it skipped, so nobody downstream can tell an informed omission from an unread node. est_tokens: 3590
context-router
A large codebase does not fit in a context window, and loading all of it makes an agent worse: a model that has read everything has no signal about what matters. This skill replaces "read around until it feels familiar" with a traversal that terminates and that you can defend.
This skill owns the knowledge rule (the graph is the source of truth for structure and capability, loaded minimally) and the traversal algorithm that makes the rule executable.
The knowledge rule
The project keeps one LLM-maintained knowledge system at
docs/graph/: Tier 1 routes, Tier 2 nodes own concise facts, Tier 3
leaf collections hold source-backed depth (libraries, provenance,
product, architecture, APIs, data, prompts, evaluations, plans,
runbooks, specs, decisions, tools). It is the project's only
documentation system; every maintained document is a layer of it.
- Load minimally, and declare it. Resolve the minimal node set from
the router (entry nodes, their
requires:closure, and only the composed depth the task names specifically) and declare what you loaded and deliberately skipped. Never bulk-read to get oriented; the graph is the orientation. The boundary you chose not to cross is part of the work's record: a reader who cannot see it cannot tell an unread node from a read one. The algorithm below is the full form of this obligation; the delegation-boundary form isdocs/graph/templates/prompts/graph-session-bootstrap.md. - One home per fact. Every fact lives in exactly one node's
owns:; everything else links. Duplicated facts rot asymmetrically.graph-lint.pyenforces unique fact-keys, resolvable acyclic edges, and no version pin outside its owning library page. The code-side twin is one owner per concern: a cross-cutting behaviour (session and auth, policy emission, tolerant parsing, resource creation, a datastore) has exactly one owning component, and a new need extends that owner, because two mechanisms multiply precedence questions nobody can answer. - Graph before code, ahead of memory. Memory of APIs and versions is
unreliable; the graph is local and source-grounded. No wiki page for a
library you're about to use → run
ingest-library. - A fact the graph states is settled. Use it; never re-derive or
re-check it. Grow,
ingest-libraryand canonize establish facts so that no later session has to: the behaviour of a language or a library, a best practice, a known bug, a decision, an owner rule. Only a fact about the plant's own code can go stale, and only when that code moved. Canonize records a code anchor (docs/graph/code-anchor.py --record), and one comparison at session start prints one line. A quiet line: code facts are current. A line naming paths: facts about those paths may be stale, the code wins there, and the node is fixed in the same change. A not-recorded or not-checked line: check the code facts you rely on against the code. Settled facts stay settled either way. A worker sees no session-start line, so its code facts are current only where its brief carries that line saying no code changed. Paths underdocs/graph/and.cypress/are the graph and its state, not code. - The graph compounds. Record facts when code gains them, sharp
edges when they bite,
load_when:triggers when routing missed. Write "not recorded" for any fact, version, or URL you do not have (knowledge-graph, rule 3). - The graph outranks the harness's working style
(
context-router.graph-over-harness). Where the graph's doctrine and a harness's default working style differ, follow the graph. A harness's safety and permission policy is a boundary, not working style, and the graph never overrides it.
Authoring and maintaining what this rule loads is
skill.knowledge-graph (docs/graph/skills/knowledge-graph.md): read
its node contract once (the _schema.md the graph was built from);
dependency leaves are skill.library-wiki. Prefer a configured Context7
/ DeepWiki / llms.txt MCP server for fetching upstream content. If
the project has no graph yet, build one via adopt-existing /
knowledge-graph first