Skip to content

willytop8/ShareXP

Repository files navigation

ShareXP

A collective brain for software fixes.

Every day, developers and AI agents solve the same errors that someone else already fixed yesterday — in another repo, another team, another company. That fix is lost. ShareXP makes it permanent.

ShareXP is a global resolution database exposed as an MCP server. When a connected agent hits a failure, it searches the collective memory for a proven fix before trying to solve it from scratch. When it solves something new, that fix goes back into the pool — anonymized, verified, and ranked by trust — so the next agent that hits the same error gets the answer instantly.

How it works

Developer A hits an error
    → ShareXP captures the failure context
    → Developer A fixes it
    → ShareXP verifies the fix and publishes it to the global hub

                        ↓ anonymized, ranked by trust ↓

Developer B hits the same error (different repo, different company)
    → ShareXP retrieves Developer A's proven fix
    → Agent applies it — problem solved in seconds, not hours

Every resolution carries a confidence score that evolves over time. Successful reuse increases trust. Recurrence or reverts decrease it. The corpus self-corrects.

Dead ends are tracked too — when an approach fails, ShareXP records it so the next agent doesn't repeat it. Multi-step fixes are captured as resolution chains, and on-demand anomaly detection watches for spikes, new failure patterns, TTR regressions, and dead-end surges.

The three tiers

Tier Scope Storage What it does
Local Your machine SQLite Remembers your own fixes across sessions
Shared Your team PostgreSQL or SQLite Shares fixes across repos within your org
Global Everyone Central hub API Community-wide resolution pool

All three tiers are searched in parallel on every failure. Local fixes rank highest, but when you hit something nobody on your team has seen before, the global pool has your back.

What it does beyond capture and search

  • Strategy analysis — Learns which debugging tool-call sequences resolve errors fastest and recommends them
  • Staleness detection — Flags resolutions that haven't been re-verified against newer dependency versions
  • Root cause clustering — Groups co-occurring failures into causal clusters (auto-triggered during finalization) so agents fix the root cause, not individual symptoms
  • Dependency signals — Lightweight query for any dependency: failure count, resolution count, TTR, reuse rate, staleness
  • Preflight checks — Before running a risky command, aggregates known failures, dead ends, and stale fixes into a risk assessment
  • Error taxonomy — Maps errors to an abstract taxonomy (30+ categories) for cross-ecosystem classification
  • Source reputation — Scores resolution sources by outcome history so higher-trust sources rank first

Quick start

Prerequisites

  • Node.js >= 20

Install

git clone https://github.com/willytop8/ShareXP.git
cd ShareXP
npm install
npm run build

Run as an MCP server

# stdio mode (for Claude Code, Cursor, etc.)
node dist/index.js

# HTTP mode (for hosted deployments)
ER_TRANSPORT=streamable-http node dist/index.js

Connect to the global hub

Point your instance at a hub to search and contribute to the collective brain:

export ER_GLOBAL_API_URL=https://your-hub.fly.dev

Connect to Claude Code

Add ShareXP as an MCP server in your Claude Code settings, then copy the hook config:

cp .claude/settings.example.json .claude/settings.json

This registers hooks so failures are captured and fixes are published automatically.

Host your own hub

Any ShareXP instance running in HTTP mode is a hub. It exposes two open endpoints:

  • POST /api/v1/global/publish — Accept anonymized resolutions
  • POST /api/v1/global/search — Search by fingerprint and error message

Point your team's instances at it and you have a shared resolution network.

MCP tools

ShareXP exposes 18 tools over MCP.

Core resolution lifecycle

Tool What it does
capture_resolution_candidate Record a failure event and a draft resolution
finalize_resolution Promote a candidate to a verified resolution with evidence
find_similar_resolutions Search local + shared + global for past fixes matching a failure
record_resolution_outcome Report reuse success/failure, recurrence, or feedback
record_dead_end Capture a failed approach so others don't repeat it
suggest_proactive_resolutions Surface known pitfalls based on files being edited
report_ci_outcomes Batch verification outcomes from CI

Resolution chains and anomaly detection

Tool What it does
manage_resolution_chain Create, advance, or query multi-step migration playbooks (action: create/advance/get)
detect_anomalies On-demand scan for frequency spikes, new failures, TTR regressions, dead-end surges

Debugging strategy and root cause

Tool What it does
get_debugging_strategy Recommended tool-call sequences for a failure based on historical traces
get_stale_resolutions Resolutions needing reverification, prioritized by retrieval frequency
get_root_cause_analysis Find the causal cluster for a failure — sibling failures, root cause, fix sequence
label_root_cause Annotate a causal cluster with its root cause description

Dependency signals and preflight

Tool What it does
query_dependency_signals Failure count, resolution count, avg TTR, reuse rate, and staleness for a dependency
preflight_check Risk assessment before running a command — known failures, dead ends, stale fixes

Classification and observability

Tool What it does
tag_error_category Tag a resolution with an abstract error category from the taxonomy
get_dashboard_data Failure/resolution graph data for visualization
get_operational_signals TTR percentiles, trending fingerprints, slowest resolutions

How ranking works

ShareXP uses hybrid search (full-text + vector embeddings) combined with deterministic trust scoring.

Signals that affect the ranking score:

  • Fingerprint matching — Normalized error signatures for exact and fuzzy matching
  • Semantic similarity — Local vector embeddings via Transformers.js (all-MiniLM-L6-v2, fully offline)
  • Verification status — Verified resolutions rank above candidates
  • Reuse count and confidence — More reuse and higher confidence boost rank
  • Source reputation — Outcomes per source (agent, CI, GitHub, manual) feed a Bayesian trust score that nudges ranking
  • Pinned resolutions — Golden fixes that always rank first
  • Recurrence / revert / harmful penalties — Penalized in the score; harmful and reverted fixes are filtered out entirely
  • Scope — Local and same-repo results rank above cross-repo
  • Vertical pools — Domain-scoped filtering (saas-devops, data-pipeline, etc.) narrows candidates before scoring

Enrichment returned alongside results (not part of the score):

  • Outcome loop — Every reuse updates confidence (reuse_success +0.12, recurred -0.18, reverted -0.3)
  • Dead ends — Known failed approaches for the same fingerprint are surfaced so agents don't repeat them
  • Resolution chains — Multi-step playbooks are returned when a fingerprint matches a chain pattern
  • Staleness — Each result carries a staleness score reflecting how long since its dependencies were re-verified
  • Causal clusters — When a result belongs to a cluster, sibling failures and the root cause are attached
  • Strategy suggestions — Winning debugging sequences from historical traces are included

Privacy

Nothing leaves your machine without being scrubbed. ShareXP strips secrets, PII, file paths, and high-entropy strings before publishing to the hub. Strategy traces store only tool names and categories — never arguments, file contents, or variable values. Error classifications use a fixed taxonomy, not free-text extraction. You can audit what's stored locally with npm run sharexp:audit. See SECURITY.md for the full threat model.

CLI

# Hook handler (called automatically by Claude Code hooks)
npm run sharexp:hook -- < event.json

# Wrap a command for automatic capture/finalize
npm run sharexp:run -- -- npm test

# Record an outcome manually
npm run sharexp:outcome -- --state-key <key> --outcome-kind reuse_success

# CI batch outcomes
npm run sharexp:ci -- --repo <repo> --sha <sha> --outcomes '[...]'

# Publish to shared corpus
npm run sharexp:publish-shared -- --resolution-id <id> --approve

# Create a PR from a resolution's patch
npm run sharexp:auto-pr -- <resolution-id> --dry-run

# Audit local DB for leaked secrets
npm run sharexp:audit

# Import resolutions from GitHub
npm run sharexp:import-github -- --repo owner/name

Configuration

Variable Default Description
ER_GLOBAL_API_URL URL of the central ShareXP hub (no authentication required — the global API is open)
ER_DB_PATH data/registry.db Local SQLite database path
ER_TRANSPORT stdio stdio or streamable-http
ER_HTTP_PORT 8787 HTTP server port
ER_SHARED_PG_URL PostgreSQL URL for team-level shared corpus
ER_SHARED_DB_PATH SQLite path for shared corpus (alternative to PG)
ER_AUTO_PUBLISH_SHARED false Auto-publish verified resolutions to shared corpus
ER_REDACT_ON_INGEST false Redact detected secrets/PII instead of rejecting
ER_REQUIRE_MANUAL_APPROVAL false Require manual approval before sharing redacted records
ER_DASHBOARD_TOKEN Bearer token for the dashboard HTTP endpoint

Project structure

src/
├── tools/          MCP tool handlers (18 tools)
├── services/       Business logic (capture, finalize, search, trust, publish,
│                   dead ends, chains, anomaly detection, strategy analysis,
│                   staleness, root cause, preflight, source reputation)
├── workflows/      Claude Code hook handler and workflow state
├── search/         Hybrid search: FTS5 + vector embeddings
├── ranking/        Deterministic trust-based ranking
├── context/        Environment capture, strategy traces, error taxonomy
├── privacy/        Secret/PII scanning, redaction, .sharexpignore
├── validation/     Zod input schemas
├── db/             SQLite/PostgreSQL abstraction, migrations (17 migrations)
├── sharing/        Cross-repo identity for shared corpus
├── observability/  Structured JSON logging
scripts/            CLI tools and workflow helpers
tests/              Vitest test suite
evaluation/         Ranking evaluation corpus
public/             Failure Explorer dashboard (standalone HTML)

Development

npm run typecheck   # Type-check
npm run build       # Compile TypeScript
npm test            # Run tests
npm run test:watch  # Watch mode

License

MIT

About

A local-first resolution database that captures, verifies, and shares proven fixes across sessions, teams, and the global community. Plugs into Claude Code via MCP and hooks. Nothing leaves your machine unless you say so.

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors