The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Flaiwheel listing page.
Self-hosted memory & governance layer for AI coding agents. Turn every bug fix into permanent knowledge. Zero cloud. Zero lock-in.
AI coding agents forget everything between sessions. That leads to repeated bugs, lost architectural decisions, and knowledge decay.
Flaiwheel ensures:
Every bug fixed makes the next bug cheaper.
It does not replace your AI assistant. It makes it reliable at scale.
📄 Whitepaper (PDF) — Vision, architecture, and design in depth.
Flaiwheel is a self-contained Docker service that operates on three levels:
Pull — agents search before they code (search_docs, get_file_context)
Push — agents document as they work (write_bugfix_summary, write_architecture_doc, …)
Capture — git commits auto-capture knowledge via a post-commit hook, even without an AI agent
.md, .pdf, .html, .docx, .rst, .txt, .json, .yaml, .csv) into a vector databaseget_file_context(filename) — pre-loads spatial knowledge for any file the agent is about to edit (complements get_recent_sessions for full temporal + spatial context)fix:, feat:, refactor:, perf:, docs: commit as a structured knowledge doc automaticallyGiven, When, Then) for QA automationrelations() and timeline() derive a per-project knowledge graph from optional YAML frontmatter on existing docs (id, replaces, depends_on, fixes, implements, status). No second store — markdown stays canonical and Git history is the validity windowvalidate_doc() checks freeform markdown before it enters the knowledge base, including unknown-relation-key warnings/api/impact-metrics computes estimated time saved + regressions avoided; CI pipelines can post guardrail outcomes to /api/telemetry/ci-guardrail-reportanalyze_codebase(path) scans a source code directory entirely server-side (zero tokens, zero cloud). Uses Python's built-in ast module for Python, regex for TypeScript/JavaScript, the existing MiniLM embedding model for classification and duplicate detection. Returns a single bootstrap_report.md with language distribution, category map, top 20 files to document first ranked by documentability score, duplicate pairs, and coverage gaps. Reduces cold-start token cost by ~90% on legacy codebases.http://host:8081/sse. This is the recommended configuration until the Web UI provides TLS activation, CA download, and operating-system installation instructions. An update preserves its existing mode unless FLAIWHEEL_TLS_AUTO=0 or 1 is set explicitly.FLAIWHEEL_TLS_AUTO=0 now explicitly returns an existing TLS-enabled installation to HTTP while preserving its volumes and other MCP_* settings.FLAIWHEEL_TLS_AUTO unset during an update preserves the currently deployed mode.v3.15.2 corrected endpoint schemes and certificate persistence, but its direct-SSE client guidance was incomplete. An env block containing NODE_EXTRA_CA_CERTS does not necessarily control TLS for a direct Cursor/Electron SSE connection. Direct clients may require the generated CA in the operating-system trust store. Use the default HTTP endpoint unless you have completed that trust step.
192.168.178.230, so the only previous options were openssl by hand or a proxy. Set MCP_SSE_TLS_AUTO=true and Flaiwheel generates a private CA plus a server certificate on first start, covering the configured hosts and loopback./data/tls and reused while it is valid and still covers the requested names — an upgrade does not change the fingerprint, so a client that pinned the CA stays valid. A certificate that has gone stale, stopped covering a host, or lost its matching key is re-issued, with the reason logged.mkcert to run a per-machine step. So the startup log prints the fingerprint and the exact NODE_EXTRA_CA_CERTS=... line for the client's env block. That is the floor, and it is real TLS: encryption and identity, with the CA pinned by trust-on-first-use.NODE_TLS_REJECT_UNAUTHORIZED=0 anywhere in this path. The easy way to "make HTTPS work" is to disable verification, which defends against nothing; it is not offered as an option here.http:// to https://, and doing that unasked during an upgrade would break every existing client — the same class of failure as an installer that refuses to upgrade. It fails closed too: if provisioning fails, startup aborts rather than quietly serving cleartext.200; an untrusting client is rejected. Both directions asserted.localhost: the socket bound 0.0.0.0 while the application layer answered HTTP 421 Invalid Host header to every other Host. The workaround was a proxy that rewrites Host: localhost — a moving part, and a boot-ordering dependency. Set MCP_SSE_ALLOWED_HOSTS=flaiwheel.example.com and connect directly.FastMCP itself and passed neither host nor transport_security, so the SDK's loopback-only guard always applied. FASTMCP_HOST looks like the fix and is silently inert — init arguments outrank environment variables in pydantic-settings. Verified empirically before and after.host='0.0.0.0') makes the SDK skip its auto-enable and turn DNS-rebinding protection off entirely. Instead, protection remains enabled with a wider allowlist — Host and Origin are still validated, and lookalike suffixes like flaiwheel.example.com.evil.com are still rejected.ssh -L forwards and existing Host-rewriting proxies keep working.MCP_SSE_TLS_CERTFILE + MCP_SSE_TLS_KEYFILE and the endpoint is served over HTTPS directly. Verified against a real TLS listener: TLSv1.3, 200 over HTTPS for the allowlisted host, 421 still enforced for evil.example.com, and a plain HTTP request to the same port rejected.SECURITY.md carries the deployment table so you can see which layer encrypts what.check_divergence() compares HEAD against @{u} and classifies the result as synced / ahead / behind / diverged / no-upstream./health gains divergence_status, commits_ahead, commits_behind and last_divergence_at, and reports degraded on diverged, ahead or no-upstream. Being behind is the normal state between two pulls and deliberately does not alarm.write_* results append an explicit warning when the repo has diverged — including on "nothing to push". A warning in an endpoint nobody polls does not exist; the agent that just wrote the document is the one that needs to know it never left the machine.knowledge: update flaiwheel/telemetry.json, read as one project's file being committed into all 11 repos. The real path is .flaiwheel/telemetry.json, with a leading dot: the signature of the porcelain off-by-one already fixed in v3.12.2. Every project owns an identically-named telemetry file, so all 11 watchers logged the same mangled string at once — uniformity caused by shared code, mistaken for shared state.>=X. That fails silently: the breaking release lands, existing installs keep working off a stale resolve, and it only bites on the next fresh install — CI, a Docker rebuild, a new contributor. Exactly how mcp 2.0.0 broke CI and the Docker build together three weeks after release while every dev machine stayed green. A clean install resolves to identical versions as before, so this constrains the future without moving anything today./health. HealthTracker kept only last_push_ok — a single boolean the next attempt overwrites — so one blip and a repo failing for weeks looked the same. push_failures_consecutive escalates past 3 consecutive failures. A single failure deliberately does not degrade; crying wolf on transients is how alerts get ignored./health names the failing projects. Adds last_push_ok, last_push_error, push_failures_consecutive and degraded_projects — previously the endpoint could say degraded while showing only the default project's numbers, with no way to tell which repo was broken.from flaiwheel.server import create_mcp_server inside the image before starting a container, and renames rather than removes the previous container so rollback is instant.git status --porcelain emits XY <path> where a leading space is data (" M file"). Stripping the whole output before splitting ate that space on the first line only, so line[3:] truncated the filename's first character — .flaiwheel/telemetry.json became flaiwheel/telemetry.json, git add failed, and the commit aborted. Intermittent and file-order dependent, which is why it survived so long.old -> new; the whole string was passed to git add, so renames were never committed.mcp[cli]<2.0.0. mcp 2.0.0 removed mcp.server.fastmcp (FastMCP → mcp.server.mcpserver), breaking every import of the server on a fresh resolve.push_pending() returns a structured result (ok / noop / disabled / failed / blocked) and every write_* tool renders that outcome. Previously the success line was derived from configuration (git_auto_push and bool(git_repo_url)), so it read Auto-pushed to remote: True even when every push was being rejected. A failed push now says "Auto-push: FAILED — this doc is NOT on the remote" with the git error attached.except in push_pending() that only wrote to the diagnostic log now records to HealthTracker and returns the error to the caller. A failing git commit is reported instead of raising through an unchecked check=True._push_local_changes() before the commit — not as a per-clone git hook that gets lost on re-clone. MCP_GITLEAKS_MODE=block (default) refuses to commit and reports the findings through the MCP result; warn commits and reports; off disables. Honours a .gitleaks.toml in the knowledge repo for allowlisting. A missing or broken scanner is reported explicitly, never silently skipped.tests/test_watcher_push.py: push success/failure/noop/disabled reporting, gitleaks block/warn/clean, unavailable-scanner visibility).docker volume rm flaiwheel-data. A per-project summary slice is mirrored from the Docker volume into each knowledge repo at <docs_path>/.flaiwheel/telemetry.json. On the next cold start, hydrate_from_mirrors() rebuilds the in-memory state from these files so the Tool Telemetry dashboard does not reset to zero. Hot tier wins when both exist; mirror writes are rate-limited to 60s/project to avoid one Git commit per tool call. Events stay in the volume only (too noisy for the knowledge repo). Don't want it committed? Add .flaiwheel/ to your knowledge repo's .gitignore — Flaiwheel will still read/write the file locally.POST /api/telemetry/reset?project=<name> endpoint. The 30-day impact-metrics window keeps working because events history is preserved.AGENTS.md and both install.sh templates now include a "Structured Relations Workflow" section with three concrete rules (when to add fixes, when to add replaces, when to add depends_on) so agents actually use the v3.10.x graph machinery instead of ignoring it..vscode/mcp.json file Flaiwheel emits already works for Copilot — no separate snippet needed.test_telemetry.py for mirror writes, rate limiting, cold-start hydration, hot-tier authority, and reset semantics).write_bugfix_summary, write_architecture_doc, write_api_doc, write_best_practice, write_setup_doc, write_changelog_entry, and write_test_case prepend id / type / status: active + empty relation lists to every new doc. Every doc you create from now on is automatically a graph node — no manual frontmatter editing required. IDs are derived from the existing filename slugs (e.g. adr-2026-05-22-payment-service-architecture, bugfix-2026-05-22-fix-race-condition, api-create-user-endpoint).flaiwheel.frontmatter.emit() with stable, deterministic key order so same-day overwrites produce minimal diffs.relations(entity_id) and timeline(entity_id), derive a per-project knowledge graph from YAML frontmatter on existing markdown docs. No new persistent store and no graph_add / invalidate writes: markdown stays the single source of truth and Git history is the validity window. Recognised relation keys: replaces, depends_on, fixes, implements. Scalar keys: id, type, status, superseded_at.validate_doc() now warns on unknown relation keys (info severity) and invalid status values (warning severity); heading-structure checks strip the leading --- block first so frontmatter does not confuse the "first heading is h1" rule.GitWatcher.log_for_file() — read-only helper returning newest-first commits (hash, author, ISO date, subject); backs the timeline() tool.flaiwheel.frontmatter). No python-frontmatter / PyYAML added.Note: the SQLite ER store (
graph_add/graph_invalidate/valid_from/valid_tocolumns) originally proposed for this feature is deferred as v2, gated on a real query becoming measurably too slow on v1. AST-driven code↔symbol edges (v3) remain merged with thefeature_ideas_backlog#13 track.
claude-md no longer fails on repeat runs — claude mcp add non-zero exits (e.g. MCP already registered) no longer abort the parallel phase under set -e; registration output is captured safely._FW_VERSION is refreshed from main pyproject.toml when reachable so Docker rebuild / version checks stay aligned with the package even if raw install.sh on main lags at the CDN.AuthManager crashed on read-only /data before the MCP server could start (the real reason Glama saw 0 tools). Skipped in stdio cold-start mode.print() in watcher, indexer, readers, bootstrap replaced with diag() (stderr). Verified: full MCP handshake returns all 28 tools over stdio.config.save() resilient — read-only filesystem logs warning instead of crashing.LICENSE file (BSL 1.1) for correct GitHub/Glama detection; all docs and headers point to LICENSE (not LICENSE.md).[inspect] deps and cold-start stdio path for lightweight MCP directory builds..skills/skills/flaiwheel/SKILL.md to your project. When you open the project in Claude (Cowork), the skill is auto-available — no extra setup needed. The skill drives session-start context restore, pre-coding knowledge search, mandatory post-bugfix documentation, and session-end summarisation.skills/flaiwheel/SKILL.md in this repo for reference and manual install.iptables to legacy backend (fixes Docker networking / DNAT errors)docker group (no more permission denied)service (no systemd on WSL2)~/.bashrc (idempotent, runs on every WSL2 login)python3 extensively for JSON manipulation. On minimal Linux/WSL2 systems without python3, config file writes silently failed (/dev/fd/63: line N: python3: command not found). python3 is now checked as prerequisite #0 and auto-installed via apt/dnf/yum/pacman/brew if missing.iptables-nft backend is not supported. The installer now switches to iptables-legacy via update-alternatives before starting Docker. Also adds the current user to the docker group automatically.bash <(curl ...) — every displayed install/re-run command throughout the script (error messages, AGENTS.md, Cursor rules, etc.) now uses process substitution to avoid WSL2 pipe issues.curl | bash pipe write failures on WSL2 — curl | bash can fail with curl: (23) Failure writing output on WSL2 due to pipe/tmp permission issues. The primary install command in README is now bash <(curl ...) (process substitution), which avoids the pipe entirely. The re-exec block also tries $HOME as a fallback temp dir when /tmp writes fail. Error message explicitly recommends the bash <(curl ...) form.sudo curl | bash was used, the curl: (23) pipe error truncated the script before the previous sudo guard (which was after colors/functions) was ever reached. The guard is now the very first executable line (set -euo pipefail aside), so it fires even on a truncated download. Duplicate guard after colors removed.docker info every 2 seconds for up to 30 seconds after service docker start. Also shows the actual output of service docker start so startup errors are visible instead of silently swallowed.systemd, so systemctl start docker silently failed. The installer now detects WSL2 via /proc/version and uses sudo service docker start instead. If Docker still isn't running after install, a clear WSL2-specific error is shown with the exact fix command and a tip to add it to ~/.bashrc for auto-start on login.sudo curl | bash and sudo bash install.sh — running the installer as root via sudo breaks GitHub CLI authentication: gh auth stores credentials in /root/.config/gh/ instead of the real user's home, making every subsequent gh call fail. Also caused curl: (23) Failure writing output pipe errors on WSL. The installer now detects SUDO_USER at startup and exits immediately with a clear message telling the user to re-run without sudo. Privilege escalation for package installs is handled internally.gh auth login must not be run with sudo — after auto-installing gh on Linux/WSL, the installer now explicitly tells the user to run gh auth login without sudo. If auth was previously done with sudo, credentials ended up in /root/.config/gh/ and were invisible to the current user, causing the auth check to fail. The error messages at both the post-install and the auth-check step now clearly warn: do not use sudo for gh auth.apt-get, dnf, yum, zypper, pacman), Docker convenience script, and systemctl calls now automatically use sudo when the installer is not running as root. Root installs are unaffected. Fixes Permission denied / lock file errors on WSL and standard Linux desktop users./data/ — analyze_codebase() saves the report to /data/coldstart-<project>.md after the first run. Subsequent calls return the cached report instantly (<1s). The installer also writes the cache during install so the very first MCP call by any agent is instant. Call with force=True to regenerate after major codebase changes.analyze_codebase() in all agent Session Setup templates — AGENTS.md, .cursor/rules/flaiwheel.mdc, CLAUDE.md, and .github/copilot-instructions.md all now include it as step 3 of Session Setup. Agents automatically get the codebase overview before starting work.docker exec for cold-start — replaced broken HTTP calls to the MCP SSE endpoint with direct docker exec python3. Analysis now works reliably in ~20s.y now always re-runs analysis even when cached report exists._run_coldstart/_do_coldstart_analysis to top of script so fast-path can call them.LATEST_VERSION now uses _FW_VERSION directly, no CDN fetch._run_coldstart() called from fast-path, update, and fresh install. Smart cache detection.analyze_codebase() cached to /data/coldstart-<project>.md for instant reads. New force=True param.analyze_codebase() as a first-session step.docker exec python3 invocation. Cold-start report now actually works (~20s).analyze_codebase() for up to 90s after container starts.main — LATEST_VERSION now fetched from main branch so stale cached installers no longer silently skip updates.install.sh cold-start question is now asked right after the embedding model selection (before the Docker rebuild), so all interactive questions are gathered first and the user never misses the prompt after a long rebuild.analyze_codebase(path) — new 28th MCP tool for zero-token cold-start analysis of legacy codebases. Runs entirely server-side in Docker. Uses Python ast, regex, MiniLM embeddings, and nearest-centroid classification. Returns a ranked bootstrap_report.md with language distribution, category map, top 20 files by documentability score, near-duplicate pairs, and recommended next steps. Reduces cold-start token cost by ∼90%.reindex() MCP tool), keeping the vector DB clean until the repo has been reviewed..vscode/mcp.json and .github/copilot-instructions.md.mcp-remote.search_bugfixes calls no longer inflate miss rate above 100%._path_category_hint unified token-based approach across all categories.CHANGELOG.md added to repo root.Prerequisites: GitHub CLI authenticated (gh auth login), Docker running.
Platform support: macOS and Linux work out of the box. On Windows, run the installer from WSL or Git Bash (Docker Desktop must be running with WSL 2 backend enabled).
Run this from inside your project directory:
WSL2 / Linux note: Use the
bash <(curl ...)form above — it avoidscurl: (23)pipe write errors that occur withcurl | bashon some WSL2 setups. Never prefix withsudo.
That's it. The installer automatically:
<project>-knowledge repo with the standard folder structure.cursor/mcp.json and .cursor/rules/flaiwheel.mdc.vscode/mcp.json (native SSE, VS Code 1.99+) and .github/copilot-instructions.mdclaude_desktop_config.json via mcp-remote bridge (requires Node.js).mcp.json + CLAUDE.md and runs claude mcp add automatically if the CLI is on PATH.skills/skills/flaiwheel/SKILL.md so the full Flaiwheel workflow is available as a native Claude skillAGENTS.md for all other agents.md docs are found, creates a migration guide — the AI will offer to organize them into the knowledge repoAfter install:
| Agent | What to do |
|---|---|
| Cursor | Restart Cursor → Settings → MCP → enable flaiwheel toggle |
| Claude Desktop (macOS app) | Quit and reopen Claude for Mac — hammer icon appears when connected |
| Claude Code CLI | Already registered automatically — run /mcp inside Claude Code to verify |
| VS Code | Open project → Command Palette → MCP: List Servers → start flaiwheel |
| Claude (Cowork) | Skill auto-loads from .skills/skills/flaiwheel/SKILL.md — no further action needed |
The installer also sets up a post-commit git hook that automatically captures every fix:, feat:, refactor:, perf:, and docs: commit as a structured knowledge doc — no agent or manual action required.
Once connected, the AI has access to all Flaiwheel tools. If you have existing docs, tell the AI: "migrate docs".
If you also use Open WebUI's Open Terminal integration, this repo includes helper installers for a local open-terminal daemon.
Third-party write-ups (for example AI·Collab — Open Terminal) may mirror only the Linux script; macOS uses scripts/macos/install-open-terminal-launchagent.sh below. After any mirror update, re-check the file with shasum -a 256 against the same revision on GitHub.
curl (no git clone)Use main or pin a commit SHA / tag in the URL for reproducible bytes.
Linux / WSL2 (systemd --user):
macOS (LaunchAgent; do not use sudo):
If chmod or bash are “not found”, your PATH is broken (often Conda base); the /bin/… paths above still work.
systemd --user)com.flaiwheel.open-terminal-local.servicehttp://localhost:8000systemd=true is enabled in /etc/wsl.conf.Useful commands:
launchctl LaunchAgent)com.flaiwheel.open-terminal-localhttp://localhost:8000$HOME by default so Open Terminal does not start in /private/tmp.launchd does not load ~/.zshrc, so the daemon used to see only /usr/bin:/bin:… and miss Homebrew / Supabase CLI. The generated wrapper prepends /opt/homebrew/bin, /usr/local/bin, ~/.local/bin, and ~/.npm-global/bin. Re-run the installer (menu →1 Update) after pulling this change so the wrapper is regenerated.~/.config/flaiwheel/open-terminal-working-directory (fresh-install prompt, or menu →5 when re-running the script). Update (menu →1) keeps using that saved path. One-off override: set OPEN_TERMINAL_WORKING_DIRECTORY for that run only.Environment overrides (both scripts):
macOS only — custom initial folder for Open Terminal (must exist before you save it):
Re-run the same script and choose 5 to change or clear the saved folder (or edit ~/.config/flaiwheel/open-terminal-working-directory). Non-interactive install: set the env var above or create that file with a single line (path); use AUTO_INSTALL_DEPS=1 to skip the first-run path prompt.
Run the same install command again from your project directory:
The installer detects the existing container, asks for confirmation, then:
/data and /docs), the host port bindings, and all MCP_* settingsYour knowledge base, index, and credentials are preserved — only the code is updated.
If 8080/8081 are already taken (e.g. by a fronting proxy), point the installer at free ports instead of fighting over the defaults:
| Variable | Default | Purpose |
|---|---|---|
FLAIWHEEL_WEB_PORT | 8080 | Host port for the Web UI |
FLAIWHEEL_SSE_PORT | 8081 | Host port for the MCP SSE endpoint |
FLAIWHEEL_WEB_BIND | 0.0.0.0 | Host bind address for the Web UI |
FLAIWHEEL_SSE_BIND | 0.0.0.0 | Host bind address for MCP SSE |
FLAIWHEEL_AGGRESSIVE_CLEANUP | 0 | Allow host-wide Docker pruning (docker image prune -af, docker container prune -f, systemctl stop docker) |
FLAIWHEEL_CLIENT_CA_PATH | $HOME/.flaiwheel/ca.pem | Where the installer exports the TLS CA so clients on this host can trust it |
On a shared host, leave FLAIWHEEL_AGGRESSIVE_CLEANUP unset. Those commands affect every project and container on the machine — systemctl stop docker stops all containers — so they are off by default and only run when you explicitly opt in.
Which ports does the installer change?
FLAIWHEEL_SSE_PORTchanges the container's published port only. Client config files generated for other tools still reference the default8081, so update those yourself if you remap it.
Upgrading an existing container? Run the smoke test above first, then rename the old container instead of removing it (
docker rename flaiwheel flaiwheel-rollback) so you can restore it instantly if the new one fails its health check. Confirm every knowledge repo is pushed (git rev-list --count @{u}..HEAD→0) before swapping.
Cursor — add to .cursor/mcp.json:
VS Code / GitHub Copilot (1.99+) — add to .vscode/mcp.json:
Then: Command Palette → MCP: List Servers → start flaiwheel.
Claude Desktop (macOS app) — add to ~/Library/Application Support/Claude/claude_desktop_config.json:
Requires Node.js. Restart Claude for Mac after editing.
Claude Code CLI — run once in your project directory:
By default the MCP endpoint is loopback-only: the transport guard accepts
only localhost, 127.0.0.1 and [::1], and any other client gets
HTTP 421 Invalid Host header. Binding is not the problem — the allowlist is,
and it is enforced at the application layer, so it is invisible from inside the
container.
To serve a shared or LAN instance, allowlist the hostname you connect with:
Both forms work: comma-separated (host1,host2) or JSON (["host1"]). Each
host matches with or without a port, so the same entry covers
flaiwheel.example.com and flaiwheel.example.com:8081. Loopback entries are
always kept, so an SSH tunnel or an existing Host-rewriting proxy keeps working
unchanged.
Then point your client at that hostname:
Default and recommended: use the HTTP endpoint on port
8081. This avoids client trust-store setup and is the configuration produced by the normal installer command. HTTP traffic is not encrypted, so use it only on a trusted LAN, localhost, an SSH tunnel, or an encrypted network such as WireGuard or Tailscale.
Automatic TLS is available, but it is not the default recommendation yet.
Flaiwheel generates and persists a private CA and a server certificate. Each
client computer must trust that CA. Direct Cursor/Electron SSE connections use
the operating-system trust store; an env object in a direct remote-server
entry does not establish certificate trust.
New installation, with TLS off by default (an update preserves its current mode):
Explicitly return an existing TLS-enabled installation to HTTP:
Enable automatic TLS only when the clients have been prepared to trust its CA:
The generated files are stored in /data/tls in the persistent data volume.
The installer exports the public CA certificate to
${HOME}/.flaiwheel/ca.pem; override that path with
FLAIWHEEL_CLIENT_CA_PATH. Flaiwheel reuses the generated CA across container
restarts and upgrades.
After enabling TLS, install the exported CA into the trust store used by the client operating system, restart the client, and use an HTTPS endpoint such as:
The following procedure was verified against the live v3.15.3 deployment on
2026-09-11. It uses the current user's login keychain and does not require
NODE_EXTRA_CA_CERTS for the direct SSE entry.
https:// and the hostname or IP
covered by the certificate. Do not add an env block:Fully quit and restart Cursor after installing the CA or changing
.cursor/mcp.json.
Verify system trust without -k, --cacert, or an environment override:
Expected: HTTP/1.1 200 OK, content-type: text/event-stream, and an
event: endpoint payload. curl exits after the timeout because an SSE stream
remains open; receiving the 200 and event proves the TLS and SSE connection.
Do not use NODE_TLS_REJECT_UNAUTHORIZED=0; it disables certificate
verification.
Set a certificate and key and the endpoint is served over HTTPS directly:
Obtain the certificate from your CA (e.g. certbot certonly --standalone -d flaiwheel.example.com), or generate an internal-CA cert for a LAN hostname.
Use fullchain.pem, not the bare leaf certificate, or clients will reject it
for an incomplete chain.
TLS fails closed. If only one of the two paths is set, or the file is
unreadable, Flaiwheel refuses to start rather than quietly falling back to
plain HTTP — an operator who asked for encryption must never silently get
cleartext. Check the logs for FATAL: MCP_SSE_TLS_... if the container exits
immediately. Note the Web UI on MCP_WEB_PORT is still plain HTTP; terminate
TLS for the UI at a proxy if you expose it beyond localhost.
FASTMCP_HOST will not help. It looks like the obvious knob and is
silently ignored: FastMCP.__init__ passes host and transport_security
into its Settings(...) as explicit init arguments, and pydantic-settings
gives init arguments precedence over environment variables. Use
MCP_SSE_HOST (bind address, default 0.0.0.0) and MCP_SSE_ALLOWED_HOSTS
(allowlist) instead.
Flaiwheel indexes 9 file formats. All non-markdown files are converted to markdown-like text in memory at index time — no generated files on disk, no repo clutter.
| Format | Extension(s) | How it works |
|---|---|---|
| Markdown | .md | Native (pass-through) |
| Plain text | .txt | Wrapped in # filename heading |
.pdf | Text extracted per page via pypdf | |
| HTML | .html, .htm | Headings/lists/code converted to markdown, scripts stripped |
| reStructuredText | .rst | Heading underlines converted to # levels, code blocks preserved |
| Word | .docx | Paragraphs + heading styles mapped to markdown |
| JSON | .json | Pretty-printed in fenced json code block |
| YAML | .yaml, .yml | Wrapped in fenced yaml code block |
| CSV | .csv | Converted to markdown table |
Quality checks (structure, completeness, bugfix format) apply only to .md files. Other formats are indexed as-is.
All config via environment variables (MCP_ prefix), Web UI (http://localhost:8080), or .env file.
| Variable | Default | Description |
|---|---|---|
MCP_DOCS_PATH | /docs | Path to .md files inside container |
MCP_EMBEDDING_PROVIDER | local | local (free, private) or openai |
MCP_EMBEDDING_MODEL | all-MiniLM-L6-v2 | Embedding model name |
MCP_CHUNK_STRATEGY | heading | heading, fixed, or hybrid |
MCP_RERANKER_ENABLED | false | Enable cross-encoder reranker for higher precision |
MCP_RERANKER_MODEL | cross-encoder/ms-marco-MiniLM-L-6-v2 | Reranker model name |
MCP_RRF_K | 60 | RRF k parameter (lower = more weight on top ranks) |
MCP_RRF_VECTOR_WEIGHT | 1.0 | Vector search weight in RRF fusion |
MCP_RRF_BM25_WEIGHT | 1.0 | BM25 keyword search weight in RRF fusion |
MCP_MIN_RELEVANCE | 0 | Minimum relevance % to return (0 = no filter) |
MCP_GIT_REPO_URL | Knowledge repo URL (enables git sync) | |
MCP_GIT_BRANCH | main | Branch to sync |
MCP_GIT_TOKEN | GitHub token for private repos | |
MCP_GIT_SYNC_INTERVAL | 300 | Pull interval in seconds (0 = disabled) |
MCP_GIT_AUTO_PUSH | true | Auto-commit + push bugfix summaries |
MCP_GITLEAKS_MODE | block | Secret scan before auto-commit: block (refuse), warn (commit + report), off |
MCP_WEBHOOK_SECRET | GitHub webhook secret (enables /webhook/github HMAC verification) | |
MCP_TRANSPORT | sse | MCP transport: sse or stdio |
MCP_SSE_PORT | 8081 | MCP SSE endpoint port |
MCP_SSE_HOST | 0.0.0.0 | SSE bind address (an IP, not a hostname). Set 127.0.0.1 for loopback-only |
MCP_SSE_ALLOWED_HOSTS | Extra Host headers accepted by the transport guard, comma-separated or JSON. Required to serve remote/LAN clients directly | |
MCP_SSE_ALLOWED_ORIGINS | Extra Origin headers (browser-based MCP clients only) | |
MCP_SSE_DNS_REBINDING_PROTECTION | true | Keep on. false disables the Host and Origin guard for all clients |
MCP_SSE_TLS_CERTFILE | PEM certificate — with the key, serves MCP over HTTPS natively (no proxy) | |
MCP_SSE_TLS_KEYFILE | PEM private key. TLS is all-or-nothing: set both or neither | |
MCP_SSE_TLS_AUTO | false | Let Flaiwheel issue its own CA + certificate when none is configured. Opt-in: it flips the endpoint to HTTPS, so existing clients must trust the new CA |
MCP_SSE_TLS_DIR | /data/tls | Where generated certificates live. Must be persistent — regenerating the CA invalidates every client that trusts it |
MCP_WEB_PORT | 8080 | Web UI port |
A single Flaiwheel container can manage multiple knowledge repositories — one per project. Each project gets its own ChromaDB collection, git watcher, index lock, health tracker, and quality checker, while sharing one embedding model in RAM and one MCP/Web endpoint.
How it works:
install.sh run creates the Flaiwheel container with project Ainstall.sh runs from other project directories detect the running container and register the new project via the API — no additional containersproject parameter (e.g., search_docs("query", project="my-app"))set_project("my-app") at the start of every conversation to bind all subsequent calls to that project (sticky session)project parameter, the active project (set via set_project) is used; if none is set, the first project is usedlist_projects() via MCP to see all registered projects (shows active marker)Adding/removing projects:
setup_project(name="my-app", git_repo_url="...") — registers, clones, indexes, and auto-bindsinstall.sh from a new project directory (auto-registers)POST /api/projects with {name, git_repo_url, git_branch, git_token}DELETE /api/projects/{name} or the "Remove" button in the Web UIBackward compatibility: existing single-project setups continue to work without changes. If no projects.json exists but MCP_GIT_REPO_URL is set, Flaiwheel auto-creates a single project from the env vars.
When you change the embedding model via the Web UI, Flaiwheel re-embeds all documents in the background using a shadow collection. Search remains fully available on the old model while the migration runs. Once complete, the new index atomically replaces the old one — zero downtime.
The Web UI shows a live progress bar with file count and percentage. You can cancel at any time.
| Model | RAM | Quality | Best for |
|---|---|---|---|
all-MiniLM-L6-v2 | 90MB | 78% | Large repos, low RAM |
nomic-ai/nomic-embed-text-v1.5 | 520MB | 87% | Best English quality |
BAAI/bge-m3 | 2.2GB | 86% | Multilingual (DE/EN) |
Select via Web UI or MCP_EMBEDDING_MODEL env var. Full list in the Web UI.
The reranker is a second-stage model that rescores the top candidates from hybrid search. It reads the full (query, document) pair together, which produces much more accurate relevance scores than independent embeddings — especially for vocabulary-mismatch queries where the user and the document use different words for the same concept.
How it works:
top_k × 5)top_kEnable via Web UI (Search & Retrieval card) or environment variable:
| Reranker Model | RAM | Speed | Quality |
|---|---|---|---|
cross-encoder/ms-marco-MiniLM-L-6-v2 | 90MB | Fast | Good — best speed/quality balance |
cross-encoder/ms-marco-MiniLM-L-12-v2 | 130MB | Medium | Better — higher precision |
BAAI/bge-reranker-base | 420MB | Slower | Best — state-of-the-art accuracy |
The reranker is off by default (zero overhead). When enabled, it adds ~50ms latency per search but typically improves precision by 10-25% on vocabulary-mismatch queries.
Instead of waiting for the 300s polling interval, configure a GitHub webhook for instant reindex on push:
http://your-server:8080/webhook/githubapplication/jsonMCP_WEBHOOK_SECRETThe webhook endpoint verifies the HMAC signature if MCP_WEBHOOK_SECRET is set. Without a secret, any POST triggers a pull + reindex.
Track non-vanity engineering impact directly in Flaiwheel:
/api/telemetry/ci-guardrail-report — CI reports guardrail findings/fixes per PR/api/impact-metrics?project=<name>&days=30 — returns estimated time saved + regressions avoidedExample payload:
Flaiwheel persists telemetry on disk (<vectorstore>/telemetry) so metrics survive container restarts and updates.
Reindexing is incremental by default — only files whose content changed since the last run are re-embedded. On a 500-file repo, this means a typical reindex after a single-file push takes <1s instead of re-embedding everything.
Use reindex(force=True) via MCP or the Web UI "Reindex" button to force a full rebuild (e.g. after changing the embedding model).
Access at http://localhost:8080 (HTTP Basic Auth — credentials shown on first start).
Features:
Business Source License 1.1 (BSL 1.1)
Flaiwheel is source-available under the Business Source License 1.1.
You may use Flaiwheel for free if:
Commercial use beyond these limits (e.g., teams of 11+ or commercial deployment) requires a paid license.
See LICENSE for full terms.