agentleFS
srmackeysrmackey/dev-span/.cursor/rules/devspan-router.mdc

dev-span / rules

Cursor rule1 starsChanged 2 months agoMITView on GitHub

How to use the DevSpan MCP server to load and capture engineering context. Applies to all planning and coding work; covers when to recall context and when to create/capture task context proactively.

  • Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.

    Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

We split this devspan-router.mdc into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use DevSpan on your own initiative.

    line 15
  2. Very specific:

    If it does, get_task_pack(task_slug=...).

    line 21
  3. Very specific:

    Call get_current_workspace(path=<the open repo's absolute path>).

    line 31
  4. Very specific:

    Only pull what the task concerns.

    line 39
  5. Very specific:

    Call resolve_ref(query="the gateway") first and use the top-ranked candidate.

    line 43
  6. Distinctive:

    Never invent a slug or silently create a new entity for a name that might already exist.

    line 44
  7. Very specific:

    When you learn something durable that lives in no system (tribal knowledge), write it without being asked: …

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
devspan-router.mdc
---
description: How to use the DevSpan MCP server to load and capture engineering context. Applies to all planning and coding work; covers when to recall context and when to create/capture task context proactively.
globs:
alwaysApply: true
---

# DevSpan router

DevSpan 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 DevSpan on your own initiative; the user should not have to say "add
this to DevSpan" or "did you check DevSpan?". 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.

## When the user uses a name or nickname (not a slug)
Call `resolve_ref(query="the gateway")` first and use the top-ranked candidate.
Never invent a slug or silently create a new entity for a name that might
already exist.

## Live external data (Jira / Confluence / GitLab)
DevSpan stores **pointers**, not live content:
- `external_refs` on a task point at tickets/MRs — fetch their live state via the
  native Jira/GitLab/Confluence MCPs when needed.
- `import_content(ref, content, source_url)` snapshots external content into a
  subtopic with source tracking; `refresh_source(ref)` returns the URL to re-fetch.

## Capturing knowledge
When you learn something durable that lives in no system (tribal knowledge),
write it without being asked: `upsert_context(ref="repo:<slug>/<subtopic>", content=...)`
or `append_context(...)`. Triggers to capture: a decision is made (record it +
*why*), a non-obvious workaround or gotcha surfaces, an external doc is summarized
(`import_content`), or a task wraps. Keep entity/subtopic slugs lowercase `a-z0-9-`.
For long sessions, see the session-distill rule.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.