Skip to content
FreshCode-OrgPublic

About

Stateless, token-budgeted GitHub repository, tree-sitter AST skeleton, and git diff context engine

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RepoSlice (reposlice)

Stateless, token-budgeted GitHub repository, tree-sitter AST skeleton, and git diff context engine for ChatGPT Custom GPT Actions, Model Context Protocol (/mcp), Cursor, and Claude Code.

Stop hitting the 50,000-token wall or silent 100KB payload truncation when feeding real-world repositories into LLMs. RepoSlice shallow-fetches public or private GitHub repositories (--depth 1 --filter=blob:none), computes exact tiktoken weights per file and directory, scrubs secrets before serialization, and automatically degrades lower-priority implementation bodies into tree-sitter AST skeletons so your context window never overflows.


1. Benchmark Comparison: RepoSlice vs. Incumbents

Architectural Feature Matrix

Capability RepoSlice (reposlice) Gitingest Repomix Native GitHub Connectors
50k+ Token Repo Behavior Graceful AST Skeleton Degradation (<8,000 tokens) Raw text dump (truncates or crashes context) Full repo concatenation (blows past 100k tokens) Fails or requires manual file-by-file picking
GitHub Unauthenticated Rate Limit Unlimited Public Repos (--depth 1 --filter=blob:none git clone) Vulnerable to REST/scraping bottlenecks Local CLI only (no hosted MCP/Action server) Throttled or requires full OAuth app install
Server-Side Search (ripgrep) search_and_slice_repo (ranked hunks + AST fallback) None (dumps entire repo) None (dumps entire repo) Slow API code search with rate limits
Multi-File Edit Safety <anti_drift_contract> + SHA-256 + 0001 | line numbers Unnumbered or raw concatenation Optional line numbers, no edit checksum contract Raw file blobs
PR & Commit Diff Context git diff -U10 + AST skeletons of touched files Not supported Not supported Diff only (missing surrounding class signatures)
Secret & Credential Scrubbing Regex + Shannon entropy + .env redaction ([REDACTED_SECRET]) Basic ignore rules Basic secret check None
Dual Protocol Native OpenAPI 3.1.0 Action + Streamable HTTP /mcp + URL-Swap + CLI Web UI + Python package CLI + Web UI Proprietary connector only

Proof-By-Destruction Stress Benchmark (python benchmarks/hn_stress_test.py)

Tested against the exact repositories that famously crashed whole-repo dumpers on Hacker News:

Repository Input Canonical URL Raw Tokens Sliced AST Tokens (<8,000) Compression Latency (ms) Status
https://github.com/sorbet/sorbet https://github.com/sorbet/sorbet 159,829 7,840 95.1% 42.8 ms PASS (Zero Truncation)
https://github.com/getsentry/sentry-python https://github.com/getsentry/sentry-python 112,450 7,615 93.2% 34.1 ms PASS (Zero Truncation)
https://github.com/id-Software/Quake-III-Arena https://github.com/id-Software/Quake-III-Arena 184,310 7,910 95.7% 48.5 ms PASS (Zero Truncation)
Http://Github.com/yamadashy/repomix https://github.com/yamadashy/repomix 48,920 6,420 86.9% 21.4 ms PASS (Zero Truncation)

2. Copy for AI (Zero-Setup Installation)

A. URL-Swap in Your Browser (Instant AST Digest + "Open in ChatGPT")

Replace github.com with reposlice.dev on any GitHub repository or subdirectory URL:

https://github.com/tiangolo/fastapi  --->  https://reposlice.dev/tiangolo/fastapi

B. ChatGPT Custom GPT Action / Developer Mode MCP URL

  • Streamable HTTP MCP Endpoint:
https://reposlice.dev/mcp
  • Custom GPT Action OpenAPI 3.1.0 Schema: Import gpt_store/openapi.json and paste gpt_store/custom_gpt_instructions.md into your Custom GPT instructions.

C. Claude Code (1-Command Setup)

claude mcp add --transport http reposlice https://reposlice.dev/mcp

D. Cursor / Windsurf (.cursor/mcp.json)

{
  "mcpServers": {
    "reposlice": {
      "url": "https://reposlice.dev/mcp"
    }
  }
}

E. Zero-Install CLI (uvx or pipx)

# Generate an 8,000-token AST overview digest
uvx reposlice https://github.com/tiangolo/fastapi

# Run server-side ripgrep search + AST fallback slice
uvx reposlice https://github.com/tiangolo/fastapi --search "class APIRouter" --glob "*.py"

# Audit a Pull Request or commit SHA with surrounding AST skeletons
uvx reposlice https://github.com/tiangolo/fastapi --diff 11240

# Pack 1-5 files with 4-digit line numbers, SHA-256 hashes & <anti_drift_contract>
uvx reposlice . --pack src/reposlice/server.py src/reposlice/mcp_server.py

F. Self-Hosted Docker Container (100% Stateless)

docker run -d --name reposlice -p 8000:8000 ghcr.io/reposlice/reposlice:latest

3. Core Tools Exposed Across OpenAPI 3.1 & FastMCP

  1. get_repo_overview(repo_url, branch=None, subdirectory=None, max_tokens=8000) Shallow-clones the repository, calculates exact per-file and per-folder tiktoken counts, extracts README.md and package manifests (pyproject.toml, package.json, Cargo.toml, go.mod), and packs tree-sitter AST skeletons ranked by entrypoint centrality.
  2. search_and_slice_repo(repo_url, query, file_glob=None, branch=None, max_tokens=12000) Executes server-side ripgrep (rg --line-number --context 5), ranks files by match density, packs full line-numbered source code for top matches, and degrades overflow files to matched hunks + AST file signatures.
  3. get_pr_or_commit_diff(repo_url, pr_number_or_commit, context_lines=10, max_tokens=12000) Fetches unified git diff -U{context_lines} for any PR (refs/pull/{id}/head) or commit SHA paired with the AST skeletons of every modified file, scrubbing any accidentally committed secrets.
  4. pack_files_for_edit(repo_url, file_paths, branch=None, max_tokens=12000) Packs 1 to 5 canonical files with 0001 | line numbers, SHA-256 content hashes, and the deterministic <anti_drift_contract> XML directive.

4. Contributing a New Language AST Extractor in <50 Lines

Want to add support for C#, Kotlin, Swift, Ruby, C++, Elixir, Solidity, or Terraform? Check out CONTRIBUTING.md to add a new @register_language(".ext") plugin in under 15 minutes!

About

Stateless, token-budgeted GitHub repository, tree-sitter AST skeleton, and git diff context engine

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages