Labsco
reprompt-dev logo

reprompt

β˜… 46

from reprompt-dev

Prompt analytics MCP server: score prompts, search history, detect leaked credentials, and scan AI coding sessions.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeNeeds API keys

ctxray

See how you really use AI.

X-ray your AI coding sessions across Claude Code, Cursor, ChatGPT, and 6 more tools. Discover your patterns, find wasted tokens, catch leaked secrets β€” all locally, nothing leaves your machine.

PyPI version Python 3.10+ License: MIT Tests Coverage

Works in your pipeline

Drop ctxray into your CI as a prompt quality gate. No LLM, no API key, no network β€” <50ms per prompt.

Copy & paste β€” that's it
# .github/workflows/prompt-quality.yml
- uses: ctxray/ctxray@main
  with:
    score-threshold: 43    # experimentally validated quality threshold
    model: claude          # model-specific rules (claude/gpt/gemini)
    comment-on-pr: true
Copy & paste β€” that's it
# .pre-commit-config.yaml
repos:
  - repo: https://github.com/ctxray/ctxray
    rev: v3.0.0
    hooks:
      - id: ctxray-lint-score   # fail below quality threshold
      # or: id: ctxray-lint-claude  # Claude-specific rules + threshold
  • Deterministic β€” same prompt, same score, every run. No flaky LLM-based checks.
  • Air-gapped β€” runs in offline and private networks. All analysis stays on your infrastructure.
  • Configurable β€” .ctxray.toml or [tool.ctxray.lint] in pyproject.toml. Per-project rules.

Full setup: GitHub Action Β· pre-commit Β· .ctxray.toml

What you'll discover

Your AI coding persona

ctxray wrapped generates a Spotify Wrapped-style report of your AI interactions β€” your persona (Debugger? Architect? Explorer?), top patterns, and a shareable card.

Your prompt patterns

ctxray insights compares your actual prompting habits against research-backed benchmarks. Are your prompts specific enough? Do you front-load instructions? How much context do you provide?

Your privacy exposure

ctxray privacy --deep scans every prompt you've sent for API keys, tokens, passwords, and PII. See exactly what you've shared with which AI tool.

Full prompt diagnostic

ctxray check "your prompt" scores, lints, and rewrites in one command β€” no LLM, <50ms.

Experimentally validated on 3000+ LLM calls across 8 models (1.5B β†’ 27B): prompts at or above score 43 hit ~93% pass rate on executable code tests. Below 43 they average 72% or lower. ctxray tells you which side you're on and what to fix β€” see experiments/RESULTS.md for the full cross-model data.

Copy & paste β€” that's it
ctxray check "fix the auth bug in login.ts"        # threshold pass/fail + diagnostics
ctxray check "fix bug" --model claude               # model-specific scoring for Claude
ctxray check "refactor middleware" --threshold 50    # custom threshold for stricter teams
<img src="docs/screenshots/check-good.svg" alt="ctxray check β€” good prompt" width="800"> <details> <summary>More screenshots</summary>

ctxray rewrite β€” rule-based prompt improvement

<img src="docs/screenshots/rewrite.svg" alt="ctxray rewrite β€” before/after" width="800">

ctxray build β€” assemble prompts from components

<img src="docs/screenshots/build.svg" alt="ctxray build β€” structured prompt assembly" width="800">

What a bad prompt looks like

<img src="docs/screenshots/check-bad.svg" alt="ctxray check β€” weak prompt" width="800"> </details>

All commands

Discover your patterns

CommandDescription
ctxray wrappedAI coding persona + shareable card
ctxray insightsPersonal patterns vs research-optimal benchmarks
ctxray toolsCross-tool comparison β€” how your Claude Code / Cursor / ChatGPT habits differ
ctxray sessionsSession quality scores with frustration signal detection
ctxray agentAgent workflow analysis β€” error loops, tool patterns, efficiency
ctxray repetitionCross-session repetition detection β€” spot recurring prompts
ctxray patternsPersonal prompt weaknesses β€” recurring gaps by task type
ctxray distillExtract important turns from conversations with 6-signal scoring
ctxray projectsPer-project quality breakdown
ctxray stylePrompting fingerprint with --trends for evolution tracking
ctxray privacySee what data you sent where β€” file paths, errors, PII exposure

Optimize your prompts

CommandDescription
ctxray check "prompt"Full diagnostic β€” score + lint + rewrite + threshold pass/fail
ctxray score "prompt"Research-backed 0-100 scoring with 30+ features
ctxray score "prompt" --model claudeModel-specific scoring β€” Claude, GPT, or Gemini adjustments
ctxray rewrite "prompt"Rule-based improvement β€” filler removal, restructuring, hedging cleanup
ctxray build "task"Build prompts from components β€” task, context, files, errors, constraints
ctxray compress "prompt"4-layer prompt compression (40-60% token savings typical)
ctxray compare "a" "b"Side-by-side prompt analysis (or --best-worst for auto-selection)
ctxray lintConfigurable linter with CI/GitHub Action support

Manage

