agentleFS
HoangP8HoangP8/tokless/.cursor/rules/context-tools.mdc

tokless / rules

Cursor rule281 starsChanged 56 days agoMITView on GitHub

This rule guides efficient context collection, analysis, and retrieval while keeping raw data focused.

The file

We split this context-tools.mdc into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use host tools for edits, Git writes, navigation, installs, and small output.

    line 62

≈ “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
context-tools.mdc
---
description: This rule guides efficient context collection, analysis, and retrieval while keeping raw data focused.
alwaysApply: true
---
## Context Tools (context-mode)

MCP tools `ctx_*` keep large or uncertain analysis out of context.

### Rules

| Tool | Role | Replaces |
|------|------|----------|
| `ctx_execute` | Run code in sandbox. Only stdout enters context. | Bash for analysis tasks |
| `ctx_execute_file` | Process file in sandbox. Raw bytes never leave. | Read on large files (>200 lines) |
| `ctx_batch_execute` | Run N commands + auto-index output. Search in same call. Concurrency 1-8. | Multiple Bash + grep |
| `ctx_index` | Chunk markdown/text into FTS5. Queryable via `ctx_search`. | Manual grep over pasted content |
| `ctx_search` | Multi-strategy search across indexed content + session memory. Typo correction. | Re-asking user, re-deriving |
| `ctx_fetch_and_index` | Fetch URL, chunk and index. Cache 24h; `ttl: 0` or `force: true` bypasses cache. Supports `requests` + `concurrency: 1-8`. | Webfetch |

### Examples

```shell
ctx_execute(language:"shell", code:"git log --oneline -20 | wc -l")
```

```javascript
ctx_execute(language:"javascript", code:`
  const fs = require('node:fs');
  const files = fs.readdirSync('src').filter(f => f.endsWith('.ts'));
  const counts = files.map(f => ({
    file: f,
    lines: fs.readFileSync('src/' + f, 'utf8').split('\n').length
  }));
  console.log(JSON.stringify(counts));
`)
```

```javascript
ctx_execute_file(path:"app.log", language:"javascript", code:`
  const lines = FILE_CONTENT.split('\n');
  const errs = lines.filter(l => /ERROR|FATAL/.test(l));
  console.log(errs.length + ' errors');
`)
```

```javascript
ctx_batch_execute(commands:[
  {label:"diff", command:"git diff HEAD~1"},
  {label:"status", command:"git status"},
], queries:["failures","errors"], timeout:120000, concurrency:2,
 cwd:".", query_scope:"batch")
```

```javascript
ctx_fetch_and_index(requests:[
  {url:"https://docs.example.com/api", source:"api-docs"},
  {url:"https://docs.example.com/guide", source:"guide"},
], concurrency:4)
ctx_search(queries:["auth endpoint","rate limits"], source:"api-docs")
```

Use host tools for edits, Git writes, navigation, installs, and small output. Use context-mode for analysis and large command output. Sandbox writes do not affect host files.

Windows: `pwsh -NoProfile -Command`, absolute paths, `X:\` maps to `/x/`, quote spaces.

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.