Local-first AI performance profiler that mathematically verifies optimizations for Python, C++, and CUDA
Project description
CoreInsight CLI
CoreInsight is a local-first, hardware-aware AI performance profiler. It parses Python, C++, and CUDA code, identifies hardware bottlenecks (CPU cache thrashing, CUDA warp divergence, algorithmic complexity issues), generates optimized code using an LLM, and mathematically verifies the results inside isolated Docker sandboxes with no data leaving your machine unless you explicitly configure a cloud provider.
How it works
CoreInsight is built around three pillars:
1. Two-pillar mathematical verification: Every optimization is verified by two independent checks before being accepted and not just trusted because the AI said so:
- Speedup integrity: Recomputes speedup from raw timing columns and cross-checks against reported values, flagging fabricated or suspicious results
- Output correctness: Spins up a fresh Docker container, runs both original and optimized functions on identical test inputs, and compares outputs with float tolerance
2. AI-free hardware evidence On top of sandbox verification, CoreInsight runs real profiling tools against both versions and reports hardware counters — wall time, total function calls, cache misses, CPU cycles — as deterministic, LLM-independent evidence. This is the number a code reviewer or auditor can trust.
3. Optimization memory Every verified optimization is stored in a local vector database (ChromaDB). On subsequent analyses, CoreInsight retrieves structurally similar past optimizations before calling the LLM. When a match is found, the entire LLM + sandbox pipeline is skipped and the stored result is returned instantly. The tool gets faster and smarter the longer you use it and saves token cost over time.
Prerequisites
- Python 3.9+
- Docker Desktop / Docker Engine: Must be running for sandbox verification. Install: https://docs.docker.com/engine/install/
- Ollama: Frr local inference (default).
Install: https://ollama.com/download, then
ollama pull llama3.2 - Recommended: OpenAI / Anthropic / Google API keys for cloud models (Pro)
Install
pip install coreinsight-cli
Or clone and install in editable mode for development:
git clone https://github.com/your-org/coreinsight
cd coreinsight
pip install -e .
Quick start
# Step 1: Configure your AI provider (defaults to Ollama + llama3.2)
coreinsight configure
# Step 2: Run the built-in demo to verify everything works
coreinsight demo
# Step 3: Analyse your own file
coreinsight analyze path/to/your_file.py
All commands
coreinsight analyze <file>
Analyse a .py, .cpp, or .cu file. Extracts functions, runs
bottleneck analysis in parallel, benchmarks in Docker, verifies
mathematically, and writes a live Markdown report next to the source file.
coreinsight analyze src/matrix_ops.py
coreinsight analyze kernels/sort.cpp
coreinsight demo [--lang python|cpp]
Run CoreInsight on a built-in example to see the full pipeline end-to-end.
coreinsight demo
coreinsight demo --lang cpp
coreinsight memory [--clear]
Inspect the local optimization memory store wjocj shows every verified optimization with function name, language, measured speedup, severity, issue summary, and hardware evidence.
coreinsight memory # list stored optimizations
coreinsight memory --clear # wipe the store
coreinsight index [--dir <path>]
Index a repository into a local vector database so the AI has cross-file context (custom structs, helper functions, dependencies) during analysis.
coreinsight index
coreinsight index --dir ./src
coreinsight scan [--dir <path>] [--top N]
Scan a directory with static AST analysis and rank the most complex, deeply-nested hotspots without touching the LLM. Useful for triaging large codebases before a full analysis.
coreinsight scan
coreinsight scan --dir ./src --top 20
coreinsight configure [--pro-key <key>]
Set up your AI provider and API keys interactively.
Pass --pro-key to unlock Pro features.
coreinsight configure
coreinsight configure --pro-key <your-key>
coreinsight configure [--agent-mode <mode>]
Choose between single-agent or multi-agent mode.
Pass --agent-mode multi for multi-agent usage.
# Explicit override
coreinsight configure --agent-mode multi
coreinsight configure --agent-mode single
# Reset to auto-selection
coreinsight configure --agent-mode auto
Supported languages
| Language | Analysis | Benchmarking | Correctness | Hardware profiling |
|---|---|---|---|---|
| Python | ✅ | ✅ | ✅ | ✅ (Pro) |
| C++ | ✅ | ✅ | ✅ | 🔜 v0.2.1 |
| CUDA | ✅ | ✅ | — | 🔜 v0.2.1 |
Supported AI providers
| Provider | Tier | Setup |
|---|---|---|
| Ollama (local) | Free | ollama pull llama3.2 |
LM Studio / vLLM (local_server) |
Free | Point to http://localhost:1234/v1 |
| OpenAI | Pro | API key via coreinsight configure |
| Anthropic | Pro | API key via coreinsight configure |
| Google Gemini | Pro | API key via coreinsight configure |
All local providers run 100% on-device — no data leaves your machine.
Tiers
| Feature | Free | Pro |
|---|---|---|
| Local providers (Ollama, LM Studio) | ✅ | ✅ |
| Cloud providers (OpenAI, Anthropic, Gemini) | — | ✅ |
| Functions per file | 3 | Unlimited |
| Retry attempts | 2 | 5 |
| Correctness test cases | 8 | 15 |
| AI-free hardware profiling | — | ✅ |
| Optimization memory | ✅ | ✅ |
Architecture
coreinsight/
├── main.py CLI entry point, parallel execution, Rich UI, report generation
├── analyzer.py LLM chain: bottleneck analysis, harness generation, test cases
├── sandbox.py Docker execution, speedup integrity, output correctness
├── profiler.py AI-free hardware profiling (cProfile, perf stat)
├── memory.py Optimization memory store (ChromaDB, semantic + exact lookup)
├── parser.py AST parsing via tree-sitter for Python, C++, CUDA
├── indexer.py RAG repo indexer (ChromaDB + sentence-transformers)
├── hardware.py Hardware detection for LLM context
├── scanner.py Project-wide hotspot scanner
├── config.py Provider config, tier limits, pro key activation
└── prompts.py System prompt, analysis template, tiered harness addenda
All verification runs inside Docker with network disabled, memory limits enforced, and all capabilities dropped. The LLM sees your code; the sandbox never phones home.
Output
Every analysis writes a Markdown report next to your source file:
your_file_coreinsight_report.md
your_file_benchmark_plot.png # Python only
The report includes the optimized code, benchmark table, verification results, and (Pro) a Hardware Evidence section with deterministic profiler output — suitable for sharing with a team or attaching to a PR.
Get Pro: Free while this tool is in beta
Pro features (cloud providers, AI-free hardware profiling, unlimited functions) are free during the beta period. Pro keys are being handed out manually right now.
Request a key: tally.so/r/xXZ9YE
Once you have a key:
coreinsight configure --pro-key <your-key>
Privacy
CoreInsight is local-first by design:
- Ollama / local_server — code never leaves your machine
- Cloud providers — only the function code and context you choose to analyse is sent to the provider's API, under your own key
- The optimization memory store lives at
~/.coreinsight/memory_dbon your local filesystem
Troubleshooting
ChromaDB issue with old SQLite3 versions. To resolve:
pip install pysqlite3-binary # >=0.5.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coreinsight_cli-0.2.7.tar.gz.
File metadata
- Download URL: coreinsight_cli-0.2.7.tar.gz
- Upload date:
- Size: 74.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07ddc5af3b036b6508577924f61a9a381f97b98bb1100aa29e196982f9099b45
|
|
| MD5 |
afd565895e4248dd300873dbf58d835a
|
|
| BLAKE2b-256 |
78f5227e1426fbad69a994c63b34c7464700236c477e5ce347e70e8db70fd126
|
Provenance
The following attestation bundles were made for coreinsight_cli-0.2.7.tar.gz:
Publisher:
publish.yml on Prais3/coreinsight_cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coreinsight_cli-0.2.7.tar.gz -
Subject digest:
07ddc5af3b036b6508577924f61a9a381f97b98bb1100aa29e196982f9099b45 - Sigstore transparency entry: 1204618507
- Sigstore integration time:
-
Permalink:
Prais3/coreinsight_cli@331d3459715c1304a8dd896e53a863b33a2c7860 -
Branch / Tag:
refs/tags/v0.2.7 - Owner: https://github.com/Prais3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@331d3459715c1304a8dd896e53a863b33a2c7860 -
Trigger Event:
push
-
Statement type:
File details
Details for the file coreinsight_cli-0.2.7-py3-none-any.whl.
File metadata
- Download URL: coreinsight_cli-0.2.7-py3-none-any.whl
- Upload date:
- Size: 77.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c39b6c8d6a5722ab17b2f2e79a30ade6a222cd0ee102b5db0347b94ee1bebee0
|
|
| MD5 |
817958287c8e27584a1b7c6662429d55
|
|
| BLAKE2b-256 |
b169e1d654e15673eb007e75b5c1a7b9c14e3eea7d0e96a26b3cc82aeb2bf90e
|
Provenance
The following attestation bundles were made for coreinsight_cli-0.2.7-py3-none-any.whl:
Publisher:
publish.yml on Prais3/coreinsight_cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coreinsight_cli-0.2.7-py3-none-any.whl -
Subject digest:
c39b6c8d6a5722ab17b2f2e79a30ade6a222cd0ee102b5db0347b94ee1bebee0 - Sigstore transparency entry: 1204618508
- Sigstore integration time:
-
Permalink:
Prais3/coreinsight_cli@331d3459715c1304a8dd896e53a863b33a2c7860 -
Branch / Tag:
refs/tags/v0.2.7 - Owner: https://github.com/Prais3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@331d3459715c1304a8dd896e53a863b33a2c7860 -
Trigger Event:
push
-
Statement type: