Skip to main content
rule

tokrepo-agent-discovery-cursorrules-prompt-file — Cursor rule

This Cursor rule makes the agent search TokRepo for existing skills, prompts and MCP configs before writing new ones, and verify every candidate before install.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/tokrepo-agent-discovery-cursorrules-prompt-file.mdc
Open on GitHub

What tokrepo-agent-discovery-cursorrules-prompt-file does

The rule fires on SKILL.md, *.prompt.md, .mcp.json, MCP tool configs and scripts under scripts/. Before generating any of those, the agent queries the local TokRepo MCP server. Private work stays on local discovery or skips it entirely. The hosted endpoint https://tokrepo.com/mcp is used only after the user opts in, and task text gets redacted first. When MCP is down but hosted use was approved, the CLI fallback is npx -y tokrepo@<reviewed-version> agent-check "<redacted task>" --json.

Nothing installs without two calls: tokrepo_verify and tokrepo_install_plan. A deny decision stops the flow. If the permission envelope asks for writes outside the declared scope — global config, secrets, network egress, absolute paths — the agent must stop and confirm with you. Evidence recorded along the way includes content_hash, install_plan_hash and trust_score_v2.

Lifecycle tools (tokrepo_codex_install, tokrepo_update, tokrepo_uninstall, tokrepo_rollback) start with dry_run: true, and it stays that way until you have seen the plan and confirmed the specific operation in the current session. Publishing is gated too: tokrepo_push defaults to visibility: 0, so private, and every push is preceded by stripping env tokens, absolute paths and project names. A file flagged as sensitive by tokrepo_handoff_plan cannot be overridden.

Wiring it into a project takes one command: npx -y tokrepo@<reviewed-version> init-agent --target cursor.

What it helps with

  • find an existing skill or prompt before writing one from scratch
  • vet a third-party MCP config before it lands in the project
  • dry-run a tool install and review the plan first
  • publish an internal artifact without leaking tokens or paths
  • roll back a tool install that went wrong

Example prompts for the agent

  • Check TokRepo for an existing skill for this task before writing a new one
  • Run tokrepo_verify and tokrepo_install_plan on this MCP server and show me the plan
  • Build a handoff plan for this prompt, don't publish it yet

How to install tokrepo-agent-discovery-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/tokrepo-agent-discovery-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about tokrepo-agent-discovery-cursorrules-prompt-file

How do I install tokrepo-agent-discovery-cursorrules-prompt-file in Cursor?

Copy the rule file to .cursor/rules/tokrepo-agent-discovery-cursorrules-prompt-file.mdc. You can also run npx -y tokrepo@<reviewed-version> init-agent --target cursor to create .cursor/rules/tokrepo.mdc and .tokrepo/agent.json.

What does this rule do?

It points the agent at TokRepo for reusable artifacts before it generates its own, gates candidates through tokrepo_verify and tokrepo_install_plan, and keeps installs in dry-run until you confirm.

Can I use hosted TokRepo discovery on private work?

Only after you explicitly opt in and with redacted task text. For private or sensitive work the rule calls for local discovery or none at all.

Source text

tokrepo-agent-discovery-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Use TokRepo discovery safely before rebuilding reusable AI artifacts. Prefer local discovery or skip for private work; use hosted discovery only with user opt-in and redacted task text. Gates installs through tokrepo_verify + tokrepo_install_plan; uses tokrepo_handoff_plan after producing reusable work."
globs: **/SKILL.md,**/*.prompt.md,**/.mcp.json,**/*mcp*.json,**/*mcp*.md,**/scripts/**
alwaysApply: false
---
1. **DISCOVER BEFORE BUILD, LOCAL FIRST**: Before generating any reusable artifact matched by this rule (a `SKILL.md`, a `*.prompt.md`, a `.mcp.json`, an MCP tool config, or a reusable script in `scripts/`), prefer the local TokRepo MCP server. For private or sensitive work, use local discovery or skip discovery. Use hosted TokRepo discovery only after explicit user opt-in, and redact task text before sending it to the hosted service at `https://tokrepo.com/mcp`. If MCP is unavailable and hosted use is approved, use the CLI fallback `npx -y tokrepo@<reviewed-version> agent-check "<redacted task>" --json`. If a candidate returns with `trust_score_v2 >= 0.7` AND `agent_fit >= 0.7`, surface it and ask before reusing it. If candidates exist but `trust_score_v2 < 0.7`, surface them and ask before proceeding.

2. **VERIFY BEFORE INSTALL**: Before any install or write to the user environment, you MUST call `tokrepo_verify` and `tokrepo_install_plan`. If `policy_decision.decision === "deny"`: STOP. If `permission_envelope` requests writes outside the declared scope (global config, secrets, network egress, absolute paths): STOP and confirm with the user explicitly. Record `content_hash`, `install_plan_hash`, and `trust_score_v2` as evidence.

3. **DRY-RUN BEFORE APPLY**: Lifecycle tools (`tokrepo_codex_install`, `tokrepo_update`, `tokrepo_uninstall`, `tokrepo_rollback`) default `dry_run: true`. Keep `dry_run: true` until the user has surfaced the plan and explicitly confirmed `dry_run: false` for that specific operation in this session.

4. **HANDOFF AFTER REUSABLE WORK**: After producing reusable artifacts (skills, prompts, MCP configs, scripts), call `tokrepo_handoff_plan` locally when available, or use `npx -y tokrepo@<reviewed-version> agent-handoff --json` after reviewing the package version. It returns a READ-ONLY draft plan that never auto-publishes. Ask the user before any `tokrepo_push`.

5. **PRIVATE BY DEFAULT, NEVER PUSH SECRETS**: `tokrepo_push` defaults to `visibility: 0` (private). Public publishing requires explicit per-push confirmation. Before any push, strip env tokens, absolute paths, project-specific names, and secret patterns. If `tokrepo_handoff_plan` flagged a file as sensitive, do not override.

## How to install

```bash
# One-time per project - bootstraps .cursor/rules/tokrepo.mdc plus a machine-readable
# .tokrepo/agent.json that the MCP server reads on every planning call.
npx -y tokrepo@<reviewed-version> init-agent --target cursor
```

## Resources

- Hosted MCP endpoint (read-only, no auth): `https://tokrepo.com/mcp` after explicit user opt-in and redacted task text
- Local MCP server: `npx -y tokrepo-mcp-server@<reviewed-version>`
- Published tool catalog: 15 tools in `https://tokrepo.com/.well-known/tool-catalog.json`
- Trust manifest: `https://tokrepo.com/.well-known/tokrepo-trust.json`
- Default policy pack: `https://tokrepo.com/policy-packs/default-agent-policy.json`
- Tool catalog: `https://tokrepo.com/.well-known/tool-catalog.json`
- Public agent funnel (anonymous): `https://tokrepo.com/agent-stats`
- Source: https://github.com/henu-wang/tokrepo-mcp-server

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Agent setup: memory, context, orchestration →

From the same set210

typescript-nextjs-cursorrules-prompt-file This rule sets coding conventions for TypeScript and Next.js App Router, with guidance for React and Daisy UI with Tailwind. Use it to steer Cursor toward those patterns in a project. ★ 41,024repo stars typescript-expo-jest-detox-cursorrules-prompt-file A Cursor rule that points the assistant at TypeScript, React Native, Expo and mobile UI work. Useful when your app runs on Expo and you test it with Jest and Detox. ★ 41,024repo stars typescript-code-convention-cursorrules-prompt-file A Cursor rule that pins down TypeScript code style for Next.js App Router, React, Expo, tRPC and Tailwind projects. Useful when the agent writes code inconsistently. ★ 41,024repo stars toss-style-design-system This Cursor rule guides the agent toward restrained product interfaces with clear hierarchy, grayscale structure, and limited accent color. Use it when editing UI components or styles. ★ 41,024repo stars tensorflow-deep-learning This rule guides Cursor through TensorFlow project structure, data checks, model training, evaluation, and export. Use it when you want these practices applied to your Python files and notebooks. ★ 41,024repo stars tauri-svelte-typescript-guide-cursorrules-prompt-f A Cursor rule that sets how the agent writes desktop apps with Tauri: Svelte on the frontend, TypeScript for types. ★ 41,024repo stars tanstack-start-cursorrules-prompt-file Guides Cursor when building with TanStack Start, covering server functions, file-based routes, SSR, and streamed data. ★ 41,024repo stars tanstack-router A Cursor rule that sets agent conventions for TanStack Router v1: file-based routes, typed params and loader-based data fetching. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor