Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Outline

ContextSlice — Agent Automation

Automates the ctxslice pre-step so agents run it before every task without you doing anything manually.


Cursor Agent — .cursorrules

Copy .cursorrules from the repo root into your project:

cp /path/to/ContextSlice/.cursorrules /path/to/your-project/.cursorrules

That's it. Every Cursor Agent session now:

  1. Runs ctxslice run "<your task>" automatically as its first action
  2. Reads .ctxslice.md
  3. Works only within that context
  4. Never expands to the full codebase unless it hits a concrete blocker

You just type your task normally. The agent handles the rest.


Claude Desktop — MCP Server

The MCP server exposes three tools to Claude:

Tool When Claude calls it
ctxslice_run Before every coding task — mandatory first step
ctxslice_index When working in a new repo for the first time
ctxslice_stats When asked about index health

Setup

Step 1 — Find your Claude Desktop config file

macOS:   ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux:   ~/.config/Claude/claude_desktop_config.json

Step 2 — Add the MCP server

Open the config file and add the contextslice entry under mcpServers:

{
  "mcpServers": {
    "contextslice": {
      "command": "python",
      "args": ["/absolute/path/to/ContextSlice/mcp/server.py"],
      "env": {}
    }
  }
}

Replace /absolute/path/to/ContextSlice with your actual path. On macOS:

/Users/yourname/projects/ContextSlice/mcp/server.py

Step 3 — Restart Claude Desktop

Quit and reopen. The contextslice tools should appear in the tools list.

Step 4 — Use normally

Tell Claude any coding task:

Add server-side pagination to the users endpoint in src/api/UsersController.java

Claude will automatically call ctxslice_run first, read the context, then work within it. You never touch the terminal.


How the MCP tool works

When Claude calls ctxslice_run:

  1. The server runs ctxslice run "<task>" --repo <repo> --file <file> as a subprocess
  2. Reads .ctxslice.md from the repo root
  3. Returns the full content back to Claude as tool output
  4. Includes an instruction telling Claude to stay within the context

Claude receives the filtered codebase as tool output — same as if you had uploaded the file manually, but fully automatic.


Tool parameters Claude can pass

ctxslice_run

  • task (required) — the task description
  • file (optional) — active file relative to repo root
  • repo (optional) — absolute path to repo root, defaults to cwd
  • tokens (optional) — token budget, default 40000

ctxslice_index

  • repo (optional) — repo root
  • force (optional) — full rebuild, default false

ctxslice_stats

  • repo (optional) — repo root

Telling Claude which repo to use

If Claude Desktop's working directory isn't your project, include the repo path in your task:

In /Users/me/projects/my-app, add pagination to UserList

Claude will pass it as the repo argument automatically.

Or set it once at the start of a conversation:

I'm working in /Users/me/projects/my-app. Always use that as the repo root.

Both together

There's no conflict. Use .cursorrules when working in Cursor Agent mode, and the MCP server when working in Claude Desktop. Same underlying pipeline, same output format, different integration surface.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.