CommandDescription
ctxrayInstant dashboard β€” prompts, sessions, avg score, top categories
ctxray scanAuto-discover prompts from 9 AI tools
ctxray reportFull analytics: hot phrases, clusters, patterns (--html for dashboard)
ctxray digestWeekly summary comparing current vs previous period
ctxray template save|list|useSave and reuse your best prompts
ctxray distill --exportRecover context when a session runs out β€” paste into new session
ctxray initGenerate .ctxray.toml config for your project

Supported AI tools

ToolFormatAuto-discovered by scan
Claude CodeJSONLYes
Codex CLIJSONLYes
Cursor.vscdbYes
AiderMarkdownYes
Gemini CLIJSONYes
Cline (VS Code)JSONYes
OpenClaw / OpenCodeJSONYes
ChatGPTJSONVia ctxray import
Claude.aiJSON/ZIPVia ctxray import

Prompt Science

Scoring is calibrated against 10 peer-reviewed papers covering 30+ features across 5 dimensions:

DimensionWhat it measuresKey papers
StructureMarkdown, code blocks, explicit constraintsPrompt Report (2406.06608)
ContextFile paths, error messages, I/O specs, edge casesZi+ (2508.03678), Google (2512.14982)
PositionInstruction placement relative to contextStanford (2307.03172), Veseli+ (2508.07479), Chowdhury (2603.10123)
RepetitionRedundancy that degrades model attentionGoogle (2512.14982)
ClarityReadability, sentence length, ambiguitySPELL (EMNLP 2023), PEEM (2603.10477)

Cross-validated findings that inform our engine:

  • Position bias is architectural β€” present at initialization, not learned. Front-loading instructions is effective for prompts under 50% of context window (3 papers agree)
  • Moderate compression improves output β€” rule-based filler removal doesn't just save tokens, it enhances LLM performance (2505.00019)
  • Prompt quality is independently measurable β€” prompt-only scoring predicts output quality without seeing the response (ACL 2025, 2503.10084)
  • Quality threshold at score ~43 β€” our own experiment (30 prompts, 5 tiers, 2 models) found a step function: below 43, 83% failure rate; above 43, 94% success (Pearson r=0.56, Spearman ρ=0.64)
  • Format preferences are model-dependent β€” XML benefits Claude, Markdown benefits GPT, but having any structure matters more than the specific format (PromptBridge 2512.01420)

Model-specific scoring (--model claude/gpt/gemini) applies research-backed adjustments for each model's known preferences and sensitivities.

All analysis runs locally in <1ms per prompt. No LLM calls, no network requests.

</details> <details> <summary>How it works β€” architecture</summary>

How it works

Copy & paste β€” that's it
 Data sources:
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚Claude Codeβ”‚ β”‚  Cursor  β”‚ β”‚  Aider   β”‚ β”‚ ChatGPT  β”‚ β”‚ 5 more.. β”‚
 β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    scan -> dedup -> store -> analyze
                                 β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              v                  v                  v
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ insights β”‚     β”‚  patterns    β”‚    β”‚ sessions β”‚
        β”‚ wrapped  β”‚     β”‚  repetition  β”‚    β”‚ projects β”‚
        β”‚ style    β”‚     β”‚  privacy     β”‚    β”‚ agent    β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key design decisions:

  • Pure rules, no LLM β€” scoring and rewriting use regex + TF-IDF + research heuristics. Deterministic, private, <1ms per prompt.
  • Adapter pattern β€” each AI tool gets a parser that normalizes to a common Prompt model. Adding a new tool = one file.
  • Two-layer dedup β€” SHA-256 for exact matches, TF-IDF cosine similarity for near-dupes.
  • Research-calibrated β€” 10 peer-reviewed papers inform the scoring weights.
</details> <details> <summary>Conversation Distillation</summary>

Conversation Distillation

ctxray distill scores every turn in a conversation using 6 signals:

  • Position β€” first/last turns carry framing and conclusions
  • Length β€” substantial turns contain more information
  • Tool trigger β€” turns that cause tool calls are action-driving
  • Error recovery β€” turns that follow errors show problem-solving
  • Semantic shift β€” topic changes mark conversation boundaries
  • Uniqueness β€” novel phrasing vs repetitive follow-ups

Session type (debugging, feature-dev, exploration, refactoring) is auto-detected and signal weights adapt accordingly.

</details>

Why ctxray?

After Promptfoo joined OpenAI and Humanloop joined Anthropic, ctxray is the independent, open-source alternative for understanding your AI interactions.

  • 100% local β€” your prompts never leave your machine
  • No LLM required β€” pure rule-based analysis, <50ms per prompt
  • 9 AI tools β€” the only tool that works across Claude Code, Cursor, ChatGPT, and more
  • Research-backed β€” calibrated against 10 peer-reviewed papers, not vibes

Previously published as reprompt-cli. Same tool, new name, clean namespace.

Privacy

  • All analysis runs locally. No prompts leave your machine.
  • ctxray privacy shows exactly what you've sent to which AI tool.
  • Optional telemetry sends only anonymous feature vectors β€” never prompt text.
  • Open source: audit exactly what's collected.

Links

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT