Verified decision provenance for AI-assisted development — memory, AST provenance, and quality verification.
Project description
WhyCode
Ask why any function exists. Get the decision that created it.
WhyCode is an MCP server that gives AI coding agents persistent memory, bidirectional code provenance, and independent quality verification. It works with Claude Code, Cursor, Windsurf, and any MCP-compatible client. Free forever for solo developers. Apache 2.0.
See it in action
$ provenance.reverse("backend/auth/auth_service.py", "hash_password")
decision Use Argon2id for all password hashing
recorded Apr 10 · claude-code · session sess_a1b2
rationale OWASP 2024 recommendation, memory-hard, GPU-resistant
commit a1b2c3d — [P1] Auth service with Argon2id hashing
changes hash_password (added), verify_password (added)
verified CI passed · run #9912 · Apr 10 10:12
$ drift.check("my-saas-project")
warning backend/cache/redis.py imports asyncpg directly
violates decision dec_007: "All DB access through db_backend.py"
Quick start
Requires Node.js 18+. Python 3.11+ installed automatically.
npx whycode@latest init-and-serve
Open http://localhost:8100 — a 5-step walkthrough gets you to your first provenance query in under 5 minutes.
Works with: Claude Code · Cursor · Windsurf · Any MCP client Runs on: Windows · macOS · Linux Backends: Git and non-git projects
What WhyCode does
Bidirectional code provenance
Every architectural decision links to the exact code it produced — down to the AST level. Ask why any function exists and get back the decision, the commit, and the CI verification.
Active context injection
Relevant decisions are injected automatically before every session and every file edit via Claude Code hooks. Your agent knows your architecture before it types a character. No manual prompting required.
Independent quality harness
Five sensors — coverage delta, complexity, import health, drift violations, decision density — running independently of what the agent reports. Catches tautological tests that prove implementation instead of specification.
Architectural drift detection
Compares your import graph against recorded architecture decisions in real time. Catches violations before they compound into a refactor.
Rollback impact planning
Before reverting any decision, see the full downstream dependency graph — which functions break, which decisions become orphaned, and the risk level.
How it works
1. Install once
npx whycode@latest init-and-serve
One command on any OS. Python venv, server, and MCP config handled automatically.
2. Init each project
whycode init
Creates config, git hooks, and a project CLAUDE.md that instructs the agent.
3. Work normally Open Claude Code or Cursor. Context is injected automatically. Record decisions when you make architectural choices.
4. Query anything
provenance.reverse("path/to/file.py", "function_name")
drift.check("project-name")
harness.score("session-id")
What makes WhyCode different
Most AI memory tools give agents session memory — the ability to recall past conversations and past context.
WhyCode does something different: it links decisions to code.
When your agent writes a function, WhyCode records why — and you can ask "why does this function exist" and get back the decision, the commit, and the CI result that verified it.
| Capability | WhyCode | Typical AI memory tools |
|---|---|---|
| Semantic memory | ✓ | ✓ |
| Decision → code provenance | ✓ | — |
| Reverse trace: code → decision | ✓ | — |
| CI verification linked | ✓ | — |
| Drift detection | ✓ | — |
| Tautological test detection | ✓ | — |
| Rollback impact planning | ✓ | — |
| Auto context injection via hooks | ✓ | partial |
Installation
One command (recommended)
npx whycode@latest init-and-serve
Requires Node.js 18+. Detects or installs Python 3.11+ automatically.
Custom port
npx whycode@latest init-and-serve --port 9000
Team mode
npx whycode@latest init-and-serve --mode team
Python directly
pip install whycode
cd your-project
whycode init
whycode serve
whycode connect
Per-project setup
Once the server is running, initialise each project:
cd your-project
whycode init
One server serves all projects simultaneously.
Configuration
WhyCode generates whycode.toml in each project directory.
See whycode.toml.example for all options.
Key settings:
[server]
port = 8100 # change if 8100 is in use
mode = "solo" # or "team" for shared server
[embedding]
backend = "local" # or "ollama" for higher quality
[billing]
open_beta = true # all features free during beta
enabled = false # set true when Stripe configured
MCP client support
whycode connect auto-configures all detected clients.
| Client | MCP tools | Auto context | File hooks | Auto session |
|---|---|---|---|---|
| Claude Code | ✓ full | ✓ | ✓ | ✓ |
| Cursor | ✓ | ✓ via tool | ✓ via before_edit | ✓ inactivity |
| Windsurf | ✓ | ✓ via tool | ✓ via before_edit | ✓ inactivity |
| Claude Desktop | ✓ | ✓ via tool | ✓ via before_edit | ✓ inactivity |
| Any MCP client | ✓ | ✓ via tool | ✓ via before_edit | ✓ inactivity |
OAuth login setup (optional)
WhyCode supports Google and GitHub OAuth for dashboard login. OAuth is optional — the solo bearer token works for both the dashboard and MCP clients without any additional setup.
Show your solo bearer token
whycode token show
Paste the token into the dashboard login form, or run
whycode token write-config --client claude-desktop to wire it
into Claude Desktop automatically.
Configure Google OAuth
- Go to https://console.cloud.google.com
- Create a project → APIs & Services → Credentials
- Create an OAuth 2.0 Client ID → Web application
- Add
http://localhost:8100/api/auth/oauth/google/callbackas an authorised redirect URI - Copy the client ID and secret, then run:
whycode config set-oauth --provider google
Configure GitHub OAuth
- Go to https://github.com/settings/applications/new
- Homepage URL:
http://localhost:8100 - Authorization callback URL:
http://localhost:8100/api/auth/oauth/github/callback - Copy the client ID and secret, then run:
whycode config set-oauth --provider github
Restart the server after configuring: whycode serve.
Contributing
git clone https://github.com/whycodeAI/whycode.git
cd whycode
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
pytest tests/ -v
Before submitting a PR:
ruff check .must passmypy --strict backend/must passpytest tests/ --cov=backend --cov-fail-under=82must pass- No new runtime CVEs (
pip-audit)
See docs/CONTRIBUTING.md for full guidelines.
Security
WhyCode stores no credentials in its database. All secrets live in your OS keyring or an AES-256-GCM encrypted vault file. Passwords are hashed with Argon2id (64MB, 3 iterations, parallelism 4).
See docs/SECURITY.md for the complete security model.
To report a vulnerability: open a GitHub Security Advisory or email security@whycodeai.github.io
Benchmarks
Retrieval quality measured against LongMemEval-S and LOCOMO datasets. Results in scripts/benchmark/README.md.
Run benchmarks yourself:
pip install whycode[benchmark]
whycode-benchmark run --dataset longmemeval --output results.json
Pricing
Solo — Free forever. Full capabilities. Apache 2.0. Self-hosted. All features available during open beta.
Team — $9/seat/month (min 2 seats). Shared decision history, conflict detection, sprint intelligence. Trigger: shared state, not seat count.
Enterprise — Custom. RBAC, audit export, SSO, SLA.
All features free during open beta.
License
Apache 2.0 — see LICENSE for details.
Copyright 2026 WhyCodeAI
Project details
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 whycode-0.4.7.tar.gz.
File metadata
- Download URL: whycode-0.4.7.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef1b43e18c840e1d20002c4bca309cb9444fc60607d2cb06ddfd457d212b96a5
|
|
| MD5 |
7ba990726b5a8922e967e174d2bd605d
|
|
| BLAKE2b-256 |
ad0b23f19449c6fe1cc7f362307b1d65dfd898ea56acf27dd32430aed232dde2
|
File details
Details for the file whycode-0.4.7-py3-none-any.whl.
File metadata
- Download URL: whycode-0.4.7-py3-none-any.whl
- Upload date:
- Size: 779.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6e0d1c4fe97ed3b8e66afdbe6ea507d932b12d490a500d4cc81f9a15bc429fc
|
|
| MD5 |
4f22541d88b135364e57526f9e01d92a
|
|
| BLAKE2b-256 |
da98bedf4bbb310209c08b904a4bf4990ce1e30aded33fe1c0fcb7a78e05e5c2
|